Skip to content

Commit

Permalink
Turrets Now Actually Connect To Their Console Consistently (#3412)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
makes turrets link to their console once everything has been linked to
the shuttle.

Adds a proc just in case anyone else needs 2 do this.
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
functional code
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
fix: turrets will now _actually_ connect to their console. i swear im a
real coder.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Bjarl committed Sep 23, 2024
1 parent 6da28a5 commit 06ce830
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_ship.dm
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 8 additions & 0 deletions code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions code/modules/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 06ce830

Please sign in to comment.