mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-25 22:28:44 +01:00
Merge pull request #6195 from Verkister/patch-65
Earlyports phoron generator runtime spam fix
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
var/coeff = 100
|
||||
var/obj/item/stack/material/fuel
|
||||
var/fuel_type = /obj/item/stack/material/phoron
|
||||
var/fuel_amount = 0
|
||||
var/max_fuel = 150000
|
||||
var/fuel_per_cycle_idle = 100
|
||||
var/fuel_per_cycle_active = 500
|
||||
@@ -18,7 +19,7 @@
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/Initialize()
|
||||
. = ..()
|
||||
fuel = new fuel_type(src, 0)
|
||||
fuel = new fuel_type(src)
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/Destroy()
|
||||
qdel(fuel)
|
||||
@@ -28,7 +29,7 @@
|
||||
if(!chassis)
|
||||
set_ready_state(TRUE)
|
||||
return PROCESS_KILL
|
||||
if(fuel.get_amount() <= 0)
|
||||
if(fuel_amount <= 0)
|
||||
log_message("Deactivated - no fuel.")
|
||||
set_ready_state(TRUE)
|
||||
return PROCESS_KILL
|
||||
@@ -42,7 +43,7 @@
|
||||
if(cur_charge<chassis.cell.maxcharge)
|
||||
use_fuel = fuel_per_cycle_active
|
||||
chassis.give_power(power_per_cycle)
|
||||
fuel.set_amount(min(use_fuel/fuel.perunit, fuel.get_amount()), TRUE) // allows fuel to get to 0
|
||||
fuel_amount -= min(use_fuel, fuel_amount) // allows fuel to get to 0
|
||||
update_equip_info()
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/detach()
|
||||
@@ -67,7 +68,7 @@
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/get_equip_info()
|
||||
var/output = ..()
|
||||
if(output)
|
||||
return "[output] \[[fuel]: [round(fuel.get_amount()*fuel.perunit,0.1)] cm<sup>3</sup>\] - <a href='?src=\ref[src];toggle=1'>[(datum_flags & DF_ISPROCESSING)?"Dea":"A"]ctivate</a>"
|
||||
return "[output] \[[fuel]: [fuel_amount] cm<sup>3</sup>\] - <a href='?src=\ref[src];toggle=1'>[(datum_flags & DF_ISPROCESSING)?"Dea":"A"]ctivate</a>"
|
||||
return
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/action(target)
|
||||
@@ -85,14 +86,14 @@
|
||||
return
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/proc/load_fuel(var/obj/item/stack/material/P)
|
||||
if(P.type == fuel.type && P.get_amount())
|
||||
var/to_load = max(max_fuel - fuel.get_amount()*fuel.perunit,0)
|
||||
if(to_load)
|
||||
var/units = min(max(round(to_load / P.perunit),1),P.get_amount())
|
||||
if(units)
|
||||
fuel.add(units)
|
||||
P.use(units)
|
||||
return units
|
||||
if(P.type == fuel_type && P.get_amount())
|
||||
var/to_load = max(max_fuel - fuel_amount,0)
|
||||
if(to_load >= 2000)
|
||||
var/sheets = round(to_load / 2000, 1)
|
||||
if(P.get_amount() >= sheets)
|
||||
fuel_amount += sheets * 2000
|
||||
P.use(sheets)
|
||||
return sheets * 2000
|
||||
else
|
||||
return 0
|
||||
return
|
||||
@@ -142,4 +143,4 @@
|
||||
return
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/generator/nuclear/critfail()
|
||||
return
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user