//////////////////////////////////////// Action Buttons /////////////////////////////////////////////// /obj/mecha/proc/GrantActions(mob/living/user, human_occupant = 0) if(human_occupant) eject_action.Grant(user, src) internals_action.Grant(user, src) cycle_action.Grant(user, src) lights_action.Grant(user, src) stats_action.Grant(user, src) strafing_action.Grant(user, src) /obj/mecha/proc/RemoveActions(mob/living/user, human_occupant = 0) if(human_occupant) eject_action.Remove(user) internals_action.Remove(user) cycle_action.Remove(user) lights_action.Remove(user) stats_action.Remove(user) strafing_action.Remove(user) /datum/action/innate/mecha check_flags = AB_CHECK_RESTRAINED | AB_CHECK_STUNNED | AB_CHECK_CONSCIOUS var/obj/mecha/chassis /datum/action/innate/mecha/Grant(mob/living/L, obj/mecha/M) if(M) chassis = M ..() /datum/action/innate/mecha/Destroy() chassis = null return ..() /datum/action/innate/mecha/mech_eject name = "Eject From Mech" button_icon_state = "mech_eject" /datum/action/innate/mecha/mech_eject/Activate() if(!owner) return if(!chassis || chassis.occupant != owner) return chassis.go_out() /datum/action/innate/mecha/mech_toggle_internals name = "Toggle Internal Airtank Usage" button_icon_state = "mech_internals_off" /datum/action/innate/mecha/mech_toggle_internals/Activate() if(!owner || !chassis || chassis.occupant != owner) return chassis.use_internal_tank = !chassis.use_internal_tank button_icon_state = "mech_internals_[chassis.use_internal_tank ? "on" : "off"]" chassis.occupant_message("Now taking air from [chassis.use_internal_tank?"internal airtank":"environment"].") chassis.log_message("Now taking air from [chassis.use_internal_tank?"internal airtank":"environment"].") UpdateButtonIcon() /datum/action/innate/mecha/mech_cycle_equip name = "Cycle Equipment" button_icon_state = "mech_cycle_equip_off" /datum/action/innate/mecha/mech_cycle_equip/Activate() if(!owner || !chassis || chassis.occupant != owner) return var/list/available_equipment = list() for(var/obj/item/mecha_parts/mecha_equipment/M in chassis.equipment) if(M.selectable) available_equipment += M if(available_equipment.len == 0) chassis.occupant_message("No equipment available.") return if(!chassis.selected) chassis.selected = available_equipment[1] chassis.occupant_message("You select [chassis.selected]") send_byjax(chassis.occupant,"exosuit.browser","eq_list",chassis.get_equipment_list()) button_icon_state = "mech_cycle_equip_on" UpdateButtonIcon() return var/number = 0 for(var/A in available_equipment) number++ if(A == chassis.selected) if(available_equipment.len == number) chassis.selected = null chassis.occupant_message("You switch to no equipment") button_icon_state = "mech_cycle_equip_off" else chassis.selected = available_equipment[number+1] chassis.occupant_message("You switch to [chassis.selected]") button_icon_state = "mech_cycle_equip_on" send_byjax(chassis.occupant,"exosuit.browser","eq_list",chassis.get_equipment_list()) UpdateButtonIcon() return /datum/action/innate/mecha/mech_toggle_lights name = "Toggle Lights" button_icon_state = "mech_lights_off" /datum/action/innate/mecha/mech_toggle_lights/Activate() if(!owner || !chassis || chassis.occupant != owner) return chassis.lights = !chassis.lights if(chassis.lights) chassis.set_light(chassis.lights_power) button_icon_state = "mech_lights_on" else chassis.set_light(-chassis.lights_power) button_icon_state = "mech_lights_off" chassis.occupant_message("Toggled lights [chassis.lights?"on":"off"].") chassis.log_message("Toggled lights [chassis.lights?"on":"off"].") UpdateButtonIcon() /datum/action/innate/mecha/mech_view_stats name = "View Stats" button_icon_state = "mech_view_stats" /datum/action/innate/mecha/mech_view_stats/Activate() if(!owner || !chassis || chassis.occupant != owner) return chassis.occupant << browse(chassis.get_stats_html(), "window=exosuit") /datum/action/innate/mecha/strafe name = "Toggle Strafing" button_icon_state = "strafe" /datum/action/innate/mecha/strafe/Activate() if(!owner || !chassis || chassis.occupant != owner) return chassis.toggle_strafe() /obj/mecha/AltClick(mob/living/user) if(user == occupant) toggle_strafe() /obj/mecha/proc/toggle_strafe() strafe = !strafe occupant_message("Toggled strafing mode [strafe?"on":"off"].") log_message("Toggled strafing mode [strafe?"on":"off"].") strafing_action.UpdateButtonIcon() //////////////////////////////////////// Specific Ability Actions /////////////////////////////////////////////// //Need to be granted by the mech type, Not default abilities. /datum/action/innate/mecha/mech_toggle_thrusters name = "Toggle Thrusters" button_icon_state = "mech_thrusters_off" /datum/action/innate/mecha/mech_toggle_thrusters/Activate() if(!owner || !chassis || chassis.occupant != owner) return if(chassis.get_charge() > 0) chassis.thrusters_active = !chassis.thrusters_active button_icon_state = "mech_thrusters_[chassis.thrusters_active ? "on" : "off"]" chassis.log_message("Toggled thrusters.") chassis.occupant_message("Thrusters [chassis.thrusters_active ?"en":"dis"]abled.") /datum/action/innate/mecha/mech_defence_mode name = "Toggle Defence Mode" button_icon_state = "mech_defense_mode_off" /datum/action/innate/mecha/mech_defence_mode/Activate(forced_state = null) if(!owner || !chassis || chassis.occupant != owner) return if(!isnull(forced_state)) chassis.defence_mode = forced_state else chassis.defence_mode = !chassis.defence_mode button_icon_state = "mech_defense_mode_[chassis.defence_mode ? "on" : "off"]" if(chassis.defence_mode) chassis.deflect_chance = chassis.defence_mode_deflect_chance chassis.occupant_message("You enable [chassis] defence mode.") else chassis.deflect_chance = initial(chassis.deflect_chance) chassis.occupant_message("You disable [chassis] defence mode.") chassis.log_message("Toggled defence mode.") UpdateButtonIcon() /datum/action/innate/mecha/mech_overload_mode name = "Toggle leg actuators overload" button_icon_state = "mech_overload_off" /datum/action/innate/mecha/mech_overload_mode/Activate(forced_state = null) if(!owner || !chassis || chassis.occupant != owner) return if(!isnull(forced_state)) chassis.leg_overload_mode = forced_state else chassis.leg_overload_mode = !chassis.leg_overload_mode button_icon_state = "mech_overload_[chassis.leg_overload_mode ? "on" : "off"]" chassis.log_message("Toggled leg actuators overload.") if(chassis.leg_overload_mode) chassis.leg_overload_mode = 1 chassis.bumpsmash = 1 chassis.step_in = min(1, round(chassis.step_in/2)) chassis.step_energy_drain = chassis.step_energy_drain*chassis.leg_overload_coeff chassis.occupant_message("You enable leg actuators overload.") else chassis.leg_overload_mode = 0 chassis.bumpsmash = 0 chassis.step_in = initial(chassis.step_in) chassis.step_energy_drain = initial(chassis.step_energy_drain) chassis.occupant_message("You disable leg actuators overload.") UpdateButtonIcon() /datum/action/innate/mecha/mech_smoke name = "Smoke" button_icon_state = "mech_smoke" /datum/action/innate/mecha/mech_smoke/Activate() if(!owner || !chassis || chassis.occupant != owner) return if(chassis.smoke_ready && chassis.smoke>0) chassis.smoke_system.start() chassis.smoke-- chassis.smoke_ready = 0 spawn(chassis.smoke_cooldown) chassis.smoke_ready = 1 /datum/action/innate/mecha/mech_zoom name = "Zoom" button_icon_state = "mech_zoom_off" /datum/action/innate/mecha/mech_zoom/Activate() if(!owner || !chassis || chassis.occupant != owner) return if(owner.client) chassis.zoom_mode = !chassis.zoom_mode button_icon_state = "mech_zoom_[chassis.zoom_mode ? "on" : "off"]" chassis.log_message("Toggled zoom mode.") chassis.occupant_message("Zoom mode [chassis.zoom_mode?"en":"dis"]abled.") if(chassis.zoom_mode) owner.client.change_view(12) owner << sound('sound/mecha/imag_enh.ogg',volume=50) else owner.client.change_view(world.view) //world.view - default mob view size UpdateButtonIcon() /datum/action/innate/mecha/mech_switch_damtype name = "Reconfigure arm microtool arrays" button_icon_state = "mech_damtype_brute" /datum/action/innate/mecha/mech_switch_damtype/Activate() if(!owner || !chassis || chassis.occupant != owner) return var/new_damtype switch(chassis.damtype) if("tox") new_damtype = "brute" chassis.occupant_message("Your exosuit's hands form into fists.") if("brute") new_damtype = "fire" chassis.occupant_message("A torch tip extends from your exosuit's hand, glowing red.") if("fire") new_damtype = "tox" chassis.occupant_message("A bone-chillingly thick plasteel needle protracts from the exosuit's palm.") chassis.damtype = new_damtype. button_icon_state = "mech_damtype_[new_damtype]" playsound(src, 'sound/mecha/mechmove01.ogg', 50, 1) UpdateButtonIcon() /datum/action/innate/mecha/mech_toggle_phasing name = "Toggle Phasing" button_icon_state = "mech_phasing_off" /datum/action/innate/mecha/mech_toggle_phasing/Activate() if(!owner || !chassis || chassis.occupant != owner) return chassis.phasing = !chassis.phasing button_icon_state = "mech_phasing_[chassis.phasing ? "on" : "off"]" chassis.occupant_message("En":"#f00\">Dis"]abled phasing.") UpdateButtonIcon()