Polaris sync

This commit is contained in:
killer653
2017-08-06 19:07:17 -04:00
652 changed files with 44410 additions and 18080 deletions

View File

@@ -142,26 +142,26 @@
if(!istype(W) || !user) return
if(istype(W, /obj/item/weapon/wrench))
if(!anchored)
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the anchor bolts to the floor.", \
"You hear a ratchet")
"You hear a ratchet.")
src.anchored = 1
connect_to_network()
else if(!linked_shielding.len > 0)
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] unsecures the [src.name].", \
"You remove the anchor bolts.", \
"You hear a ratchet")
"You hear a ratchet.")
src.anchored = 0
disconnect_from_network()
else
user << "\red Once bolted and linked to a shielding unit it the [src.name] is unable to be moved!"
user << "<font color='red'>Once bolted and linked to a shielding unit it the [src.name] is unable to be moved!</font>"
return
if(istype(W, /obj/item/weapon/am_containment))
if(fueljar)
user << "\red There is already a [fueljar] inside!"
user << "<font color='red'>There is already a [fueljar] inside!</font>"
return
fueljar = W
user.remove_from_mob(W)

View File

@@ -109,7 +109,7 @@
antiH_fuel = residual_matter
for(var/mob/M in hearers(src, null))
M.show_message(text("\red You hear a loud bang!"))
M.show_message(text("<font color='red'>You hear a loud bang!</font>"))
//Q = k x (delta T)
@@ -161,7 +161,7 @@
if(energy > convert2energy(8e-12)) //TOO MUCH ENERGY
for(var/mob/M in hearers(src, null))
M.show_message(text("\red You hear a loud whirring!"))
M.show_message(text("<font color='red'>You hear a loud whirring!</font>"))
sleep(20)
//Q = k x (delta T)
@@ -180,7 +180,7 @@
if(energy > convert2energy(8e-12)) //FAR TOO MUCH ENERGY STILL
for(var/mob/M in hearers(src, null))
M.show_message(text("\red <big>BANG!</big>"))
M.show_message(text("<font color='red'><big>BANG!</big></font>"))
new /obj/effect/bhole(src.loc)
else //this amount of energy is okay so it does the proper output thing

View File

@@ -74,9 +74,9 @@
/obj/item/weapon/fuel/proc/injest(mob/M as mob)
switch(content)
if("Anti-Hydrogen")
M.gib()
M.gib() //Yikes!
if("Hydrogen")
M << "\blue You feel very light, as if you might just float away..."
M << "<font color='blue'>You feel very light, as if you might just float away...</font>"
qdel(src)
return
@@ -95,5 +95,5 @@
return
else
for(var/mob/O in viewers(M, null))
O.show_message(text("\red [M] ate the [content ? content : "empty canister"]!"), 1)
O.show_message(text("<font color='red'>[M] ate the [content ? content : "empty canister"]!</font>"), 1)
src.injest(M)

View File

@@ -68,7 +68,7 @@ proc/cardinalrange(var/center)
/obj/machinery/am_shielding/Destroy()
if(control_unit) control_unit.remove_shielding(src)
if(processing) shutdown_core()
visible_message("\red The [src.name] melts!")
visible_message("<font color='red'>The [src.name] melts!</font>")
//Might want to have it leave a mess on the floor but no sprites for now
..()
return

View File

@@ -444,9 +444,9 @@
if (terminal)
to_chat(user,"<span class='warning'>Disconnect the wires first.</span>")
return
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
playsound(src, W.usesound, 50, 1)
to_chat(user,"You begin to remove the power control board...") //lpeters - fixed grammar issues //Ner - grrrrrr
if(do_after(user, 50))
if(do_after(user, 50 * W.toolspeed))
if (has_electronics==1)
has_electronics = 0
if ((stat & BROKEN))
@@ -498,12 +498,12 @@
if (has_electronics==1 && terminal)
has_electronics = 2
stat &= ~MAINT
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user,"You screw the circuit electronics into place.")
else if (has_electronics==2)
has_electronics = 1
stat |= MAINT
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user,"You unfasten the electronics.")
else /* has_electronics==0 */
to_chat(user,"<span class='warning'>There is nothing to secure.</span>")
@@ -512,6 +512,7 @@
else
wiresexposed = !wiresexposed
to_chat(user,"The wires have been [wiresexposed ? "exposed" : "unexposed"].")
playsound(src, W.usesound, 50, 1)
update_icon()
else if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
@@ -567,7 +568,7 @@
user.visible_message("<span class='warning'>[user.name] starts dismantling the [src]'s power terminal.</span>", \
"You begin to cut the cables...")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50))
if(do_after(user, 50 * W.toolspeed))
if(terminal && opened && has_electronics!=2)
if (prob(50) && electrocute_mob(usr, terminal.powernet, terminal))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
@@ -599,8 +600,8 @@
user.visible_message("<span class='warning'>[user.name] begins cutting apart [src] with the [WT.name].</span>", \
"You start welding the APC frame...", \
"You hear welding.")
playsound(src.loc, 'sound/items/Welder.ogg', 25, 1)
if(do_after(user, 50))
playsound(src, WT.usesound, 25, 1)
if(do_after(user, 50 * WT.toolspeed))
if(!src || !WT.remove_fuel(3, user)) return
if (emagged || (stat & BROKEN) || opened==2)
new /obj/item/stack/material/steel(loc)

View File

@@ -81,7 +81,7 @@
if(istype(W, /obj/item/weapon/crowbar))
if (charge < (capacity / 100))
if (!output_attempt && !input_attempt)
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
playsound(src, W.usesound, 50, 1)
var/obj/structure/frame/M = new /obj/structure/frame(src.loc)
M.frame_type = "machine"
M.state = 2

View File

@@ -34,24 +34,24 @@
/obj/machinery/power/breakerbox/examine(mob/user)
user << "Large machine with heavy duty switching circuits used for advanced grid control"
if(on)
user << "\green It seems to be online."
user << "<font color='green'>It seems to be online.</font>"
else
user << "\red It seems to be offline"
user << "<font color='red'>It seems to be offline.</font>"
/obj/machinery/power/breakerbox/attack_ai(mob/user)
if(update_locked)
user << "\red System locked. Please try again later."
user << "<font color='red'>System locked. Please try again later.</font>"
return
if(busy)
user << "\red System is busy. Please wait until current operation is finished before changing power settings."
user << "<font color='red'>System is busy. Please wait until current operation is finished before changing power settings.</font>"
return
busy = 1
user << "\green Updating power settings.."
user << "<font color='green'>Updating power settings...</font>"
if(do_after(user, 50))
set_state(!on)
user << "\green Update Completed. New setting:[on ? "on": "off"]"
user << "<font color='green'>Update Completed. New setting:[on ? "on": "off"]</font>"
update_locked = 1
spawn(600)
update_locked = 0
@@ -60,16 +60,16 @@
/obj/machinery/power/breakerbox/attack_hand(mob/user)
if(update_locked)
user << "\red System locked. Please try again later."
user << "<font color='red'>System locked. Please try again later.</font>"
return
if(busy)
user << "\red System is busy. Please wait until current operation is finished before changing power settings."
user << "<font color='red'>System is busy. Please wait until current operation is finished before changing power settings.</font>"
return
busy = 1
for(var/mob/O in viewers(user))
O.show_message(text("\red [user] started reprogramming [src]!"), 1)
O.show_message(text("<font color='red'>[user] started reprogramming [src]!</font>"), 1)
if(do_after(user, 50))
set_state(!on)

View File

@@ -17,10 +17,10 @@
return
if(istype(W, /obj/item/weapon/wirecutters))
usr << "\blue These cables are too tough to be cut with those [W.name]."
usr << "<font color='blue'>These cables are too tough to be cut with those [W.name].</font>"
return
else if(istype(W, /obj/item/stack/cable_coil))
usr << "\blue You will need heavier cables to connect to these."
usr << "<font color='blue'>You will need heavier cables to connect to these.</font>"
return
else
..()

View File

@@ -18,7 +18,7 @@
/obj/machinery/power/fractal_reactor/New()
..()
if(!mapped_in)
world << "<b>\red WARNING: \black Map testing power source activated at: X:[src.loc.x] Y:[src.loc.y] Z:[src.loc.z]</b>"
world << "<b><font color='red'>WARNING:</font><font color='black'> Map testing power source activated at: X:[src.loc.x] Y:[src.loc.y] Z:[src.loc.z]</font></b>"
/obj/machinery/power/fractal_reactor/process()
if(!powernet && !powernet_connection_failed)

View File

@@ -0,0 +1,83 @@
// temperature of the core of the sun
#define FUSION_HEAT_CAP 1.57e7
#define SETUP_OK 1 // All good
#define SETUP_WARNING 2 // Something that shouldn't happen happened, but it's not critical so we will continue
#define SETUP_ERROR 3 // Something bad happened, and it's important so we won't continue setup.
#define SETUP_DELAYED 4 // Wait for other things first.
/datum/admins/proc/setup_fusion()
set category = "Debug"
set name = "Setup Fusion Core"
set desc = "Allows you to start the R-UST engine."
if (!istype(src,/datum/admins))
src = usr.client.holder
if (!istype(src,/datum/admins))
to_chat(usr, "Error: you are not an admin!")
return
if(!(locate(/obj/machinery/power/fusion_core/mapped) in world))
to_chat(usr, "This map is not appropriate for this verb.")
return
var/response = input(usr, "Are you sure?", "Engine setup") as null|anything in list("No", "Yes")
if(!response || response == "No")
return
var/errors = 0
var/warnings = 0
var/success = 0
log_and_message_admins("## FUSION CORE SETUP - Setup initiated by [usr].")
for(var/obj/machinery/fusion_fuel_injector/mapped/injector in machines)
injector.cur_assembly = new /obj/item/weapon/fuel_assembly/deuterium(injector)
injector.BeginInjecting()
var/obj/machinery/power/fusion_core/mapped/core = locate() in machines
if(core.jumpstart(15000))
var/list/delayed_objects = list()
// SETUP PHASE
for(var/obj/effect/engine_setup/S in world)
var/result = S.activate(0)
switch(result)
if(SETUP_OK)
success++
continue
if(SETUP_WARNING)
warnings++
continue
if(SETUP_ERROR)
errors++
log_and_message_admins("## FUSION CORE SETUP - Error encountered! Aborting.")
break
if(SETUP_DELAYED)
delayed_objects.Add(S)
continue
if(!errors)
for(var/obj/effect/engine_setup/S in delayed_objects)
var/result = S.activate(1)
switch(result)
if(SETUP_OK)
success++
continue
if(SETUP_WARNING)
warnings++
continue
if(SETUP_ERROR)
errors++
log_and_message_admins("## FUSION CORE SETUP - Error encountered! Aborting.")
break
else
log_and_message_admins("## FUSION CORE SETUP - Error encountered! Aborting.")
errors++
log_and_message_admins("## FUSION CORE SETUP - Setup completed with [errors] errors, [warnings] warnings and [success] successful steps.")
#undef SETUP_OK
#undef SETUP_WARNING
#undef SETUP_ERROR
#undef SETUP_DELAYED

View File

@@ -0,0 +1,131 @@
/*
TODO README
*/
var/list/fusion_cores = list()
#define MAX_FIELD_STR 1000
#define MIN_FIELD_STR 1
/obj/machinery/power/fusion_core
name = "\improper R-UST Mk. 8 Tokamak core"
desc = "An enormous solenoid for generating extremely high power electromagnetic fields. It includes a kinetic energy harvester."
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core0"
density = 1
use_power = 1
idle_power_usage = 50
active_power_usage = 500 //multiplied by field strength
anchored = 0
var/obj/effect/fusion_em_field/owned_field
var/field_strength = 1//0.01
var/id_tag
/obj/machinery/power/fusion_core/mapped
anchored = 1
/obj/machinery/power/fusion_core/initialize()
. = ..()
connect_to_network()
fusion_cores += src
/obj/machinery/power/fusion_core/Destroy()
for(var/obj/machinery/computer/fusion_core_control/FCC in machines)
FCC.connected_devices -= src
if(FCC.cur_viewed_device == src)
FCC.cur_viewed_device = null
fusion_cores -= src
return ..()
/obj/machinery/power/fusion_core/process()
if((stat & BROKEN) || !powernet || !owned_field)
Shutdown()
/obj/machinery/power/fusion_core/Topic(href, href_list)
if(..())
return 1
if(href_list["str"])
var/dif = text2num(href_list["str"])
field_strength = min(max(field_strength + dif, MIN_FIELD_STR), MAX_FIELD_STR)
active_power_usage = 500 * field_strength
if(owned_field)
owned_field.ChangeFieldStrength(field_strength)
/obj/machinery/power/fusion_core/proc/Startup()
if(owned_field)
return
owned_field = new(loc, src)
owned_field.ChangeFieldStrength(field_strength)
icon_state = "core1"
use_power = 2
. = 1
/obj/machinery/power/fusion_core/proc/Shutdown(var/force_rupture)
if(owned_field)
icon_state = "core0"
if(force_rupture || owned_field.plasma_temperature > 1000)
owned_field.Rupture()
else
owned_field.RadiateAll()
qdel(owned_field)
owned_field = null
use_power = 1
/obj/machinery/power/fusion_core/proc/AddParticles(var/name, var/quantity = 1)
if(owned_field)
owned_field.AddParticles(name, quantity)
. = 1
/obj/machinery/power/fusion_core/bullet_act(var/obj/item/projectile/Proj)
if(owned_field)
. = owned_field.bullet_act(Proj)
/obj/machinery/power/fusion_core/proc/set_strength(var/value)
value = Clamp(value, MIN_FIELD_STR, MAX_FIELD_STR)
field_strength = value
active_power_usage = 5 * value
if(owned_field)
owned_field.ChangeFieldStrength(value)
/obj/machinery/power/fusion_core/attack_hand(var/mob/user)
if(!Adjacent(user)) // As funny as it was for the AI to hug-kill the tokamak field from a distance...
return
visible_message("<span class='notice'>\The [user] hugs \the [src] to make it feel better!</span>")
if(owned_field)
Shutdown()
/obj/machinery/power/fusion_core/attackby(var/obj/item/W, var/mob/user)
if(owned_field)
to_chat(user,"<span class='warning'>Shut \the [src] off first!</span>")
return
if(ismultitool(W))
var/new_ident = input("Enter a new ident tag.", "Fusion Core", id_tag) as null|text
if(new_ident && user.Adjacent(src))
id_tag = new_ident
return
else if(iswrench(W))
anchored = !anchored
playsound(src, W.usesound, 75, 1)
if(anchored)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the [src.name] to the floor.", \
"You hear a ratchet")
else
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
"You unsecure the [src.name] from the floor.", \
"You hear a ratchet")
return
return ..()
/obj/machinery/power/fusion_core/proc/jumpstart(var/field_temperature)
field_strength = 501 // Generally a good size.
Startup()
if(!owned_field)
return FALSE
owned_field.plasma_temperature = field_temperature
return TRUE

View File

@@ -0,0 +1,176 @@
/obj/machinery/computer/fusion_core_control
name = "\improper R-UST Mk. 8 core control"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core_control"
light_color = COLOR_ORANGE
var/id_tag
var/scan_range = 25
var/list/connected_devices = list()
var/obj/machinery/power/fusion_core/cur_viewed_device
/obj/machinery/computer/fusion_core_control/attackby(var/obj/item/thing, var/mob/user)
if(ismultitool(thing))
var/new_ident = input("Enter a new ident tag.", "Core Control", id_tag) as null|text
if(new_ident && user.Adjacent(src))
id_tag = new_ident
cur_viewed_device = null
return
else
return ..()
/obj/machinery/computer/fusion_core_control/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/computer/fusion_core_control/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/computer/fusion_core_control/interact(mob/user)
if(!cur_viewed_device || !check_core_status(cur_viewed_device))
cur_viewed_device = null
if(!id_tag)
to_chat(user, "<span class='warning'>This console has not been assigned an ident tag. Please contact your system administrator or conduct a manual update with a standard multitool.</span>")
return
if(cur_viewed_device && (cur_viewed_device.id_tag != id_tag || get_dist(src, cur_viewed_device) > scan_range))
cur_viewed_device = null
var/dat = "<B>Core Control #[id_tag]</B><BR>"
if(cur_viewed_device)
dat += {"
<a href='?src=\ref[src];goto_scanlist=1'>Back to overview</a><hr>
Device ident '[cur_viewed_device.id_tag]' <span style='color: [cur_viewed_device.owned_field ? "green" : "red"]'>[cur_viewed_device.owned_field ? "active" : "inactive"].</span><br>
<b>Power status:</b> [cur_viewed_device.avail()]/[cur_viewed_device.active_power_usage] W<br>
<hr>
<a href='?src=\ref[src];toggle_active=1'>Bring field [cur_viewed_device.owned_field ? "offline" : "online"].</a><br>
<hr>
<b>Field power density (W.m<sup>-3</sup>):</b><br>
<a href='?src=\ref[src];str=-1000'>----</a>
<a href='?src=\ref[src];str=-100'>--- </a>
<a href='?src=\ref[src];str=-10'>-- </a>
<a href='?src=\ref[src];str=-1'>- </a>
<a href='?src=\ref[src];str=0'>[cur_viewed_device.field_strength]</a>
<a href='?src=\ref[src];str=1'>+ </a>
<a href='?src=\ref[src];str=10'>++ </a>
<a href='?src=\ref[src];str=100'>+++ </a>
<a href='?src=\ref[src];str=1000'>++++</a><hr>
"}
if(cur_viewed_device.owned_field)
dat += {"
<b>Approximate field diameter (m):</b> [cur_viewed_device.owned_field.size]<br>
<b>Field instability:</b> [cur_viewed_device.owned_field.percent_unstable * 100]%<br>
<b>Plasma temperature:</b> [cur_viewed_device.owned_field.plasma_temperature + 295]K<hr>
<b>Fuel:</b><br>
<table><tr><th><b>Name</b></th><th><b>Amount</b></th></tr>
"}
for(var/reagent in cur_viewed_device.owned_field.dormant_reactant_quantities)
dat += "<tr><td>[reagent]</td><td>[cur_viewed_device.owned_field.dormant_reactant_quantities[reagent]]</td></tr>"
dat += "</table><hr>"
else
connected_devices.Cut()
for(var/obj/machinery/power/fusion_core/C in fusion_cores)
if(C.id_tag == id_tag && get_dist(src, C) <= scan_range)
connected_devices += C
for(var/obj/machinery/power/fusion_core/C in gyrotrons)
if(C.id_tag == id_tag && get_dist(src, C) <= scan_range)
connected_devices += C
if(connected_devices.len)
dat += {"
<b>Connected EM field generators:</b><hr>
<table>
<tr>
<th><b>Device tag</b></th>
<th><b>Status</b></th>
<th><b>Controls</b></th>
</tr>
"}
for(var/obj/machinery/power/fusion_core/C in connected_devices)
var/status
var/can_access = 1
if(!check_core_status(C))
status = "<span style='color: red'>Unresponsive</span>"
can_access = 0
else if(C.avail() < C.active_power_usage)
status = "<span style='color: orange'>Underpowered</span>"
else
status = "<span style='color: green'>Good</span>"
dat += {"
<tr>
<td>[C.id_tag]</td>
<td>[status]</td>
"}
if(!can_access)
dat += {"
<td><span style='color: red'>ERROR</span></td>
"}
else
dat += {"
<td><a href=?src=\ref[src];access_device=[connected_devices.Find(C)]'>ACCESS</a></td>
"}
dat += {"
</tr>
"}
else
dat += "<span style='color: red'>No electromagnetic field generators connected.</span>"
var/datum/browser/popup = new(user, "fusion_control", name, 500, 400, src)
popup.set_content(dat)
popup.open()
user.set_machine(src)
/obj/machinery/computer/fusion_core_control/Topic(href, href_list)
. = ..()
if(.)
return
if(href_list["access_device"])
var/idx = Clamp(text2num(href_list["toggle_active"]), 1, connected_devices.len)
cur_viewed_device = connected_devices[idx]
updateUsrDialog()
return 1
//All HREFs from this point on require a device anyways.
if(!cur_viewed_device || !check_core_status(cur_viewed_device) || cur_viewed_device.id_tag != id_tag || get_dist(src, cur_viewed_device) > scan_range)
return
if(href_list["goto_scanlist"])
cur_viewed_device = null
updateUsrDialog()
return 1
if(href_list["toggle_active"])
if(!cur_viewed_device.Startup()) //Startup() whilst the device is active will return null.
cur_viewed_device.Shutdown()
updateUsrDialog()
return 1
if(href_list["str"])
var/val = text2num(href_list["str"])
if(!val) //Value is 0, which is manual entering.
cur_viewed_device.set_strength(input("Enter the new field power density (W.m^-3)", "Fusion Control", cur_viewed_device.field_strength) as num)
else
cur_viewed_device.set_strength(cur_viewed_device.field_strength + val)
updateUsrDialog()
return 1
//Returns 1 if the machine can be interacted with via this console.
/obj/machinery/computer/fusion_core_control/proc/check_core_status(var/obj/machinery/power/fusion_core/C)
if(isnull(C))
return
if(C.stat & BROKEN)
return
if(C.idle_power_usage > C.avail())
return
. = 1

View File

@@ -0,0 +1,494 @@
#define FUSION_ENERGY_PER_K 20
/obj/effect/fusion_em_field
name = "electromagnetic field"
desc = "A coruscating, barely visible field of energy. It is shaped like a slightly flattened torus."
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "emfield_s1"
alpha = 50
layer = 4
light_color = COLOR_BLUE
var/size = 1
var/energy = 0
var/plasma_temperature = 0
var/radiation = 0
var/field_strength = 0.01
var/tick_instability = 0
var/percent_unstable = 0
var/obj/machinery/power/fusion_core/owned_core
var/list/dormant_reactant_quantities = list()
var/list/particle_catchers = list()
var/list/ignore_types = list(
/obj/item/projectile,
/obj/effect,
/obj/fire,
/obj/structure/cable,
/obj/machinery/atmospherics,
/obj/machinery/air_sensor,
/mob/observer/dead
)
var/light_min_range = 2
var/light_min_power = 3
var/light_max_range = 10
var/light_max_power = 10
var/last_range
var/last_power
/obj/effect/fusion_em_field/New(loc, var/obj/machinery/power/fusion_core/new_owned_core)
..()
set_light(light_min_range,light_min_power)
last_range = light_min_range
last_power = light_min_power
owned_core = new_owned_core
if(!owned_core)
qdel(src)
//create the gimmicky things to handle field collisions
var/obj/effect/fusion_particle_catcher/catcher
catcher = new (locate(src.x,src.y,src.z))
catcher.parent = src
catcher.SetSize(1)
particle_catchers.Add(catcher)
catcher = new (locate(src.x-1,src.y,src.z))
catcher.parent = src
catcher.SetSize(3)
particle_catchers.Add(catcher)
catcher = new (locate(src.x+1,src.y,src.z))
catcher.parent = src
catcher.SetSize(3)
particle_catchers.Add(catcher)
catcher = new (locate(src.x,src.y+1,src.z))
catcher.parent = src
catcher.SetSize(3)
particle_catchers.Add(catcher)
catcher = new (locate(src.x,src.y-1,src.z))
catcher.parent = src
catcher.SetSize(3)
particle_catchers.Add(catcher)
catcher = new (locate(src.x-2,src.y,src.z))
catcher.parent = src
catcher.SetSize(5)
particle_catchers.Add(catcher)
catcher = new (locate(src.x+2,src.y,src.z))
catcher.parent = src
catcher.SetSize(5)
particle_catchers.Add(catcher)
catcher = new (locate(src.x,src.y+2,src.z))
catcher.parent = src
catcher.SetSize(5)
particle_catchers.Add(catcher)
catcher = new (locate(src.x,src.y-2,src.z))
catcher.parent = src
catcher.SetSize(5)
particle_catchers.Add(catcher)
catcher = new (locate(src.x-3,src.y,src.z))
catcher.parent = src
catcher.SetSize(7)
particle_catchers.Add(catcher)
catcher = new (locate(src.x+3,src.y,src.z))
catcher.parent = src
catcher.SetSize(7)
particle_catchers.Add(catcher)
catcher = new (locate(src.x,src.y+3,src.z))
catcher.parent = src
catcher.SetSize(7)
particle_catchers.Add(catcher)
catcher = new (locate(src.x,src.y-3,src.z))
catcher.parent = src
catcher.SetSize(7)
particle_catchers.Add(catcher)
processing_objects.Add(src)
/obj/effect/fusion_em_field/process()
//make sure the field generator is still intact
if(!owned_core || QDELETED(owned_core))
qdel(src)
return
// Take some gas up from our environment.
var/added_particles = FALSE
var/datum/gas_mixture/uptake_gas = owned_core.loc.return_air()
if(uptake_gas)
uptake_gas = uptake_gas.remove_by_flag(XGM_GAS_FUSION_FUEL, rand(50,100))
if(uptake_gas && uptake_gas.total_moles)
for(var/gasname in uptake_gas.gas)
if(uptake_gas.gas[gasname]*10 > dormant_reactant_quantities[gasname])
AddParticles(gasname, uptake_gas.gas[gasname]*10)
uptake_gas.adjust_gas(gasname, -(uptake_gas.gas[gasname]), update=FALSE)
added_particles = TRUE
if(added_particles)
uptake_gas.update_values()
//let the particles inside the field react
React()
// Dump power to our powernet.
owned_core.add_avail(FUSION_ENERGY_PER_K * plasma_temperature)
// Energy decay.
if(plasma_temperature >= 1)
var/lost = plasma_temperature*0.01
radiation += lost
plasma_temperature -= lost
//handle some reactants formatting
for(var/reactant in dormant_reactant_quantities)
var/amount = dormant_reactant_quantities[reactant]
if(amount < 1)
dormant_reactant_quantities.Remove(reactant)
else if(amount >= 1000000)
var/radiate = rand(3 * amount / 4, amount / 4)
dormant_reactant_quantities[reactant] -= radiate
radiation += radiate
var/use_range
var/use_power
if(plasma_temperature <= 6000)
use_range = light_min_range
use_power = light_min_power
else if(plasma_temperature >= 25000)
use_range = light_max_range
use_power = light_max_power
else
var/temp_mod = ((plasma_temperature-5000)/20000)
use_range = light_min_range + ceil((light_max_range-light_min_range)*temp_mod)
use_power = light_min_power + ceil((light_max_power-light_min_power)*temp_mod)
if(last_range != use_range || last_power != use_power)
set_light(use_range,use_power)
last_range = use_range
last_power = use_power
check_instability()
Radiate()
if(radiation)
radiation_repository.radiate(src, radiation)
return 1
/obj/effect/fusion_em_field/proc/check_instability()
if(tick_instability > 0)
percent_unstable += (tick_instability*size)/10000
tick_instability = 0
else
if(percent_unstable < 0)
percent_unstable = 0
else
if(percent_unstable > 100)
percent_unstable = 100
if(percent_unstable > 0)
percent_unstable = max(0, percent_unstable-rand(0.01,0.03))
if(percent_unstable >= 1)
owned_core.Shutdown(force_rupture=1)
else
if(percent_unstable > 0.5 && prob(percent_unstable*100))
if(plasma_temperature < 2000)
visible_message("<span class='danger'>\The [src] ripples uneasily, like a disturbed pond.</span>")
else
var/flare
var/fuel_loss
var/rupture
if(percent_unstable < 0.7)
visible_message("<span class='danger'>\The [src] ripples uneasily, like a disturbed pond.</span>")
fuel_loss = prob(5)
else if(percent_unstable < 0.9)
visible_message("<span class='danger'>\The [src] undulates violently, shedding plumes of plasma!</span>")
flare = prob(50)
fuel_loss = prob(20)
rupture = prob(5)
else
visible_message("<span class='danger'>\The [src] is wracked by a series of horrendous distortions, buckling and twisting like a living thing!</span>")
flare = 1
fuel_loss = prob(50)
rupture = prob(25)
if(rupture)
owned_core.Shutdown(force_rupture=1)
else
var/lost_plasma = (plasma_temperature*percent_unstable)
radiation += lost_plasma
if(flare)
radiation += plasma_temperature/2
plasma_temperature -= lost_plasma
if(fuel_loss)
for(var/particle in dormant_reactant_quantities)
var/lost_fuel = dormant_reactant_quantities[particle]*percent_unstable
radiation += lost_fuel
dormant_reactant_quantities[particle] -= lost_fuel
if(dormant_reactant_quantities[particle] <= 0)
dormant_reactant_quantities.Remove(particle)
Radiate()
return
/obj/effect/fusion_em_field/proc/Rupture()
visible_message("<span class='danger'>\The [src] shudders like a dying animal before flaring to eye-searing brightness and rupturing!</span>")
set_light(15, 15, "#CCCCFF")
empulse(get_turf(src), ceil(plasma_temperature/1000), ceil(plasma_temperature/300))
sleep(5)
RadiateAll()
explosion(get_turf(owned_core),-1,-1,8,10) // Blow out all the windows.
return
/obj/effect/fusion_em_field/proc/ChangeFieldStrength(var/new_strength)
var/calc_size = 1
if(new_strength <= 50)
calc_size = 1
else if(new_strength <= 200)
calc_size = 3
else if(new_strength <= 500)
calc_size = 5
else
calc_size = 7
field_strength = new_strength
change_size(calc_size)
/obj/effect/fusion_em_field/proc/AddEnergy(var/a_energy, var/a_plasma_temperature)
energy += a_energy
plasma_temperature += a_plasma_temperature
if(a_energy && percent_unstable > 0)
percent_unstable -= a_energy/10000
if(percent_unstable < 0)
percent_unstable = 0
while(energy >= 100)
energy -= 100
plasma_temperature += 1
/obj/effect/fusion_em_field/proc/AddParticles(var/name, var/quantity = 1)
if(name in dormant_reactant_quantities)
dormant_reactant_quantities[name] += quantity
else if(name != "proton" && name != "electron" && name != "neutron")
dormant_reactant_quantities.Add(name)
dormant_reactant_quantities[name] = quantity
/obj/effect/fusion_em_field/proc/RadiateAll(var/ratio_lost = 1)
// Create our plasma field and dump it into our environment.
var/turf/T = get_turf(src)
if(istype(T))
var/datum/gas_mixture/plasma = new
plasma.adjust_gas("oxygen", (size*100), 0)
plasma.adjust_gas("phoron", (size*100), 0)
plasma.temperature = (plasma_temperature/2)
plasma.update_values()
T.assume_air(plasma)
T.hotspot_expose(plasma_temperature)
plasma = null
// Radiate all our unspent fuel and energy.
for(var/particle in dormant_reactant_quantities)
radiation += dormant_reactant_quantities[particle]
dormant_reactant_quantities.Remove(particle)
radiation += plasma_temperature/2
plasma_temperature = 0
radiation_repository.radiate(src, radiation)
Radiate()
/obj/effect/fusion_em_field/proc/Radiate()
if(istype(loc, /turf))
var/empsev = max(1, min(3, ceil(size/2)))
for(var/atom/movable/AM in range(max(1,Floor(size/2)), loc))
if(AM == src || AM == owned_core || !AM.simulated)
continue
var/skip_obstacle
for(var/ignore_path in ignore_types)
if(istype(AM, ignore_path))
skip_obstacle = TRUE
break
if(skip_obstacle)
continue
log_debug("R-UST DEBUG: [AM] is [AM.type]")
AM.visible_message("<span class='danger'>The field buckles visibly around \the [AM]!</span>")
tick_instability += rand(15,30)
AM.emp_act(empsev)
if(owned_core && owned_core.loc)
var/datum/gas_mixture/environment = owned_core.loc.return_air()
if(environment && environment.temperature < (T0C+1000)) // Putting an upper bound on it to stop it being used in a TEG.
environment.add_thermal_energy(plasma_temperature*20000)
radiation = 0
/obj/effect/fusion_em_field/proc/change_size(var/newsize = 1)
var/changed = 0
switch(newsize)
if(1)
size = 1
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "emfield_s1"
pixel_x = 0
pixel_y = 0
//
changed = 1
if(3)
size = 3
icon = 'icons/effects/96x96.dmi'
icon_state = "emfield_s3"
pixel_x = -32 * PIXEL_MULTIPLIER
pixel_y = -32 * PIXEL_MULTIPLIER
//
changed = 3
if(5)
size = 5
icon = 'icons/effects/160x160.dmi'
icon_state = "emfield_s5"
pixel_x = -64 * PIXEL_MULTIPLIER
pixel_y = -64 * PIXEL_MULTIPLIER
//
changed = 5
if(7)
size = 7
icon = 'icons/effects/224x224.dmi'
icon_state = "emfield_s7"
pixel_x = -96 * PIXEL_MULTIPLIER
pixel_y = -96 * PIXEL_MULTIPLIER
//
changed = 7
for(var/obj/effect/fusion_particle_catcher/catcher in particle_catchers)
catcher.UpdateSize()
return changed
//the !!fun!! part
/obj/effect/fusion_em_field/proc/React()
//loop through the reactants in random order
var/list/react_pool = dormant_reactant_quantities.Copy()
//cant have any reactions if there aren't any reactants present
if(react_pool.len)
//determine a random amount to actually react this cycle, and remove it from the standard pool
//this is a hack, and quite nonrealistic :(
for(var/reactant in react_pool)
react_pool[reactant] = rand(Floor(react_pool[reactant]/2),react_pool[reactant])
dormant_reactant_quantities[reactant] -= react_pool[reactant]
if(!react_pool[reactant])
react_pool -= reactant
//loop through all the reacting reagents, picking out random reactions for them
var/list/produced_reactants = new/list
var/list/p_react_pool = react_pool.Copy()
while(p_react_pool.len)
//pick one of the unprocessed reacting reagents randomly
var/cur_p_react = pick(p_react_pool)
p_react_pool.Remove(cur_p_react)
//grab all the possible reactants to have a reaction with
var/list/possible_s_reacts = react_pool.Copy()
//if there is only one of a particular reactant, then it can not react with itself so remove it
possible_s_reacts[cur_p_react] -= 1
if(possible_s_reacts[cur_p_react] < 1)
possible_s_reacts.Remove(cur_p_react)
//loop through and work out all the possible reactions
var/list/possible_reactions = new/list
for(var/cur_s_react in possible_s_reacts)
if(possible_s_reacts[cur_s_react] < 1)
continue
var/decl/fusion_reaction/cur_reaction = get_fusion_reaction(cur_p_react, cur_s_react)
if(cur_reaction && plasma_temperature >= cur_reaction.minimum_energy_level)
possible_reactions.Add(cur_reaction)
//if there are no possible reactions here, abandon this primary reactant and move on
if(!possible_reactions.len)
continue
//split up the reacting atoms between the possible reactions
while(possible_reactions.len)
var/decl/fusion_reaction/cur_reaction = pick(possible_reactions)
possible_reactions.Remove(cur_reaction)
//set the randmax to be the lower of the two involved reactants
var/max_num_reactants = react_pool[cur_reaction.p_react] > react_pool[cur_reaction.s_react] ? \
react_pool[cur_reaction.s_react] : react_pool[cur_reaction.p_react]
if(max_num_reactants < 1)
continue
//make sure we have enough energy
if(plasma_temperature < cur_reaction.minimum_reaction_temperature)
continue
if(plasma_temperature < max_num_reactants * cur_reaction.energy_consumption)
max_num_reactants = round(plasma_temperature / cur_reaction.energy_consumption)
if(max_num_reactants < 1)
continue
//randomly determined amount to react
var/amount_reacting = rand(1, max_num_reactants)
//removing the reacting substances from the list of substances that are primed to react this cycle
//if there aren't enough of that substance (there should be) then modify the reactant amounts accordingly
if( react_pool[cur_reaction.p_react] - amount_reacting >= 0 )
react_pool[cur_reaction.p_react] -= amount_reacting
else
amount_reacting = react_pool[cur_reaction.p_react]
react_pool[cur_reaction.p_react] = 0
//same again for secondary reactant
if(react_pool[cur_reaction.s_react] - amount_reacting >= 0 )
react_pool[cur_reaction.s_react] -= amount_reacting
else
react_pool[cur_reaction.p_react] += amount_reacting - react_pool[cur_reaction.p_react]
amount_reacting = react_pool[cur_reaction.s_react]
react_pool[cur_reaction.s_react] = 0
plasma_temperature -= max_num_reactants * cur_reaction.energy_consumption // Remove the consumed energy.
plasma_temperature += max_num_reactants * cur_reaction.energy_production // Add any produced energy.
radiation += max_num_reactants * cur_reaction.radiation // Add any produced radiation.
tick_instability += max_num_reactants * cur_reaction.instability
// Create the reaction products.
for(var/reactant in cur_reaction.products)
var/success = 0
for(var/check_reactant in produced_reactants)
if(check_reactant == reactant)
produced_reactants[reactant] += cur_reaction.products[reactant] * amount_reacting
success = 1
break
if(!success)
produced_reactants[reactant] = cur_reaction.products[reactant] * amount_reacting
// Handle anything special. If this proc returns true, abort the current reaction.
if(cur_reaction.handle_reaction_special(src))
return
// This reaction is done, and can't be repeated this sub-cycle.
possible_reactions.Remove(cur_reaction.s_react)
// Loop through the newly produced reactants and add them to the pool.
for(var/reactant in produced_reactants)
AddParticles(reactant, produced_reactants[reactant])
// Check whether there are reactants left, and add them back to the pool.
for(var/reactant in react_pool)
AddParticles(reactant, react_pool[reactant])
/obj/effect/fusion_em_field/Destroy()
set_light(0)
RadiateAll()
for(var/obj/effect/fusion_particle_catcher/catcher in particle_catchers)
qdel(catcher)
if(owned_core)
owned_core.owned_field = null
owned_core = null
processing_objects.Remove(src)
. = ..()
/obj/effect/fusion_em_field/bullet_act(var/obj/item/projectile/Proj)
AddEnergy(Proj.damage)
update_icon()
return 0
#undef FUSION_HEAT_CAP

View File

@@ -0,0 +1,67 @@
/obj/item/weapon/fuel_assembly
name = "fuel rod assembly"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "fuel_assembly"
layer = 4
var/material_name
var/percent_depleted = 1
var/list/rod_quantities = list()
var/fuel_type = "composite"
var/fuel_colour
var/radioactivity = 0
var/const/initial_amount = 300
/obj/item/weapon/fuel_assembly/New(var/newloc, var/_material, var/_colour)
fuel_type = _material
fuel_colour = _colour
..(newloc)
/obj/item/weapon/fuel_assembly/initialize()
. = ..()
var/material/material = get_material_by_name(fuel_type)
if(istype(material))
name = "[material.use_name] fuel rod assembly"
desc = "A fuel rod for a fusion reactor. This one is made from [material.use_name]."
fuel_colour = material.icon_colour
fuel_type = material.use_name
if(material.radioactivity)
radioactivity = material.radioactivity
desc += " It is warm to the touch."
processing_objects += src
if(material.luminescence)
set_light(material.luminescence, material.luminescence, material.icon_colour)
else
name = "[fuel_type] fuel rod assembly"
desc = "A fuel rod for a fusion reactor. This one is made from [fuel_type]."
icon_state = "blank"
var/image/I = image(icon, "fuel_assembly")
I.color = fuel_colour
overlays += list(I, image(icon, "fuel_assembly_bracket"))
rod_quantities[fuel_type] = initial_amount
/obj/item/weapon/fuel_assembly/process()
if(!radioactivity)
return PROCESS_KILL
if(istype(loc, /turf))
radiation_repository.radiate(src, max(1,ceil(radioactivity/30)))
/obj/item/weapon/fuel_assembly/Destroy()
processing_objects -= src
return ..()
// Mapper shorthand.
/obj/item/weapon/fuel_assembly/deuterium/New(var/newloc)
..(newloc, "deuterium")
/obj/item/weapon/fuel_assembly/tritium/New(var/newloc)
..(newloc, "tritium")
/obj/item/weapon/fuel_assembly/phoron/New(var/newloc)
..(newloc, "phoron")
/obj/item/weapon/fuel_assembly/supermatter/New(var/newloc)
..(newloc, "supermatter")

View File

@@ -0,0 +1,54 @@
/obj/machinery/fusion_fuel_compressor
name = "fuel compressor"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "fuel_compressor1"
density = 1
anchored = 1
layer = 4
/obj/machinery/fusion_fuel_compressor/MouseDrop_T(var/atom/movable/target, var/mob/user)
if(user.incapacitated() || !user.Adjacent(src))
return
return do_special_fuel_compression(target, user)
/obj/machinery/fusion_fuel_compressor/proc/do_special_fuel_compression(var/obj/item/thing, var/mob/user)
if(istype(thing) && thing.reagents && thing.reagents.total_volume && thing.is_open_container())
if(thing.reagents.reagent_list.len > 1)
to_chat(user, "<span class='warning'>The contents of \the [thing] are impure and cannot be used as fuel.</span>")
return 1
if(thing.reagents.total_volume < 50)
to_chat(user, "<span class='warning'>You need at least fifty units of material to form a fuel rod.</span>")
return 1
var/datum/reagent/R = thing.reagents.reagent_list[1]
visible_message("<span class='notice'>\The [src] compresses the contents of \the [thing] into a new fuel assembly.</span>")
var/obj/item/weapon/fuel_assembly/F = new(get_turf(src), R.id, R.color)
thing.reagents.remove_reagent(R.id, R.volume)
user.put_in_hands(F)
else if(istype(thing, /obj/machinery/power/supermatter/shard))
var/obj/item/weapon/fuel_assembly/F = new(get_turf(src), "supermatter")
visible_message("<span class='notice'>\The [src] compresses the \[thing] into a new fuel assembly.</span>")
qdel(thing)
user.put_in_hands(F)
return 1
return 0
/obj/machinery/fusion_fuel_compressor/attackby(var/obj/item/thing, var/mob/user)
if(istype(thing, /obj/item/stack/material))
var/obj/item/stack/material/M = thing
var/material/mat = M.get_material()
if(!mat.is_fusion_fuel)
to_chat(user, "<span class='warning'>It would be pointless to make a fuel rod out of [mat.use_name].</span>")
return
if(M.get_amount() < 25)
to_chat(user, "<span class='warning'>You need at least 25 [mat.sheet_plural_name] to make a fuel rod.</span>")
return
var/obj/item/weapon/fuel_assembly/F = new(get_turf(src), mat.name)
visible_message("<span class='notice'>\The [src] compresses the [mat.use_name] into a new fuel assembly.</span>")
M.use(25)
user.put_in_hands(F)
else if(do_special_fuel_compression(thing, user))
return
return ..()

View File

@@ -0,0 +1,102 @@
/obj/machinery/computer/fusion_fuel_control
name = "fuel injection control computer"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "fuel"
var/id_tag
var/scan_range = 25
/obj/machinery/computer/fusion_fuel_control/attack_ai(mob/user)
attack_hand(user)
/obj/machinery/computer/fusion_fuel_control/attack_hand(mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/computer/fusion_fuel_control/interact(var/mob/user)
if(stat & (BROKEN|NOPOWER))
user.unset_machine()
user << browse(null, "window=fuel_control")
return
if (!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
user.unset_machine()
user << browse(null, "window=fuel_control")
return
if(!id_tag)
to_chat(user, "<span class='warning'>This console has not been assigned an ident tag. Please contact your system administrator or conduct a manual update with a standard multitool.</span>")
return
var/dat = "<B>Reactor Core Fuel Control #[id_tag]</B><BR>"
dat += {"
<hr>
<table border=1 width='100%'>
<tr>
<td><b>Contains</b></td>
<td><b>Assembly</b></td>
<td><b>Remaining</b></td>
</tr>"}
for(var/obj/machinery/fusion_fuel_injector/I in fuel_injectors)
if(!id_tag || !I.id_tag || I.id_tag != id_tag || get_dist(src, I) > scan_range)
continue
dat += "<tr>"
if(I.stat & (BROKEN|NOPOWER))
dat += "<td><span class='danger'>ERROR</span></td>"
dat += "<td><span class='danger'>ERROR</span></td>"
dat += "<td><span class='danger'>ERROR</span></td>"
else
dat += "<td>[I.cur_assembly ? I.cur_assembly.fuel_type : "NONE"]</td>"
if(I.cur_assembly)
dat += "<td><a href='?src=\ref[src];toggle_injecting=\ref[I]'>\[[I.injecting ? "Halt injecting" : "Begin injecting"]\]</a></td>"
else
dat += "<td>None</td>"
if(I.cur_assembly)
dat += "<td>[I.cur_assembly.percent_depleted * 100]%</td>"
else
dat += "<td>NA</td>"
dat += "</tr>"
dat += {"</table><hr>
<A href='?src=\ref[src];refresh=1'>Refresh</A>
<A href='?src=\ref[src];close=1'>Close</A><BR>"}
var/datum/browser/popup = new(user, "fuel_control", "Fusion Fuel Control Console", 800, 400, src)
popup.set_content(dat)
popup.open()
user.set_machine(src)
/obj/machinery/computer/fusion_fuel_control/Topic(href, href_list)
if(..())
return 1
if(href_list["toggle_injecting"])
var/obj/machinery/fusion_fuel_injector/I = locate(href_list["toggle_injecting"])
if(I.id_tag != id_tag || get_dist(src, I) > scan_range)
return
if(istype(I))
if(I.injecting)
I.StopInjecting()
else
I.BeginInjecting()
if( href_list["close"] )
usr << browse(null, "window=fuel_control")
usr.unset_machine()
updateDialog()
/obj/machinery/computer/fusion_fuel_control/attackby(var/obj/item/W, var/mob/user)
if(ismultitool(W))
var/new_ident = input("Enter a new ident tag.", "Fuel Control", id_tag) as null|text
if(new_ident && user.Adjacent(src))
id_tag = new_ident
return
return ..()

View File

@@ -0,0 +1,153 @@
var/list/fuel_injectors = list()
/obj/machinery/fusion_fuel_injector
name = "fuel injector"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "injector0"
density = 1
anchored = 0
req_access = list(access_engine)
use_power = 1
idle_power_usage = 10
active_power_usage = 500
var/fuel_usage = 0.0001
var/id_tag
var/injecting = 0
var/obj/item/weapon/fuel_assembly/cur_assembly
/obj/machinery/fusion_fuel_injector/New()
..()
fuel_injectors += src
tag = null
/obj/machinery/fusion_fuel_injector/Destroy()
if(cur_assembly)
cur_assembly.forceMove(get_turf(src))
cur_assembly = null
fuel_injectors -= src
return ..()
/obj/machinery/fusion_fuel_injector/mapped
anchored = 1
/obj/machinery/fusion_fuel_injector/process()
if(injecting)
if(stat & (BROKEN|NOPOWER))
StopInjecting()
else
Inject()
/obj/machinery/fusion_fuel_injector/attackby(obj/item/W, mob/user)
if(ismultitool(W))
var/new_ident = input("Enter a new ident tag.", "Fuel Injector", id_tag) as null|text
if(new_ident && user.Adjacent(src))
id_tag = new_ident
return
if(istype(W, /obj/item/weapon/fuel_assembly))
if(injecting)
to_chat(user, "<span class='warning'>Shut \the [src] off before playing with the fuel rod!</span>")
return
if(cur_assembly)
cur_assembly.forceMove(get_turf(src))
visible_message("<span class='notice'>\The [user] swaps \the [src]'s [cur_assembly] for \a [W].</span>")
else
visible_message("<span class='notice'>\The [user] inserts \a [W] into \the [src].</span>")
user.drop_from_inventory(W)
W.forceMove(src)
if(cur_assembly)
cur_assembly.forceMove(get_turf(src))
user.put_in_hands(cur_assembly)
cur_assembly = W
return
if(iswrench(W))
if(injecting)
to_chat(user, "<span class='warning'>Shut \the [src] off first!</span>")
return
anchored = !anchored
playsound(src, W.usesound, 75, 1)
if(anchored)
user.visible_message("\The [user] secures \the [src] to the floor.")
else
user.visible_message("\The [user] unsecures \the [src] from the floor.")
return
return ..()
/obj/machinery/fusion_fuel_injector/attack_hand(mob/user)
if(injecting)
to_chat(user, "<span class='warning'>Shut \the [src] off before playing with the fuel rod!</span>")
return
if(cur_assembly)
cur_assembly.forceMove(get_turf(src))
user.put_in_hands(cur_assembly)
visible_message("<span class='notice'>\The [user] removes \the [cur_assembly] from \the [src].</span>")
cur_assembly = null
return
else
to_chat(user, "<span class='warning'>There is no fuel rod in \the [src].</span>")
return
/obj/machinery/fusion_fuel_injector/proc/BeginInjecting()
if(!injecting && cur_assembly)
icon_state = "injector1"
injecting = 1
use_power = 1
/obj/machinery/fusion_fuel_injector/proc/StopInjecting()
if(injecting)
injecting = 0
icon_state = "injector0"
use_power = 0
/obj/machinery/fusion_fuel_injector/proc/Inject()
if(!injecting)
return
if(cur_assembly)
var/amount_left = 0
for(var/reagent in cur_assembly.rod_quantities)
if(cur_assembly.rod_quantities[reagent] > 0)
var/amount = cur_assembly.rod_quantities[reagent] * fuel_usage
var/numparticles = round(amount * 1000)
if(numparticles < 1)
numparticles = 1
var/obj/effect/accelerated_particle/A = new/obj/effect/accelerated_particle(get_turf(src), dir)
A.particle_type = reagent
A.additional_particles = numparticles - 1
A.move(1)
if(cur_assembly)
cur_assembly.rod_quantities[reagent] -= amount
amount_left += cur_assembly.rod_quantities[reagent]
if(cur_assembly)
cur_assembly.percent_depleted = amount_left / cur_assembly.initial_amount
flick("injector-emitting",src)
else
StopInjecting()
/obj/machinery/fusion_fuel_injector/verb/rotate_clock()
set category = "Object"
set name = "Rotate Generator (Clockwise)"
set src in view(1)
if (usr.incapacitated() || usr.restrained() || anchored)
return
src.dir = turn(src.dir, -90)
/obj/machinery/fusion_fuel_injector/verb/rotate_anticlock()
set category = "Object"
set name = "Rotate Generator (Counter-clockwise)"
set src in view(1)
if (usr.incapacitated() || usr.restrained() || anchored)
return
src.dir = turn(src.dir, 90)

View File

@@ -0,0 +1,99 @@
/obj/item/weapon/circuitboard/fusion_core_control
name = "circuit board (fusion core controller)"
build_path = /obj/machinery/computer/fusion_core_control
origin_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 4)
/obj/item/weapon/circuitboard/fusion_fuel_compressor
name = "circuit board (fusion fuel compressor)"
build_path = /obj/machinery/fusion_fuel_compressor
board_type = new /datum/frame/frame_types/machine
origin_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 4, TECH_MATERIAL = 4)
req_components = list(
/obj/item/weapon/stock_parts/manipulator/nano = 2,
/obj/item/weapon/stock_parts/matter_bin/super = 2,
/obj/item/weapon/stock_parts/console_screen = 1,
/obj/item/stack/cable_coil = 5
)
/obj/item/weapon/circuitboard/fusion_fuel_control
name = "circuit board (fusion fuel controller)"
build_path = /obj/machinery/computer/fusion_fuel_control
origin_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 4)
/obj/item/weapon/circuitboard/gyrotron_control
name = "circuit board (gyrotron controller)"
build_path = /obj/machinery/computer/gyrotron_control
origin_tech = list(TECH_DATA = 4, TECH_ENGINEERING = 4)
/obj/item/weapon/circuitboard/fusion_core
name = "internal circuitry (fusion core)"
build_path = /obj/machinery/power/fusion_core
board_type = new /datum/frame/frame_types/machine
origin_tech = list(TECH_BLUESPACE = 2, TECH_MAGNET = 4, TECH_POWER = 4)
req_components = list(
/obj/item/weapon/stock_parts/manipulator/nano = 2,
/obj/item/weapon/stock_parts/micro_laser/high = 1,
/obj/item/weapon/stock_parts/console_screen = 1,
/obj/item/stack/cable_coil = 5
)
/obj/item/weapon/circuitboard/fusion_injector
name = "internal circuitry (fusion fuel injector)"
build_path = /obj/machinery/fusion_fuel_injector
board_type = new /datum/frame/frame_types/machine
origin_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 4, TECH_MATERIAL = 4)
req_components = list(
/obj/item/weapon/stock_parts/manipulator/nano = 2,
/obj/item/weapon/stock_parts/scanning_module/adv = 1,
/obj/item/weapon/stock_parts/matter_bin/super = 1,
/obj/item/weapon/stock_parts/console_screen = 1,
/obj/item/stack/cable_coil = 5
)
/obj/item/weapon/circuitboard/gyrotron
name = "circuit board (gyrotron)"
build_path = /obj/machinery/power/emitter/gyrotron
board_type = new /datum/frame/frame_types/machine
origin_tech = list(TECH_POWER = 4, TECH_ENGINEERING = 4, TECH_MATERIAL = 5, TECH_MAGNET = 3)
req_components = list(
/obj/item/weapon/stock_parts/scanning_module/adv = 1,
/obj/item/weapon/stock_parts/micro_laser/high = 3,
/obj/item/weapon/stock_parts/capacitor/adv = 1
)
/datum/design/circuit/fusion
name = "fusion core control console"
id = "fusion_core_control"
build_path = /obj/item/weapon/circuitboard/fusion_core_control
sort_string = "LAAAD"
req_tech = list(TECH_POWER = 3, TECH_ENGINEERING = 3, TECH_MATERIAL = 3)
/datum/design/circuit/fusion/fuel_compressor
name = "fusion fuel compressor"
id = "fusion_fuel_compressor"
build_path = /obj/item/weapon/circuitboard/fusion_fuel_compressor
sort_string = "LAAAE"
/datum/design/circuit/fusion/fuel_control
name = "fusion fuel control console"
id = "fusion_fuel_control"
build_path = /obj/item/weapon/circuitboard/fusion_fuel_control
sort_string = "LAAAF"
/datum/design/circuit/fusion/gyrotron_control
name = "gyrotron control console"
id = "gyrotron_control"
build_path = /obj/item/weapon/circuitboard/gyrotron_control
sort_string = "LAAAG"
/datum/design/circuit/fusion/core
name = "fusion core"
id = "fusion_core"
build_path = /obj/item/weapon/circuitboard/fusion_core
sort_string = "LAAAH"
/datum/design/circuit/fusion/injector
name = "fusion fuel injector"
id = "fusion_injector"
build_path = /obj/item/weapon/circuitboard/fusion_injector
sort_string = "LAAAI"

View File

@@ -0,0 +1,41 @@
/obj/effect/fusion_particle_catcher
icon = 'icons/effects/effects.dmi'
density = 1
anchored = 1
invisibility = 101
var/obj/effect/fusion_em_field/parent
var/mysize = 0
light_color = COLOR_BLUE
/obj/effect/fusion_particle_catcher/Destroy()
. =..()
parent.particle_catchers -= src
parent = null
/obj/effect/fusion_particle_catcher/proc/SetSize(var/newsize)
name = "collector [newsize]"
mysize = newsize
UpdateSize()
/obj/effect/fusion_particle_catcher/proc/AddParticles(var/name, var/quantity = 1)
if(parent && parent.size >= mysize)
parent.AddParticles(name, quantity)
return 1
return 0
/obj/effect/fusion_particle_catcher/proc/UpdateSize()
if(parent.size >= mysize)
density = 1
name = "collector [mysize] ON"
else
density = 0
name = "collector [mysize] OFF"
/obj/effect/fusion_particle_catcher/bullet_act(var/obj/item/projectile/Proj)
parent.AddEnergy(Proj.damage)
update_icon()
return 0
/obj/effect/fusion_particle_catcher/CanPass(var/atom/movable/mover, var/turf/target, var/height=0, var/air_group=0)
return ismob(mover)

View File

@@ -0,0 +1,164 @@
var/list/fusion_reactions
/decl/fusion_reaction
var/p_react = "" // Primary reactant.
var/s_react = "" // Secondary reactant.
var/minimum_energy_level = 1
var/energy_consumption = 0
var/energy_production = 0
var/radiation = 0
var/instability = 0
var/list/products = list()
var/minimum_reaction_temperature = 100
/decl/fusion_reaction/proc/handle_reaction_special(var/obj/effect/fusion_em_field/holder)
return 0
proc/get_fusion_reaction(var/p_react, var/s_react, var/m_energy)
if(!fusion_reactions)
fusion_reactions = list()
for(var/rtype in typesof(/decl/fusion_reaction) - /decl/fusion_reaction)
var/decl/fusion_reaction/cur_reaction = new rtype()
if(!fusion_reactions[cur_reaction.p_react])
fusion_reactions[cur_reaction.p_react] = list()
fusion_reactions[cur_reaction.p_react][cur_reaction.s_react] = cur_reaction
if(!fusion_reactions[cur_reaction.s_react])
fusion_reactions[cur_reaction.s_react] = list()
fusion_reactions[cur_reaction.s_react][cur_reaction.p_react] = cur_reaction
if(fusion_reactions.Find(p_react))
var/list/secondary_reactions = fusion_reactions[p_react]
if(secondary_reactions.Find(s_react))
return fusion_reactions[p_react][s_react]
// Material fuels
// deuterium
// tritium
// phoron
// supermatter
// Virtual fuels
// helium-3
// lithium-6
// boron-11
// Basic power production reactions.
/decl/fusion_reaction/deuterium_deuterium
p_react = "deuterium"
s_react = "deuterium"
energy_consumption = 1
energy_production = 2
// Advanced production reactions (todo)
/decl/fusion_reaction/deuterium_helium
p_react = "deuterium"
s_react = "helium-3"
energy_consumption = 1
energy_production = 5
radiation = 2
/decl/fusion_reaction/deuterium_tritium
p_react = "deuterium"
s_react = "tritium"
energy_consumption = 1
energy_production = 1
products = list("helium-3" = 1)
instability = 0.5
radiation = 3
/decl/fusion_reaction/deuterium_lithium
p_react = "deuterium"
s_react = "lithium"
energy_consumption = 2
energy_production = 0
radiation = 3
products = list("tritium"= 1)
instability = 1
// Unideal/material production reactions
/decl/fusion_reaction/oxygen_oxygen
p_react = "oxygen"
s_react = "oxygen"
energy_consumption = 10
energy_production = 0
instability = 5
radiation = 5
products = list("silicon"= 1)
/decl/fusion_reaction/iron_iron
p_react = "iron"
s_react = "iron"
products = list("silver" = 1, "gold" = 1, "platinum" = 1) // Not realistic but w/e
energy_consumption = 10
energy_production = 0
instability = 2
minimum_reaction_temperature = 10000
/decl/fusion_reaction/phoron_hydrogen
p_react = "hydrogen"
s_react = "phoron"
energy_consumption = 10
energy_production = 0
instability = 5
products = list("mydrogen" = 1)
minimum_reaction_temperature = 8000
// VERY UNIDEAL REACTIONS.
/decl/fusion_reaction/phoron_supermatter
p_react = "supermatter"
s_react = "phoron"
energy_consumption = 0
energy_production = 5
radiation = 20
instability = 20
/decl/fusion_reaction/phoron_supermatter/handle_reaction_special(var/obj/effect/fusion_em_field/holder)
wormhole_event()
var/turf/origin = get_turf(holder)
holder.Rupture()
qdel(holder)
var/radiation_level = rand(100, 200)
// Copied from the SM for proof of concept. //Not any more --Cirra //Use the whole z proc --Leshana
radiation_repository.z_radiate(locate(1, 1, holder.z), radiation_level, 1)
for(var/mob/living/mob in living_mob_list)
var/turf/T = get_turf(mob)
if(T && (holder.z == T.z))
if(istype(mob, /mob/living/carbon/human))
var/mob/living/carbon/human/H = mob
H.hallucination += rand(100,150)
for(var/obj/machinery/fusion_fuel_injector/I in range(world.view, origin))
if(I.cur_assembly && I.cur_assembly.fuel_type == "supermatter")
explosion(get_turf(I), 1, 2, 3)
spawn(5)
if(I && I.loc)
qdel(I)
sleep(5)
explosion(origin, 1, 2, 5)
return 1
// High end reactions.
/decl/fusion_reaction/boron_hydrogen
p_react = "boron"
s_react = "hydrogen"
minimum_energy_level = FUSION_HEAT_CAP * 0.5
energy_consumption = 3
energy_production = 15
radiation = 3
instability = 3
/decl/fusion_reaction/hydrogen_hydrogen
p_react = "hydrogen"
s_react = "hydrogen"
minimum_energy_level = FUSION_HEAT_CAP * 0.75
energy_consumption = 0
energy_production = 20
radiation = 5
instability = 5

View File

@@ -0,0 +1,57 @@
var/list/gyrotrons = list()
/obj/machinery/power/emitter/gyrotron
name = "gyrotron"
icon = 'icons/obj/machines/power/fusion.dmi'
desc = "It is a heavy duty industrial gyrotron suited for powering fusion reactors."
icon_state = "emitter-off"
req_access = list(access_engine)
use_power = 1
active_power_usage = 50000
var/id_tag
var/rate = 3
var/mega_energy = 1
/obj/machinery/power/emitter/gyrotron/anchored
anchored = 1
state = 2
/obj/machinery/power/emitter/gyrotron/initialize()
gyrotrons += src
active_power_usage = mega_energy * 50000
. = ..()
/obj/machinery/power/emitter/gyrotron/Destroy()
gyrotrons -= src
return ..()
/obj/machinery/power/emitter/gyrotron/process()
active_power_usage = mega_energy * 50000
. = ..()
/obj/machinery/power/emitter/gyrotron/get_rand_burst_delay()
return rate * 10
/obj/machinery/power/emitter/gyrotron/get_burst_delay()
return rate * 10
/obj/machinery/power/emitter/gyrotron/get_emitter_beam()
var/obj/item/projectile/beam/emitter/E = ..()
E.damage = mega_energy * 50
return E
/obj/machinery/power/emitter/gyrotron/update_icon()
if (active && powernet && avail(active_power_usage))
icon_state = "emitter-on"
else
icon_state = "emitter-off"
/obj/machinery/power/emitter/gyrotron/attackby(var/obj/item/W, var/mob/user)
if(ismultitool(W))
var/new_ident = input("Enter a new ident tag.", "Gyrotron", id_tag) as null|text
if(new_ident && user.Adjacent(src))
id_tag = new_ident
return
return ..()

View File

@@ -0,0 +1,97 @@
/obj/machinery/computer/gyrotron_control
name = "gyrotron control console"
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "engine"
light_color = COLOR_BLUE
var/id_tag
var/scan_range = 25
/obj/machinery/computer/gyrotron_control/attack_ai(var/mob/user)
attack_hand(user)
/obj/machinery/computer/gyrotron_control/attack_hand(var/mob/user)
add_fingerprint(user)
interact(user)
/obj/machinery/computer/gyrotron_control/interact(var/mob/user)
if(!id_tag)
to_chat(user, "<span class='warning'>This console has not been assigned an ident tag. Please contact your system administrator or conduct a manual update with a standard multitool.</span>")
return
var/dat = "<td><b>Gyrotron controller #[id_tag]</b>"
dat = "<table><tr>"
dat += "<td><b>Mode</b></td>"
dat += "<td><b>Fire Delay</b></td>"
dat += "<td><b>Power</b></td>"
dat += "</tr>"
for(var/obj/machinery/power/emitter/gyrotron/G in gyrotrons)
if(!G || G.id_tag != id_tag || get_dist(src, G) > scan_range)
continue
dat += "<tr>"
if(G.state != 2 || (G.stat & (NOPOWER | BROKEN))) //Error data not found.
dat += "<td><span style='color: red'>ERROR</span></td>"
dat += "<td><span style='color: red'>ERROR</span></td>"
dat += "<td><span style='color: red'>ERROR</span></td>"
else
dat += "<td><a href='?src=\ref[src];machine=\ref[G];toggle=1'>[G.active ? "Emitting" : "Standing By"]</a></td>"
dat += "<td><a href='?src=\ref[src];machine=\ref[G];modifyrate=1'>[G.rate]</a></td>"
dat += "<td><a href='?src=\ref[src];machine=\ref[G];modifypower=1'>[G.mega_energy]</a></td>"
dat += "</tr></table>"
var/datum/browser/popup = new(user, "gyrotron_controller_[id_tag]", "Gyrotron Remote Control Console", 500, 400, src)
popup.set_content(dat)
popup.open()
add_fingerprint(user)
user.set_machine(src)
/obj/machinery/computer/gyrotron_control/Topic(var/href, var/list/href_list)
. = ..()
if(.)
return
if(stat & (NOPOWER | BROKEN))
return
var/obj/machinery/power/emitter/gyrotron/G = locate(href_list["machine"])
if(!G || G.id_tag != id_tag || get_dist(src, G) > scan_range)
return
if(href_list["modifypower"])
var/new_val = input("Enter new emission power level (1 - 50)", "Modifying power level", G.mega_energy) as num
if(!new_val)
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
return 1
G.mega_energy = Clamp(new_val, 1, 50)
G.active_power_usage = G.mega_energy * 1500
updateUsrDialog()
return 1
if(href_list["modifyrate"])
var/new_val = input("Enter new emission delay between 1 and 10 seconds.", "Modifying emission rate", G.rate) as num
if(!new_val)
to_chat(usr, "<span class='warning'>That's not a valid number.</span>")
return 1
G.rate = Clamp(new_val, 1, 10)
updateUsrDialog()
return 1
if(href_list["toggle"])
G.activate(usr)
updateUsrDialog()
return 1
return 0
/obj/machinery/computer/gyrotron_control/attackby(var/obj/item/W, var/mob/user)
if(ismultitool(W))
var/new_ident = input("Enter a new ident tag.", "Gyrotron Control", id_tag) as null|text
if(new_ident && user.Adjacent(src))
id_tag = new_ident
return
return ..()

View File

@@ -138,11 +138,11 @@
/obj/machinery/power/generator/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
anchored = !anchored
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \
"You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \
"You hear a ratchet")
"You hear a ratchet.")
use_power = anchored
if(anchored) // Powernet connection stuff.
connect_to_network()

View File

@@ -48,9 +48,9 @@
src.add_fingerprint(user)
if (istype(W, /obj/item/weapon/wrench))
if (src.stage == 1)
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
usr << "You begin deconstructing [src]."
if (!do_after(usr, 30))
if (!do_after(usr, 30 * W.toolspeed))
return
new /obj/item/stack/material/steel( get_turf(src.loc), sheets_refunded )
user.visible_message("[user.name] deconstructs [src].", \
@@ -78,7 +78,7 @@
new /obj/item/stack/cable_coil(get_turf(src.loc), 1, "red")
user.visible_message("[user.name] removes the wiring from [src].", \
"You remove the wiring from [src].", "You hear a noise.")
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
playsound(src.loc, W.usesound, 50, 1)
return
if(istype(W, /obj/item/stack/cable_coil))
@@ -109,7 +109,7 @@
src.stage = 3
user.visible_message("[user.name] closes [src]'s casing.", \
"You close [src]'s casing.", "You hear a noise.")
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
switch(fixture_type)
@@ -467,7 +467,7 @@
// attempt to stick weapon into light socket
else if(status == LIGHT_EMPTY)
if(istype(W, /obj/item/weapon/screwdriver)) //If it's a screwdriver open it.
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] opens [src]'s casing.", \
"You open [src]'s casing.", "You hear a noise.")
var/obj/machinery/light_construct/newlight = null
@@ -504,7 +504,7 @@
/obj/machinery/light/flamp/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/wrench))
anchored = !anchored
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
playsound(src, W.usesound, 50, 1)
user << "<span class='notice'>You [anchored ? "wrench" : "unwrench"] \the [src].</span>"
if(!lamp_shade)
@@ -516,7 +516,7 @@
else
if(istype(W, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] removes [src]'s lamp shade.", \
"You remove [src]'s lamp shade.", "You hear a noise.")
lamp_shade = 0
@@ -578,7 +578,7 @@
if(H.species.can_shred(H))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
for(var/mob/M in viewers(src))
M.show_message("\red [user.name] smashed the light!", 3, "You hear a tinkle of breaking glass", 2)
M.show_message("<font color='red'>[user.name] smashed the light!</font>", 3, "You hear a tinkle of breaking glass", 2)
broken()
return
@@ -864,7 +864,7 @@
/obj/item/weapon/light/proc/shatter()
if(status == LIGHT_OK || status == LIGHT_BURNED)
src.visible_message("\red [name] shatters.","\red You hear a small glass object shatter.")
src.visible_message("<font color='red'>[name] shatters.</font>","<font color='red'> You hear a small glass object shatter.</font>")
status = LIGHT_BROKEN
force = 5
sharp = 1

View File

@@ -52,7 +52,7 @@
examine(mob/user)
..(user)
user << "\blue The generator has [P.air_contents.phoron] units of fuel left, producing [power_gen] per cycle."
user << "<font color='blue'>The generator has [P.air_contents.phoron] units of fuel left, producing [power_gen] per cycle.</font>"
handleInactive()
heat -= 2
@@ -70,29 +70,30 @@
attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/weapon/tank/phoron))
if(P)
user << "\red The generator already has a phoron tank loaded!"
user << "<font color='red'>The generator already has a phoron tank loaded!</font>"
return
P = O
user.drop_item()
O.loc = src
user << "\blue You add the phoron tank to the generator."
user << "<font color='blue'>You add the phoron tank to the generator.</font>"
else if(!active)
if(istype(O, /obj/item/weapon/wrench))
anchored = !anchored
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(anchored)
user << "\blue You secure the generator to the floor."
user << "<font color='blue'>You secure the generator to the floor.</font>"
else
user << "\blue You unsecure the generator from the floor."
user << "<font color='blue'>You unsecure the generator from the floor.</font>"
makepowernets()
else if(istype(O, /obj/item/weapon/screwdriver))
open = !open
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(loc, O.usesound, 50, 1)
if(open)
user << "\blue You open the access panel."
user << "<font color='blue'>You open the access panel.</font>"
else
user << "\blue You close the access panel."
user << "<font color='blue'>You close the access panel.</font>"
else if(istype(O, /obj/item/weapon/crowbar) && !open)
playsound(loc, O.usesound, 50, 1)
var/obj/machinery/constructable_frame/machine_frame/new_frame = new /obj/machinery/constructable_frame/machine_frame(src.loc)
for(var/obj/item/I in component_parts)
I.loc = src.loc
@@ -165,7 +166,7 @@
usr << browse(null, "window=port_gen")
usr.machine = null
/obj/machinery/power/port_gen/pacman2/emag_act(var/remaining_uses, var/mob/user)
/obj/machinery/power/port_gen/pacman2/emag_act(var/remaining_uses, var/mob/user)
emagged = 1
emp_act(1)
return 1

View File

@@ -54,7 +54,7 @@ var/global/list/rad_collectors = list()
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.gas["phoron"]/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
return
else
user << "\red The controls are locked!"
user << "<font color='red'>The controls are locked!</font>"
return
..()
@@ -62,10 +62,10 @@ var/global/list/rad_collectors = list()
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/tank/phoron))
if(!src.anchored)
user << "\red The [src] needs to be secured to the floor first."
user << "<font color='red'>The [src] needs to be secured to the floor first.</font>"
return 1
if(src.P)
user << "\red There's already a phoron tank loaded."
user << "<font color='red'>There's already a phoron tank loaded.</font>"
return 1
user.drop_item()
src.P = W
@@ -78,13 +78,13 @@ var/global/list/rad_collectors = list()
return 1
else if(istype(W, /obj/item/weapon/wrench))
if(P)
user << "\blue Remove the phoron tank first."
user << "<font color='blue'>Remove the phoron tank first.</font>"
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
src.anchored = !src.anchored
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
"You [anchored? "secure":"undo"] the external bolts.", \
"You hear a ratchet")
"You hear a ratchet.")
if(anchored)
connect_to_network()
else
@@ -97,9 +97,9 @@ var/global/list/rad_collectors = list()
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
else
src.locked = 0 //just in case it somehow gets locked
user << "\red The controls can only be locked when the [src] is active"
user << "<font color='red'>The controls can only be locked when the [src] is active.</font>"
else
user << "\red Access denied!"
user << "<font color='red'>Access denied!</font>"
return 1
return ..()

View File

@@ -24,6 +24,9 @@
var/state = 0
var/locked = 0
var/burst_delay = 2
var/initial_fire_delay = 100
var/integrity = 80
@@ -75,7 +78,7 @@
src.active = 1
user << "You turn on [src]."
src.shot_number = 0
src.fire_delay = 100
src.fire_delay = get_initial_fire_delay()
message_admins("Emitter turned on by [key_name(user, user.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[user]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("Emitter turned on by [user.ckey]([user]) in ([x],[y],[z])")
investigate_log("turned <font color='green'>on</font> by [user.key]","singulo")
@@ -119,10 +122,10 @@
src.last_shot = world.time
if(src.shot_number < burst_shots)
src.fire_delay = 2
src.fire_delay = get_burst_delay() //R-UST port
src.shot_number ++
else
src.fire_delay = rand(min_burst_delay, max_burst_delay)
src.fire_delay = get_rand_burst_delay() //R-UST port
src.shot_number = 0
//need to calculate the power per shot as the emitter doesn't fire continuously.
@@ -135,7 +138,7 @@
s.set_up(5, 1, src)
s.start()
var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter( src.loc )
var/obj/item/projectile/beam/emitter/A = get_emitter_beam()
A.damage = round(power_per_shot/EMITTER_DAMAGE_POWER_TRANSFER)
A.launch( get_step(src.loc, src.dir) )
@@ -148,17 +151,17 @@
switch(state)
if(0)
state = 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] secures [src] to the floor.", \
"You secure the external reinforcing bolts to the floor.", \
"You hear a ratchet")
"You hear a ratchet.")
src.anchored = 1
if(1)
state = 0
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] unsecures [src] reinforcing bolts from the floor.", \
"You undo the external reinforcing bolts.", \
"You hear a ratchet")
"You hear a ratchet.")
src.anchored = 0
if(2)
user << "<span class='warning'>\The [src] needs to be unwelded from the floor.</span>"
@@ -174,11 +177,11 @@
user << "<span class='warning'>\The [src] needs to be wrenched to the floor.</span>"
if(1)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to weld [src] to the floor.", \
"You start to weld [src] to the floor.", \
"You hear welding")
if (do_after(user,20))
if (do_after(user,20 * WT.toolspeed))
if(!src || !WT.isOn()) return
state = 2
user << "You weld [src] to the floor."
@@ -187,11 +190,11 @@
user << "<span class='warning'>You need more welding fuel to complete this task.</span>"
if(2)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to cut [src] free from the floor.", \
"You start to cut [src] free from the floor.", \
"You hear welding")
if (do_after(user,20))
if (do_after(user,20 * WT.toolspeed))
if(!src || !WT.isOn()) return
state = 1
user << "You cut [src] free from the floor."
@@ -266,3 +269,16 @@
user << "<span class='danger'>\The [src] is damaged.</span>"
if(77 to 99)
user << "<span class='warning'>\The [src] is slightly damaged.</span>"
//R-UST port
/obj/machinery/power/emitter/proc/get_initial_fire_delay()
return initial_fire_delay
/obj/machinery/power/emitter/proc/get_rand_burst_delay()
return rand(min_burst_delay, max_burst_delay)
/obj/machinery/power/emitter/proc/get_burst_delay()
return burst_delay
/obj/machinery/power/emitter/proc/get_emitter_beam()
return new /obj/item/projectile/beam/emitter(get_turf(src))

View File

@@ -106,34 +106,34 @@ field_generator power level display
switch(state)
if(0)
state = 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the external reinforcing bolts to the floor.", \
"You hear ratchet")
src.anchored = 1
if(1)
state = 0
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
"You undo the external reinforcing bolts.", \
"You hear ratchet")
src.anchored = 0
if(2)
user << "\red The [src.name] needs to be unwelded from the floor."
user << "<font color='red'>The [src.name] needs to be unwelded from the floor.</font>"
return
else if(istype(W, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = W
switch(state)
if(0)
user << "\red The [src.name] needs to be wrenched to the floor."
user << "<font color='red'>The [src.name] needs to be wrenched to the floor.</font>"
return
if(1)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20))
if (do_after(user,20 * WT.toolspeed))
if(!src || !WT.isOn()) return
state = 2
user << "You weld the field generator to the floor."
@@ -141,11 +141,11 @@ field_generator power level display
return
if(2)
if (WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20))
if (do_after(user,20 * WT.toolspeed))
if(!src || !WT.isOn()) return
state = 1
user << "You cut the [src] free from the floor."
@@ -211,7 +211,7 @@ field_generator power level display
return 1
else
for(var/mob/M in viewers(src))
M.show_message("\red \The [src] shuts down!")
M.show_message("<font color='red'>\The [src] shuts down!</font>")
turn_off()
investigate_log("ran out of power and <font color='red'>deactivated</font>","singulo")
src.power = 0

View File

@@ -18,14 +18,14 @@
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/wrench))
anchored = !anchored
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
if(anchored)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the [src.name] to the floor.", \
"You hear a ratchet")
"You hear a ratchet.")
else
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
"You unsecure the [src.name] from the floor.", \
"You hear a ratchet")
"You hear a ratchet.")
return
return ..()

View File

@@ -43,6 +43,21 @@
toxmob(A)
if((istype(A,/obj/machinery/the_singularitygen))||(istype(A,/obj/singularity/)))
A:energy += energy
//R-UST port
else if(istype(A,/obj/machinery/power/fusion_core))
var/obj/machinery/power/fusion_core/collided_core = A
if(particle_type && particle_type != "neutron")
if(collided_core.AddParticles(particle_type, 1 + additional_particles))
collided_core.owned_field.plasma_temperature += mega_energy
collided_core.owned_field.energy += energy
loc = null
else if(istype(A, /obj/effect/fusion_particle_catcher))
var/obj/effect/fusion_particle_catcher/PC = A
if(particle_type && particle_type != "neutron")
if(PC.parent.owned_core.AddParticles(particle_type, 1 + additional_particles))
PC.parent.plasma_temperature += mega_energy
PC.parent.energy += energy
loc = null
return
@@ -62,7 +77,7 @@
var/radiation = (energy*2)
M.apply_effect((radiation*3),IRRADIATE,0)
M.updatehealth()
//M << "\red You feel odd."
//M << "<font color='red'>You feel odd.</font>"
return

View File

@@ -197,7 +197,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 0
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/O, var/mob/user)
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!ismob(user) || !isobj(O))
@@ -207,14 +207,14 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, O.usesound, 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, O.usesound, 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
"You remove the external bolts.")
@@ -337,7 +337,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 0
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/O, var/mob/user)
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!ismob(user) || !isobj(O))
@@ -346,14 +346,14 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, O.usesound, 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(iswrench(O))
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, O.usesound, 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
"You remove the external bolts.")

View File

@@ -238,10 +238,12 @@
if(!open_hatch)
open_hatch = 1
user << "<span class='notice'>You open the maintenance hatch of [src].</span>"
playsound(src, W.usesound, 50, 1)
return 0
else
open_hatch = 0
user << "<span class='notice'>You close the maintenance hatch of [src].</span>"
playsound(src, W.usesound, 50, 1)
return 0
if (!open_hatch)
@@ -276,7 +278,7 @@
else
user << "<span class='notice'>You begin to cut the cables...</span>"
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50))
if(do_after(user, 50 * W.toolspeed))
if (prob(50) && electrocute_mob(usr, terminal.powernet, terminal))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
@@ -380,7 +382,7 @@
if(src.z in using_map.station_levels)
if(prob(1)) //explosion
for(var/mob/M in viewers(src))
M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
M.show_message("<font color='red'>The [src.name] is making strange noises!</font>", 3, "<font color='red'>You hear sizzling electronics.</font>", 2)
sleep(10*pick(4,5,6,7,10,14))
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)

View File

@@ -335,15 +335,15 @@
user << "<span class='warning'>You have to disassemble the terminal first!</span>"
return
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
playsound(get_turf(src), W.usesound, 50, 1)
user << "<span class='warning'>You begin to disassemble the [src]!</span>"
if (do_after(usr, 100 * cur_coils)) // More coils = takes longer to disassemble. It's complex so largest one with 5 coils will take 50s
if (do_after(usr, (100 * cur_coils) * W.toolspeed)) // More coils = takes longer to disassemble. It's complex so largest one with 5 coils will take 50s with a normal crowbar
if (failure_probability && prob(failure_probability))
total_system_failure(failure_probability, user)
return
usr << "\red You have disassembled the SMES cell!"
usr << "<font color='red'>You have disassembled the SMES cell!</font>"
var/obj/structure/frame/M = new /obj/structure/frame(src.loc)
M.frame_type = new /datum/frame/frame_types/machine
M.anchored = 1
@@ -372,7 +372,7 @@
W.loc = src
recalc_coils()
else
usr << "\red You can't insert more coils to this SMES unit!"
usr << "<font color='red'>You can't insert more coils to this SMES unit!</font>"
// Proc: toggle_input()
// Parameters: None

View File

@@ -231,13 +231,13 @@ var/list/solars_list = list()
if(istype(W, /obj/item/weapon/wrench))
anchored = 1
user.visible_message("<span class='notice'>[user] wrenches the solar assembly into place.</span>")
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
return 1
else
if(istype(W, /obj/item/weapon/wrench))
anchored = 0
user.visible_message("<span class='notice'>[user] unwrenches the solar assembly from it's place.</span>")
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src, W.usesound, 75, 1)
return 1
if(istype(W, /obj/item/stack/material) && (W.get_material_name() == "glass" || W.get_material_name() == "rglass"))
@@ -402,12 +402,12 @@ var/list/solars_list = list()
return
/obj/machinery/power/solar_control/attackby(I as obj, user as mob)
/obj/machinery/power/solar_control/attackby(obj/item/I, user as mob)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src, I.usesound, 50, 1)
if(do_after(user, 20))
if (src.stat & BROKEN)
user << "\blue The broken glass falls out."
user << "<font color='blue'>The broken glass falls out.</font>"
var/obj/structure/frame/A = new /obj/structure/frame( src.loc )
new /obj/item/weapon/material/shard( src.loc )
var/obj/item/weapon/circuitboard/solar_control/M = new /obj/item/weapon/circuitboard/solar_control( A )
@@ -420,7 +420,7 @@ var/list/solars_list = list()
A.anchored = 1
qdel(src)
else
user << "\blue You disconnect the monitor."
user << "<font color='blue'>You disconnect the monitor.</font>"
var/obj/structure/frame/A = new /obj/structure/frame( src.loc )
var/obj/item/weapon/circuitboard/solar_control/M = new /obj/item/weapon/circuitboard/solar_control( A )
for (var/obj/C in src)

View File

@@ -181,7 +181,7 @@
return
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
if(!istype(usr, /mob/living/silicon/ai))
usr << "\red You don't have the dexterity to do this!"
usr << "<font color='red'>You don't have the dexterity to do this!</font>"
return
if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
@@ -229,10 +229,10 @@
/*
/obj/machinery/computer/turbine_computer/attackby(I as obj, user as mob)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, I.usesound, 50, 1)
if(do_after(user, 20))
if (src.stat & BROKEN)
user << "\blue The broken glass falls out."
user << "<font color='blue'>The broken glass falls out.</font>"
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
new /obj/item/weapon/material/shard( src.loc )
var/obj/item/weapon/circuitboard/turbine_control/M = new /obj/item/weapon/circuitboard/turbine_control( A )
@@ -245,7 +245,7 @@
A.anchored = 1
qdel(src)
else
user << "\blue You disconnect the monitor."
user << "<font color='blue'>You disconnect the monitor.</font>"
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
var/obj/item/weapon/circuitboard/turbine_control/M = new /obj/item/weapon/circuitboard/turbine_control( A )
for (var/obj/C in src)