Initial Commit

This commit is contained in:
kevinz000
2018-09-03 10:35:47 -07:00
parent a8a6bcd23e
commit 2bf5e6af58
7 changed files with 170 additions and 129 deletions
+1
View File
@@ -71,6 +71,7 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define TESLA_MOB_STUN (1<<4)
#define TESLA_DEFAULT_FLAGS ALL
#define TESLA_FUSION_FLAGS TESLA_OBJ_DAMAGE | TESLA_MOB_DAMAGE | TESLA_MOB_STUN
//EMP protection
#define EMP_PROTECT_SELF (1<<0)
+22
View File
@@ -143,6 +143,17 @@
if(337.5 to 360)
return NORTH
/proc/angle2dir_cardinal(angle)
switch(round(angle, 0.1))
if(315.5 to 360, 0 to 45.5)
return NORTH
if(45.6 to 135.5)
return EAST
if(135.6 to 225.5)
return SOUTH
if(225.6 to 315.5)
return WEST
//returns the north-zero clockwise angle in degrees, given a direction
/proc/dir2angle(D)
switch(D)
@@ -437,6 +448,17 @@
else
. = max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307))
/proc/fusionpower2text(power) //used when displaying fusion power on analyzers
switch(power)
if(0 to 5)
return "low"
if(5 to 20)
return "mid"
if(20 to 50)
return "high"
if(50 to INFINITY)
return "super"
/proc/color2hex(color) //web colors
if(!color)
return "#000000"
+36 -1
View File
@@ -42,7 +42,7 @@ SLIME SCANNER
/obj/item/t_scanner/proc/scan()
t_ray_scan(loc)
/proc/t_ray_scan(mob/viewer, flick_time = 8, distance = 2)
/proc/t_ray_scan(mob/viewer, flick_time = 8, distance = 3)
if(!ismob(viewer) || !viewer.client)
return
var/list/t_ray_images = list()
@@ -328,6 +328,7 @@ SLIME SCANNER
if(cyberimp_detect)
to_chat(user, "<span class='notice'>Detected cybernetic modifications:</span>")
to_chat(user, "<span class='notice'>[cyberimp_detect]</span>")
SEND_SIGNAL(M, COMSIG_NANITE_SCAN, user, FALSE)
/proc/chemscan(mob/living/user, mob/living/M)
if(istype(M))
@@ -527,6 +528,7 @@ SLIME SCANNER
var/pressure = air_contents.return_pressure()
var/volume = air_contents.return_volume() //could just do mixture.volume... but safety, I guess?
var/temperature = air_contents.temperature
var/cached_scan_results = air_contents.analyzer_results
if(total_moles > 0)
to_chat(user, "<span class='notice'>Moles: [round(total_moles, 0.01)] mol</span>")
@@ -544,6 +546,12 @@ SLIME SCANNER
to_chat(user, "<span class='notice'>This node is empty!</span>")
else
to_chat(user, "<span class='notice'>[target] is empty!</span>")
if(cached_scan_results && cached_scan_results["fusion"]) //notify the user if a fusion reaction was detected
var/fusion_power = round(cached_scan_results["fusion"], 0.01)
var/tier = fusionpower2text(fusion_power)
to_chat(user, "<span class='boldnotice'>Large amounts of free neutrons detected in the air indicate that a fusion reaction took place.</span>")
to_chat(user, "<span class='notice'>Power of the last fusion reaction: [fusion_power]\n This power indicates it was a [tier]-tier fusion reaction.</span>")
return
//slime scanner
@@ -603,3 +611,30 @@ SLIME SCANNER
to_chat(user, "<span class='notice'>Core mutation in progress: [T.effectmod]</span>")
to_chat(user, "<span_class = 'notice'>Progress in core mutation: [T.applied] / [SLIME_EXTRACT_CROSSING_REQUIRED]</span>")
to_chat(user, "========================")
/obj/item/nanite_scanner
name = "nanite scanner"
icon = 'icons/obj/device.dmi'
icon_state = "nanite_scanner"
item_state = "nanite_remote"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
desc = "A hand-held body scanner able to detect nanites and their programming."
flags_1 = CONDUCT_1
item_flags = NOBLUDGEON
slot_flags = ITEM_SLOT_BELT
throwforce = 3
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 7
materials = list(MAT_METAL=200)
/obj/item/nanite_scanner/attack(mob/living/M, mob/living/carbon/human/user)
user.visible_message("<span class='notice'>[user] has analyzed [M]'s nanites.</span>")
add_fingerprint(user)
var/response = SEND_SIGNAL(M, COMSIG_NANITE_SCAN, user, TRUE)
if(!response)
to_chat(user, "<span class='info'>No nanites detected in the subject.</span>")
@@ -28,6 +28,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/volume = CELL_VOLUME //liters
var/last_share = 0
var/list/reaction_results
var/list/analyzer_results //used for analyzer feedback - not initialized until its used
/datum/gas_mixture/New(volume)
gases = new
@@ -427,14 +428,14 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
for(var/r in SSair.gas_reactions)
var/datum/gas_reaction/reaction = r
var/list/min_reqs = reaction.min_requirements.Copy()
var/list/min_reqs = reaction.min_requirements
if((min_reqs["TEMP"] && temp < min_reqs["TEMP"]) \
|| (min_reqs["ENER"] && ener < min_reqs["ENER"]))
continue
min_reqs -= "TEMP"
min_reqs -= "ENER"
for(var/id in min_reqs)
if (id == "TEMP" || id == "ENER")
continue
if(!cached_gases[id] || cached_gases[id][MOLES] < min_reqs[id])
continue reaction_loop
//at this point, all minimum requirements for the reaction are satisfied.
@@ -74,7 +74,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
name = "Water Vapor"
gas_overlay = "water_vapor"
moles_visible = MOLES_GAS_VISIBLE
fusion_power = 4
fusion_power = 8
/datum/gas/hypernoblium
id = "nob"
@@ -99,7 +99,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_overlay = "nitryl"
moles_visible = MOLES_GAS_VISIBLE
dangerous = TRUE
fusion_power = 10
fusion_power = 15
/datum/gas/tritium
id = "tritium"
@@ -115,7 +115,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
specific_heat = 20
name = "BZ"
dangerous = TRUE
fusion_power = 15
fusion_power = 8
/datum/gas/stimulum
id = "stim"
@@ -1,57 +1,4 @@
//Plasma fire properties
#define OXYGEN_BURN_RATE_BASE 1.4
#define PLASMA_BURN_RATE_DELTA 9
#define PLASMA_MINIMUM_OXYGEN_NEEDED 2
#define PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO 30
#define FIRE_CARBON_ENERGY_RELEASED 100000 //Amount of heat released per mole of burnt carbon into the tile
#define FIRE_HYDROGEN_ENERGY_RELEASED 280000 //Amount of heat released per mole of burnt hydrogen and/or tritium(hydrogen isotope)
#define FIRE_PLASMA_ENERGY_RELEASED 3000000 //Amount of heat released per mole of burnt plasma into the tile
//General assmos defines.
#define WATER_VAPOR_FREEZE 200
#define NITRYL_FORMATION_ENERGY 100000
#define TRITIUM_BURN_OXY_FACTOR 100
#define TRITIUM_BURN_TRIT_FACTOR 10
#define TRITIUM_BURN_RADIOACTIVITY_FACTOR 50000 //The neutrons gotta go somewhere. Completely arbitrary number.
#define TRITIUM_MINIMUM_RADIATION_ENERGY 0.1 //minimum 0.01 moles trit or 10 moles oxygen to start producing rads
#define SUPER_SATURATION_THRESHOLD 96
#define STIMULUM_HEAT_SCALE 100000
#define STIMULUM_FIRST_RISE 0.65
#define STIMULUM_FIRST_DROP 0.065
#define STIMULUM_SECOND_RISE 0.0009
#define STIMULUM_ABSOLUTE_DROP 0.00000335
#define REACTION_OPPRESSION_THRESHOLD 5
#define NOBLIUM_FORMATION_ENERGY 2e9 //1 Mole of Noblium takes the planck energy to condense.
//Plasma fusion properties
#define FUSION_ENERGY_THRESHOLD 3e9 //Amount of energy it takes to start a fusion reaction
#define FUSION_TEMPERATURE_THRESHOLD 1000 //Temperature required to start a fusion reaction
#define FUSION_MOLE_THRESHOLD 250 //Mole count required (tritium/plasma) to start a fusion reaction
#define FUSION_RELEASE_ENERGY_SUPER 3e9 //Amount of energy released in the fusion process, super tier
#define FUSION_RELEASE_ENERGY_HIGH 1e9 //Amount of energy released in the fusion process, high tier
#define FUSION_RELEASE_ENERGY_MID 5e8 //Amount of energy released in the fusion process, mid tier
#define FUSION_RELEASE_ENERGY_LOW 1e8 //Amount of energy released in the fusion process, low tier
#define FUSION_MEDIATION_FACTOR 80 //Arbitrary
#define FUSION_SUPER_TIER 50 //anything above this is super tier
#define FUSION_HIGH_TIER 20 //anything above this and below 50 is high tier
#define FUSION_MID_TIER 5 //anything above this and below 20 is mid tier - below this is low tier, but that doesnt need a define
#define FUSION_ENERGY_DIVISOR_SUPER 25
#define FUSION_ENERGY_DIVISOR_HIGH 20
#define FUSION_ENERGY_DIVISOR_MID 10
#define FUSION_ENERGY_DIVISOR_LOW 2
#define FUSION_GAS_CREATION_FACTOR_SUPER 0.20 //stimulum and pluoxium - 40% in total
#define FUSION_GAS_CREATION_FACTOR_HIGH 0.60 //trit - one gas, so its higher than the other two - 60% in total
#define FUSION_GAS_CREATION_FACTOR_MID 0.45 //BZ and N2O - 90% in total
#define FUSION_GAS_CREATION_FACTOR_LOW 0.48 //O2 and CO2 - 96% in total
#define FUSION_MID_TIER_RAD_PROB_FACTOR 2 //probability of radpulse is power ratio * this for whatever tier
#define FUSION_LOW_TIER_RAD_PROB_FACTOR 5
#define FUSION_EFFICIENCY_BASE 60 //used in the fusion efficiency calculations
#define FUSION_EFFICIENCY_DIVISOR 0.6 //ditto
#define FUSION_RADIATION_FACTOR 15000 //horizontal asymptote
#define FUSION_RADIATION_CONSTANT 30 //equation is form of (ax) / (x + b), where a = radiation factor and b = radiation constant (https://www.desmos.com/calculator/4i1f296phl)
#define FUSION_VOLUME_SUPER 100 //volume of the sound the fusion noises make
#define FUSION_VOLUME_HIGH 50
#define FUSION_VOLUME_MID 25
#define FUSION_VOLUME_LOW 10
//All defines used in reactions are located in ..\__DEFINES\reactions.dm
/proc/init_gas_reactions()
var/list/reaction_types = list()
@@ -249,7 +196,10 @@
return cached_results["fire"] ? REACTING : NO_REACTION
//fusion: a terrible idea that was fun but broken. Now reworked to be less broken and more interesting. Again (and again).
//fusion: a terrible idea that was fun but broken. Now reworked to be less broken and more interesting. Again (and again, and again)
//Fusion Rework Counter: Please increment this if you make a major overhaul to this system again.
//5 reworks
/datum/gas_reaction/fusion
exclude = FALSE
priority = 2
@@ -268,6 +218,9 @@
/datum/gas_reaction/fusion/react(datum/gas_mixture/air, datum/holder)
var/list/cached_gases = air.gases
var/temperature = air.temperature
if(!air.analyzer_results)
air.analyzer_results = new
var/list/cached_scan_results = air.analyzer_results
var/turf/open/location
if (istype(holder,/datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet.
var/datum/pipeline/fusion_pipenet = holder
@@ -280,70 +233,70 @@
var/mediation = FUSION_MEDIATION_FACTOR*(air.heat_capacity()-(cached_gases[/datum/gas/plasma][MOLES]*cached_gases[/datum/gas/plasma][GAS_META][META_GAS_SPECIFIC_HEAT]))/(air.total_moles()-cached_gases[/datum/gas/plasma][MOLES]) //This is the average specific heat of the mixture,not including plasma.
var/moles_excluding_plasma = air.total_moles() - cached_gases[/datum/gas/plasma][MOLES]
var/plasma_differential = (cached_gases[/datum/gas/plasma][MOLES] - moles_excluding_plasma) / air.total_moles()
var/gases_fused = air.total_moles() - cached_gases[/datum/gas/plasma][MOLES]
var/plasma_differential = (cached_gases[/datum/gas/plasma][MOLES] - gases_fused) / air.total_moles()
var/reaction_efficiency = FUSION_EFFICIENCY_BASE ** -((plasma_differential ** 2) / FUSION_EFFICIENCY_DIVISOR) //https://www.desmos.com/calculator/6jjx3vdrvx
var/gases_fused = air.total_moles()
var/gas_power = 0
for (var/id in cached_gases)
gas_power += reaction_efficiency * (cached_gases[id][GAS_META][META_GAS_FUSION_POWER]*cached_gases[id][MOLES])
for (var/gas_id in cached_gases)
gas_power += reaction_efficiency * (cached_gases[gas_id][GAS_META][META_GAS_FUSION_POWER]*cached_gases[gas_id][MOLES])
var/power_ratio = gas_power/mediation
cached_scan_results[id] = power_ratio //used for analyzer feedback
for (var/gas_id in cached_gases) //and now we fuse
cached_gases[gas_id][MOLES] = 0
var/radiation_power = (FUSION_RADIATION_FACTOR * power_ratio) / (power_ratio + FUSION_RADIATION_CONSTANT) //https://www.desmos.com/calculator/4i1f296phl
var/zap_power = ((FUSION_ZAP_POWER_ASYMPTOTE * power_ratio) / (power_ratio + FUSION_ZAP_POWER_CONSTANT)) + FUSION_ZAP_POWER_BASE //https://www.desmos.com/calculator/n0zkdpxnrr
var/do_explosion = FALSE
var/zap_range //these ones are set later
var/fusion_prepare_to_die_edition_rng
if (power_ratio > FUSION_SUPER_TIER) //power ratio 50+: SUPER TIER. The gases become so energized that they fuse into stimulum and pluoxium, which is pretty nice! IF you can salvage them, which is going to be hard because this reaction is ridiculously dangerous.
if (power_ratio > FUSION_SUPER_TIER_THRESHOLD) //power ratio 50+: SUPER TIER. The gases become so energized that they fuse into a ton of tritium, which is pretty nice! Until you consider the fact that everything just exploded, the canister is probably going to break and you're irradiated.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_SUPER * (power_ratio / FUSION_ENERGY_DIVISOR_SUPER)
for (var/id in cached_gases)
cached_gases[id][MOLES] = 0
air.assert_gases(/datum/gas/stimulum,/datum/gas/pluoxium)
cached_gases[/datum/gas/stimulum][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_SUPER //60% of the gas is converted to energy, 40% to stimulum and pluoxium
cached_gases[/datum/gas/pluoxium][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_SUPER
if (location) //It's going to happen regardless of whether you want it to or not
radiation_pulse(location, radiation_power * 2)
explosion(location,0,0,10,power_ratio,TRUE,TRUE)//A decent explosion with a huge shockwave. People WILL know you're doing fusion.
playsound(location, "sound/effects/supermatter.ogg", FUSION_VOLUME_SUPER, 0)
cached_gases[/datum/gas/tritium][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_TRITIUM //60% of the gas is converted to energy, 40% to trit
fusion_prepare_to_die_edition_rng = 100 //Wait a minute..
do_explosion = TRUE
zap_range = FUSION_ZAP_RANGE_SUPER
else if (power_ratio > FUSION_HIGH_TIER) //power ratio 20-50; High tier. Fuses into one big atom which then turns to tritium instantly. Very dangerous, but super cool.
else if (power_ratio > FUSION_HIGH_TIER_THRESHOLD) //power ratio 20-50; High tier. The reaction is so energized that it fuses into a small amount of stimulum, and some pluoxium. Very dangerous, but super cool and super useful.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_HIGH * (power_ratio / FUSION_ENERGY_DIVISOR_HIGH)
for (var/id in cached_gases)
cached_gases[id][MOLES] = 0
cached_gases[/datum/gas/tritium][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_HIGH //40% of the gas is converted to energy, 60% to tritium
if (location)
if(prob(power_ratio)) //You really don't want this to happen.
radiation_pulse(location, radiation_power)
explosion(location,0,0,3,power_ratio * 0.5,TRUE,TRUE)//A tiny explosion with a large shockwave. People will know you're doing fusion.
playsound(location, "sound/effects/supermatter.ogg", FUSION_VOLUME_HIGH, 0)
else
playsound(location, "sound/effects/phasein.ogg", FUSION_VOLUME_HIGH, 0)
air.assert_gases(/datum/gas/stimulum, /datum/gas/pluoxium)
cached_gases[/datum/gas/stimulum][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_STIM //40% of the gas is converted to energy, 60% to stim and pluox
cached_gases[/datum/gas/pluoxium][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_PLUOX
fusion_prepare_to_die_edition_rng = power_ratio //Now we're getting into dangerous territory
do_explosion = TRUE
zap_range = FUSION_ZAP_RANGE_HIGH
else if (power_ratio > FUSION_MID_TIER) //power_ratio 5 to 20; Mediation is overpowered, fusion reaction starts to break down.
else if (power_ratio > FUSION_MID_TIER_THRESHOLD) //power_ratio 5 to 20; Mediation is overpowered, fusion reaction starts to break down.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_MID * (power_ratio / FUSION_ENERGY_DIVISOR_MID)
for (var/id in cached_gases)
cached_gases[id][MOLES] = 0
air.assert_gases(/datum/gas/bz,/datum/gas/nitrous_oxide)
cached_gases[/datum/gas/bz][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_MID //10% of the gas is converted to energy, 90% to BZ and N2O
cached_gases[/datum/gas/nitrous_oxide][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_MID
if (location)
if(prob(power_ratio * FUSION_MID_TIER_RAD_PROB_FACTOR)) //Still weak, but don't stand next to it unprotected
radiation_pulse(location, radiation_power * 0.5)
playsound(location, "sound/effects/supermatter.ogg", FUSION_VOLUME_MID, 0)
else
playsound(location, "sound/effects/phasein.ogg", FUSION_VOLUME_MID, 0)
air.assert_gases(/datum/gas/nitryl,/datum/gas/nitrous_oxide)
cached_gases[/datum/gas/nitryl][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_NITRYL //20% of the gas is converted to energy, 80% to nitryl and N2O
cached_gases[/datum/gas/nitrous_oxide][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_N2O
fusion_prepare_to_die_edition_rng = power_ratio * FUSION_MID_TIER_RAD_PROB_FACTOR //Still unlikely, but don't stand next to the reaction unprotected
zap_range = FUSION_ZAP_RANGE_MID
else //power ratio 0 to 5; Gas power is overpowered. Fusion isn't nearly as powerful.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_LOW * (power_ratio / FUSION_ENERGY_DIVISOR_LOW)
for (var/gas in cached_gases)
cached_gases[gas][MOLES] = 0
air.assert_gases(/datum/gas/oxygen, /datum/gas/carbon_dioxide)
cached_gases[/datum/gas/oxygen][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_LOW //4% of the gas is converted to energy, 94% to oxygen and CO2
cached_gases[/datum/gas/carbon_dioxide][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_LOW
if (location)
if(prob(power_ratio * FUSION_LOW_TIER_RAD_PROB_FACTOR)) //Weak, but still something to look out for
radiation_pulse(location, radiation_power * 0.25)
playsound(location, "sound/effects/supermatter.ogg", FUSION_VOLUME_LOW, 0)
else
playsound(location, "sound/effects/phasein.ogg", FUSION_VOLUME_LOW, 0)
air.assert_gases(/datum/gas/bz, /datum/gas/carbon_dioxide)
cached_gases[/datum/gas/bz][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_BZ //10% of the gas is converted to energy, 90% to BZ and CO2
cached_gases[/datum/gas/carbon_dioxide][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_CO2
fusion_prepare_to_die_edition_rng = power_ratio * FUSION_LOW_TIER_RAD_PROB_FACTOR //Low, but still something to look out for
zap_range = FUSION_ZAP_RANGE_LOW
//All the deadly consequences of fusion, consolidated for your viewing pleasure
if (location)
if(prob(fusion_prepare_to_die_edition_rng)) //Some.. permanent effects
if(do_explosion)
explosion(location, 0, 0, 5, power_ratio, TRUE, TRUE) //large shockwave, the actual radius is quite small - people will recognize that you're doing fusion
radiation_pulse(location, radiation_power) //You mean causing a super-tier fusion reaction in the halls is a bad idea?
playsound(location, 'sound/effects/supermatter.ogg', 100, 0)
else
playsound(location, 'sound/effects/phasein.ogg', 75, 0)
//These will always happen, so be prepared
tesla_zap(location, zap_range, zap_power, TESLA_FUSION_FLAGS) //larpers beware
location.fire_nuclear_particles(power_ratio) //see code/modules/projectile/energy/nuclear_particle.dm
if(reaction_energy > 0)
var/new_heat_capacity = air.heat_capacity()
@@ -480,21 +433,4 @@
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
air.temperature = max(((air.temperature*old_heat_capacity - energy_taken)/new_heat_capacity),TCMB)
#undef OXYGEN_BURN_RATE_BASE
#undef PLASMA_BURN_RATE_DELTA
#undef PLASMA_MINIMUM_OXYGEN_NEEDED
#undef PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO
#undef FIRE_CARBON_ENERGY_RELEASED
#undef FIRE_PLASMA_ENERGY_RELEASED
#undef WATER_VAPOR_FREEZE
#undef NITRYL_FORMATION_ENERGY
#undef TRITIUM_BURN_OXY_FACTOR
#undef SUPER_SATURATION_THRESHOLD
#undef STIMULUM_HEAT_SCALE
#undef STIMULUM_FIRST_RISE
#undef STIMULUM_FIRST_DROP
#undef STIMULUM_SECOND_RISE
#undef STIMULUM_ABSOLUTE_DROP
#undef REACTION_OPPRESSION_THRESHOLD
#undef NOBLIUM_FORMATION_ENERGY
@@ -0,0 +1,46 @@
//Nuclear particle projectile - a deadly side effect of fusion
/obj/item/projectile/energy/nuclear_particle
name = "nuclear particle"
icon_state = "nuclear_particle"
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
damage = 20
damage_type = TOX
irradiate = 2500 //enough to knockdown and induce vomiting
speed = 0.4
hitsound = 'sound/weapons/emitter2.ogg'
impact_type = /obj/effect/projectile/impact/xray
var/static/list/particle_colors = list(
"red" = "#FF0000",
"blue" = "#00FF00",
"green" = "#0000FF",
"yellow" = "#FFFF00",
"cyan" = "#00FFFF",
"purple" = "#FF00FF"
)
/obj/item/projectile/energy/nuclear_particle/Initialize()
. = ..()
//Random color time!
var/our_color = pick(particle_colors)
add_atom_colour(particle_colors[our_color], FIXED_COLOUR_PRIORITY)
set_light(4, 3, particle_colors[our_color]) //Range of 4, brightness of 3 - Same range as a flashlight
/atom/proc/fire_nuclear_particles(power_ratio) //used by fusion to fire random # of nuclear particles - power ratio determines about how many are fired
var/random_particles = rand(3,6)
var/particles_to_fire
var/particles_fired
switch(power_ratio) //multiply random_particles * factor for whatever tier
if(0 to FUSION_MID_TIER_THRESHOLD)
particles_to_fire = random_particles * FUSION_PARTICLE_FACTOR_LOW
if(FUSION_MID_TIER_THRESHOLD to FUSION_HIGH_TIER_THRESHOLD)
particles_to_fire = random_particles * FUSION_PARTICLE_FACTOR_MID
if(FUSION_HIGH_TIER_THRESHOLD to FUSION_SUPER_TIER_THRESHOLD)
particles_to_fire = random_particles * FUSION_PARTICLE_FACTOR_HIGH
if(FUSION_SUPER_TIER_THRESHOLD to INFINITY)
particles_to_fire = random_particles * FUSION_PARTICLE_FACTOR_SUPER
while(particles_to_fire)
particles_fired++
var/angle = rand(0,360)
var/obj/item/projectile/energy/nuclear_particle/P = new /obj/item/projectile/energy/nuclear_particle(src)
addtimer(CALLBACK(P, /obj/item/projectile.proc/fire, angle), particles_fired) //multiply particles fired * delay so the particles end up stagnated (once every decisecond)
particles_to_fire--