This commit is contained in:
SandPoot
2024-03-30 18:29:11 -03:00
parent 27d912aed3
commit ffe55f67b1
9 changed files with 34 additions and 33 deletions
+7 -6
View File
@@ -54,7 +54,7 @@
return occupants
/obj/vehicle/proc/occupant_amount()
return length(occupants)
return LAZYLEN(occupants)
/obj/vehicle/proc/return_amount_of_controllers_with_flag(flag)
. = 0
@@ -82,9 +82,10 @@
return !isnull(occupants[M])
/obj/vehicle/proc/add_occupant(mob/M, control_flags)
if(!istype(M) || occupants[M])
if(!istype(M) || is_occupant(M))
return FALSE
occupants[M] = NONE
LAZYSET(occupants, M, NONE)
add_control_flags(M, control_flags)
after_add_occupant(M)
grant_passenger_actions(M)
@@ -102,7 +103,7 @@
return FALSE
remove_control_flags(M, ALL)
remove_passenger_actions(M)
occupants -= M
LAZYREMOVE(occupants, M)
cleanup_actions_for_mob(M)
after_remove_occupant(M)
return TRUE
@@ -140,7 +141,7 @@
return
/obj/vehicle/proc/add_control_flags(mob/controller, flags)
if(!istype(controller) || !flags)
if(!is_occupant(controller) || !flags)
return FALSE
occupants[controller] |= flags
for(var/i in GLOB.bitflags)
@@ -149,7 +150,7 @@
return TRUE
/obj/vehicle/proc/remove_control_flags(mob/controller, flags)
if(!istype(controller) || !flags)
if(!is_occupant(controller) || !flags)
return FALSE
occupants[controller] &= ~flags
for(var/i in GLOB.bitflags)
+2 -2
View File
@@ -45,7 +45,7 @@
return ..()
/obj/vehicle/sealed/car/mob_try_exit(mob/M, mob/user, silent = FALSE)
if(M == user && (occupants[M] & VEHICLE_CONTROL_KIDNAPPED))
if(M == user && (LAZYACCESS(occupants, M) & VEHICLE_CONTROL_KIDNAPPED))
to_chat(user, "<span class='notice'>You push against the back of [src] trunk to try and get out.</span>")
if(!do_after(user, escape_time, target = src))
return FALSE
@@ -73,7 +73,7 @@
if(do_after(user, 30))
if(return_amount_of_controllers_with_flag(VEHICLE_CONTROL_KIDNAPPED))
to_chat(user, "<span class='notice'>The people stuck in [src]'s trunk all come tumbling out.</span>")
DumpSpecificMobs(VEHICLE_CONTROL_KIDNAPPED)
dump_specific_mobs(VEHICLE_CONTROL_KIDNAPPED)
else
to_chat(user, "<span class='notice'>It seems [src]'s trunk was empty.</span>")
+9 -8
View File
@@ -459,7 +459,7 @@
transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION)
cabin_air.transfer_to(t_air, transfer_moles)
if(occupants)
if(LAZYLEN(occupants))
for(var/i in occupants)
var/mob/living/occupant = i
if(cell)
@@ -908,13 +908,14 @@
///Handles an actual AI (simple_animal mecha pilot) entering the mech
/obj/vehicle/sealed/mecha/proc/aimob_enter_mech(mob/living/simple_animal/hostile/syndicate/mecha_pilot/pilot_mob)
if(pilot_mob && pilot_mob.Adjacent(src))
if(LAZYLEN(occupants))
return
LAZYADD(occupants, src)
pilot_mob.mecha = src
pilot_mob.forceMove(src)
update_icon()
if(!pilot_mob?.Adjacent(src))
return
if(LAZYLEN(occupants))
return
LAZYSET(occupants, pilot_mob, NONE)
pilot_mob.mecha = src
pilot_mob.forceMove(src)
update_icon()
///Handles an actual AI (simple_animal mecha pilot) exiting the mech
/obj/vehicle/sealed/mecha/proc/aimob_exit_mech(mob/living/simple_animal/hostile/syndicate/mecha_pilot/pilot_mob)
+1 -1
View File
@@ -177,7 +177,7 @@ own integrity back to max. Shield is automatically dropped if we run out of powe
/obj/durand_shield/proc/activate(datum/source, mob/owner, list/signal_args)
SIGNAL_HANDLER
currentuser = owner
if(!chassis?.occupants)
if(!LAZYLEN(chassis?.occupants))
return
if(switching && !signal_args[1])
return
@@ -41,7 +41,7 @@
chassis.selected = null
update_chassis_page()
log_message("[src] is destroyed.", LOG_MECHA)
if(chassis.occupants)
if(!LAZYLEN(chassis?.occupants))
to_chat(chassis.occupants, "[icon2html(src, chassis.occupants)]<span class='danger'>[src] is destroyed!</span>")
playsound(chassis, destroy_sound, 50)
if(!detachable) //If we're a built-in nondetachable equipment, let's lock up the slot that we were in.
@@ -173,8 +173,7 @@
STOP_PROCESSING(SSfastprocess, src)
qdel(src)
if(istype(loc, /obj/vehicle/sealed/mecha/working) && scanning_time <= world.time)
var/obj/vehicle/sealed/mecha/working/mecha = loc
if(!mecha.occupants)
if(!LAZYLEN(chassis?.occupants))
return
scanning_time = world.time + equip_cooldown
mineral_scan_pulse(get_turf(src))
+1 -1
View File
@@ -156,7 +156,7 @@
for(var/occus in occupants)
var/mob/living/occupant = occus
occupant.update_mouse_pointer()
if(!equipment_disabled && occupants) //prevent spamming this message with back-to-back EMPs
if(!equipment_disabled && LAZYLEN(occupants)) //prevent spamming this message with back-to-back EMPs
to_chat(occupants, "<span=danger>Error -- Connection to equipment control unit has been lost.</span>")
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/vehicle/sealed/mecha, restore_equipment)), 3 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE)
equipment_disabled = 1
+7 -6
View File
@@ -98,13 +98,14 @@
var/mob/living/carbon/Carbon = i
Carbon.DefaultCombatKnockdown(40)
/obj/vehicle/sealed/proc/DumpSpecificMobs(flag, randomstep = TRUE)
/obj/vehicle/sealed/proc/dump_specific_mobs(flag, randomstep = TRUE)
for(var/i in occupants)
if((occupants[i] & flag))
mob_exit(i, null, randomstep)
if(iscarbon(i))
var/mob/living/carbon/C = i
C.DefaultCombatKnockdown(40)
if(!(occupants[i] & flag))
continue
mob_exit(i, null, randomstep)
if(iscarbon(i))
var/mob/living/carbon/C = i
C.DefaultCombatKnockdown(40)
/obj/vehicle/sealed/AllowDrop()
+5 -6
View File
@@ -21,7 +21,7 @@
grant_controller_actions(i) //refresh
/obj/vehicle/proc/grant_action_type_to_mob(actiontype, mob/m)
if(isnull(occupants[m]) || !actiontype)
if(isnull(LAZYACCESS(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(isnull(occupants[m]) || !actiontype)
if(isnull(LAZYACCESS(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) || isnull(occupants[M]))
if(!istype(M) || isnull(LAZYACCESS(occupants, M)))
return FALSE
for(var/i in GLOB.bitflags)
if(occupants[M] & i)
@@ -58,7 +58,7 @@
return TRUE
/obj/vehicle/proc/remove_controller_actions(mob/M)
if(!istype(M) || isnull(occupants[M]))
if(!istype(M) || isnull(LAZYACCESS(occupants, M)))
return FALSE
for(var/i in GLOB.bitflags)
remove_controller_actions_by_flag(M, i)
@@ -145,8 +145,7 @@
/datum/action/vehicle/sealed/dump_kidnapped_mobs/Trigger()
vehicle_entered_target.visible_message(span_danger("[vehicle_entered_target] starts dumping the people inside of it."))
vehicle_entered_target.DumpSpecificMobs(VEHICLE_CONTROL_KIDNAPPED)
vehicle_entered_target.dump_specific_mobs(VEHICLE_CONTROL_KIDNAPPED)
/datum/action/vehicle/sealed/roll_the_dice
name = "Press Colorful Button"