Skip to content

Commit

Permalink
[MIRROR] Modular Shield Generators now play well with shuttles [NO GB…
Browse files Browse the repository at this point in the history
…P] [MDB IGNORE] (#24696) (#379)

* Modular Shield Generators now play well with shuttles [NO GBP] (#79256)

<!-- 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
So an issue with the shield generator and shuttles is that on some maps
depending on how the shuttle docks, a change of direction is possible on
launch and my dumb brain made it so that the machines lose their links
on change direction so I moved that to the wrench act.

I also made it so the shield generator automatically turns off when it
changes z levels due to shuttle movement so it doesnt leave forcefield
tiles behind, it can be turned back on immediately after. I also updated
the description of the generator so this isnt a hidden function.
<!-- 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
Less buggy system and now plays well with things like white ship and
evac shuttle. Modular shield generators are not designed as something
you are meant to have to or even be able to individually reach all of
their parts to relink/fix unless a freak accident or sabotage happened
and existing on a shuttle is not a freak accident or sabotage.

<!-- Argue for the merits of your changes and how they benefit the game,
especially if they are controversial and/or far reaching. If you can't
actually explain WHY what you are doing will improve the game, then it
probably isn't good for the game in the first place. -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

:cl:
fix: Modular shield generator modules no longer lose linkage when riding
a shuttle
fix: Modular shield generators now gracefully turn off when being moved
by a shuttle rather than leaving their projections behind, the
generator's description was updated to advertise this behavior.
/: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. -->

* Modular Shield Generators now play well with shuttles [NO GBP]

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: moocowswag <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2023
1 parent 72c1c8c commit f4001d5
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions code/game/machinery/modular_shield.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/obj/machinery/modular_shield_generator
name = "Modular Shield Generator"
desc = "A forcefield generator, it seems more stationary than its cousins."
desc = "A forcefield generator, it seems more stationary than its cousins. It cant handle G-force and will require frequent reboots when built on mobile craft."
icon = 'icons/obj/machines/modular_shield_generator.dmi'
icon_state = "gen_recovering_closed"
density = TRUE
Expand Down Expand Up @@ -162,6 +162,10 @@
return
activate_shields()

/obj/machinery/modular_shield_generator/onShuttleMove(turf/newT, turf/oldT, list/movement_force, move_dir, obj/docking_port/stationary/old_dock, obj/docking_port/mobile/moving_dock)
. = ..()
if(active)
deactivate_shields()

///generates the forcefield based on the given radius and calls calculate_regen to update the regen value accordingly
/obj/machinery/modular_shield_generator/proc/activate_shields()
Expand Down Expand Up @@ -438,17 +442,21 @@
/obj/machinery/modular_shield/module/wrench_act(mob/living/user, obj/item/tool)
. = ..()

if(default_change_direction_wrench(user, tool))
if(shield_generator)
LAZYREMOVE(shield_generator.connected_modules, (src))
shield_generator.calculate_boost()
shield_generator = null
update_icon_state()
if(connected_node)
LAZYREMOVE(connected_node.connected_through_us, (src))
connected_node = null
connected_turf = get_step(loc, dir)
return TRUE
if(!default_change_direction_wrench(user, tool))
return FALSE

if(shield_generator)
LAZYREMOVE(shield_generator.connected_modules, (src))
shield_generator.calculate_boost()
shield_generator = null
update_icon_state()

if(connected_node)
LAZYREMOVE(connected_node.connected_through_us, (src))
connected_node = null

connected_turf = get_step(loc, dir)
return TRUE

/obj/machinery/modular_shield/module/crowbar_act(mob/living/user, obj/item/tool)
. = ..()
Expand Down Expand Up @@ -514,16 +522,26 @@
return
icon_state = "node_on_[panel_open ? "open" : "closed"]"

/obj/machinery/modular_shield/module/node/setDir(new_dir)
. = ..()

/obj/machinery/modular_shield/module/node/wrench_act(mob/living/user, obj/item/tool)

if(!default_change_direction_wrench(user, tool))
return FALSE

disconnect_connected_through_us()
if(isnull(shield_generator))
return
LAZYREMOVE(shield_generator.connected_modules, (src))
shield_generator.calculate_boost()
shield_generator = null
update_icon_state()

if(shield_generator)
LAZYREMOVE(shield_generator.connected_modules, (src))
shield_generator.calculate_boost()
shield_generator = null
update_icon_state()

if(connected_node)
LAZYREMOVE(connected_node.connected_through_us, (src))
connected_node = null

connected_turf = get_step(loc, dir)
return TRUE

//after trying to connect to a machine infront of us, we will try to link anything connected to us to a generator
/obj/machinery/modular_shield/module/node/try_connect(user)
Expand Down

0 comments on commit f4001d5

Please sign in to comment.