From a9caade05e9df7d2b71a489087f98a40e674a5cd Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 28 Sep 2022 03:50:10 +0200 Subject: [PATCH] [MIRROR] Lets vehicle abilties actually be removed (#16485) * Lets vehicle abilties actually be removed (#70151) Co-authored-by: TiviPlus <572233640+TiviPlus@ users.noreply.com> * Lets vehicle abilties actually be removed Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com> Co-authored-by: TiviPlus <572233640+TiviPlus@ users.noreply.com> Co-authored-by: Tastyfish --- code/modules/vehicles/vehicle_actions.dm | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/code/modules/vehicles/vehicle_actions.dm b/code/modules/vehicles/vehicle_actions.dm index b74f94521b7..fe2ff4d9494 100644 --- a/code/modules/vehicles/vehicle_actions.dm +++ b/code/modules/vehicles/vehicle_actions.dm @@ -38,10 +38,22 @@ for(var/i in occupants) grant_passenger_actions(i) //refresh +/** + * ## destroy_passenger_action_type + * + * Removes this action type from all occupants and stops autogranting it + * args: + * * actiontype: typepath of the action you want to remove from occupants and the autogrant list. + */ +/obj/vehicle/proc/destroy_passenger_action_type(actiontype) + autogrant_actions_passenger -= actiontype + for(var/i in occupants) + remove_action_type_from_mob(actiontype, i) + /** * ## initialize_controller_action_type * - * Gives any passenger that enters the mech this action... IF they have the correct vehicle control flag. + * Gives any passenger that enters the vehicle this action... IF they have the correct vehicle control flag. * This is used so passengers cannot press buttons only drivers should have, for example. * args: * * actiontype: typepath of the action you want to give occupants. @@ -52,6 +64,19 @@ for(var/i in occupants) grant_controller_actions(i) //refresh +/** + * ## destroy_controller_action_type + * + * As the name implies, removes the actiontype from autogrant and removes it from all occupants + * args: + * * actiontype: typepath of the action you want to remove from occupants and autogrant. + */ +/obj/vehicle/proc/destroy_controller_action_type(actiontype, control_flag) + autogrant_actions_controller["[control_flag]"] -= actiontype + UNSETEMPTY(autogrant_actions_controller["[control_flag]"]) + for(var/i in occupants) + remove_action_type_from_mob(actiontype, i) + /** * ## grant_action_type_to_mob *