Labor shuttle no longer takes off with more than one prisoner inside (#88083)

This commit is contained in:
Ivory
2024-11-30 13:16:44 -05:00
committed by GitHub
parent bd7b5f2908
commit f5a712b054
5 changed files with 67 additions and 9 deletions
+53 -8
View File
@@ -12,16 +12,30 @@
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine
/// Needed to send messages to sec radio
var/obj/item/radio/security_radio
/// Whether the claim console initiated the launch.
var/initiated_launch = FALSE
/// Cooldown for console says.
COOLDOWN_DECLARE(say_cooldown)
/obj/machinery/mineral/labor_claim_console/Initialize(mapload)
. = ..()
security_radio = new /obj/item/radio(src)
security_radio.set_listening(FALSE)
locate_stacking_machine()
if(!SSshuttle.initialized)
RegisterSignal(SSshuttle, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(register_shuttle_signal))
else
register_shuttle_signal()
//If we can't find a stacking machine end it all ok?
if(!stacking_machine)
return INITIALIZE_HINT_QDEL
/obj/machinery/mineral/labor_claim_console/proc/register_shuttle_signal()
SIGNAL_HANDLER
var/obj/docking_port/mobile/laborshuttle = SSshuttle.getShuttle("laborcamp")
RegisterSignal(laborshuttle, COMSIG_SHUTTLE_SHOULD_MOVE, PROC_REF(on_laborshuttle_can_move))
UnregisterSignal(SSshuttle, COMSIG_SUBSYSTEM_POST_INITIALIZE)
/obj/machinery/mineral/labor_claim_console/Destroy()
QDEL_NULL(security_radio)
if(stacking_machine)
@@ -86,23 +100,34 @@
var/obj/item/card/id/advanced/prisoner/worn_prisoner_id = worn_id
worn_prisoner_id.points += stacking_machine.points
stacking_machine.points = 0
to_chat(user_mob, span_notice("Points transferred."))
say("Points transferred.")
return TRUE
else
to_chat(user_mob, span_alert("No valid id for point transfer detected."))
if(COOLDOWN_FINISHED(src, say_cooldown))
say("No valid id for point transfer detected.")
COOLDOWN_START(src, say_cooldown, 2 SECONDS)
if("move_shuttle")
if(!alone_in_area(get_area(src), user_mob))
to_chat(user_mob, span_alert("Prisoners are only allowed to be released while alone."))
var/list/labor_shuttle_mobs = find_labor_shuttle_mobs()
if(length(labor_shuttle_mobs) > 1 || labor_shuttle_mobs[1] != user_mob)
if(COOLDOWN_FINISHED(src, say_cooldown))
say("Prisoners may only be released one at a time.")
COOLDOWN_START(src, say_cooldown, 2 SECONDS)
return
switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE))
if(1)
to_chat(user_mob, span_alert("Shuttle not found."))
if(COOLDOWN_FINISHED(src, say_cooldown))
say("Shuttle not found.")
COOLDOWN_START(src, say_cooldown, 2 SECONDS)
if(2)
to_chat(user_mob, span_alert("Shuttle already at station."))
if(COOLDOWN_FINISHED(src, say_cooldown))
say("Shuttle already at station.")
COOLDOWN_START(src, say_cooldown, 2 SECONDS)
if(3)
to_chat(user_mob, span_alert("No permission to dock could be granted."))
if(COOLDOWN_FINISHED(src, say_cooldown))
say("No permission to dock could be granted.")
COOLDOWN_START(src, say_cooldown, 2 SECONDS)
else
if(!(obj_flags & EMAGGED))
security_radio.set_frequency(FREQ_SECURITY)
@@ -111,9 +136,29 @@
security_radio.talk_into(src, "[user_mob.name] returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
user_mob.log_message("has completed their labor points goal and is now sending the gulag shuttle back to the station.", LOG_GAME)
to_chat(user_mob, span_notice("Shuttle received message and will be sent shortly."))
say("Labor sentence finished, shuttle returning.")
initiated_launch = TRUE
return TRUE
/obj/machinery/mineral/labor_claim_console/proc/find_labor_shuttle_mobs()
var/list/prisoners = mobs_in_area_type(list(get_area(src)))
// security personnel and nonhumans do not count towards this
for(var/mob/living/mob as anything in prisoners)
var/obj/item/card/id/card = mob.get_idcard(FALSE)
if(!ishuman(mob) || (ACCESS_BRIG in card?.GetAccess()))
prisoners -= mob
return prisoners
/obj/machinery/mineral/labor_claim_console/proc/on_laborshuttle_can_move(obj/docking_port/mobile/source)
SIGNAL_HANDLER
if(initiated_launch && length(find_labor_shuttle_mobs()) > 1)
initiated_launch = FALSE
say("Takeoff aborted. Prisoners may only be released one at a time.")
return BLOCK_SHUTTLE_MOVE
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
stacking_machine = locate(/obj/machinery/mineral/stacking_machine) in dview(2, get_turf(src))
if(stacking_machine)