From 19322f10b9202a2fe1f62038b8bb3acdf32b8451 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Thu, 11 Jan 2018 12:11:07 -0800 Subject: [PATCH] Fixes vehicle action handling ordering (#34146) * Fixes cleanup not working for vehicle actions * Wrong ordering * Update vehicle_actions.dm --- code/modules/vehicles/_vehicle.dm | 2 +- code/modules/vehicles/vehicle_actions.dm | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/modules/vehicles/_vehicle.dm b/code/modules/vehicles/_vehicle.dm index 4cedfdf3e3c..9d8ab3dc952 100644 --- a/code/modules/vehicles/_vehicle.dm +++ b/code/modules/vehicles/_vehicle.dm @@ -86,8 +86,8 @@ if(!istype(M)) return FALSE remove_control_flags(M, ALL) - occupants -= M remove_passenger_actions(M) + occupants -= M cleanup_actions_for_mob(M) after_remove_occupant(M) return TRUE diff --git a/code/modules/vehicles/vehicle_actions.dm b/code/modules/vehicles/vehicle_actions.dm index 79a24c8b115..905be5b3ba1 100644 --- a/code/modules/vehicles/vehicle_actions.dm +++ b/code/modules/vehicles/vehicle_actions.dm @@ -21,7 +21,7 @@ grant_controller_actions(i) //refresh /obj/vehicle/proc/grant_action_type_to_mob(actiontype, mob/m) - if(!occupants[m] || !actiontype) + if(isnull(occupants[m]) || !actiontype) return FALSE LAZYINITLIST(occupant_actions[m]) if(occupant_actions[m][actiontype]) @@ -32,7 +32,7 @@ return TRUE /obj/vehicle/proc/remove_action_type_from_mob(actiontype, mob/m) - if(!occupants[m] || !actiontype) + if(isnull(occupants[m]) || !actiontype) return FALSE LAZYINITLIST(occupant_actions[m]) if(occupant_actions[m][actiontype]) @@ -50,7 +50,7 @@ remove_action_type_from_mob(v, M) /obj/vehicle/proc/grant_controller_actions(mob/M) - if(!istype(M) || !occupants[M]) + if(!istype(M) || isnull(occupants[M])) return FALSE for(var/i in GLOB.bitflags) if(occupants[M] & i) @@ -58,21 +58,21 @@ return TRUE /obj/vehicle/proc/remove_controller_actions(mob/M) - if(!istype(M) || !occupants[M]) + if(!istype(M) || isnull(occupants[M])) return FALSE for(var/i in GLOB.bitflags) remove_controller_actions_by_flag(M, i) return TRUE /obj/vehicle/proc/grant_controller_actions_by_flag(mob/M, flag) - if(!istype(M) || !autogrant_actions_controller["[flag]"]) + if(!istype(M)) return FALSE for(var/v in autogrant_actions_controller["[flag]"]) grant_action_type_to_mob(v, M) return TRUE /obj/vehicle/proc/remove_controller_actions_by_flag(mob/M, flag) - if(!istype(M) || autogrant_actions_controller["[flag]"]) + if(!istype(M)) return FALSE for(var/v in autogrant_actions_controller["[flag]"]) remove_action_type_from_mob(v, M) @@ -81,11 +81,11 @@ /obj/vehicle/proc/cleanup_actions_for_mob(mob/M) if(!istype(M)) return FALSE - LAZYINITLIST(occupant_actions[M]) for(var/path in occupant_actions[M]) stack_trace("Leftover action type [path] in vehicle type [type] for mob type [M.type] - THIS SHOULD NOT BE HAPPENING!") - var/datum/action/action = occupant_actions[M] + var/datum/action/action = occupant_actions[M][path] action.Remove(M) + occupant_actions[M] -= path occupant_actions -= M return TRUE