Humans no longer "enter" mechs twice (#65819)

Co-authored-by: TiviPlus <572233640+TiviPlus@users.noreply.com>
This commit is contained in:
TiviPlus
2022-03-31 13:49:09 -07:00
committed by GitHub
co-authored by TiviPlus
parent 39b90af706
commit 57ab486a10
2 changed files with 26 additions and 33 deletions
+20 -30
View File
@@ -297,6 +297,13 @@
if(driver_amount() < max_drivers)
add_control_flags(M, FULL_MECHA_CONTROL)
/obj/vehicle/sealed/mecha/generate_actions()
initialize_passenger_action_type(/datum/action/vehicle/sealed/mecha/mech_eject)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_toggle_internals, VEHICLE_CONTROL_SETTINGS)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_toggle_lights, VEHICLE_CONTROL_SETTINGS)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_view_stats, VEHICLE_CONTROL_SETTINGS)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/strafe, VEHICLE_CONTROL_DRIVE)
/obj/vehicle/sealed/mecha/proc/get_mecha_occupancy_state()
if((mecha_flags & SILICON_PILOT) && silicon_icon_state)
return silicon_icon_state
@@ -985,8 +992,6 @@
pilot_mob.forceMove(get_turf(src))
update_appearance()
/obj/vehicle/sealed/mecha/mob_try_enter(mob/M)
if(!ishuman(M)) // no silicons or drones in mechas.
return
@@ -1004,39 +1009,24 @@
to_chat(M, span_warning("Access denied. Insufficient operation keycodes."))
log_message("Permission denied (No keycode).", LOG_MECHA)
return
. = ..()
if(.)
moved_inside(M)
/obj/vehicle/sealed/mecha/enter_checks(mob/M)
if(atom_integrity <= 0)
to_chat(M, span_warning("You cannot get in the [src], it has been destroyed!"))
return FALSE
if(M.buckled)
to_chat(M, span_warning("You are currently buckled and cannot move."))
to_chat(M, span_warning("You can't enter the exosuit while buckled."))
log_message("Permission denied (Buckled).", LOG_MECHA)
return
if(M.has_buckled_mobs()) //mob attached to us
return FALSE
if(M.has_buckled_mobs())
to_chat(M, span_warning("You can't enter the exosuit with other creatures attached to you!"))
log_message("Permission denied (Attached mobs).", LOG_MECHA)
return
return FALSE
return ..()
visible_message(span_notice("[M] starts to climb into [name]."))
if(do_after(M, enter_delay, target = src))
if(atom_integrity <= 0)
to_chat(M, span_warning("You cannot get in the [name], it has been destroyed!"))
else if(LAZYLEN(occupants) >= max_occupants)
to_chat(M, span_danger("[occupants[length(occupants)]] was faster! Try better next time, loser."))//get the last one that hopped in
else if(M.buckled)
to_chat(M, span_warning("You can't enter the exosuit while buckled."))
else if(M.has_buckled_mobs())
to_chat(M, span_warning("You can't enter the exosuit with other creatures attached to you!"))
else
moved_inside(M)
return ..()
else
to_chat(M, span_warning("You stop entering the exosuit!"))
/obj/vehicle/sealed/mecha/generate_actions()
initialize_passenger_action_type(/datum/action/vehicle/sealed/mecha/mech_eject)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_toggle_internals, VEHICLE_CONTROL_SETTINGS)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_toggle_lights, VEHICLE_CONTROL_SETTINGS)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/mech_view_stats, VEHICLE_CONTROL_SETTINGS)
initialize_controller_action_type(/datum/action/vehicle/sealed/mecha/strafe, VEHICLE_CONTROL_DRIVE)
/obj/vehicle/sealed/mecha/proc/moved_inside(mob/living/newoccupant)
if(!(newoccupant?.client))
+6 -3
View File
@@ -47,16 +47,19 @@
/obj/vehicle/sealed/proc/mob_try_enter(mob/M)
if(!istype(M))
return FALSE
if(occupant_amount() >= max_occupants)
return FALSE
if(do_after(M, get_enter_delay(M), src, timed_action_flags = IGNORE_HELD_ITEM))
if(do_after(M, get_enter_delay(M), src, timed_action_flags = IGNORE_HELD_ITEM, extra_checks = CALLBACK(src, .proc/enter_checks, M)))
mob_enter(M)
return TRUE
return FALSE
/// returns enter do_after delay for the given mob in ticks
/obj/vehicle/sealed/proc/get_enter_delay(mob/M)
return enter_delay
///Extra checks to perform during the do_after to enter the vehicle
/obj/vehicle/sealed/proc/enter_checks(mob/M)
return occupant_amount() < max_occupants
/obj/vehicle/sealed/proc/mob_enter(mob/M, silent = FALSE)
if(!istype(M))
return FALSE