diff --git a/code/__DEFINES/dcs/signals/signals_ship.dm b/code/__DEFINES/dcs/signals/signals_ship.dm new file mode 100644 index 000000000000..c18a26c5089d --- /dev/null +++ b/code/__DEFINES/dcs/signals/signals_ship.dm @@ -0,0 +1,2 @@ +///Sent when a shuttle finishes loading to allow for any machinery that requires a late connection to fire that connection +#define COMSIG_SHIP_DONE_CONNECTING "late_connect" diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 33e493b3819e..3e50954df0c7 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -949,6 +949,14 @@ DEFINE_BITFIELD(turret_flags, list( /obj/machinery/turretid/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) id = "[REF(port)][id]" + RegisterSignal(port, COMSIG_SHIP_DONE_CONNECTING, PROC_REF(late_connect_to_shuttle)) + +/obj/machinery/turretid/disconnect_from_shuttle(obj/docking_port/mobile/port) + UnregisterSignal(port, COMSIG_SHIP_DONE_CONNECTING) + +/obj/machinery/turretid/proc/late_connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock) + SIGNAL_HANDLER + for(var/datum/weakref/ship_guns in port.turret_list) var/obj/machinery/porta_turret/turret_gun = ship_guns.resolve() if(turret_gun.id == id) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 084d4a49f3e7..5af554a60557 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -431,6 +431,7 @@ for(var/each in place) var/atom/atom = each atom.connect_to_shuttle(src, dock) + SEND_SIGNAL(src, COMSIG_SHIP_DONE_CONNECTING, dock) //this is a hook for custom behaviour. Maybe at some point we could add checks to see if engines are intact /obj/docking_port/mobile/proc/can_move() diff --git a/shiptest.dme b/shiptest.dme index 4861e9ab8f44..c1a3a2111b2a 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -163,6 +163,7 @@ #include "code\__DEFINES\dcs\helpers.dm" #include "code\__DEFINES\dcs\signals\signals.dm" #include "code\__DEFINES\dcs\signals\signals_mod.dm" +#include "code\__DEFINES\dcs\signals\signals_ship.dm" #include "code\__DEFINES\dcs\signals\signals_storage.dm" #include "code\__DEFINES\dcs\signals\signals_mob\signals_mob_carbon.dm" #include "code\__DEFINES\dcs\signals\signals_obj\signals_object.dm"