Player can delete mortar by exiting while undeploying

Issue #357 resolved
Andrew Theel created an issue

Steps to reproduce:

  1. Be on mortar

  2. Begin undeploying

  3. Immediately exit

  4. Notice no mortar in inventory or on ground

Comments (3)

  1. Matt Hands

    Fixed in commit 5160487.

    Server now goes into state Undeploying at start of undeploy process. Player cannon exit while in Undeploying state - or any Busy-derived state.

    Required minor switch around in client-to-server undeploying process. Client used to go to UD state, time how long undeployment took, then finally send the ServerUndeploy() function call to the server at the end. Server would then give the player back their mortar inventory item, make them exit the mortar, with the mortar vehicle actors being destroyed by the server.

    Now the client sends a modified ServerUndeploy() function call to the server at the START of the process. ServerUndeploy() now passes the undeploy anim duration to the server, as server doesn't have HUDOverlay & so doesn't know the anim duration. Server now goes into state Undeploying, which is the crucial change to prevent KDriverLeave() from allowing player to exit while in this state. Server now controls timing before undeployment finishes, using passed AnimDuration value.

  2. Matt Hands

    Improved fix in commit bc2a023.

    Rather than the client pass the UndeployingDuration as a float in a replicated server function call every time the player undeploys, it's better to specify literal duration values in def props. The server needs the literal because it doesn't have the HUDOverlay actor that the anim plays on, so it can't use GetAnimDuration() to find out how long it is. Using literals, although avoided where possible, is a network optimisation by reducing the amount of info that is replicated.

    I have logged the anim durations for both mortars and added correct literals in def props.

  3. Log in to comment