mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-05 07:02:36 +00:00
* Get pants that match or else you gonna look silly yo
* Posters
* Fix other hud elements
* Rereviewed
* Update shotglass.dm
* Fix for new merged PRs
* Typo
* Coming across other stuff
* Update theblob.dm
* No takebacksies
* smh i forget to leave a comment
* Updated for the detgun and cards
* Should have rerun langserver again
* No longer plastic, more in scope
* Damn you bluespace
* Reverting turret logic, out of scope at this point
* Tweak that part
* Went over energy guns again, and fixed UI White's sprite sheet
* Welding masks, glasses, and JUSTICE
* Update portable_atmospherics.dm
* Cleaning up, clearing things up
* Review and suggestions
* Update valve.dm
* More tweaks
* Missing character
* Not distinct lightmasks, so they can be overlays
* Update generator.dm
* Add parameter so holodeck doesn't try to make a perfect copy
* Update unsorted.dm
* Spiders
* Better fix for spiders, fix vamps too
* Ghosts
* Update telekinesis.dm
* Cleaning up old procs
* It's set up to not copy datums... Unless they're in a list
* Donuts, duct tape, and detgun. D3VR coming to Early Access
* Update procs that interact with doors so they call update_state instead
* Forgot one spot, and actually might as well just force lock
* Cleaning up other things... Sigh, and kitty ears
* oops
* Getting used to how it works
* blinds
* Going back to the suit obscuring thing, so it doesn't update all the time
* Missed that from merging master
* I made this PR and forgot about it
* Fix runtimes in cards
* Make things a bit more unified
* Update update_icons.dm
* yarn, really?
* Update library_equipment.dm
* Update shieldgen.dm
* Every time Charlie merges something, I go back and see if I can improve things further
* what's this? more?
* Update misc_special.dm
* wow, paper
* Review
* More reviews
* To be sure, seems like being broken messed something sometimes
* Brought airlocks closer to how TG works to iron out some stuff
* Pizza and morgue
* Doesn't seem to hurt, tried with holodeck
* Revert "Doesn't seem to hurt, tried with holodeck"
This reverts commit 158529302b.
* Icon conflict
* Fix organ damage
* Don't ask how. Why. It's like that on prod too.
* Cutting down on things and updating from TG.
* More flexible. Just in case the thing you stuck it on didn't destroy.
* Hydro was one the things I touched earlier on, better rework it
* Reviews
* Cleaning up further, also bri'ish
* Undo a change I did, and switch over to a more recent implementation
* Update biogenerator.dm
* Rolling back to old airlocks, but with new duct taped note
* Functionally the same. I'd just rather not have the smoothing happen there
* Went over APCs again
* Fix welding helmet names in species files
* Update airlock.dm
* Update persistent_overlay.dm
* Oh, topic
154 lines
4.5 KiB
Plaintext
154 lines
4.5 KiB
Plaintext
#define DISCONNECTED 0
|
|
#define CLAMPED_OFF 1
|
|
#define OPERATING 2
|
|
|
|
// Powersink - used to drain station power
|
|
|
|
/obj/item/powersink
|
|
name = "power sink"
|
|
desc = "A nulling power sink which drains energy from electrical systems."
|
|
icon = 'icons/obj/device.dmi'
|
|
icon_state = "powersink0"
|
|
item_state = "electronic"
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
flags = CONDUCT
|
|
throwforce = 5
|
|
throw_speed = 1
|
|
throw_range = 2
|
|
materials = list(MAT_METAL=750)
|
|
origin_tech = "powerstorage=5;syndicate=5"
|
|
var/drain_rate = 2000000 // amount of power to drain per tick
|
|
var/power_drained = 0 // has drained this much power
|
|
var/max_power = 6e8 // maximum power that can be drained before exploding
|
|
var/mode = 0 // 0 = off, 1=clamped (off), 2=operating
|
|
var/admins_warned = FALSE // stop spam, only warn the admins once that we are about to boom
|
|
|
|
var/obj/structure/cable/attached // the attached cable
|
|
|
|
/obj/item/powersink/Destroy()
|
|
STOP_PROCESSING(SSobj, src)
|
|
attached = null
|
|
return ..()
|
|
|
|
/obj/item/powersink/update_icon_state()
|
|
icon_state = "powersink[mode == OPERATING]"
|
|
|
|
/obj/item/powersink/proc/set_mode(value)
|
|
if(value == mode)
|
|
return
|
|
switch(value)
|
|
if(DISCONNECTED)
|
|
attached = null
|
|
if(mode == OPERATING)
|
|
STOP_PROCESSING(SSobj, src)
|
|
anchored = FALSE
|
|
density = FALSE
|
|
|
|
if(CLAMPED_OFF)
|
|
if(!attached)
|
|
return
|
|
if(mode == OPERATING)
|
|
STOP_PROCESSING(SSobj, src)
|
|
anchored = TRUE
|
|
density = TRUE
|
|
|
|
if(OPERATING)
|
|
if(!attached)
|
|
return
|
|
START_PROCESSING(SSobj, src)
|
|
anchored = TRUE
|
|
density = TRUE
|
|
|
|
mode = value
|
|
update_icon(UPDATE_ICON_STATE)
|
|
set_light(0)
|
|
|
|
/obj/item/powersink/screwdriver_act(mob/user, obj/item/I)
|
|
. = TRUE
|
|
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
|
return
|
|
if(mode == DISCONNECTED)
|
|
var/turf/T = loc
|
|
if(isturf(T) && !T.intact)
|
|
attached = locate() in T
|
|
if(!attached)
|
|
to_chat(user, "No exposed cable here to attach to.")
|
|
return
|
|
else
|
|
set_mode(CLAMPED_OFF)
|
|
visible_message("<span class='notice'>[user] attaches [src] to the cable!</span>")
|
|
message_admins("Power sink activated by [key_name_admin(user)] at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
|
|
log_game("Power sink activated by [key_name(user)] at ([x],[y],[z])")
|
|
else
|
|
to_chat(user, "Device must be placed over an exposed cable to attach to it.")
|
|
else
|
|
set_mode(DISCONNECTED)
|
|
src.visible_message("<span class='notice'>[user] detaches [src] from the cable!</span>")
|
|
|
|
/obj/item/powersink/attack_ai()
|
|
return
|
|
|
|
/obj/item/powersink/attack_hand(mob/user)
|
|
switch(mode)
|
|
if(DISCONNECTED)
|
|
..()
|
|
if(CLAMPED_OFF)
|
|
user.visible_message( \
|
|
"[user] activates \the [src]!", \
|
|
"<span class='notice'>You activate \the [src].</span>",
|
|
"<span class='italics'>You hear a click.</span>")
|
|
message_admins("Power sink activated by [ADMIN_LOOKUPFLW(user)] at [ADMIN_VERBOSEJMP(src)]")
|
|
log_game("Power sink activated by [key_name(user)] at [AREACOORD(src)]")
|
|
set_mode(OPERATING)
|
|
|
|
if(OPERATING)
|
|
user.visible_message( \
|
|
"[user] deactivates \the [src]!", \
|
|
"<span class='notice'>You deactivate \the [src].</span>",
|
|
"<span class='italics'>You hear a click.</span>")
|
|
set_mode(CLAMPED_OFF)
|
|
|
|
/obj/item/powersink/process()
|
|
if(!attached)
|
|
set_mode(DISCONNECTED)
|
|
return
|
|
|
|
var/datum/powernet/PN = attached.powernet
|
|
if(PN)
|
|
set_light(5)
|
|
|
|
// found a powernet, so drain up to max power from it
|
|
|
|
var/drained = min (drain_rate, attached.newavail())
|
|
attached.add_delayedload(drained)
|
|
power_drained += drained
|
|
|
|
// if tried to drain more than available on powernet
|
|
// now look for APCs and drain their cells
|
|
if(drained < drain_rate)
|
|
for(var/obj/machinery/power/terminal/T in PN.nodes)
|
|
if(istype(T.master, /obj/machinery/power/apc))
|
|
var/obj/machinery/power/apc/A = T.master
|
|
if(A.operating && A.cell)
|
|
A.cell.charge = max(0, A.cell.charge - 50)
|
|
power_drained += 50
|
|
if(A.charging == APC_FULLY_CHARGED) // If the cell was full
|
|
A.charging = APC_IS_CHARGING // It's no longer full
|
|
if(drained >= drain_rate)
|
|
break
|
|
|
|
if(power_drained > max_power * 0.98)
|
|
if (!admins_warned)
|
|
admins_warned = TRUE
|
|
message_admins("Power sink at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>) is 95% full. Explosion imminent.")
|
|
playsound(src, 'sound/effects/screech.ogg', 100, 1, 1)
|
|
|
|
if(power_drained >= max_power)
|
|
STOP_PROCESSING(SSobj, src)
|
|
explosion(src.loc, 4,8,16,32)
|
|
qdel(src)
|
|
|
|
#undef DISCONNECTED
|
|
#undef CLAMPED_OFF
|
|
#undef OPERATING
|