Power fix

Fixes a bug with power draw in machines, where if they didn't have an overwritten process procedure they wouldn't draw power. Ex. Chem Masters. This fixes power draw for the safety tether
Safety tether now draws roughly balanced amount of power. draws 1kw default, drains about a fourth the apc cell's charge if unupgraded when teleporting.
This commit is contained in:
Haha26315
2022-09-12 08:43:56 -04:00
parent 1d1772e7e0
commit 9beae92ef3
4 changed files with 24 additions and 33 deletions
-2
View File
@@ -137,8 +137,6 @@
var/tether_number = GLOB.safety_tethers_list.len
priority_announce("[tether_number] tethers present.")
//If safety tethers are present, get one from the global list to teleport the body to if operational
if(tether_number > 0)
if(tether_number == 1)
+7 -2
View File
@@ -157,8 +157,13 @@ Class Procs:
/obj/machinery/proc/locate_machinery()
return
/obj/machinery/process()//If you dont use process or power why are you here
return PROCESS_KILL
/obj/machinery/process()
//Here because if the machine doesn't have a process code attached to it or if PROCESS_KILL is returned it will no longer draw power.
if(is_operational())
return 1
else
return 0
/obj/machinery/proc/process_atmos()//If you dont use process why are you here
return PROCESS_KILL
@@ -72,10 +72,10 @@
use_power = IDLE_POWER_USE
power_channel = EQUIP
idle_power_usage = 500
var/teleport_power_usage = 10000
idle_power_usage = 1000
var/teleport_power_usage = 1000000 //Uses about a fourth of the upgraded power cell plus default in APCs
var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
var/internal_radio = TRUE
var/obj/item/radio/radio
@@ -101,31 +101,24 @@
//ensures light is properly centered around the tether. Removes lighting system's pixel approximation that breaks it.
light_source = get_turf(src)
update_icon()
power_change() //Here to start lights on ititialization.
/obj/machinery/safety_tether/Destroy()
QDEL_NULL(radio)
GLOB.safety_tethers_list -= src
. = ..()
/obj/machinery/safety_tether/doMove(atom/destination)
. = ..()
//ensures light is properly centered around the tether. Removes lighting system's pixel approximation that breaks it.
light_source = get_turf(src)
return .
/obj/machinery/safety_tether/Destroy()
QDEL_NULL(radio)
GLOB.safety_tethers_list -= src
//if made into connected machine later, like gravgen
//if(connected)
// connected.DetachCloner(src)
. = ..()
/obj/machinery/safety_tether/update_icon()
cut_overlays()
if(is_operational())
add_overlay("operational_overlay")
//Clonepod
/obj/machinery/safety_tether/examine(mob/user)
. = ..()
@@ -141,21 +134,18 @@
//Returns true if teleport is successful, false otherwise
/obj/machinery/safety_tether/proc/bungee_teleport(mob/living/M)
priority_announce("Tether bungee activated!")
if(ismovableatom(M) && is_operational() != 0 && do_teleport(M, get_turf(src), channel = TELEPORT_CHANNEL_BLUESPACE))
use_power(teleport_power_usage)
M.spawn_gibs()
M.emote("scream")
//priority_announce("[M] ([key_name(M)]) had a tether mishap")
if(iscarbon(M))
var/mob/living/carbon/Carbon = M
//Rework to teleporter mishap
priority_announce("[Carbon] ([key_name(Carbon)]) had a tether mishap")
to_chat(Carbon, "<span class='italics'>Buzzing static snaps taut on your chest....</span>")
Carbon.adjustCloneLoss(rand(40,75))
@@ -209,8 +199,6 @@
else
if(issilicon(M))
var/mob/living/silicon/S = M
//Rework to teleporter mishap
priority_announce("[S] ([key_name(S)]) had a tether mishap")
to_chat(S, "<span class='italics'>Your circuits spark, slag, and pop as overwhelming white noise crackles and YANKS...</span>")
S.apply_damage_type(damage = rand(silicon_burn_min, silicon_burn_max), damagetype = BURN)
@@ -229,10 +217,11 @@
//Updates machine icon and lighting every time power in the area changes
/obj/machinery/safety_tether/power_change()
. = ..()
if(stat & NOPOWER)
light_source.set_light(0)
else
light_source.set_light(brightness_on, light_power, light_color)
if(light_source)
if(stat & NOPOWER)
light_source.set_light(0)
else
light_source.set_light(brightness_on, light_power, light_color)
update_icon()
//possible emagging or other interactions later, like EMPs
@@ -316,5 +305,4 @@
//#undef SPEAK
#undef SPEAKMEDICAL
#undef SPEAKSCIENCE
#undef SPEAKSCIENCE
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB