Skip to content

Commit

Permalink
Merge pull request #1099 from ariaworld/fix-mechs
Browse files Browse the repository at this point in the history
[MIRROR] Fixes simple animal mecha pilots + adds a chocolate box to Hilbert's hotel
  • Loading branch information
MosleyTheMalO authored Mar 11, 2024
2 parents 21f4e41 + 7567216 commit c925c37
Show file tree
Hide file tree
Showing 20 changed files with 100 additions and 40 deletions.
2 changes: 2 additions & 0 deletions _maps/splurt_maps/templates/hilbertshotel.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@
/area/hilbertshotel)
"MA" = (
/obj/structure/table/wood/fancy,
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/indestructible/hotelwood,
/area/hilbertshotel)
"MZ" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@
/obj/effect/turf_decal/siding/wood{
dir = 8
},
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/wood/wood_tiled,
/area/hilbertshotel)
"WX" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,12 @@
},
/turf/open/floor/wood/wood_tiled,
/area/hilbertshotel)
"gq" = (
/obj/structure/table/wood,
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/carpet,
/area/hilbertshotel)
"jn" = (
/turf/closed/wall,
/area/hilbertshotel)
Expand Down Expand Up @@ -613,7 +619,7 @@ ab
ax
no
aD
bB
gq
bs
bB
aD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
/area/hilbertshotel)
"bl" = (
/obj/structure/table/wood,
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/carpet,
/area/hilbertshotel)
"bn" = (
Expand Down Expand Up @@ -356,6 +358,10 @@
},
/turf/open/floor/mineral/plastitanium,
/area/hilbertshotel)
"nA" = (
/obj/structure/table/wood,
/turf/open/floor/carpet,
/area/hilbertshotel)
"nE" = (
/obj/effect/turf_decal/siding/wood/corner{
dir = 4
Expand Down Expand Up @@ -753,7 +759,7 @@ aU
YE
bh
kt
bl
nA
ax
LU
XP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
/obj/effect/turf_decal/siding/wood{
dir = 8
},
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/carpet/royalblue,
/area/hilbertshotel)
"yJ" = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
dir = 1
},
/obj/structure/table/wood/fancy/royalblack,
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/wood/wood_tiled,
/area/hilbertshotel)
"ee" = (
Expand Down Expand Up @@ -102,6 +104,13 @@
/obj/structure/table/wood/poker/shadow,
/turf/open/floor/carpet/royalblack,
/area/hilbertshotel)
"nQ" = (
/obj/effect/turf_decal/siding/wood{
dir = 1
},
/obj/structure/table/wood/fancy/royalblack,
/turf/open/floor/wood/wood_tiled,
/area/hilbertshotel)
"oH" = (
/obj/structure/table/wood,
/obj/machinery/chem_dispenser/drinks/beer{
Expand Down Expand Up @@ -206,6 +215,12 @@
"yz" = (
/turf/open/floor/glass/reinforced,
/area/hilbertshotel)
"yO" = (
/obj/effect/turf_decal/siding/wood,
/obj/structure/table/wood/poker/shadow,
/obj/item/choice_beacon/box/plushie,
/turf/open/floor/carpet/royalblack,
/area/hilbertshotel)
"BL" = (
/obj/machinery/light{
dir = 8
Expand Down Expand Up @@ -475,11 +490,11 @@ rY
ee
ee
pr
nj
yO
Wg
yz
dy
dR
nQ
TA
Pz
li
Expand All @@ -497,7 +512,7 @@ nj
cK
yz
dy
dR
nQ
af
af
lS
Expand Down Expand Up @@ -533,7 +548,7 @@ sm
cK
yz
dy
dR
nQ
af
af
fo
Expand All @@ -551,7 +566,7 @@ sm
cK
yz
dy
dR
nQ
af
af
af
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@
/obj/structure/flora/ausbushes/brflowers,
/turf/open/floor/grass/fairy/purple,
/area/hilbertshotel)
"JW" = (
/obj/structure/chair/pew,
/obj/item/choice_beacon/box/plushie,
/turf/open/floor/wood/wood_tiled,
/area/hilbertshotel)
"Kc" = (
/obj/structure/flora/rock,
/obj/structure/flora/ausbushes/brflowers,
Expand Down Expand Up @@ -487,6 +492,8 @@
"Xj" = (
/obj/structure/flora/ausbushes/lavendergrass,
/obj/structure/flora/ausbushes/ppflowers,
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/grass/fairy/purple,
/area/hilbertshotel)
"XX" = (
Expand Down Expand Up @@ -661,7 +668,7 @@ Dd
uV
qq
Qc
Gj
JW
Kj
tY
YG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@
/area/hilbertshotel)
"qm" = (
/obj/structure/table/wood,
/obj/item/storage/fancy/heart_box,
/obj/item/paper/fluff/hilbertshotel/welcomeletter,
/turf/open/floor/wood,
/area/hilbertshotel)
"qv" = (
Expand Down Expand Up @@ -519,6 +521,7 @@
pixel_x = 5;
pixel_y = 3
},
/obj/item/choice_beacon/box/plushie,
/turf/open/floor/carpet/red,
/area/hilbertshotel)
"ND" = (
Expand Down
13 changes: 7 additions & 6 deletions code/modules/vehicles/_vehicle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/vehicles/cars/car.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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>")

Expand Down
17 changes: 9 additions & 8 deletions code/modules/vehicles/mecha/_mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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, pilot_mob)
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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/mecha/combat/durand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/mecha/equipment/mecha_equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
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(mecha.occupants))
return
scanning_time = world.time + equip_cooldown
mineral_scan_pulse(get_turf(src))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/vehicles/mecha/mecha_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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, /obj/vehicle/sealed/mecha/proc/restore_equipment), 3 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE)
equipment_disabled = 1
Expand Down
13 changes: 7 additions & 6 deletions code/modules/vehicles/sealed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.Paralyze(40)


/obj/vehicle/sealed/AllowDrop()
Expand Down
Loading

0 comments on commit c925c37

Please sign in to comment.