mirror of
https://github.com/evilew/GS13-Citadel.git
synced 2026-08-26 14:48:03 +01:00
can be ordered in cargo and limited to 4 per grid
This commit is contained in:
@@ -4,3 +4,10 @@
|
||||
cost = 10000
|
||||
contains = list(/obj/item/vending_refill/mealdor)
|
||||
crate_name = "meal vendor supply crate"
|
||||
|
||||
/datum/supply_pack/engineering/energy_harvester_board
|
||||
name = "Energy Harvester Board"
|
||||
desc = "Engineering made some crazy power device that seems to be creating massive amounts of energy out of thin air? With the parts found in this crate, you'll be able to make some sweet cash out of the engineers hard labor. Half of the credits made by this machine go to the engineering budget."
|
||||
cost = 5000
|
||||
contains = list(/obj/item/circuitboard/machine/energy_harvester)
|
||||
crate_name = "Energy Harvester Board supply crate"
|
||||
|
||||
@@ -19,11 +19,16 @@
|
||||
var/power_available = 0
|
||||
var/active = FALSE
|
||||
|
||||
/obj/machinery/power/energy_harvester/Initialize(mapload) // TODO: make sure we can only place 4 of those
|
||||
/obj/machinery/power/energy_harvester/Initialize(mapload)
|
||||
. = ..()
|
||||
RefreshParts()
|
||||
if(anchored)
|
||||
connect_to_network()
|
||||
if(too_many_harvesters_in_network())
|
||||
src.visible_message("<span class='alert'>[src] buzzes. Seems like there are too many energy harvesters connected to this powernet.</span>")
|
||||
playsound(src, 'sound/machines/buzz-two.ogg', 50)
|
||||
disconnect_from_network()
|
||||
return
|
||||
power_available = avail()
|
||||
|
||||
/obj/machinery/power/energy_harvester/RefreshParts()
|
||||
@@ -46,10 +51,14 @@
|
||||
return
|
||||
|
||||
if(!powernet)
|
||||
src.visible_message("<span class='alert'>[src] buzzes. Seems like it's not connected to a powernet.</span>")
|
||||
playsound(src, 'sound/machines/buzz-two.ogg', 50)
|
||||
return
|
||||
|
||||
power_available = avail()
|
||||
if(power_available <= 0)
|
||||
src.visible_message("<span class='alert'>[src] buzzes. Seems like there is no energy in the connected powernet.</span>")
|
||||
playsound(src, 'sound/machines/buzz-two.ogg', 50)
|
||||
return
|
||||
|
||||
var/power_drain = power_available * set_power_drain
|
||||
@@ -71,6 +80,11 @@
|
||||
if(. == SUCCESSFUL_UNFASTEN)
|
||||
if(anchored)
|
||||
connect_to_network()
|
||||
if(too_many_harvesters_in_network())
|
||||
src.visible_message("<span class='alert'>[src] buzzes. Seems like there are too many energy harvesters connected to this powernet.</span>")
|
||||
playsound(src, 'sound/machines/buzz-two.ogg', 50)
|
||||
disconnect_from_network()
|
||||
return
|
||||
power_available = avail()
|
||||
else
|
||||
disconnect_from_network()
|
||||
@@ -79,9 +93,11 @@
|
||||
/obj/machinery/power/energy_harvester/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if(!active)
|
||||
default_deconstruction_screwdriver(user, "state_open", "state_off", I)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/energy_harvester/wrench_act(mob/living/user, obj/item/I)
|
||||
@@ -91,6 +107,16 @@
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/energy_harvester/proc/too_many_harvesters_in_network()
|
||||
var/counter = 0
|
||||
for(var/machine in powernet.nodes)
|
||||
if(istype(machine, /obj/machinery/power/energy_harvester))
|
||||
counter += 1
|
||||
if(counter > 4)
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/power/energy_harvester/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
@@ -119,7 +145,9 @@
|
||||
return
|
||||
if(!anchored)
|
||||
return
|
||||
if(!powernet)
|
||||
if(!active && !powernet)
|
||||
src.visible_message("<span class='alert'>[src] buzzes. Seems like it's not connected to a powernet.</span>")
|
||||
playsound(src, 'sound/machines/buzz-two.ogg', 50)
|
||||
return
|
||||
active = !active
|
||||
. = TRUE
|
||||
|
||||
Reference in New Issue
Block a user