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
Erikafox authored Sep 23, 2024
1 parent e03aaab commit 5375d29
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,9 @@
/atom/proc/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
return

/atom/proc/late_connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
return

/atom/proc/disconnect_from_shuttle(obj/docking_port/mobile/port)
return

Expand Down
2 changes: 2 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,8 @@ 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]"

/obj/machinery/turretid/late_connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
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
12 changes: 12 additions & 0 deletions code/modules/shuttle/shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,18 @@
for(var/each in place)
var/atom/atom = each
atom.connect_to_shuttle(src, dock)
late_linkup(docked, current_ship)

//Called after shuttle is completely loaded and connected
/obj/docking_port/mobile/proc/late_linkup(obj/docking_port/stationary/dock, datum/overmap/ship/controlled/new_ship)
current_ship = new_ship
docked = dock
for(var/place in shuttle_areas)
var/area/area = place
area.late_connect_to_shuttle(src, dock)
for(var/each in place)
var/atom/atom = each
atom.late_connect_to_shuttle(src, 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

0 comments on commit 5375d29

Please sign in to comment.