Skip to content

Commit

Permalink
[MIRROR] xenobio shield gens can be rebuilt + some code cleanup and c…
Browse files Browse the repository at this point in the history
…hanges [MDB IGNORE] (#25353) (#904)

* xenobio shield gens can be rebuilt + some code cleanup and changes (#79887)

## About The Pull Request
shield gens now have a board, cant be printed
![2023-11-22
06_49_55-Window](https://github.com/tgstation/tgstation/assets/70376633/0041d965-98ae-40a1-b36a-fd6ce15f4720)

you may now screw open an unlocked shield generator to access its sole
wire, the wire that toggles it on and off
you may also after that crowbar it if it isnt active to deconstruct

converted things to balloon alerts and some cleaning

## Why It's Good For The Game

these things just vanishing if destroyed is dumb and wiring allows for
shenanigans

## Changelog
:cl:
fix: shield wall gens actually use power now
qol: shield wall gens may now be rebuilt and use some balloon alerts,
and have wiring
/:cl:

---------



* xenobio shield gens can be rebuilt + some code cleanup and changes

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: jimmyl <[email protected]>
Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
  • Loading branch information
4 people authored Dec 2, 2023
1 parent 18f5169 commit 0b9ab7a
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 14 deletions.
14 changes: 14 additions & 0 deletions code/datums/wires/shieldwallgen.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/datum/wires/shieldwallgen
proper_name = "Shield Wall Generator"
randomize = TRUE
holder_type = /obj/machinery/power/shieldwallgen

/datum/wires/shieldwallgen/New(atom/holder)
wires = list(WIRE_ACTIVATE)
..()

/datum/wires/shieldwallgen/on_pulse(wire)
var/obj/machinery/power/shieldwallgen/generator = holder
if(generator.anchored && generator.powernet)
generator.active = generator.active ? FALSE : TRUE //shield gens use some silly defines here but its usually just a true or false
..()
65 changes: 51 additions & 14 deletions code/game/machinery/shieldgen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,23 @@
desc = "A shield generator."
icon ='icons/obj/machines/shield_generator.dmi' //SKYRAT EDIT CHANGE - ICON OVERRIDEN IN SKYRAT AESTHETICS - SEE MODULE
icon_state = "shield_wall_gen"
base_icon_state = "shield_wall_gen"
anchored = FALSE
density = TRUE
req_access = list(ACCESS_TELEPORTER)
flags_1 = CONDUCT_1
use_power = NO_POWER_USE
active_power_usage = 150
circuit = /obj/item/circuitboard/machine/shieldwallgen
max_integrity = 300
/// whether the shield generator is active, ACTIVE_SETUPFIELDS will make it search for generators on process, and if that is successful, is set to ACTIVE_HASFIELDS
var/active = FALSE
/// are we locked?
var/locked = TRUE
/// how far do we seek another generator in our cardinal directions
var/shield_range = 8
var/obj/structure/cable/attached // the attached cable
/// the attached cable under us
var/obj/structure/cable/attached

/obj/machinery/power/shieldwallgen/xenobiologyaccess //use in xenobiology containment
name = "xenobiology shield wall generator"
Expand All @@ -317,6 +324,17 @@
if(anchored)
connect_to_network()
RegisterSignal(src, COMSIG_ATOM_SINGULARITY_TRY_MOVE, PROC_REF(block_singularity_if_active))
set_wires(new /datum/wires/shieldwallgen(src))

/obj/machinery/power/shieldwallgen/update_icon_state()
icon_state = "[base_icon_state][active ? "_on" : ""]"
return ..()

/obj/machinery/power/shieldwallgen/update_overlays()
. = ..()
if(!panel_open)
return
. += "shieldgen_wires"

/obj/machinery/power/shieldwallgen/Destroy()
for(var/d in GLOB.cardinals)
Expand All @@ -333,27 +351,27 @@

/obj/machinery/power/shieldwallgen/process()
if(active)
icon_state = "shield_wall_gen_on"
if(active == ACTIVE_SETUPFIELDS)
var/fields = 0
for(var/d in GLOB.cardinals)
if(setup_field(d))
fields++
if(fields)
active = ACTIVE_HASFIELDS
update_appearance()
if(!active_power_usage || surplus() >= active_power_usage)
add_load(active_power_usage)
else
visible_message(span_danger("The [src.name] shuts down due to lack of power!"), \
visible_message(span_danger("[src] shuts down due to lack of power!"), \
"If this message is ever seen, something is wrong.",
span_hear("You hear heavy droning fade out."))
icon_state = "shield_wall_gen"
active = FALSE
log_game("[src] deactivated due to lack of power at [AREACOORD(src)]")
for(var/d in GLOB.cardinals)
cleanup_field(d)
update_appearance()
else
icon_state = "shield_wall_gen"
update_appearance()
for(var/d in GLOB.cardinals)
cleanup_field(d)

Expand Down Expand Up @@ -425,33 +443,52 @@
if(. == SUCCESSFUL_UNFASTEN && anchored)
connect_to_network()

/obj/machinery/power/shieldwallgen/screwdriver_act(mob/user, obj/item/tool)
if(!panel_open && locked)
balloon_alert(user, "unlock first!")
return
update_appearance(UPDATE_OVERLAYS)
return default_deconstruction_screwdriver(user, icon_state, icon_state, tool)

/obj/machinery/power/shieldwallgen/crowbar_act(mob/user, obj/item/tool)
if(active)
return
return default_deconstruction_crowbar(tool)

/obj/machinery/power/shieldwallgen/attackby(obj/item/W, mob/user, params)
. = ..()
if(W.GetID())
if(allowed(user) && !(obj_flags & EMAGGED))
locked = !locked
to_chat(user, span_notice("You [src.locked ? "lock" : "unlock"] the controls."))
balloon_alert(user, "[locked ? "locked!" : "unlocked"]")
else if(obj_flags & EMAGGED)
to_chat(user, span_danger("Error, access controller damaged!"))
balloon_alert(user, "malfunctioning!")
else
to_chat(user, span_danger("Access denied."))
balloon_alert(user, "no access!")

return

add_fingerprint(user)
if(is_wire_tool(W) && panel_open)
wires.interact(user)
return

else
add_fingerprint(user)
return ..()

/obj/machinery/power/shieldwallgen/interact(mob/user)
. = ..()
if(.)
return
if(!anchored)
to_chat(user, span_warning("\The [src] needs to be firmly secured to the floor first!"))
balloon_alert(user, "not secured!")
return
if(locked && !issilicon(user))
to_chat(user, span_warning("The controls are locked!"))
balloon_alert(user, "locked!")
return
if(!powernet)
to_chat(user, span_warning("\The [src] needs to be powered by a wire!"))
balloon_alert(user, "needs to be powered by wire!")
return
if(panel_open)
balloon_alert(user, "panel open!")
return

if(active)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1564,3 +1564,12 @@
/obj/item/stack/sheet/plasteel = 2,
)

/obj/item/circuitboard/machine/shieldwallgen
name = "Shield Wall Generator"
greyscale_colors = CIRCUIT_COLOR_SCIENCE
build_path = /obj/machinery/power/shieldwallgen
req_components = list(
/datum/stock_part/capacitor/tier2 = 2,
/datum/stock_part/micro_laser/tier2 = 2,
/obj/item/stack/sheet/plasteel = 2,
)
Binary file modified icons/obj/machines/shield_generator.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,7 @@
#include "code\datums\wires\robot.dm"
#include "code\datums\wires\roulette.dm"
#include "code\datums\wires\scanner_gate.dm"
#include "code\datums\wires\shieldwallgen.dm"
#include "code\datums\wires\suit_storage_unit.dm"
#include "code\datums\wires\syndicatebomb.dm"
#include "code\datums\wires\tesla_coil.dm"
Expand Down

0 comments on commit 0b9ab7a

Please sign in to comment.