mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-26 01:52:15 +00:00
Antimatter Engine Tweaks (#10836)
This commit is contained in:
@@ -125,6 +125,4 @@ var/list/restricted_camera_networks = list(NETWORK_ERT,NETWORK_MERCENARY,"Secret
|
||||
#define M_NO_PROCESS 27
|
||||
|
||||
// This controls how much power the AME generates per unit of fuel.
|
||||
// Assuming 100% efficency, use this equation to figure out power output.
|
||||
// power_generated = (fuel**2) * AM_POWER_FACTOR
|
||||
#define AM_POWER_FACTOR 50000
|
||||
#define AM_POWER_FACTOR 1000000
|
||||
@@ -1,98 +0,0 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:05
|
||||
#define STATE_DEFAULT 1
|
||||
#define STATE_INJECTOR 2
|
||||
#define STATE_ENGINE 3
|
||||
|
||||
|
||||
/obj/machinery/computer/am_engine
|
||||
name = "Antimatter Engine Console"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "comm_computer"
|
||||
req_access = list(ACCESS_ENGINE)
|
||||
var/engine_id = 0
|
||||
var/authenticated = 0
|
||||
var/obj/machinery/power/am_engine/engine/connected_E = null
|
||||
var/obj/machinery/power/am_engine/injector/connected_I = null
|
||||
var/state = STATE_DEFAULT
|
||||
|
||||
/obj/machinery/computer/am_engine/New()
|
||||
..()
|
||||
spawn( 24 )
|
||||
for(var/obj/machinery/power/am_engine/engine/E in machines)
|
||||
if(E.engine_id == src.engine_id)
|
||||
src.connected_E = E
|
||||
for(var/obj/machinery/power/am_engine/injector/I in machines)
|
||||
if(I.engine_id == src.engine_id)
|
||||
src.connected_I = I
|
||||
return
|
||||
|
||||
/obj/machinery/computer/am_engine/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.machine = src
|
||||
|
||||
if(!href_list["operation"])
|
||||
return
|
||||
switch(href_list["operation"])
|
||||
// main interface
|
||||
if("activate")
|
||||
src.connected_E.engine_process()
|
||||
if("engine")
|
||||
src.state = STATE_ENGINE
|
||||
if("injector")
|
||||
src.state = STATE_INJECTOR
|
||||
if("main")
|
||||
src.state = STATE_DEFAULT
|
||||
if("login")
|
||||
var/mob/M = usr
|
||||
var/obj/item/card/id/I = M.equipped()
|
||||
if (I && istype(I))
|
||||
if(src.check_access(I))
|
||||
authenticated = 1
|
||||
if("deactivate")
|
||||
src.connected_E.stopping = 1
|
||||
if("logout")
|
||||
authenticated = 0
|
||||
|
||||
src.updateUsrDialog()
|
||||
|
||||
/obj/machinery/computer/am_engine/attack_ai(var/mob/user as mob)
|
||||
if(!ai_can_interact(user))
|
||||
return
|
||||
src.add_hiddenprint(user)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/am_engine/attack_paw(var/mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/am_engine/attack_hand(var/mob/user as mob)
|
||||
if(..())
|
||||
return
|
||||
user.machine = src
|
||||
var/dat = "<head><title>Engine Computer</title></head><body>"
|
||||
switch(src.state)
|
||||
if(STATE_DEFAULT)
|
||||
if (src.authenticated)
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=logout'>Log Out</A> \]<br>"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=engine'>Engine Menu</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=injector'>Injector Menu</A> \]"
|
||||
else
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=login'>Log In</A> \]"
|
||||
if(STATE_INJECTOR)
|
||||
if(src.connected_I.injecting)
|
||||
dat += "<BR>\[ Injecting \]<br>"
|
||||
else
|
||||
dat += "<BR>\[ Injecting not in progress \]<br>"
|
||||
if(STATE_ENGINE)
|
||||
if(src.connected_E.stopping)
|
||||
dat += "<BR>\[ STOPPING \]"
|
||||
else if(src.connected_E.operating && !src.connected_E.stopping)
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=deactivate'>Emergency Stop</A> \]"
|
||||
else
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=activate'>Activate Engine</A> \]"
|
||||
dat += "<BR>Contents:<br>[src.connected_E.H_fuel]kg of Hydrogen<br>[src.connected_E.antiH_fuel]kg of Anti-Hydrogen<br>"
|
||||
|
||||
dat += "<BR>\[ [(src.state != STATE_DEFAULT) ? "<A HREF='?src=\ref[src];operation=main'>Main Menu</A> | " : ""]<A HREF='?src=\ref[user];mach_close=communications'>Close</A> \]"
|
||||
user << browse(dat, "window=communications;size=400x500")
|
||||
onclose(user, "communications")
|
||||
|
||||
@@ -4,25 +4,22 @@
|
||||
desc_antag = "Antimatter is extremely volatile, and containment jars are not particularly strong. Weak explosions will reduce the container's integrity, and larger ones will cause it to explode immediately."
|
||||
icon = 'icons/obj/machines/antimatter.dmi'
|
||||
icon_state = "jar"
|
||||
density = 0
|
||||
anchored = 0
|
||||
force = 8
|
||||
throwforce = 10
|
||||
throw_speed = 1
|
||||
throw_range = 2
|
||||
|
||||
var/fuel = 1000 // WAS ORIGINALLY 10000
|
||||
var/fuel_max = 1000//Lets try this for now
|
||||
var/stability = 100//TODO: add all the stability things to this so its not very safe if you keep hitting in on things
|
||||
var/exploded = 0
|
||||
var/fuel = 1000
|
||||
var/stability = 100 //TODO: add all the stability things to this so its not very safe if you keep hitting in on things
|
||||
var/exploded = FALSE
|
||||
|
||||
/obj/item/am_containment/proc/boom()
|
||||
var/percent = 0
|
||||
if(fuel)
|
||||
percent = (fuel / fuel_max) * 100
|
||||
percent = (fuel / initial(fuel)) * 100
|
||||
if(!exploded && percent >= 10)
|
||||
explosion(get_turf(src), 1, 2, 3, 5)//Should likely be larger but this works fine for now I guess
|
||||
exploded=1
|
||||
exploded = TRUE
|
||||
if(src)
|
||||
qdel(src)
|
||||
|
||||
@@ -31,16 +28,19 @@
|
||||
if(1.0)
|
||||
boom()
|
||||
if(2.0)
|
||||
if(prob((fuel/10)-stability))
|
||||
if(prob((fuel / 10) - stability))
|
||||
boom()
|
||||
stability -= 40
|
||||
if(3.0)
|
||||
stability -= 20
|
||||
//check_stability()
|
||||
return
|
||||
check_stability()
|
||||
|
||||
/obj/item/am_containment/proc/check_stability()
|
||||
if(stability <= 0)
|
||||
boom()
|
||||
|
||||
/obj/item/am_containment/proc/usefuel(var/wanted)
|
||||
if(fuel < wanted)
|
||||
wanted = fuel
|
||||
fuel -= wanted
|
||||
return wanted
|
||||
return wanted
|
||||
@@ -6,9 +6,8 @@
|
||||
icon = 'icons/obj/machines/new_ame.dmi'
|
||||
icon_state = "control"
|
||||
var/icon_mod = "on" // on, critical, or fuck
|
||||
var/old_icon_mod = "on"
|
||||
anchored = 0
|
||||
density = 1
|
||||
anchored = FALSE
|
||||
density = TRUE
|
||||
use_power = 1
|
||||
idle_power_usage = 100
|
||||
active_power_usage = 1000
|
||||
@@ -16,28 +15,22 @@
|
||||
var/list/obj/machinery/am_shielding/linked_shielding
|
||||
var/list/obj/machinery/am_shielding/linked_cores
|
||||
var/obj/item/am_containment/fueljar
|
||||
var/update_shield_icons = 0
|
||||
var/update_shield_icons = FALSE
|
||||
var/stability = 100
|
||||
var/exploding = 0
|
||||
var/exploded = 0
|
||||
var/exploding = FALSE
|
||||
var/exploded = FALSE
|
||||
|
||||
var/active = 0 //On or not
|
||||
var/fuel_injection = 2 //How much fuel to inject
|
||||
var/shield_icon_delay = 0 //delays resetting for a short time
|
||||
var/active = FALSE //On or not
|
||||
var/fuel_injection = 2 //How much fuel to inject
|
||||
var/shield_icon_delay = FALSE //delays resetting for a short time
|
||||
var/reported_core_efficiency = 0
|
||||
|
||||
var/power_cycle = 0
|
||||
var/power_cycle_delay = 4 //How many ticks till produce_power is called
|
||||
var/power_cycle_delay = 4 //How many ticks till produce_power is called
|
||||
var/stored_core_stability = 0
|
||||
var/stored_core_stability_delay = 0
|
||||
|
||||
var/stored_power = 0 //Power to deploy per tick
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/New()
|
||||
..()
|
||||
linked_shielding = list()
|
||||
linked_cores = list()
|
||||
var/stored_power = 0 //Power to deploy per tick
|
||||
|
||||
/obj/machinery/power/am_control_unit/Destroy()//Perhaps damage and run stability checks rather than just del on the others
|
||||
for(var/obj/machinery/am_shielding/AMS in linked_shielding)
|
||||
@@ -47,11 +40,9 @@
|
||||
AMS.control_unit = null
|
||||
qdel(AMS)
|
||||
|
||||
qdel(fueljar)
|
||||
fueljar = null
|
||||
QDEL_NULL(fueljar)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/machinery_process()
|
||||
if(exploding && !exploded)
|
||||
message_admins("AME explosion at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>) - Last touched by [fingerprintslast]",0,1)
|
||||
@@ -82,29 +73,28 @@
|
||||
power_cycle = 0
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/produce_power()
|
||||
playsound(get_turf(src), 'sound/effects/bang.ogg', 25, 1)
|
||||
for (var/thing in linked_cores)
|
||||
playsound(get_turf(src), 'sound/effects/air_seal.ogg', 25, TRUE, environment = SEWER_PIPE)
|
||||
for(var/thing in linked_cores)
|
||||
flick("core2", thing)
|
||||
var/core_power = reported_core_efficiency //Effectively how much fuel we can safely deal with
|
||||
if(core_power <= 0)
|
||||
return 0//Something is wrong
|
||||
if(reported_core_efficiency <= 0)
|
||||
return FALSE //Something is wrong
|
||||
var/core_damage = 0
|
||||
var/fuel = fueljar.usefuel(fuel_injection)
|
||||
|
||||
stored_power = (fuel / core_power) * fuel * AM_POWER_FACTOR // Was 200000, was too much. New value run past Aurx. - N3X
|
||||
//Now check if the cores could deal with it safely, this is done after so you can overload for more power if needed, still a bad idea
|
||||
if(fuel > (2*core_power)) //More fuel has been put in than the current cores can deal with
|
||||
stored_power = fuel * AM_POWER_FACTOR
|
||||
// Now check if the cores could deal with it safely, this is done after so you can overload for more power if needed, still a bad idea
|
||||
if(fuel > (2 * reported_core_efficiency)) //More fuel has been put in than the current cores can deal with
|
||||
if(prob(50))
|
||||
core_damage = 1 //Small chance of damage
|
||||
if((fuel-core_power) > 5)
|
||||
if((fuel - reported_core_efficiency) > 5)
|
||||
core_damage = 5 //Now its really starting to overload the cores
|
||||
if((fuel-core_power) > 10)
|
||||
if((fuel - reported_core_efficiency) > 10)
|
||||
core_damage = 20 //Welp now you did it, they wont stand much of this
|
||||
if(core_damage == 0)
|
||||
return
|
||||
for(var/obj/machinery/am_shielding/AMS in linked_cores)
|
||||
AMS.stability -= core_damage
|
||||
AMS.check_stability(1)
|
||||
AMS.check_stability(TRUE)
|
||||
playsound(get_turf(src), 'sound/effects/bang.ogg', 50, 1)
|
||||
|
||||
/obj/machinery/power/am_control_unit/emp_act(severity)
|
||||
@@ -112,11 +102,12 @@
|
||||
if(1)
|
||||
if(active)
|
||||
toggle_power()
|
||||
stability -= rand(15,30)
|
||||
stability -= rand(15, 30)
|
||||
if(2)
|
||||
if(active)
|
||||
toggle_power()
|
||||
stability -= rand(10,20)
|
||||
stability -= rand(10, 20)
|
||||
check_stability()
|
||||
..()
|
||||
|
||||
/obj/machinery/power/am_control_unit/ex_act(severity)
|
||||
@@ -128,150 +119,134 @@
|
||||
if(3.0)
|
||||
stability -= 20
|
||||
check_stability()
|
||||
return
|
||||
|
||||
/obj/machinery/power/am_control_unit/power_change()
|
||||
..()
|
||||
if(stat & NOPOWER && active)
|
||||
toggle_power()
|
||||
return
|
||||
|
||||
/obj/machinery/power/am_control_unit/update_icon()
|
||||
if(active)
|
||||
icon_state = "control_[icon_mod]"
|
||||
else
|
||||
icon_state = "control"
|
||||
//No other icons for it atm
|
||||
|
||||
/obj/machinery/power/am_control_unit/attackby(obj/item/W, mob/user)
|
||||
if(!istype(W) || !user)
|
||||
return
|
||||
if(W.iswrench())
|
||||
if(!anchored)
|
||||
playsound(get_turf(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")
|
||||
src.anchored = 1
|
||||
user.visible_message("<b>[user.name]</b> secures \the [src] to the floor.", \
|
||||
SPAN_NOTICE("You secure the anchor bolts to the floor."), \
|
||||
SPAN_NOTICE("You hear a ratcheting noise."))
|
||||
anchored = TRUE
|
||||
update_shield_icons = 2
|
||||
check_shield_icons()
|
||||
connect_to_network()
|
||||
else if(!linked_shielding.len > 0)
|
||||
else if(!LAZYLEN(linked_shielding))
|
||||
playsound(get_turf(src), W.usesound, 75, 1)
|
||||
user.visible_message("[user.name] unsecures the [src.name].", \
|
||||
"You remove the anchor bolts.", \
|
||||
"You hear a ratchet")
|
||||
src.anchored = 0
|
||||
user.visible_message("<b>[user]</b> unsecures \the [src].", \
|
||||
SPAN_NOTICE("You remove the anchor bolts."), \
|
||||
SPAN_NOTICE("You hear a ratcheting noise."))
|
||||
anchored = FALSE
|
||||
disconnect_from_network()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Once bolted and linked to a shielding unit it the [src.name] is unable to be moved!</span>")
|
||||
to_chat(user, SPAN_WARNING("Once bolted and linked to a shielding unit it \the [src] is unable to be moved!"))
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/am_containment))
|
||||
if(fueljar)
|
||||
to_chat(user, "<span class='warning'>There is already a [fueljar] inside!</span>")
|
||||
to_chat(user, SPAN_WARNING("There is already \a [fueljar] loaded!"))
|
||||
return
|
||||
fueljar = W
|
||||
user.drop_from_inventory(W, src)
|
||||
message_admins("AME loaded with fuel by [user.real_name] ([user.key]) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
user.visible_message("[user.name] loads an [W.name] into the [src.name].", \
|
||||
"You load an [W.name].", \
|
||||
"You hear a thunk.")
|
||||
user.visible_message("<b>[user]</b> loads \the [W] into \the [src].", \
|
||||
SPAN_NOTICE("You load \the [W] into \the [src]."), \
|
||||
SPAN_NOTICE("You hear a thunk."))
|
||||
return
|
||||
|
||||
if(W.force >= 20)
|
||||
stability -= W.force/2
|
||||
user.do_attack_animation(src, W)
|
||||
stability -= W.force / 2
|
||||
check_stability()
|
||||
..()
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/attack_hand(mob/user as mob)
|
||||
/obj/machinery/power/am_control_unit/attack_hand(mob/user)
|
||||
if(anchored)
|
||||
interact(user)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/add_shielding(var/obj/machinery/am_shielding/AMS, var/AMS_linking = 0)
|
||||
if(!istype(AMS))
|
||||
return 0
|
||||
return FALSE
|
||||
if(!anchored)
|
||||
return 0
|
||||
return FALSE
|
||||
if(!AMS_linking && !AMS.link_control(src))
|
||||
return 0
|
||||
if(!(AMS in linked_shielding))
|
||||
linked_shielding.Add(AMS)
|
||||
return FALSE
|
||||
LAZYDISTINCTADD(linked_shielding, AMS)
|
||||
update_shield_icons = 1
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/remove_shielding(var/obj/machinery/am_shielding/AMS)
|
||||
if(!istype(AMS))
|
||||
return 0
|
||||
linked_shielding.Remove(AMS)
|
||||
return FALSE
|
||||
LAZYREMOVE(linked_shielding, AMS)
|
||||
update_shield_icons = 2
|
||||
if(active)
|
||||
toggle_power()
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/check_stability()//TODO: make it break when low also might want to add a way to fix it like a part or such that can be replaced
|
||||
if(stability <= 0)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/toggle_power()
|
||||
active = !active
|
||||
if(active)
|
||||
use_power = 2
|
||||
visible_message("The [src.name] starts up.")
|
||||
visible_message(SPAN_NOTICE("\The [src] starts up."))
|
||||
else
|
||||
use_power = 1
|
||||
visible_message("The [src.name] shuts down.")
|
||||
visible_message(SPAN_NOTICE("\The [src] shuts down."))
|
||||
for(var/obj/machinery/am_shielding/AMS in linked_cores)
|
||||
AMS.update_icon()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/check_shield_icons()//Forces icon_update for all shields
|
||||
if(shield_icon_delay)
|
||||
return
|
||||
shield_icon_delay = 1
|
||||
shield_icon_delay = TRUE
|
||||
if(update_shield_icons == 2)//2 means to clear everything and rebuild
|
||||
for(var/obj/machinery/am_shielding/neighbor in cardinalrange(loc))
|
||||
if(!neighbor.control_unit)
|
||||
linked_shielding += neighbor
|
||||
LAZYADD(linked_shielding, neighbor)
|
||||
for(var/obj/machinery/am_shielding/AMS in linked_shielding)
|
||||
if(AMS.processing)
|
||||
AMS.shutdown_core()
|
||||
AMS.control_unit = null
|
||||
spawn(10)
|
||||
AMS.controllerscan()
|
||||
AMS.assimilate()
|
||||
linked_shielding = list()
|
||||
|
||||
addtimer(CALLBACK(src, .proc/ams_do_scan, AMS), 1 SECOND)
|
||||
LAZYCLEARLIST(linked_shielding)
|
||||
else
|
||||
for(var/obj/machinery/am_shielding/AMS in linked_shielding)
|
||||
AMS.update_icon()
|
||||
sleep(20)
|
||||
shield_icon_delay = 0
|
||||
addtimer(CALLBACK(src, .proc/clear_shield_icon_delay), 2 SECONDS)
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/ams_do_scan(var/obj/machinery/am_shielding/AMS)
|
||||
AMS.controllerscan()
|
||||
AMS.assimilate()
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/clear_shield_icon_delay()
|
||||
shield_icon_delay = FALSE
|
||||
|
||||
/obj/machinery/power/am_control_unit/proc/check_core_stability()
|
||||
//if(stored_core_stability_delay || linked_cores.len <= 0) return
|
||||
if(linked_cores.len <= 0)
|
||||
if(!LAZYLEN(linked_cores))
|
||||
return
|
||||
//stored_core_stability_delay = 1
|
||||
stored_core_stability = 0
|
||||
for(var/thing in linked_cores)
|
||||
var/obj/machinery/am_shielding/AMS = thing
|
||||
if (QDELETED(AMS))
|
||||
if(QDELETED(AMS))
|
||||
continue
|
||||
|
||||
stored_core_stability += AMS.stability
|
||||
stored_core_stability /= linked_cores.len
|
||||
stored_core_stability /= LAZYLEN(linked_cores)
|
||||
switch(stored_core_stability)
|
||||
if(0 to 24)
|
||||
icon_mod = "fuck"
|
||||
@@ -279,17 +254,11 @@
|
||||
icon_mod = "critical"
|
||||
if(50 to INFINITY)
|
||||
icon_mod = "on"
|
||||
|
||||
if(icon_mod != old_icon_mod)
|
||||
old_icon_mod = icon_mod
|
||||
update_icon()
|
||||
|
||||
//spawn(40)
|
||||
// stored_core_stability_delay = 0
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/power/am_control_unit/interact(mob/user)
|
||||
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
|
||||
if(!istype(user, /mob/living/silicon/ai))
|
||||
if(!issilicon(user))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=AMcontrol")
|
||||
return
|
||||
@@ -299,24 +268,23 @@
|
||||
if(!user)
|
||||
return
|
||||
|
||||
var/list/fueljar_data=null
|
||||
var/list/fueljar_data = null
|
||||
if(fueljar)
|
||||
fueljar_data=list(
|
||||
"fuel"=fueljar.fuel,
|
||||
"fuel_max"=fueljar.fuel_max,
|
||||
"injecting"=fuel_injection
|
||||
fueljar_data = list(
|
||||
"fuel" = fueljar.fuel,
|
||||
"fuel_max" = initial(fueljar.fuel),
|
||||
"injecting" = fuel_injection
|
||||
)
|
||||
|
||||
var/list/data = list(
|
||||
"active" = active,
|
||||
//"stability" = stability,
|
||||
"linked_shields" = linked_shielding.len,
|
||||
"linked_cores" = linked_cores.len,
|
||||
"linked_shields" = LAZYLEN(linked_shielding),
|
||||
"linked_cores" = LAZYLEN(linked_cores),
|
||||
"efficiency" = reported_core_efficiency,
|
||||
"stability" = stored_core_stability,
|
||||
"stored_power" = stored_power,
|
||||
"fueljar" = fueljar_data,
|
||||
"siliconUser" = istype(user, /mob/living/silicon)
|
||||
"siliconUser" = issilicon(user)
|
||||
)
|
||||
|
||||
var/datum/nanoui/ui = SSnanoui.get_open_ui(user, src, ui_key)
|
||||
@@ -327,20 +295,19 @@
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
// Auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
ui.set_auto_update(TRUE)
|
||||
else
|
||||
// The UI is already open so push the new data to it
|
||||
ui.push_data(data)
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_control_unit/Topic(href, href_list)
|
||||
if(..())
|
||||
return 1
|
||||
return TRUE
|
||||
if(href_list["close"])
|
||||
if(usr.machine == src)
|
||||
usr.unset_machine()
|
||||
return 1
|
||||
return TRUE
|
||||
//Ignore input if we are broken or guy is not touching us, AI can control from a ways away
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
usr.unset_machine()
|
||||
@@ -355,11 +322,11 @@
|
||||
if(href_list["togglestatus"])
|
||||
toggle_power()
|
||||
message_admins("AME toggled [active?"on":"off"] by [usr.real_name] ([usr.key]) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if(href_list["refreshicons"])
|
||||
update_shield_icons = 2 // Fuck it
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if(href_list["ejectjar"])
|
||||
if(fueljar)
|
||||
@@ -368,21 +335,20 @@
|
||||
fueljar = null
|
||||
//fueljar.control_unit = null currently it does not care where it is
|
||||
//update_icon() when we have the icon for it
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if(href_list["set_strength"])
|
||||
var/newval = input("Enter new injection strength") as num|null
|
||||
if(isnull(newval))
|
||||
return
|
||||
fuel_injection=newval
|
||||
fuel_injection=max(1,fuel_injection)
|
||||
fuel_injection = newval
|
||||
fuel_injection = max(1, fuel_injection)
|
||||
message_admins("AME injection strength set to [fuel_injection] by [usr.real_name] ([usr.key]) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if(href_list["refreshstability"])
|
||||
check_core_stability()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
updateDialog()
|
||||
return 1
|
||||
|
||||
return TRUE
|
||||
@@ -1,212 +0,0 @@
|
||||
/obj/machinery/power/am_engine
|
||||
icon = 'icons/am_engine.dmi'
|
||||
density = 1
|
||||
anchored = 1.0
|
||||
flags = ON_BORDER
|
||||
|
||||
/obj/machinery/power/am_engine/bits
|
||||
name = "Antimatter Engine"
|
||||
icon_state = "1"
|
||||
|
||||
/obj/machinery/power/am_engine/engine
|
||||
name = "Antimatter Engine"
|
||||
icon_state = "am_engine"
|
||||
var/engine_id = 0
|
||||
var/H_fuel = 0
|
||||
var/antiH_fuel = 0
|
||||
var/operating = 0
|
||||
var/stopping = 0
|
||||
var/obj/machinery/power/am_engine/injector/connected = null
|
||||
|
||||
/obj/machinery/power/am_engine/injector
|
||||
name = "Injector"
|
||||
icon_state = "injector"
|
||||
var/engine_id = 0
|
||||
var/injecting = 0
|
||||
var/fuel = 0
|
||||
var/obj/machinery/power/am_engine/engine/connected = null
|
||||
|
||||
//injector
|
||||
|
||||
/obj/machinery/power/am_engine/injector/New()
|
||||
..()
|
||||
spawn( 13 )
|
||||
var/loc = get_step(src, NORTH)
|
||||
src.connected = locate(/obj/machinery/power/am_engine/engine, get_step(loc, NORTH))
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_engine/injector/attackby(obj/item/fuel/F, mob/user)
|
||||
if( (stat & BROKEN) || !connected)
|
||||
return
|
||||
|
||||
if(istype(F, /obj/item/fuel/H))
|
||||
if(injecting)
|
||||
to_chat(user, "There's already a fuel rod in the injector!")
|
||||
return
|
||||
to_chat(user, "You insert the rod into the injector.")
|
||||
injecting = 1
|
||||
var/fuel = F.fuel
|
||||
qdel(F)
|
||||
F = null
|
||||
spawn( 300 )
|
||||
injecting = 0
|
||||
new/obj/item/fuel(src.loc)
|
||||
connected.H_fuel += fuel
|
||||
|
||||
if(istype(F, /obj/item/fuel/antiH))
|
||||
if(injecting)
|
||||
to_chat(user, "There's already a fuel rod in the injector!")
|
||||
return
|
||||
to_chat(user, "You insert the rod into the injector.")
|
||||
injecting = 1
|
||||
var/fuel = F.fuel
|
||||
qdel(F)
|
||||
F = null
|
||||
spawn( 300 )
|
||||
injecting = 0
|
||||
new /obj/item/fuel(src.loc)
|
||||
connected.antiH_fuel += fuel
|
||||
|
||||
return
|
||||
|
||||
|
||||
//engine
|
||||
|
||||
|
||||
/obj/machinery/power/am_engine/engine/New()
|
||||
..()
|
||||
spawn( 7 )
|
||||
var/loc = get_step(src, SOUTH)
|
||||
src.connected = locate(/obj/machinery/power/am_engine/injector, get_step(loc, SOUTH))
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_engine/engine/proc/engine_go()
|
||||
|
||||
|
||||
if( (!src.connected) || (stat & BROKEN) )
|
||||
return
|
||||
|
||||
if(!antiH_fuel || !H_fuel)
|
||||
return
|
||||
|
||||
operating = 1
|
||||
var/energy = 0
|
||||
|
||||
if(antiH_fuel == H_fuel)
|
||||
var/mass = antiH_fuel + H_fuel
|
||||
energy = convert2energy(mass)
|
||||
H_fuel = 0
|
||||
antiH_fuel = 0
|
||||
else
|
||||
var/residual_matter = modulus(H_fuel - antiH_fuel)
|
||||
var/mass = antiH_fuel + H_fuel - residual_matter
|
||||
energy = convert2energy(mass)
|
||||
if( H_fuel > antiH_fuel )
|
||||
H_fuel = residual_matter
|
||||
antiH_fuel = 0
|
||||
else
|
||||
H_fuel = 0
|
||||
antiH_fuel = residual_matter
|
||||
|
||||
for(var/mob/M in hearers(src, null))
|
||||
M.show_message(text("<span class='warning'>You hear a loud bang!</span>"))
|
||||
|
||||
//Q = k x (delta T)
|
||||
|
||||
energy = energy*0.75
|
||||
operating = 0
|
||||
|
||||
//TODO: DEFERRED Heat tile
|
||||
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/power/am_engine/engine/proc/engine_process()
|
||||
|
||||
|
||||
do
|
||||
if( (!src.connected) || (stat & BROKEN) )
|
||||
return
|
||||
|
||||
if(!antiH_fuel || !H_fuel)
|
||||
return
|
||||
|
||||
if(operating)
|
||||
return
|
||||
|
||||
operating = 1
|
||||
|
||||
sleep(50)
|
||||
|
||||
var/energy //energy from the reaction
|
||||
var/H //residual matter if H
|
||||
var/antiH //residual matter if antiH
|
||||
var/mass //total mass
|
||||
|
||||
if(antiH_fuel == H_fuel) //if they're equal then convert the whole mass to energy
|
||||
mass = antiH_fuel + H_fuel
|
||||
energy = convert2energy(mass)
|
||||
|
||||
else //else if they're not equal determine which isn't equal
|
||||
//and set it equal to either H or antiH so we don't lose anything
|
||||
|
||||
var/residual_matter = modulus(H_fuel - antiH_fuel)
|
||||
mass = antiH_fuel + H_fuel - residual_matter
|
||||
energy = convert2energy(mass)
|
||||
|
||||
if( H_fuel > antiH_fuel )
|
||||
H = residual_matter
|
||||
else
|
||||
antiH = residual_matter
|
||||
|
||||
|
||||
if(energy > convert2energy(8e-12)) //TOO MUCH ENERGY
|
||||
for(var/mob/M in hearers(src, null))
|
||||
M.show_message(text("<span class='warning'>You hear a loud whirring!</span>"))
|
||||
sleep(20)
|
||||
|
||||
//Q = k x (delta T)
|
||||
//Too much energy so machine panics and dissapates half of it as heat
|
||||
//The rest of the energetic photons then form into H and anti H particles again!
|
||||
|
||||
H_fuel -= H
|
||||
antiH_fuel -= antiH
|
||||
antiH_fuel = antiH_fuel/2
|
||||
H_fuel = H_fuel/2
|
||||
|
||||
energy = convert2energy(H_fuel + antiH_fuel)
|
||||
|
||||
H_fuel += H
|
||||
antiH_fuel += antiH
|
||||
|
||||
if(energy > convert2energy(8e-12)) //FAR TOO MUCH ENERGY STILL
|
||||
for(var/mob/M in hearers(src, null))
|
||||
M.show_message(text("<span class='warning'><big>BANG!</big></span>"))
|
||||
new /obj/effect/bhole(src.loc)
|
||||
|
||||
else //this amount of energy is okay so it does the proper output thing
|
||||
|
||||
sleep(60)
|
||||
//E = Pt
|
||||
//Lets say its 86% efficient
|
||||
var/output = 0.86*energy/20
|
||||
add_avail(output)
|
||||
//yeah the machine realises that something isn't right and accounts for it if H or antiH
|
||||
H_fuel -= H
|
||||
antiH_fuel -= antiH
|
||||
antiH_fuel = antiH_fuel/4
|
||||
H_fuel = H_fuel/4
|
||||
H_fuel += H
|
||||
antiH_fuel += antiH
|
||||
operating = 0
|
||||
sleep(100)
|
||||
|
||||
while(!stopping)
|
||||
|
||||
stopping = 0
|
||||
|
||||
return
|
||||
@@ -1,103 +0,0 @@
|
||||
/obj/item/fuel
|
||||
name = "nagnetic storage ring"
|
||||
desc = "A magnetic storage ring."
|
||||
icon = 'icons/obj/tools.dmi'
|
||||
icon_state = "rcdammo"
|
||||
opacity = 0
|
||||
density = 0
|
||||
anchored = 0.0
|
||||
var/fuel = 0
|
||||
var/s_time = 1.0
|
||||
var/content = null
|
||||
|
||||
/obj/item/fuel/H
|
||||
name = "hydrogen storage ring"
|
||||
content = "Hydrogen"
|
||||
fuel = 1e-12 //pico-kilogram
|
||||
|
||||
/obj/item/fuel/antiH
|
||||
name = "anti-hydrogen storage ring"
|
||||
content = "Anti-Hydrogen"
|
||||
fuel = 1e-12 //pico-kilogram
|
||||
|
||||
/obj/item/fuel/attackby(obj/item/fuel/F, mob/user)
|
||||
..()
|
||||
if(istype(src, /obj/item/fuel/antiH))
|
||||
if(istype(F, /obj/item/fuel/antiH))
|
||||
src.fuel += F.fuel
|
||||
F.fuel = 0
|
||||
to_chat(user, "You add the anti-Hydrogen to the storage ring. It now contains [src.fuel]kg.")
|
||||
if(istype(F, /obj/item/fuel/H))
|
||||
src.fuel += F.fuel
|
||||
qdel(F)
|
||||
F = null
|
||||
src:annihilation(src.fuel)
|
||||
if(istype(src, /obj/item/fuel/H))
|
||||
if(istype(F, /obj/item/fuel/H))
|
||||
src.fuel += F.fuel
|
||||
F.fuel = 0
|
||||
to_chat(user, "You add the Hydrogen to the storage ring. It now contains [src.fuel]kg")
|
||||
if(istype(F, /obj/item/fuel/antiH))
|
||||
src.fuel += F.fuel
|
||||
qdel(src)
|
||||
F:annihilation(F.fuel)
|
||||
|
||||
/obj/item/fuel/antiH/proc/annihilation(var/mass)
|
||||
|
||||
|
||||
var/strength = convert2energy(mass)
|
||||
|
||||
if (strength < 773.0)
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
if (strength > (450+T0C))
|
||||
explosion(T, 0, 1, 2, 4)
|
||||
else
|
||||
if (strength > (300+T0C))
|
||||
explosion(T, 0, 0, 2, 3)
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
var/turf/ground_zero = get_turf(loc)
|
||||
|
||||
var/ground_zero_range = round(strength / 387)
|
||||
explosion(ground_zero, ground_zero_range, ground_zero_range*2, ground_zero_range*3, ground_zero_range*4)
|
||||
|
||||
//SN src = null
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/fuel/examine()
|
||||
..()
|
||||
to_chat(user, "<span class='info'>A magnetic storage ring containing [fuel]kg of [content ? content : "nothing"].</span>")
|
||||
|
||||
/obj/item/fuel/proc/injest(mob/M as mob)
|
||||
switch(content)
|
||||
if("Anti-Hydrogen")
|
||||
to_chat(mob, SPAN_NOTICE("That was not a very bright idea."))
|
||||
M.gib()
|
||||
if("Hydrogen")
|
||||
to_chat(M, "<span class='notice'>You feel very light, as if you might just float away...</span>")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/fuel/attack(mob/M as mob, mob/user as mob)
|
||||
if (user != M)
|
||||
//If you come from the distant future and happen to find this unincluded and derelict file, you may be wondering what this is. In truth, it's better that you don't know.
|
||||
var/obj/effect/equip_e/human/O = new /obj/effect/equip_e/human( )
|
||||
O.source = user
|
||||
O.target = M
|
||||
O.item = src
|
||||
O.s_loc = user.loc
|
||||
O.t_loc = M.loc
|
||||
O.place = "fuel"
|
||||
M.requests += O
|
||||
spawn( 0 )
|
||||
O.process()
|
||||
return
|
||||
else
|
||||
for(var/mob/O in viewers(M, null))
|
||||
O.show_message(text("<span class='warning'>\The [M] eats the [content ? content : "empty canister"]!</span>"), 1)
|
||||
src.injest(M)
|
||||
@@ -13,31 +13,29 @@ proc/cardinalrange(var/center)
|
||||
desc = "A shielding component for an antimatter reactor. Looks delicate."
|
||||
desc_info = "Antimatter shielding sections must be beside an anchored control unit or another shielding section. If either are destroyed, the section will disappear."
|
||||
desc_antag = "Antimatter shielding sections are delicate. Attacking the shielding unit with a damaging object will reduce its stability, as will explosions. If the stability hits zero, the reactor may explode."
|
||||
|
||||
//icon = 'icons/obj/machines/antimatter.dmi'
|
||||
icon = 'icons/obj/machines/new_ame.dmi'
|
||||
icon_state = "shield"
|
||||
anchored = 1
|
||||
density = 1
|
||||
dir = 1
|
||||
use_power = 0//Living things generally dont use power
|
||||
anchored = TRUE
|
||||
density = TRUE
|
||||
dir = NORTH
|
||||
use_power = 0
|
||||
idle_power_usage = 0
|
||||
active_power_usage = 0
|
||||
|
||||
var/obj/machinery/power/am_control_unit/control_unit = null
|
||||
var/processing = 0//To track if we are in the update list or not, we need to be when we are damaged and if we ever
|
||||
var/stability = 100//If this gets low bad things tend to happen
|
||||
var/efficiency = 1//How many cores this core counts for when doing power processing, phoron in the air and stability could affect this
|
||||
var/processing = FALSE //To track if we are in the update list or not, we need to be when we are damaged and if we ever
|
||||
var/stability = 100 //If this gets low bad things tend to happen
|
||||
var/efficiency = 1 //How many cores this core counts for when doing power processing, phoron in the air and stability could affect this
|
||||
var/coredirs = 0
|
||||
var/dirs = 0
|
||||
var/mapped = 0 //Set to 1 to ignore usual suicide if it doesn't immediately find a control_unit
|
||||
var/mapped = FALSE //Set to 1 to ignore usual suicide if it doesn't immediately find a control_unit
|
||||
|
||||
// Stupidly easy way to use it in maps
|
||||
/obj/machinery/am_shielding/map
|
||||
mapped = 1
|
||||
mapped = TRUE
|
||||
|
||||
/obj/machinery/am_shielding/Initialize(mapload, var/obj/machinery/power/am_control_unit/AMC)
|
||||
. = ..()
|
||||
..()
|
||||
if(!AMC)
|
||||
if (!mapped)
|
||||
WARNING("AME sector somehow created without a parent control unit!")
|
||||
@@ -45,39 +43,34 @@ proc/cardinalrange(var/center)
|
||||
return
|
||||
link_control(AMC)
|
||||
remove_machine(src, FALSE)
|
||||
if (mapload)
|
||||
. = INITIALIZE_HINT_LATELOAD
|
||||
else
|
||||
addtimer(CALLBACK(src, /atom/.proc/update_icon), 1 SECOND)
|
||||
return INITIALIZE_HINT_LATELOAD
|
||||
|
||||
/obj/machinery/am_shielding/LateInitialize()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/am_shielding/proc/link_control(var/obj/machinery/power/am_control_unit/AMC)
|
||||
if(!istype(AMC))
|
||||
return 0
|
||||
return FALSE
|
||||
if(control_unit && control_unit != AMC)
|
||||
return 0//Already have one
|
||||
return FALSE // already have one
|
||||
control_unit = AMC
|
||||
return control_unit.add_shielding(src,1)
|
||||
return control_unit.add_shielding(src, TRUE)
|
||||
|
||||
/obj/machinery/am_shielding/Destroy()
|
||||
if(control_unit)
|
||||
control_unit.remove_shielding(src)
|
||||
if(processing)
|
||||
shutdown_core()
|
||||
visible_message("<span class='warning'>\The [src.name] melts!</span>")
|
||||
//Might want to have it leave a mess on the floor but no sprites for now
|
||||
visible_message(SPAN_WARNING("\The [src] melts!"))
|
||||
// Might want to have it leave a mess on the floor but no sprites for now
|
||||
return ..()
|
||||
|
||||
/obj/machinery/am_shielding/proc/controllerscan(var/priorscan = 0)
|
||||
/obj/machinery/am_shielding/proc/controllerscan(var/priorscan = FALSE)
|
||||
//Make sure we are the only one here
|
||||
if(!istype(src.loc, /turf))
|
||||
if(!isturf(loc))
|
||||
qdel(src)
|
||||
return
|
||||
for(var/obj/machinery/am_shielding/AMS in loc.contents)
|
||||
if(AMS == src)
|
||||
continue
|
||||
for(var/obj/machinery/am_shielding/AMS in loc.contents - src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
@@ -93,14 +86,14 @@ proc/cardinalrange(var/center)
|
||||
if(!mapped) // Prevent rescanning and suicide if it's part of the map
|
||||
if(!priorscan)
|
||||
sleep(20)
|
||||
controllerscan(1)//Last chance
|
||||
controllerscan(TRUE)//Last chance
|
||||
return
|
||||
qdel(src)
|
||||
|
||||
// Find surrounding unconnected shielding and add them to our controller
|
||||
/obj/machinery/am_shielding/proc/assimilate()
|
||||
if(!control_unit)
|
||||
return // nothing to share :'^(
|
||||
return // nothing to share :'^[
|
||||
for(var/obj/machinery/am_shielding/neighbor in cardinalrange(src))
|
||||
if(neighbor && !neighbor.control_unit)
|
||||
neighbor.link_control(control_unit)
|
||||
@@ -108,9 +101,8 @@ proc/cardinalrange(var/center)
|
||||
|
||||
/obj/machinery/am_shielding/Cross(atom/movable/mover, turf/target, height=1.5, air_group = 0)
|
||||
if(air_group || (height==0))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/am_shielding/machinery_process()
|
||||
if(!processing)
|
||||
@@ -120,8 +112,7 @@ proc/cardinalrange(var/center)
|
||||
|
||||
|
||||
/obj/machinery/am_shielding/emp_act()//Immune due to not really much in the way of electronics.
|
||||
return 0
|
||||
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/am_shielding/ex_act(severity)
|
||||
switch(severity)
|
||||
@@ -131,86 +122,86 @@ proc/cardinalrange(var/center)
|
||||
stability -= 40
|
||||
if(3.0)
|
||||
stability -= 20
|
||||
check_stability()
|
||||
|
||||
/obj/machinery/am_shielding/update_icon()
|
||||
overlays.len = 0
|
||||
cut_overlays()
|
||||
coredirs = 0
|
||||
dirs = 0
|
||||
for(var/direction in alldirs)
|
||||
var/turf/T = get_step(loc, direction)
|
||||
for(var/obj/machinery/machine in T)
|
||||
// Detect cores
|
||||
if((istype(machine, /obj/machinery/am_shielding) && machine:control_unit == control_unit && machine:processing))
|
||||
coredirs |= direction
|
||||
if(istype(machine, /obj/machinery/am_shielding))
|
||||
var/obj/machinery/am_shielding/AMS = machine
|
||||
if(AMS.control_unit == control_unit && AMS.processing)
|
||||
coredirs |= direction
|
||||
|
||||
// Detect cores, shielding, and control boxen.
|
||||
if(direction in cardinal)
|
||||
if((istype(machine, /obj/machinery/am_shielding) && machine:control_unit == control_unit) || (istype(machine, /obj/machinery/power/am_control_unit) && machine == control_unit))
|
||||
dirs |= direction
|
||||
if(istype(machine, /obj/machinery/am_shielding))
|
||||
var/obj/machinery/am_shielding/AMS = machine
|
||||
if(AMS.control_unit == control_unit)
|
||||
dirs |= direction
|
||||
else if(istype(machine, /obj/machinery/power/am_control_unit))
|
||||
var/obj/machinery/power/am_control_unit/AMCU = machine
|
||||
if(AMCU == control_unit)
|
||||
dirs |= direction
|
||||
|
||||
// If we're next to a core, set the prefix.
|
||||
var/prefix = ""
|
||||
var/icondirs = dirs
|
||||
|
||||
if(coredirs)
|
||||
prefix="core"
|
||||
var/is_core = core_check()
|
||||
|
||||
// Set our overlay
|
||||
icon_state = "[prefix]shield_[icondirs]"
|
||||
|
||||
if(core_check())
|
||||
if(!is_core)
|
||||
icon_state = "shield_[dirs]"
|
||||
if(is_core)
|
||||
icon_state = "core[control_unit && control_unit.active]"
|
||||
if(!processing)
|
||||
setup_core()
|
||||
else if(processing)
|
||||
shutdown_core()
|
||||
|
||||
|
||||
/obj/machinery/am_shielding/attackby(obj/item/W, mob/user)
|
||||
if(!istype(W) || !user)
|
||||
return
|
||||
if(W.force > 10)
|
||||
stability -= W.force/2
|
||||
user.do_attack_animation(src, W)
|
||||
stability -= W.force / 2
|
||||
check_stability()
|
||||
..()
|
||||
return
|
||||
return ..()
|
||||
|
||||
//Scans cards for shields or the control unit and if all there it
|
||||
/obj/machinery/am_shielding/proc/core_check()
|
||||
for(var/direction in alldirs)
|
||||
var/found_am_device=0
|
||||
var/found_am_device = FALSE
|
||||
for(var/obj/machinery/machine in get_step(loc, direction))
|
||||
if(!machine)
|
||||
continue
|
||||
if(istype(machine, /obj/machinery/am_shielding) || istype(machine, /obj/machinery/power/am_control_unit))
|
||||
found_am_device=1
|
||||
found_am_device = TRUE
|
||||
break
|
||||
if(!found_am_device)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/am_shielding/proc/setup_core()
|
||||
processing = 1
|
||||
processing = TRUE
|
||||
if(!control_unit)
|
||||
return
|
||||
control_unit.linked_cores.Add(src)
|
||||
LAZYADD(control_unit.linked_cores, src)
|
||||
control_unit.reported_core_efficiency += efficiency
|
||||
|
||||
|
||||
/obj/machinery/am_shielding/proc/shutdown_core()
|
||||
processing = 0
|
||||
if(!control_unit)
|
||||
return
|
||||
control_unit.linked_cores.Remove(src)
|
||||
LAZYREMOVE(control_unit.linked_cores, src)
|
||||
control_unit.reported_core_efficiency -= efficiency
|
||||
|
||||
|
||||
/obj/machinery/am_shielding/proc/check_stability(var/injecting_fuel = 0)
|
||||
/obj/machinery/am_shielding/proc/check_stability(var/injecting_fuel = FALSE)
|
||||
if(stability > 0)
|
||||
return
|
||||
if(injecting_fuel && control_unit)
|
||||
control_unit.exploding = 1
|
||||
control_unit.exploding = TRUE
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/am_shielding/proc/recalc_efficiency(var/new_efficiency)//tbh still not 100% sure how I want to deal with efficiency so this is likely temp
|
||||
@@ -221,8 +212,6 @@ proc/cardinalrange(var/center)
|
||||
control_unit.reported_core_efficiency += (new_efficiency - efficiency)
|
||||
efficiency = new_efficiency
|
||||
|
||||
|
||||
|
||||
/obj/item/device/am_shielding_container
|
||||
name = "packaged antimatter reactor section"
|
||||
desc = "A section of antimatter reactor shielding. Do not eat."
|
||||
@@ -230,31 +219,30 @@ proc/cardinalrange(var/center)
|
||||
icon = 'icons/obj/machines/antimatter.dmi'
|
||||
icon_state = "box"
|
||||
item_state = "electronic"
|
||||
siemens_coefficient = 1
|
||||
throwforce = 5
|
||||
throw_speed = 1
|
||||
throw_range = 2
|
||||
|
||||
/obj/item/device/am_shielding_container/attackby(var/obj/item/I, var/mob/user)
|
||||
if(I.ismultitool() && isturf(loc))
|
||||
if(locate(/obj/machinery/am_shielding/) in loc)
|
||||
to_chat(user, "<span class='warning'>[icon2html(src, user)]There is already an antimatter reactor section there.</span>")
|
||||
if(locate(/obj/machinery/am_shielding) in loc)
|
||||
to_chat(user, SPAN_WARNING("There is already an antimatter reactor section there."))
|
||||
return
|
||||
|
||||
//Search for shielding first
|
||||
for(var/obj/machinery/am_shielding/AMS in cardinalrange(src))
|
||||
if(AMS.control_unit)
|
||||
new/obj/machinery/am_shielding(src.loc, AMS.control_unit)
|
||||
new /obj/machinery/am_shielding(loc, AMS.control_unit)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
//No other guys nearby, look for a control unit
|
||||
var/obj/machinery/power/am_control_unit/AMC = locate() in cardinalrange(src)
|
||||
if(AMC && AMC.anchored)
|
||||
new/obj/machinery/am_shielding(src.loc, AMC)
|
||||
if(AMC?.anchored)
|
||||
new /obj/machinery/am_shielding(loc, AMC)
|
||||
qdel(src)
|
||||
else //Stranded & Alone
|
||||
to_chat(user, "<span class='warning'>[icon2html(src, user)]Couldn't connect to an Antimatter Control Unit.</span>")
|
||||
to_chat(user, SPAN_WARNING("\The [src] couldn't connect to an Antimatter Control Unit."))
|
||||
return
|
||||
|
||||
..()
|
||||
..()
|
||||
Reference in New Issue
Block a user