mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
Merge branch 'master' of https://github.com/tgstation/-tg-station into 13/10/2013-Limb/organ-stuff
This probably broke everything... :(
This commit is contained in:
+90
-127
@@ -485,133 +485,87 @@
|
||||
if(wiresexposed /*&& (!istype(user, /mob/living/silicon))*/) //Commented out the typecheck to allow engiborgs to repair damaged apcs.
|
||||
wires.Interact(user)
|
||||
|
||||
user.set_machine(src)
|
||||
var/t = "" //"<B>Area Power Controller</B> ([area.name])"
|
||||
|
||||
//This goes after the wire stuff. They should be able to fix a physical problem when a wire is cut
|
||||
if ( (get_dist(src, user) > 1 ))
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=apc")
|
||||
return
|
||||
else if (istype(user, /mob/living/silicon) && src.aidisabled && !src.malfhack)
|
||||
user << "AI control for this APC interface has been disabled."
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=apc")
|
||||
return
|
||||
else if (src.malfai)
|
||||
if ((src.malfai != user && src.malfai != user:parent) && !islinked(user, malfai))
|
||||
user << "AI control for this APC interface has been disabled."
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=apc")
|
||||
return
|
||||
return ui_interact(user)
|
||||
|
||||
|
||||
if(locked && (!istype(user, /mob/living/silicon)))
|
||||
t += "<div class='notice icon'>Swipe ID card to unlock interface</div>"
|
||||
t += "<h3>Status</h3>"
|
||||
t += "Main Breaker: <B>[operating ? "<font class='good'>On</font>" : "<font class='bad'>Off</font>"]</B><br />"
|
||||
t += "External Power: <B>[ main_status ? (main_status ==2 ? "<font class='good'>Good</font>" : "<font class='average'>Low</font>") : "<font class='bad'>None</font>"]</B><br />"
|
||||
t += "Power Cell: <B>[cell ? "[round(cell.percent())]%" : "<font COLOR=red>Not connected.</font>"]</B>"
|
||||
if(cell)
|
||||
t += "<BR/>Charge Mode: [chargemode ? "Auto" : "Off"]"
|
||||
t += " ([charging ? ( charging == 1 ? "Charging" : "Fully charged" ) : "Not charging"])"
|
||||
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main")
|
||||
if(!user)
|
||||
return
|
||||
|
||||
t += "<h3>Power Channels</h3><PRE>"
|
||||
|
||||
var/list/L = list ("Off","Off (Auto)", "On", "On (Auto)")
|
||||
|
||||
t += "Equipment: [add_lspace(lastused_equip, 6)] W : <B>[L[equipment+1]]</B><br />"
|
||||
t += "Lighting: [add_lspace(lastused_light, 6)] W : <B>[L[lighting+1]]</B><br />"
|
||||
t += "Environmental:[add_lspace(lastused_environ, 6)] W : <B>[L[environ+1]]</B><br />"
|
||||
|
||||
t += "<br />Total Load: [lastused_light + lastused_equip + lastused_environ] W</PRE>"
|
||||
t += "<br />Cover Lock: <B>[coverlocked ? "Engaged" : "Disengaged"]</B>"
|
||||
|
||||
else
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
t += "<div class='notice icon'>Swipe ID card to lock interface</div>"
|
||||
t += "<h3>Status</h3>"
|
||||
t += "Main Breaker: [operating ? "<span class='linkOn'>On</span> <A href='?src=\ref[src];breaker=1'>Off</A>" : "<A href='?src=\ref[src];breaker=1'>On</A> <span class='linkOn'>Off</span>" ]<br />"
|
||||
t += "External power : <B>[ main_status ? (main_status ==2 ? "<font class='good'>Good</font>" : "<font class='average'>Low</font>") : "<font class='bad'>None</font>"]</B><br />"
|
||||
if(cell)
|
||||
t += "Power cell: <B>[round(cell.percent())]%</B>"
|
||||
t += "<BR/>Charge mode: [chargemode ? "<A href='?src=\ref[src];cmode=1'>Off</A> <span class='linkOn'>Auto</span>" : "<span class='linkOn'>Off</span> <A href='?src=\ref[src];cmode=1'>Auto</A>"]"
|
||||
t += " ([charging ? ( charging == 1 ? "Charging" : "Fully charged" ) : "Not charging"])"
|
||||
var/malfStatus
|
||||
if (ticker && ticker.mode && (user.mind in ticker.mode.malf_ai) && istype(user, /mob/living/silicon/ai))
|
||||
if (src.malfai == (user:parent ? user:parent : user))
|
||||
if (src.occupant == user)
|
||||
malfStatus = 3 // 3 = User is shunted in this APC
|
||||
else if (istype(user.loc, /obj/machinery/power/apc))
|
||||
malfStatus = 4 // 4 = User is shunted in another APC
|
||||
else
|
||||
malfStatus = 2 // 2 = APC hacked by user, and user is in its core.
|
||||
else
|
||||
t += "Power cell: <B><font COLOR=red>Not connected.</font></B>"
|
||||
malfStatus = 1 // 1 = APC not hacked.
|
||||
else
|
||||
malfStatus = 0 // 0 = User is not a Malf AI
|
||||
|
||||
t += "<br /><h3>Power channels</h3><PRE>"
|
||||
var/list/data = list(
|
||||
"locked" = locked,
|
||||
"isOperating" = operating,
|
||||
"externalPower" = main_status,
|
||||
"powerCellStatus" = cell ? cell.percent() : null,
|
||||
"chargeMode" = chargemode,
|
||||
"chargingStatus" = charging,
|
||||
"totalLoad" = lastused_equip + lastused_light + lastused_environ,
|
||||
"coverLocked" = coverlocked,
|
||||
"siliconUser" = istype(user, /mob/living/silicon),
|
||||
"malfStatus" = malfStatus,
|
||||
|
||||
t += "Equipment: [add_lspace(lastused_equip, 6)] W : "
|
||||
var/key = "eqp"
|
||||
switch(equipment)
|
||||
if(0)
|
||||
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];[key]=2'>On</A> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(1)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (Off)</span>"
|
||||
if(2)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <span class='linkOn'>On</span> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(3)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (On)</span>"
|
||||
t +="<br />"
|
||||
"powerChannels" = list(
|
||||
list(
|
||||
"title" = "Equipment",
|
||||
"powerLoad" = lastused_equip,
|
||||
"status" = equipment,
|
||||
"topicParams" = list(
|
||||
"auto" = list("eqp" = 3),
|
||||
"on" = list("eqp" = 2),
|
||||
"off" = list("eqp" = 1)
|
||||
)
|
||||
),
|
||||
list(
|
||||
"title" = "Lighting",
|
||||
"powerLoad" = lastused_light,
|
||||
"status" = lighting,
|
||||
"topicParams" = list(
|
||||
"auto" = list("lgt" = 3),
|
||||
"on" = list("lgt" = 2),
|
||||
"off" = list("lgt" = 1)
|
||||
)
|
||||
),
|
||||
list(
|
||||
"title" = "Environment",
|
||||
"powerLoad" = lastused_environ,
|
||||
"status" = environ,
|
||||
"topicParams" = list(
|
||||
"auto" = list("env" = 3),
|
||||
"on" = list("env" = 2),
|
||||
"off" = list("env" = 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
t += "Lighting: [add_lspace(lastused_light, 6)] W : "
|
||||
key = "lgt"
|
||||
switch(lighting)
|
||||
if(0)
|
||||
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];[key]=2'>On</A> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(1)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (Off)</span>"
|
||||
if(2)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <span class='linkOn'>On</span> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(3)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (On)</span>"
|
||||
t +="<br />"
|
||||
|
||||
|
||||
t += "Environmental:[add_lspace(lastused_environ, 6)] W : "
|
||||
key = "env"
|
||||
switch(environ)
|
||||
if(0)
|
||||
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];[key]=2'>On</A> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(1)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (Off)</span>"
|
||||
if(2)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <span class='linkOn'>On</span> <A href='?src=\ref[src];[key]=3'>Auto</A>"
|
||||
if(3)
|
||||
t += "<A href='?src=\ref[src];[key]=1'>Off</A> <A href='?src=\ref[src];[key]=2'>On</A> <span class='linkOn'>Auto (On)</span>"
|
||||
|
||||
|
||||
|
||||
t += "<br />Total Load: [lastused_light + lastused_equip + lastused_environ] W</PRE>"
|
||||
t += "<br />Cover Lock: [coverlocked ? "<B><A href='?src=\ref[src];lock=1'>Engaged</A></B>" : "<B><A href='?src=\ref[src];lock=1'>Disengaged</A></B>"]"
|
||||
|
||||
|
||||
if (istype(user, /mob/living/silicon))
|
||||
t += "<br /><A href='?src=\ref[src];overload=1'><I>Overload lighting circuit</I></A><br />"
|
||||
if (ticker && ticker.mode)
|
||||
// world << "there's a ticker"
|
||||
if(user.mind in ticker.mode.malf_ai)
|
||||
// world << "ticker says its malf"
|
||||
if (!src.malfai)
|
||||
t += "<br /><A href='?src=\ref[src];malfhack=1'><I>Override Programming</I></A><br />"
|
||||
else
|
||||
t += "<br /><I>APC Hacked</I><br />"
|
||||
if(!src.occupant)
|
||||
t += "<A href='?src=\ref[src];occupyapc=1'><I>Shunt Core Processes</I></A><br />"
|
||||
else
|
||||
t += "<I>Core Processes Uploaded</I><br />"
|
||||
|
||||
//t += "<br /><HR><A href='?src=\ref[src];close=1'>Close</A>"
|
||||
|
||||
//user << browse(t, "window=apc")
|
||||
//onclose(user, "apc")
|
||||
var/datum/browser/popup = new(user, "apc", "[area.name] APC")
|
||||
popup.set_content(t)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
return
|
||||
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, ui_key)
|
||||
if (!ui)
|
||||
// the ui does not exist, so we'll create a new one
|
||||
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 500, data["siliconUser"] ? 465 : 390)
|
||||
// When the UI is first opened this is the data it will use
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
// Auto update every Master Controller tick
|
||||
ui.set_auto_update(1)
|
||||
else
|
||||
// The UI is already open so push the new data to it
|
||||
ui.push_data(data)
|
||||
return
|
||||
//user.set_machine(src)
|
||||
|
||||
/obj/machinery/power/apc/proc/report()
|
||||
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])"
|
||||
@@ -690,11 +644,11 @@
|
||||
|
||||
/obj/machinery/power/apc/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
return 0
|
||||
|
||||
if(!isrobot(usr))
|
||||
if(!can_use(usr, 1))
|
||||
return
|
||||
return 0
|
||||
|
||||
usr.set_machine(src)
|
||||
|
||||
@@ -734,11 +688,11 @@
|
||||
else if( href_list["close"] )
|
||||
usr << browse(null, "window=apc")
|
||||
usr.unset_machine()
|
||||
return
|
||||
return 0
|
||||
else if (href_list["close2"])
|
||||
usr << browse(null, "window=apcwires")
|
||||
usr.unset_machine()
|
||||
return
|
||||
return 0
|
||||
|
||||
else if (href_list["overload"])
|
||||
if( istype(usr, /mob/living/silicon) && !src.aidisabled )
|
||||
@@ -746,10 +700,10 @@
|
||||
|
||||
else if (href_list["malfhack"])
|
||||
var/mob/living/silicon/ai/malfai = usr
|
||||
if( istype(malfai, /mob/living/silicon/ai) && !src.aidisabled )
|
||||
if( istype(malfai, /mob/living/silicon/ai) && !src.aidisabled && (ticker && ticker.mode && (malfai.mind in ticker.mode.malf_ai)) )
|
||||
if (malfai.malfhacking)
|
||||
malfai << "You are already hacking an APC."
|
||||
return
|
||||
return 1
|
||||
malfai << "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process."
|
||||
malfai.malfhack = src
|
||||
malfai.malfhacking = 1
|
||||
@@ -758,6 +712,7 @@
|
||||
if (!src.aidisabled)
|
||||
malfai.malfhack = null
|
||||
malfai.malfhacking = 0
|
||||
locked = 1
|
||||
if (ticker.mode.config_tag == "malfunction")
|
||||
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
|
||||
ticker.mode:apcs++
|
||||
@@ -774,9 +729,17 @@
|
||||
else if (href_list["deoccupyapc"])
|
||||
malfvacate()
|
||||
|
||||
else if (href_list["toggleaccess"])
|
||||
if (istype(usr, /mob/living/silicon/ai) && !src.aidisabled)
|
||||
if(emagged || (stat & (BROKEN|MAINT)))
|
||||
usr << "The APC does not respond to the command."
|
||||
else
|
||||
locked = !locked
|
||||
update_icon()
|
||||
|
||||
src.updateDialog()
|
||||
|
||||
return
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/apc/proc/toggle_breaker()
|
||||
operating = !operating
|
||||
|
||||
@@ -218,15 +218,16 @@ display round(lastgen) and plasmatank amount
|
||||
|
||||
if(istype(O, /obj/item/weapon/wrench))
|
||||
|
||||
if(!anchored)
|
||||
if(!anchored && !isinspace())
|
||||
connect_to_network()
|
||||
user << "\blue You secure the generator to the floor."
|
||||
else
|
||||
anchored = 1
|
||||
else if(anchored)
|
||||
disconnect_from_network()
|
||||
user << "\blue You unsecure the generator from the floor."
|
||||
anchored = 0
|
||||
|
||||
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
anchored = !anchored
|
||||
|
||||
else if(istype(O, /obj/item/weapon/screwdriver))
|
||||
open = !open
|
||||
|
||||
@@ -75,14 +75,19 @@ var/global/list/rad_collectors = list()
|
||||
if(P)
|
||||
user << "\blue Remove the plasma tank first."
|
||||
return 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 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")
|
||||
if(anchored)
|
||||
connect_to_network()
|
||||
else
|
||||
if(!anchored && !isinspace())
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 1
|
||||
user.visible_message("[user.name] secures the [src.name].", \
|
||||
"You secure the external bolts.", \
|
||||
"You hear a ratchet")
|
||||
disconnect_from_network()
|
||||
else if(anchored)
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 0
|
||||
user.visible_message("[user.name] unsecures the [src.name].", \
|
||||
"You unsecure the external bolts.", \
|
||||
"You hear a ratchet")
|
||||
disconnect_from_network()
|
||||
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
|
||||
if (src.allowed(user))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
||||
|
||||
/obj/machinery/containment_field
|
||||
/obj/machinery/field/containment
|
||||
name = "Containment Field"
|
||||
desc = "An energy field."
|
||||
icon = 'icons/obj/singularity.dmi'
|
||||
@@ -10,18 +10,18 @@
|
||||
unacidable = 1
|
||||
use_power = 0
|
||||
luminosity = 4
|
||||
var/obj/machinery/field_generator/FG1 = null
|
||||
var/obj/machinery/field_generator/FG2 = null
|
||||
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
||||
layer = OBJ_LAYER + 0.1
|
||||
var/obj/machinery/field/generator/FG1 = null
|
||||
var/obj/machinery/field/generator/FG2 = null
|
||||
|
||||
/obj/machinery/containment_field/Del()
|
||||
/obj/machinery/field/containment/Del()
|
||||
if(FG1 && !FG1.clean_up)
|
||||
FG1.cleanup()
|
||||
if(FG2 && !FG2.clean_up)
|
||||
FG2.cleanup()
|
||||
..()
|
||||
|
||||
/obj/machinery/containment_field/attack_hand(mob/user as mob)
|
||||
/obj/machinery/field/containment/attack_hand(mob/user as mob)
|
||||
if(get_dist(src, user) > 1)
|
||||
return 0
|
||||
else
|
||||
@@ -29,81 +29,77 @@
|
||||
return 1
|
||||
|
||||
|
||||
/obj/machinery/containment_field/blob_act()
|
||||
/obj/machinery/field/containment/blob_act()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/containment_field/ex_act(severity)
|
||||
/obj/machinery/field/containment/ex_act(severity)
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/meteorhit()
|
||||
/obj/machinery/field/containment/meteorhit()
|
||||
return 0
|
||||
|
||||
/obj/machinery/containment_field/HasProximity(atom/movable/AM as mob|obj)
|
||||
if(istype(AM,/mob/living/silicon) && prob(40))
|
||||
shock(AM)
|
||||
return 1
|
||||
if(istype(AM,/mob/living/carbon) && prob(50))
|
||||
shock(AM)
|
||||
return 1
|
||||
return 0
|
||||
/obj/machinery/field/containment/Crossed(atom/movable/mover)
|
||||
if(isliving(mover))
|
||||
shock(mover)
|
||||
|
||||
|
||||
|
||||
/obj/machinery/containment_field/proc/shock(mob/living/user as mob)
|
||||
if(hasShocked)
|
||||
/obj/machinery/field/containment/proc/set_master(var/master1,var/master2)
|
||||
if(!master1 || !master2)
|
||||
return 0
|
||||
FG1 = master1
|
||||
FG2 = master2
|
||||
return 1
|
||||
|
||||
/obj/machinery/field/containment/shock(mob/living/user as mob)
|
||||
if(!FG1 || !FG2)
|
||||
del(src)
|
||||
return 0
|
||||
if(iscarbon(user))
|
||||
..()
|
||||
|
||||
// Abstract Field Class
|
||||
// Used for overriding certain procs
|
||||
|
||||
/obj/machinery/field
|
||||
var/hasShocked = 0 //Used to add a delay between shocks. In some cases this used to crash servers by spawning hundreds of sparks every second.
|
||||
|
||||
/obj/machinery/field/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
if(isliving(mover)) // Don't let mobs through
|
||||
shock(mover)
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
/obj/machinery/field/proc/shock(mob/living/user as mob)
|
||||
if(hasShocked)
|
||||
return 0
|
||||
if(isliving(user))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
|
||||
hasShocked = 1
|
||||
var/shock_damage = min(rand(30,40),rand(30,40))
|
||||
user.burn_skin(shock_damage)
|
||||
user.updatehealth()
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
|
||||
if(iscarbon(user))
|
||||
var/stun = min(shock_damage, 15)
|
||||
user.Stun(stun)
|
||||
user.Weaken(10)
|
||||
user.burn_skin(shock_damage)
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>You feel a powerful shock course through your body sending you flying!</B>", \
|
||||
"\red You hear a heavy electrical crack")
|
||||
|
||||
var/stun = min(shock_damage, 15)
|
||||
user.Stun(stun)
|
||||
user.Weaken(10)
|
||||
else if(issilicon(user))
|
||||
if(prob(20))
|
||||
user.Stun(2)
|
||||
user.take_overall_damage(0, shock_damage)
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>Energy pulse detected, system damaged!</B>", \
|
||||
"\red You hear an electrical crack")
|
||||
|
||||
user.updatehealth()
|
||||
var/atom/target = get_edge_target_turf(user, get_dir(src, get_step_away(user, src)))
|
||||
user.throw_at(target, 200, 4)
|
||||
|
||||
sleep(20)
|
||||
hasShocked = 0
|
||||
return
|
||||
|
||||
else if(issilicon(user))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, user.loc)
|
||||
s.start()
|
||||
|
||||
hasShocked = 1
|
||||
var/shock_damage = rand(15,30)
|
||||
user.take_overall_damage(0,shock_damage)
|
||||
user.visible_message("\red [user.name] was shocked by the [src.name]!", \
|
||||
"\red <B>Energy pulse detected, system damaged!</B>", \
|
||||
"\red You hear an electrical crack")
|
||||
if(prob(20))
|
||||
user.Stun(2)
|
||||
|
||||
sleep(20)
|
||||
hasShocked = 0
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/containment_field/proc/set_master(var/master1,var/master2)
|
||||
if(!master1 || !master2)
|
||||
return 0
|
||||
FG1 = master1
|
||||
FG2 = master2
|
||||
return 1
|
||||
spawn(5)
|
||||
hasShocked = 0
|
||||
return
|
||||
@@ -87,7 +87,7 @@
|
||||
src.use_power = 1 */
|
||||
return 1
|
||||
|
||||
/obj/machinery/containment_field/meteorhit()
|
||||
/obj/machinery/field/containment/meteorhit()
|
||||
return 0
|
||||
|
||||
/obj/machinery/power/emitter/process()
|
||||
@@ -149,7 +149,7 @@
|
||||
user << "Turn off the [src] first."
|
||||
return
|
||||
switch(state)
|
||||
if(0)
|
||||
if(0 && !isinspace())
|
||||
state = 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
|
||||
@@ -13,7 +13,7 @@ field_generator power level display
|
||||
*/
|
||||
|
||||
#define field_generator_max_power 250
|
||||
/obj/machinery/field_generator
|
||||
/obj/machinery/field/generator
|
||||
name = "Field Generator"
|
||||
desc = "A large thermal battery that projects a high amount of energy when powered."
|
||||
icon = 'icons/obj/machines/field_generator.dmi'
|
||||
@@ -28,16 +28,15 @@ field_generator power level display
|
||||
var/power = 20 // Current amount of power
|
||||
var/state = 0
|
||||
var/warming_up = 0
|
||||
var/list/obj/machinery/containment_field/fields
|
||||
var/list/obj/machinery/field_generator/connected_gens
|
||||
var/list/obj/machinery/field/containment/fields
|
||||
var/list/obj/machinery/field/generator/connected_gens
|
||||
var/clean_up = 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/update_icon()
|
||||
/obj/machinery/field/generator/update_icon()
|
||||
overlays.Cut()
|
||||
if(!active)
|
||||
if(warming_up)
|
||||
overlays += "+a[warming_up]"
|
||||
if(warming_up)
|
||||
overlays += "+a[warming_up]"
|
||||
if(fields.len)
|
||||
overlays += "+on"
|
||||
// Power level indicator
|
||||
@@ -51,14 +50,14 @@ field_generator power level display
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/New()
|
||||
/obj/machinery/field/generator/New()
|
||||
..()
|
||||
fields = list()
|
||||
connected_gens = list()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/process()
|
||||
/obj/machinery/field/generator/process()
|
||||
if(Varedit_start == 1)
|
||||
if(active == 0)
|
||||
active = 1
|
||||
@@ -76,7 +75,7 @@ field_generator power level display
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/attack_hand(mob/user as mob)
|
||||
/obj/machinery/field/generator/attack_hand(mob/user as mob)
|
||||
if(state == 2)
|
||||
if(get_dist(src, user) <= 1)//Need to actually touch the thing to turn it on
|
||||
if(src.active >= 1)
|
||||
@@ -95,13 +94,13 @@ field_generator power level display
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/attackby(obj/item/W, mob/user)
|
||||
/obj/machinery/field/generator/attackby(obj/item/W, mob/user)
|
||||
if(active)
|
||||
user << "The [src] needs to be off."
|
||||
return
|
||||
else if(istype(W, /obj/item/weapon/wrench))
|
||||
switch(state)
|
||||
if(0)
|
||||
if(0 && !isinspace())
|
||||
state = 1
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
@@ -153,41 +152,40 @@ field_generator power level display
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/field_generator/emp_act()
|
||||
/obj/machinery/field/generator/emp_act()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/blob_act()
|
||||
/obj/machinery/field/generator/blob_act()
|
||||
if(active)
|
||||
return 0
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/machinery/containment_field/meteorhit()
|
||||
return 0
|
||||
|
||||
/obj/machinery/field_generator/bullet_act(var/obj/item/projectile/Proj)
|
||||
/obj/machinery/field/generator/bullet_act(var/obj/item/projectile/Proj)
|
||||
if(Proj.flag != "bullet")
|
||||
power += Proj.damage
|
||||
update_icon()
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/Del()
|
||||
/obj/machinery/field/generator/Del()
|
||||
src.cleanup()
|
||||
..()
|
||||
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_off()
|
||||
/obj/machinery/field/generator/proc/turn_off()
|
||||
active = 0
|
||||
spawn(1)
|
||||
src.cleanup()
|
||||
update_icon()
|
||||
while (warming_up>0 && !active)
|
||||
sleep(50)
|
||||
warming_up--
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/field_generator/proc/turn_on()
|
||||
/obj/machinery/field/generator/proc/turn_on()
|
||||
active = 1
|
||||
warming_up = 1
|
||||
spawn(1)
|
||||
while (warming_up<3 && active)
|
||||
sleep(50)
|
||||
@@ -195,10 +193,9 @@ field_generator power level display
|
||||
update_icon()
|
||||
if(warming_up >= 3)
|
||||
start_fields()
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/calc_power()
|
||||
/obj/machinery/field/generator/proc/calc_power()
|
||||
if(Varpower)
|
||||
return 1
|
||||
|
||||
@@ -207,7 +204,7 @@ field_generator power level display
|
||||
src.power = field_generator_max_power
|
||||
|
||||
var/power_draw = 2
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
for (var/obj/machinery/field/containment/F in fields)
|
||||
if (isnull(F))
|
||||
continue
|
||||
power_draw++
|
||||
@@ -222,7 +219,7 @@ field_generator power level display
|
||||
return 0
|
||||
|
||||
//This could likely be better, it tends to start loopin if you have a complex generator loop setup. Still works well enough to run the engine fields will likely recode the field gens and fields sometime -Mport
|
||||
/obj/machinery/field_generator/proc/draw_power(var/draw = 0, var/failsafe = 0, var/obj/machinery/field_generator/G = null, var/obj/machinery/field_generator/last = null)
|
||||
/obj/machinery/field/generator/proc/draw_power(var/draw = 0, var/failsafe = 0, var/obj/machinery/field/generator/G = null, var/obj/machinery/field/generator/last = null)
|
||||
if(Varpower)
|
||||
return 1
|
||||
if((G && G == src) || (failsafe >= 8))//Loopin, set fail
|
||||
@@ -235,7 +232,7 @@ field_generator power level display
|
||||
else//Need more power
|
||||
draw -= src.power
|
||||
src.power = 0
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
for(var/obj/machinery/field/generator/FG in connected_gens)
|
||||
if(isnull(FG))
|
||||
continue
|
||||
if(FG == last)//We just asked you
|
||||
@@ -252,7 +249,7 @@ field_generator power level display
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/start_fields()
|
||||
/obj/machinery/field/generator/proc/start_fields()
|
||||
if(!src.state == 2 || !anchored)
|
||||
turn_off()
|
||||
return
|
||||
@@ -267,9 +264,9 @@ field_generator power level display
|
||||
src.active = 2
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/setup_field(var/NSEW)
|
||||
/obj/machinery/field/generator/proc/setup_field(var/NSEW)
|
||||
var/turf/T = src.loc
|
||||
var/obj/machinery/field_generator/G
|
||||
var/obj/machinery/field/generator/G
|
||||
var/steps = 0
|
||||
if(!NSEW)//Make sure its ran right
|
||||
return
|
||||
@@ -280,11 +277,11 @@ field_generator power level display
|
||||
for(var/atom/A in T.contents)
|
||||
if(ismob(A))
|
||||
continue
|
||||
if(!istype(A,/obj/machinery/field_generator))
|
||||
if(!istype(A,/obj/machinery/field/generator))
|
||||
if((istype(A,/obj/machinery/door)||istype(A,/obj/machinery/the_singularitygen))&&(A.density))
|
||||
return 0
|
||||
steps += 1
|
||||
G = locate(/obj/machinery/field_generator) in T
|
||||
G = locate(/obj/machinery/field/generator) in T
|
||||
if(!isnull(G))
|
||||
steps -= 1
|
||||
if(!G.active)
|
||||
@@ -296,15 +293,17 @@ field_generator power level display
|
||||
for(var/dist = 0, dist < steps, dist += 1) // creates each field tile
|
||||
var/field_dir = get_dir(T,get_step(G.loc, NSEW))
|
||||
T = get_step(T, NSEW)
|
||||
if(!locate(/obj/machinery/containment_field) in T)
|
||||
var/obj/machinery/containment_field/CF = new/obj/machinery/containment_field()
|
||||
if(!locate(/obj/machinery/field/containment) in T)
|
||||
var/obj/machinery/field/containment/CF = new/obj/machinery/field/containment()
|
||||
CF.set_master(src,G)
|
||||
fields += CF
|
||||
G.fields += CF
|
||||
CF.loc = T
|
||||
CF.dir = field_dir
|
||||
for(var/mob/living/L in CF.loc)
|
||||
CF.Crossed(L)
|
||||
var/listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
for(var/obj/machinery/field/generator/FG in connected_gens)
|
||||
if (isnull(FG))
|
||||
continue
|
||||
if(FG == G)
|
||||
@@ -313,7 +312,7 @@ field_generator power level display
|
||||
if(!listcheck)
|
||||
connected_gens.Add(G)
|
||||
listcheck = 0
|
||||
for(var/obj/machinery/field_generator/FG2 in G.connected_gens)
|
||||
for(var/obj/machinery/field/generator/FG2 in G.connected_gens)
|
||||
if (isnull(FG2))
|
||||
continue
|
||||
if(FG2 == src)
|
||||
@@ -323,14 +322,14 @@ field_generator power level display
|
||||
G.connected_gens.Add(src)
|
||||
|
||||
|
||||
/obj/machinery/field_generator/proc/cleanup()
|
||||
/obj/machinery/field/generator/proc/cleanup()
|
||||
clean_up = 1
|
||||
for (var/obj/machinery/containment_field/F in fields)
|
||||
for (var/obj/machinery/field/containment/F in fields)
|
||||
if (isnull(F))
|
||||
continue
|
||||
del(F)
|
||||
fields = list()
|
||||
for(var/obj/machinery/field_generator/FG in connected_gens)
|
||||
for(var/obj/machinery/field/generator/FG in connected_gens)
|
||||
if (isnull(FG))
|
||||
continue
|
||||
FG.connected_gens.Remove(src)
|
||||
@@ -353,3 +352,7 @@ field_generator power level display
|
||||
message_admins("A singulo exists and a containment field has failed.",1)
|
||||
investigate_log("has <font color='red'>failed</font> whilst a singulo exists.","singulo")
|
||||
O.last_warning = world.time
|
||||
|
||||
/obj/machinery/field/generator/shock(mob/living/user as mob)
|
||||
if(fields.len)
|
||||
..()
|
||||
@@ -17,15 +17,18 @@
|
||||
|
||||
/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)
|
||||
if(anchored)
|
||||
|
||||
if(!anchored && !isinspace())
|
||||
user.visible_message("[user.name] secures [src.name] to the floor.", \
|
||||
"You secure the [src.name] to the floor.", \
|
||||
"You hear a ratchet")
|
||||
else
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 1
|
||||
else if(anchored)
|
||||
user.visible_message("[user.name] unsecures [src.name] from the floor.", \
|
||||
"You unsecure the [src.name] from the floor.", \
|
||||
"You hear a ratchet")
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
anchored = 0
|
||||
return
|
||||
return ..()
|
||||
|
||||
@@ -211,7 +211,7 @@ 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(istype(O, /obj/item/weapon/wrench))
|
||||
if(istype(O, /obj/item/weapon/wrench) && !isinspace())
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
|
||||
src.anchored = 1
|
||||
user.visible_message("[user.name] secures the [src.name] to the floor.", \
|
||||
|
||||
@@ -104,7 +104,7 @@ var/global/list/uneatable = list(
|
||||
|
||||
/obj/machinery/singularity/proc/admin_investigate_setup()
|
||||
last_warning = world.time
|
||||
var/count = locate(/obj/machinery/containment_field) in orange(30, src)
|
||||
var/count = locate(/obj/machinery/field/containment) in orange(30, src)
|
||||
if(!count) message_admins("A singulo has been created without containment fields active ([x],[y],[z])",1)
|
||||
investigate_log("was created. [count?"":"<font color='red'>No containment fields were active</font>"]","singulo")
|
||||
|
||||
@@ -376,10 +376,10 @@ var/global/list/uneatable = list(
|
||||
/obj/machinery/singularity/proc/can_move(var/turf/T)
|
||||
if(!T)
|
||||
return 0
|
||||
if((locate(/obj/machinery/containment_field) in T)||(locate(/obj/machinery/shieldwall) in T))
|
||||
if((locate(/obj/machinery/field/containment) in T)||(locate(/obj/machinery/shieldwall) in T))
|
||||
return 0
|
||||
else if(locate(/obj/machinery/field_generator) in T)
|
||||
var/obj/machinery/field_generator/G = locate(/obj/machinery/field_generator) in T
|
||||
else if(locate(/obj/machinery/field/generator) in T)
|
||||
var/obj/machinery/field/generator/G = locate(/obj/machinery/field/generator) in T
|
||||
if(G && G.active)
|
||||
return 0
|
||||
else if(locate(/obj/machinery/shieldwallgen) in T)
|
||||
|
||||
Reference in New Issue
Block a user