more work
This commit is contained in:
@@ -0,0 +1,229 @@
|
||||
/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(mapload)
|
||||
. = ..()
|
||||
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/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
|
||||
grown_amount = initial_amount * multiplier
|
||||
|
||||
/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(initial_amount < max_initial_amount)
|
||||
var/adding = min((max_initial_amount - initial_amount), M.amount)
|
||||
M.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()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>\The [src]'s material slots are full!</span>")
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/twohanded/required/fuel_rod/material/attack_self(mob/user)
|
||||
if(expended)
|
||||
to_chat(user, "<span class='notice'>You have already removed [material_name] from \the [src].</span>")
|
||||
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
|
||||
|
||||
/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 [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/depletion_threshold*100,100)]% fissiled.</span>"
|
||||
. += "<span class='disarm'>[initial_amount]/[max_initial_amount] of the slots for [material_name] 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)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
// modular shitcode but it works:tm:
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/nuclear_reactor/multitool_act(mob/living/user, obj/item/multitool/I)
|
||||
if(istype(I))
|
||||
to_chat(user, "<span class='notice'>You add \the [src]'s ID into the multitool's buffer.</span>")
|
||||
I.buffer = src.id
|
||||
return TRUE
|
||||
/obj/machinery/computer/reactor/multitool_act(mob/living/user, obj/item/multitool/I)
|
||||
if(istype(I))
|
||||
to_chat(user, "<span class='notice'>You add the reactor's ID to \the [src]>")
|
||||
src.id = I.buffer
|
||||
link_to_reactor()
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/nuclear_reactor/cargo // easier on the brain
|
||||
|
||||
/obj/machinery/atmospherics/components/trinary/nuclear_reactor/cargo/New()
|
||||
. = ..()
|
||||
id = rand(1, 9999999) // cmon, what are the chances? The chances are... Very low friend... But maybe we can make this a bit better.
|
||||
|
||||
// Cargo variants can be wrenched down and don't start linked to the default RMBK reactor
|
||||
|
||||
/obj/machinery/computer/reactor/control_rods/cargo
|
||||
anchored = FALSE
|
||||
id = null
|
||||
|
||||
/obj/machinery/computer/reactor/stats/cargo
|
||||
anchored = FALSE
|
||||
id = null
|
||||
|
||||
/obj/machinery/computer/reactor/fuel_rods/cargo
|
||||
anchored = FALSE
|
||||
id = null
|
||||
|
||||
/obj/item/paper/fluff/rbmkcargo
|
||||
name = "Nuclear Reactor Instructions"
|
||||
info = "Make sure a 5x5 area is completely clear of pipes, cables and machinery when using the beacon. Those will be provided automatically with the beacon's bluespace decompression. Use a multitool on the reactor then on the computers provided to link them together. Also make sure the reactor has a proper pipeline filled with cooling gas before inserting fuel rods. Good luck!"
|
||||
Reference in New Issue
Block a user