Fuel rod rework + templates

This commit is contained in:
Archie
2021-05-05 04:41:07 -03:00
parent cf2cda9365
commit 0867777fa0
9 changed files with 5274 additions and 440 deletions
@@ -0,0 +1,4 @@
/datum/export/plutonium_rod
cost = 20000
unit_name = "Plutonium Rod"
export_types = list(/obj/item/twohanded/required/fuel_rod/plutonium)
@@ -1,76 +1,229 @@
/obj/item/twohanded/required/fuel_rod/telecrystal
name = "Telecrystal Fuel Rod"
desc = "A disguised titanium sheathed rod containing several small slots infused with uranium dioxide. Permits the insertion of telecrystals to grow more. Fissiles much faster than its standard counterpart"
icon_state = "telecrystal"
fuel_power = 0.30 // twice as powerful as a normal rod, you're going to need some engineering autism if you plan to mass produce TC
var/telecrystal_amount = 0 // amount of telecrystals inside the rod?
var/max_telecrystal_amount = 8 // the max amount of TC that can be in the rod?
var/grown = FALSE // has the rod fissiled enough for us to remove the grown TC?
var/expended = FALSE // have we removed the TC already?
var/multiplier = 3 // how much do we multiply the inserted TC by?
/obj/item/twohanded/required/fuel_rod
var/rad_strength = 500
var/half_life = 2000 // how many depletion ticks are needed to half the fuel_power (1 tick = 1 second)
var/time_created = 0
var/og_fuel_power = 0.20 //the original fuel power value
var/process = FALSE
// The depletion where depletion_final() will be called (and does something)
var/depletion_threshold = 100
// How fast this rod will deplete
var/depletion_speed_modifier = 1
var/depleted_final = FALSE // depletion_final should run only once
var/depletion_conversion_type = "plutonium"
/obj/item/twohanded/required/fuel_rod/Initialize()
. = ..()
time_created = world.time
AddComponent(/datum/component/radioactive, rad_strength, src) // This should be temporary for it won't make rads go lower than 350
if(process)
START_PROCESSING(SSobj, src)
/obj/item/twohanded/required/fuel_rod/telecrystal/deplete(amount=0.035)
depletion += amount
if(depletion >= 100)
fuel_power = 0.60 // thrice as powerful as plutonium, you'll want to get this one out quick!
name = "Exhausted Telecrystal Fuel Rod"
desc = "A highly energetic, disguised titanium sheathed rod containing a number of slots filled with greatly expanded telecrystals which can be removed by hand. It's extremely efficient as nuclear fuel, but will cause the reaction to get out of control if not properly utilised."
icon_state = "telecrystal_used"
grown = TRUE
/obj/item/twohanded/required/fuel_rod/Destroy()
if(process)
STOP_PROCESSING(SSobj, src)
var/obj/machinery/atmospherics/components/trinary/nuclear_reactor/N = loc
if(istype(N))
N.fuel_rods -= src
. = ..()
// This proc will try to convert your fuel rod if you don't override this proc
// So, ideally, you should write an override of this for every fuel rod you want to create
/obj/item/twohanded/required/fuel_rod/proc/depletion_final(result_rod = "")
if(result_rod)
var/obj/machinery/atmospherics/components/trinary/nuclear_reactor/N = loc
// Rod conversion is moot when you can't find the reactor
if(istype(N))
var/obj/item/twohanded/required/fuel_rod/R
// You can add your own depletion scheme and not override this proc if you are going to convert a fuel rod into another type
switch(result_rod)
if("plutonium")
R = new /obj/item/twohanded/required/fuel_rod/plutonium(loc)
R.depletion = depletion
if("depleted")
if(fuel_power < 10)
fuel_power = 0
playsound(loc, 'sound/effects/supermatter.ogg', 100, TRUE)
R = new /obj/item/twohanded/required/fuel_rod/depleted(loc)
R.depletion = depletion
// Finalization of conversion
if(istype(R))
N.fuel_rods += R
qdel(src)
else
depleted_final = FALSE // Maybe try again later?
/obj/item/twohanded/required/fuel_rod/deplete(amount=0.035) // override for the one in rmbk.dm
depletion += amount * depletion_speed_modifier
if(depletion >= depletion_threshold && !depleted_final)
depleted_final = TRUE
depletion_final(depletion_conversion_type)
/obj/item/twohanded/required/fuel_rod/plutonium
fuel_power = 0.20
name = "Plutonium-239 Fuel Rod"
desc = "A highly energetic titanium sheathed rod containing a sizeable measure of weapons grade plutonium, it's highly efficient as nuclear fuel, but will cause the reaction to get out of control if not properly utilised."
icon_state = "inferior"
rad_strength = 1500
process = TRUE // for half life code
depletion_threshold = 300
depletion_conversion_type = "depleted"
/obj/item/twohanded/required/fuel_rod/plutonium/process()
fuel_power = og_fuel_power * 0.5**((world.time - time_created) / half_life SECONDS) // halves the fuel power every half life (33 minutes)
/obj/item/twohanded/required/fuel_rod/depleted
name = "Depleted Fuel Rod"
desc = "A highly radioactive fuel rod which has expended most of it's useful energy."
icon_state = "normal"
rad_strength = 6000 // smelly
depletion_conversion_type = "" // It means that it won't turn into anything
// Master type for material optional (or requiring, wyci) and/or producing rods
/obj/item/twohanded/required/fuel_rod/material
// Whether the rod has been harvested. Should be set in expend().
var/expended = FALSE
// The material that will be inserted and then multiplied (or not). Should be some sort of /obj/item/stack
var/material_type
// The name of material that'll be used for texts
var/material_name
var/material_name_singular
var/initial_amount = 0
// The maximum amount of material the rod can hold
var/max_initial_amount = 10
var/grown_amount = 0
// The multiplier for growth. 1 for the same 2 for double etc etc
var/multiplier = 2
// After this depletion, you won't be able to add new materials
var/material_input_deadline = 25
// Material fuel rods generally don't get converted into another fuel object
depletion_conversion_type = ""
// Called when the rod is fully harvested
/obj/item/twohanded/required/fuel_rod/material/proc/expend()
expended = TRUE
// Basic checks for material rods
/obj/item/twohanded/required/fuel_rod/material/proc/check_material_input(mob/user)
if(depletion >= material_input_deadline)
to_chat(user, "<span class='warning'>The sample slots have sealed themselves shut, it's too late to add [material_name] now!</span>") // no cheesing in crystals at 100%
return FALSE
if(expended)
to_chat(user, "<span class='warning'>\The [src]'s material slots have already been used.</span>")
return FALSE
return TRUE
// The actual growth
/obj/item/twohanded/required/fuel_rod/material/depletion_final(result_rod)
if(result_rod)
..() // So if you put anything into depletion_conversion_type then your fuel rod will be converted (or not) and *won't grow*
else
fuel_power = 0.30
grown_amount = initial_amount * multiplier
/obj/item/twohanded/required/fuel_rod/telecrystal/attackby(obj/item/W, mob/user, params)
var/obj/item/stack/telecrystal/M = W
if(istype(M))
if(depletion >= 10)
to_chat(user, "<span class='warning'>The sample slots have sealed themselves shut, it's too late to add crystals now!</span>") // no cheesing in crystals at 100%
/obj/item/twohanded/required/fuel_rod/material/attackby(obj/item/W, mob/user, params)
var/obj/item/stack/M = W
if(istype(M, material_type))
if(!check_material_input(user))
return
if(expended)
to_chat(user, "<span class='warning'>\The [src]'s material slots have already been used.</span>")
return
if(telecrystal_amount < max_telecrystal_amount)
var/adding = 0
if(M.amount <= max_telecrystal_amount - telecrystal_amount)
adding = M.amount
else
adding = max_telecrystal_amount - telecrystal_amount
adding = min((max_telecrystal_amount - telecrystal_amount), M.amount)
if(initial_amount < max_initial_amount)
var/adding = min((max_initial_amount - initial_amount), M.amount)
M.amount -= adding
telecrystal_amount += adding
initial_amount += adding
if (adding == 1)
to_chat(user, "<span class='notice'>You insert [adding] [material_name_singular] into \the [src].</span>")
else
to_chat(user, "<span class='notice'>You insert [adding] [material_name] into \the [src].</span>")
M.zero_amount()
to_chat(user, "<span class='notice'>You insert [adding] telecrystals into \the [src].</span>")
else
to_chat(user, "<span class='warning'>\The [src]'s material slots are full!</span>")
return
else
return ..()
/obj/item/twohanded/required/fuel_rod/telecrystal/attack_self(mob/user)
/obj/item/twohanded/required/fuel_rod/material/attack_self(mob/user)
if(expended)
to_chat(user, "<span class='notice'>You have already removed the telecrystals from the [src].</span>")
to_chat(user, "<span class='notice'>You have already removed [material_name] from \the [src].</span>")
return
if(grown)
var/profit = round(telecrystal_amount * multiplier, 1)
to_chat(user, "<span class='notice'>You remove [profit] telecrystals from the [src].</span>")
var/obj/item/stack/telecrystal/tc = new(get_turf(src))
tc.amount = profit
expended = TRUE
telecrystal_amount = 0
return
if(depleted_final)
new material_type(user.loc, grown_amount)
if (grown_amount == 1)
to_chat(user, "<span class='notice'>You harvest [grown_amount] [material_name_singular] from \the [src].</span>") // Unlikely
else
to_chat(user, "<span class='notice'>You harvest [grown_amount] [material_name] from \the [src].</span>")
grown_amount = 0
expend()
else if(depletion)
to_chat(user, "<span class='warning'>\The [src] has not fissiled enough to fully grow the sample. The progress bar shows it is [min(depletion/depletion_threshold*100,100)]% complete.</span>")
else if(initial_amount)
new material_type(user.loc, initial_amount)
if (initial_amount == 1)
to_chat(user, "<span class='notice'>You remove [initial_amount] [material_name_singular] from \the [src].</span>")
else
to_chat(user, "<span class='notice'>You remove [initial_amount] [material_name] from \the [src].</span>")
initial_amount = 0
else
to_chat(user, "<span class='warning'>\The [src] has not fissiled enough to fully grow the sample. The progress bar shows it is [min(depletion / 40 * 100, 100)]% complete.</span>")
/obj/item/twohanded/required/fuel_rod/telecrystal/examine(mob/user)
/obj/item/twohanded/required/fuel_rod/material/examine(mob/user)
. = ..()
if(expended)
. += "<span class='warning'>The material slots have been slagged by the extreme heat, you can't grow crystals in this rod again...</span>"
. += "<span class='warning'>The material slots have been slagged by the extreme heat, you can't grow [material_name] in this rod again...</span>"
return
else if(depleted_final)
if(grown_amount == 1)
. += "<span class='warning'>This fuel rod's [material_name] are now fully grown, and it currently bears [grown_amount] harvestable [material_name_singular].</span>"
else
. += "<span class='warning'>This fuel rod's [material_name] are now fully grown, and it currently bears [grown_amount] harvestable [material_name].</span>"
return
if(depletion)
. += "<span class='danger'>The sample is [min(depletion / 40 * 100, 100)]% fissiled.</span>"
. += "<span class='danger'>The sample is [min(depletion/depletion_threshold*100,100)]% fissiled.</span>"
. += "<span class='disarm'>[initial_amount]/[max_initial_amount] of the slots for [material_name] are full.</span>"
. += "<span class='disarm'>[telecrystal_amount]/[max_telecrystal_amount] of the telecrystal slots are full.</span>"
/obj/item/twohanded/required/fuel_rod/material/telecrystal
name = "Telecrystal Fuel Rod"
desc = "A disguised titanium sheathed rod containing several small slots infused with uranium dioxide. Permits the insertion of telecrystals to grow more. Fissiles much faster than its standard counterpart"
icon_state = "telecrystal"
fuel_power = 0.30 // twice as powerful as a normal rod, you're going to need some engineering autism if you plan to mass produce TC
depletion_speed_modifier = 3 // headstart, otherwise it takes two hours
rad_strength = 1500
max_initial_amount = 8
multiplier = 3
material_type = /obj/item/stack/telecrystal
material_name = "telecrystals"
material_name_singular = "telecrystal"
/obj/item/twohanded/required/fuel_rod/material/telecrystal/depletion_final(result_rod)
..()
if(!result_rod)
fuel_power = 0.60 // thrice as powerful as plutonium, you'll want to get this one out quick!
name = "Exhausted Telecrystal Fuel Rod"
desc = "A highly energetic, disguised titanium sheathed rod containing a number of slots filled with greatly expanded telecrystals which can be removed by hand. It's extremely efficient as nuclear fuel, but will cause the reaction to get out of control if not properly utilised."
icon_state = "telecrystal_used"
AddComponent(/datum/component/radioactive, 3000, src)
/obj/item/twohanded/required/fuel_rod/material/bananium
name = "Bananium Fuel Rod"
desc = "A hilarious heavy-duty fuel rod which fissiles a bit slower than its cowardly counterparts. However, its cutting-edge cosmic clown technology allows rooms for extraordinarily exhilarating extraterrestrial element called bananium to menacingly multiply."
icon_state = "bananium"
fuel_power = 0.15
depletion_speed_modifier = 3
rad_strength = 350
max_initial_amount = 10
multiplier = 3
material_type = /obj/item/stack/sheet/mineral/bananium
material_name = "sheets of bananium"
material_name_singular = "sheet of bananium"
/obj/item/twohanded/required/fuel_rod/material/bananium/deplete(amount=0.035)
..()
if(initial_amount == max_initial_amount && prob(10))
playsound(src, pick('sound/items/bikehorn.ogg', 'yogstation/sound/misc/bikehorn_creepy.ogg'), 50) // HONK
/obj/item/twohanded/required/fuel_rod/material/bananium/depletion_final(result_rod)
..()
if(!result_rod)
fuel_power = 0.3 // Be warned
name = "Fully Grown Bananium Fuel Rod"
desc = "A hilarious heavy-duty fuel rod which fissiles a bit slower than it cowardly counterparts. Its greatly grimacing grwoth stage is now over, and bananium outgrowth hums as if it's blatantly honking bike horns."
icon_state = "bananium_used"
AddComponent(/datum/component/radioactive, 1250, src)
@@ -5,7 +5,7 @@
#define COOLANT_OUTPUT_GATE airs[3]
#define RBMK_TEMPERATURE_OPERATING 640 //Celsius
#define RBMK_TEMPERATURE_CRITICAL 800 //At this point the entire ship is alerted to a meltdown. This may need altering
#define RBMK_TEMPERATURE_CRITICAL 800 //At this point the entire ship/station is alerted to a meltdown. This may need altering
#define RBMK_TEMPERATURE_MELTDOWN 900
#define RBMK_PRESSURE_OPERATING 1000 //PSI
@@ -13,7 +13,8 @@
#define RBMK_MAX_CRITICALITY 3 //No more criticality than N for now.
#define RBMK_POWER_FLAVOURISER 1000 //To turn those KWs into something usable
//#define RBMK_POWER_FLAVOURISER 1000 //To turn those KWs into something usable
#define RBMK_POWER_FLAVOURISER 2000 //Let's use double for now.
//Math. Lame.
#define KPA_TO_PSI(A) (A/6.895)
@@ -4,5 +4,5 @@
once the rod has been fully depleted, you will be able to harvest the extra telecrystals. \
Please note: This Rod fissiles much faster than it's regular counterpart, it doesn't take \
much to overload the reactor with these..."
item = /obj/item/twohanded/required/fuel_rod/telecrystal
item = /obj/item/twohanded/required/fuel_rod/material/telecrystal
cost = 7