Merge remote-tracking branch 'bay12-upstream/master' into development

This commit is contained in:
skull132
2016-10-07 00:58:39 +03:00
1594 changed files with 53994 additions and 48590 deletions
-13
View File
@@ -101,19 +101,6 @@
return 0
/obj/machinery/power/am_control_unit/blob_act()
stability -= 20
if(prob(100-stability))//Might infect the rest of the machine
for(var/obj/machinery/am_shielding/AMS in linked_shielding)
AMS.blob_act()
spawn(0)
//Likely explode
qdel(src)
return
check_stability()
return
/obj/machinery/power/am_control_unit/ex_act(severity)
switch(severity)
if(1.0)
@@ -90,20 +90,6 @@ proc/cardinalrange(var/center)
return 0
/obj/machinery/am_shielding/blob_act()
stability -= 20
if(prob(100-stability))
if(prob(10))//Might create a node
new /obj/effect/blob/node(src.loc,150)
else
new /obj/effect/blob(src.loc,60)
spawn(0)
qdel(src)
return
check_stability()
return
/obj/machinery/am_shielding/ex_act(severity)
switch(severity)
if(1.0)
+114 -105
View File
@@ -1,12 +1,12 @@
//update_state
#define UPSTATE_CELL_IN 1
#define UPSTATE_OPENED1 2
#define UPSTATE_OPENED2 4
#define UPSTATE_MAINT 8
#define UPSTATE_BROKE 16
#define UPSTATE_BLUESCREEN 32
#define UPSTATE_WIREEXP 64
#define UPSTATE_ALLGOOD 128
#define UPDATE_CELL_IN 1
#define UPDATE_OPENED1 2
#define UPDATE_OPENED2 4
#define UPDATE_MAINT 8
#define UPDATE_BROKE 16
#define UPDATE_BLUESCREEN 32
#define UPDATE_WIREEXP 64
#define UPDATE_ALLGOOD 128
//update_overlay
#define APC_UPOVERLAY_CHARGEING0 1
@@ -43,6 +43,16 @@
/obj/machinery/power/apc/high
cell_type = /obj/item/weapon/cell/high
// Construction site APC, starts turned off
/obj/machinery/power/apc/high/inactive
cell_type = /obj/item/weapon/cell/high
lighting = 0
equipment = 0
environ = 0
locked = 0
coverlocked = 0
start_charge = 100
/obj/machinery/power/apc/super
cell_type = /obj/item/weapon/cell/super
@@ -63,6 +73,7 @@
var/area/area
var/areastring = null
var/obj/item/weapon/cell/cell
var/chargelevel = 0.0005 // Cap for how fast APC cells charge, as a percentage-per-tick (0.01 means cellcharge is capped to 1% per second)
var/start_charge = 90 // initial cell charge %
var/cell_type = /obj/item/weapon/cell/apc
var/opened = 0 //0=closed, 1=opened, 2=cover removed
@@ -99,6 +110,8 @@
var/is_critical = 0
var/global/status_overlays = 0
var/updating_icon = 0
var/failure_timer = 0
var/force_update = 0
var/global/list/status_overlays_lock
var/global/list/status_overlays_charging
var/global/list/status_overlays_equipment
@@ -169,21 +182,22 @@
area.power_equip = 0
area.power_environ = 0
area.power_change()
if(wires)
qdel(wires)
wires = null
qdel(wires)
wires = null
qdel(terminal)
terminal = null
if(cell)
cell.loc = loc
cell.forceMove(loc)
cell = null
if(terminal)
qdel(terminal)
terminal = null
// Malf AI, removes the APC from AI's hacked APCs list.
if((hacker) && (hacker.hacked_apcs) && (src in hacker.hacked_apcs))
hacker.hacked_apcs -= src
..()
return ..()
/obj/machinery/power/apc/proc/energy_fail(var/duration)
failure_timer = max(failure_timer, duration)
/obj/machinery/power/apc/proc/make_terminal()
// create a terminal object at the same position as original turf loc
@@ -287,25 +301,25 @@
return
if(update & 1) // Updating the icon state
if(update_state & UPSTATE_ALLGOOD)
if(update_state & UPDATE_ALLGOOD)
icon_state = "apc0"
else if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2))
else if(update_state & (UPDATE_OPENED1|UPDATE_OPENED2))
var/basestate = "apc[ cell ? "2" : "1" ]"
if(update_state & UPSTATE_OPENED1)
if(update_state & (UPSTATE_MAINT|UPSTATE_BROKE))
if(update_state & UPDATE_OPENED1)
if(update_state & (UPDATE_MAINT|UPDATE_BROKE))
icon_state = "apcmaint" //disabled APC cannot hold cell
else
icon_state = basestate
else if(update_state & UPSTATE_OPENED2)
else if(update_state & UPDATE_OPENED2)
icon_state = "[basestate]-nocover"
else if(update_state & UPSTATE_BROKE)
else if(update_state & UPDATE_BROKE)
icon_state = "apc-b"
else if(update_state & UPSTATE_BLUESCREEN)
else if(update_state & UPDATE_BLUESCREEN)
icon_state = "apcemag"
else if(update_state & UPSTATE_WIREEXP)
else if(update_state & UPDATE_WIREEXP)
icon_state = "apcewires"
if(!(update_state & UPSTATE_ALLGOOD))
if(!(update_state & UPDATE_ALLGOOD))
if(overlays.len)
overlays = 0
return
@@ -313,7 +327,7 @@
if(update & 2)
if(overlays.len)
overlays.len = 0
if(!(stat & (BROKEN|MAINT)) && update_state & UPSTATE_ALLGOOD)
if(!(stat & (BROKEN|MAINT)) && update_state & UPDATE_ALLGOOD)
overlays += status_overlays_lock[locked+1]
overlays += status_overlays_charging[charging+1]
if(operating)
@@ -321,6 +335,21 @@
overlays += status_overlays_lighting[lighting+1]
overlays += status_overlays_environ[environ+1]
if(update & 3)
if(update_state & UPDATE_BLUESCREEN)
set_light(l_range = 2, l_power = 0.5, l_color = "#0000FF")
else if(!(stat & (BROKEN|MAINT)) && update_state & UPDATE_ALLGOOD)
var/color
switch(charging)
if(0)
color = "#F86060"
if(1)
color = "#A8B0F8"
if(2)
color = "#82FF4C"
set_light(l_range = 2, l_power = 0.5, l_color = color)
else
set_light(0)
/obj/machinery/power/apc/proc/check_updates()
@@ -330,27 +359,27 @@
update_overlay = 0
if(cell)
update_state |= UPSTATE_CELL_IN
update_state |= UPDATE_CELL_IN
if(stat & BROKEN)
update_state |= UPSTATE_BROKE
update_state |= UPDATE_BROKE
if(stat & MAINT)
update_state |= UPSTATE_MAINT
update_state |= UPDATE_MAINT
if(opened)
if(opened==1)
update_state |= UPSTATE_OPENED1
update_state |= UPDATE_OPENED1
if(opened==2)
update_state |= UPSTATE_OPENED2
else if(emagged || hacker)
update_state |= UPSTATE_BLUESCREEN
update_state |= UPDATE_OPENED2
else if(emagged || hacker || failure_timer)
update_state |= UPDATE_BLUESCREEN
else if(wiresexposed)
update_state |= UPSTATE_WIREEXP
update_state |= UPDATE_WIREEXP
if(update_state <= 1)
update_state |= UPSTATE_ALLGOOD
update_state |= UPDATE_ALLGOOD
if(operating)
update_overlay |= APC_UPOVERLAY_OPERATING
if(update_state & UPSTATE_ALLGOOD)
if(update_state & UPDATE_ALLGOOD)
if(locked)
update_overlay |= APC_UPOVERLAY_LOCKED
@@ -452,7 +481,7 @@
return
user.drop_item()
W.loc = src
W.forceMove(src)
cell = W
user.visible_message(\
"<span class='warning'>[user.name] has inserted the power cell to [src.name]!</span>",\
@@ -502,25 +531,9 @@
update_icon()
else
user << "<span class='warning'>Access denied.</span>"
else if (istype(W, /obj/item/weapon/card/emag) && !(emagged || hacker)) // trying to unlock with an emag card
if(opened)
user << "You must close the cover to swipe an ID card."
else if(wiresexposed)
user << "You must close the panel first"
else if(stat & (BROKEN|MAINT))
user << "Nothing happens."
else
flick("apc-spark", src)
if (do_after(user,6))
if(prob(50))
emagged = 1
locked = 0
user << "<span class='notice'>You emag the APC interface.</span>"
update_icon()
else
user << "<span class='warning'>You fail to [ locked ? "unlock" : "lock"] the APC interface.</span>"
else if (istype(W, /obj/item/stack/cable_coil) && !terminal && opened && has_electronics!=2)
if (src.loc:intact)
var/turf/T = loc
if(istype(T) && !T.is_plating())
user << "<span class='warning'>You must remove the floor plating in front of the APC first.</span>"
return
var/obj/item/stack/cable_coil/C = W
@@ -532,7 +545,6 @@
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if (C.amount >= 10 && !terminal && opened && has_electronics != 2)
var/turf/T = get_turf(src)
var/obj/structure/cable/N = T.get_cable_node()
if (prob(50) && electrocute_mob(usr, N, N))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
@@ -547,7 +559,8 @@
make_terminal()
terminal.connect_to_network()
else if (istype(W, /obj/item/weapon/wirecutters) && terminal && opened && has_electronics!=2)
if (src.loc:intact)
var/turf/T = loc
if(istype(T) && !T.is_plating())
user << "<span class='warning'>You must remove the floor plating in front of the APC first.</span>"
return
user.visible_message("<span class='warning'>[user.name] dismantles the power terminal from [src].</span>", \
@@ -653,6 +666,26 @@
// attack with hand - remove cell (if cover open) or interact with the APC
/obj/machinery/power/apc/emag_act(var/remaining_charges, var/mob/user)
if (!(emagged || hacker)) // trying to unlock with an emag card
if(opened)
user << "You must close the cover to swipe an ID card."
else if(wiresexposed)
user << "You must close the panel first"
else if(stat & (BROKEN|MAINT))
user << "Nothing happens."
else
flick("apc-spark", src)
if (do_after(user,6))
if(prob(50))
emagged = 1
locked = 0
user << "<span class='notice'>You emag the APC interface.</span>"
update_icon()
else
user << "<span class='warning'>You fail to [ locked ? "unlock" : "lock"] the APC interface.</span>"
return 1
/obj/machinery/power/apc/attack_hand(mob/user)
// if (!can_use(user)) This already gets called in interact() and in topic()
// return
@@ -664,34 +697,7 @@
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
if(H.species.flags & IS_SYNTHETIC && H.a_intent == I_GRAB)
if(emagged || stat & BROKEN)
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
H << "\red The APC power currents surge eratically, damaging your chassis!"
H.adjustFireLoss(10,0)
else if(src.cell && src.cell.charge > 0)
if(H.nutrition < 450)
if(src.cell.charge >= 500)
H.nutrition += 50
src.cell.charge -= 500
else
H.nutrition += src.cell.charge/10
src.cell.charge = 0
user << "\blue You slot your fingers into the APC interface and siphon off some of the stored charge for your own use."
if(src.cell.charge < 0) src.cell.charge = 0
if(H.nutrition > 500) H.nutrition = 500
src.charging = 1
else
user << "\blue You are already fully charged."
else
user << "There is no charge to draw from that APC."
return
else if(H.species.can_shred(H))
if(H.species.can_shred(H))
user.visible_message("\red [user.name] slashes at the [src.name]!", "\blue You slash at the [src.name]!")
playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1)
@@ -728,11 +734,6 @@
// do APC interaction
src.interact(user)
/obj/machinery/power/apc/attack_ghost(user as mob)
if(stat & (BROKEN|MAINT))
return
return ui_interact(user)
/obj/machinery/power/apc/interact(mob/user)
if(!user)
return
@@ -757,6 +758,7 @@
"totalLoad" = round(lastused_total),
"totalCharging" = round(lastused_charging),
"coverLocked" = coverlocked,
"failTime" = failure_timer * 2,
"siliconUser" = istype(user, /mob/living/silicon),
"powerChannels" = list(
@@ -810,7 +812,7 @@
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])"
/obj/machinery/power/apc/proc/update()
if(operating && !shorted)
if(operating && !shorted && !failure_timer)
area.power_light = (lighting > 1)
area.power_equip = (equipment > 1)
area.power_environ = (environ > 1)
@@ -873,7 +875,7 @@
return 0
return 1
/obj/machinery/power/apc/Topic(href, href_list, var/nowindow = 0)
/obj/machinery/power/apc/Topic(href, href_list)
if(..())
return 1
@@ -891,6 +893,11 @@
else if (href_list["breaker"])
toggle_breaker()
else if( href_list["reboot"] )
failure_timer = 0
update_icon()
update()
else if (href_list["cmode"])
chargemode = !chargemode
if(!chargemode)
@@ -986,6 +993,12 @@
return
if(!area.requires_power)
return
if(failure_timer)
update()
queue_icon_update()
failure_timer--
force_update = 1
return
lastused_light = area.usage(LIGHT)
lastused_equip = area.usage(EQUIP)
@@ -1044,7 +1057,7 @@
if(src.attempt_charging())
if(excess > 0) // check to make sure we have enough to charge
// Max charge is capped to % per second constant
var/ch = min(excess*CELLRATE, cell.maxcharge*CHARGELEVEL)
var/ch = min(excess*CELLRATE, cell.maxcharge*chargelevel)
ch = draw_power(ch/CELLRATE) // Removes the power we're taking from the grid
cell.give(ch*CELLRATE) // actually recharge the cell
@@ -1061,7 +1074,7 @@
if(chargemode)
if(!charging)
if(excess > cell.maxcharge*CHARGELEVEL)
if(excess > cell.maxcharge*chargelevel)
chargecount++
else
chargecount = 0
@@ -1085,7 +1098,8 @@
autoflag = 0
// update icon & area power if anything changed
if(last_lt != lighting || last_eq != equipment || last_en != environ)
if(last_lt != lighting || last_eq != equipment || last_en != environ || force_update)
force_update = 0
queue_icon_update()
update()
else if (last_ch != charging)
@@ -1186,12 +1200,6 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
cell.ex_act(3.0)
return
/obj/machinery/power/apc/blob_act()
if (prob(75))
set_broken()
if (cell && prob(5))
cell.blob_act()
/obj/machinery/power/apc/disconnect_terminal()
if(terminal)
terminal.master = null
@@ -1207,17 +1215,18 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
update_icon()
update()
// overload all the lights in this APC area
// overload the lights in this APC area
/obj/machinery/power/apc/proc/overload_lighting()
/obj/machinery/power/apc/proc/overload_lighting(var/chance = 100)
if(/* !get_connection() || */ !operating || shorted)
return
if( cell && cell.charge>=20)
cell.use(20);
spawn(0)
for(var/obj/machinery/light/L in area)
L.on = 1
L.broken()
if(prob(chance))
L.on = 1
L.broken()
sleep(1)
/obj/machinery/power/apc/proc/setsubsystem(val)
-2
View File
@@ -87,8 +87,6 @@
M.state = 2
M.icon_state = "box_1"
for(var/obj/I in component_parts)
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
qdel(src)
return 1
+1 -1
View File
@@ -21,7 +21,7 @@
/obj/machinery/power/breakerbox/Destroy()
..()
for(var/obj/nano_module/rcon/R in world)
for(var/datum/nano_module/rcon/R in world)
R.FindDevices()
/obj/machinery/power/breakerbox/activated
+78 -88
View File
@@ -10,11 +10,11 @@
/* Cable directions (d1 and d2)
9 1 5
\ | /
8 - 0 - 4
/ | \
10 2 6
> 9 1 5
> \ | /
> 8 - 0 - 4
> / | \
> 10 2 6
If d1 = 0 and d2 = 0, there's no cable
If d1 = 0 and d2 = dir, it's a O-X cable, getting from the center of the tile to dir (knot cable)
@@ -22,6 +22,16 @@ If d1 = dir1 and d2 = dir2, it's a full X-X cable, getting from dir1 to dir2
By design, d1 is the smallest direction and d2 is the highest
*/
var/list/possible_cable_coil_colours = list(
"Yellow" = COLOR_YELLOW,
"Green" = COLOR_LIME,
"Pink" = COLOR_PINK,
"Blue" = COLOR_BLUE,
"Orange" = COLOR_ORANGE,
"Cyan" = COLOR_CYAN,
"Red" = COLOR_RED
)
/obj/structure/cable
level = 1
anchored =1
@@ -50,7 +60,7 @@ By design, d1 is the smallest direction and d2 is the highest
color = COLOR_YELLOW
/obj/structure/cable/green
color = COLOR_GREEN
color = COLOR_LIME
/obj/structure/cable/blue
color = COLOR_BLUE
@@ -70,7 +80,6 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/structure/cable/New()
..()
// ensure d1 & d2 reflect the icon_state for entering and exiting cable
var/dash = findtext(icon_state, "-")
@@ -80,8 +89,7 @@ By design, d1 is the smallest direction and d2 is the highest
d2 = text2num( copytext( icon_state, dash+1 ) )
var/turf/T = src.loc // hide if turf is not intact
if(level==1) hide(T.intact)
if(level==1) hide(!T.is_plating())
cable_list += src //add it to the global cable list
@@ -97,11 +105,13 @@ By design, d1 is the smallest direction and d2 is the highest
//If underfloor, hide the cable
/obj/structure/cable/hide(var/i)
if(level == 1 && istype(loc, /turf))
if(istype(loc, /turf))
invisibility = i ? 101 : 0
updateicon()
/obj/structure/cable/hides_under_flooring()
return 1
/obj/structure/cable/proc/updateicon()
icon_state = "[d1]-[d2]"
alpha = invisibility ? 127 : 255
@@ -122,15 +132,14 @@ By design, d1 is the smallest direction and d2 is the highest
/obj/structure/cable/attackby(obj/item/W, mob/user)
var/turf/T = src.loc
if(T.intact)
if(!T.is_plating())
return
if(istype(W, /obj/item/weapon/wirecutters))
///// Z-Level Stuff
if(src.d1 == 12 || src.d2 == 12)
if(d1 == 12 || d2 == 12)
user << "<span class='warning'>You must cut this cable from above.</span>"
return
///// Z-Level Stuff
if(breaker_box)
user << "\red This cable is connected to nearby breaker box. Use breaker box to interact with it."
return
@@ -146,16 +155,13 @@ By design, d1 is the smallest direction and d2 is the highest
for(var/mob/O in viewers(src, null))
O.show_message("<span class='warning'>[user] cuts the cable.</span>", 1)
///// Z-Level Stuff
if(src.d1 == 11 || src.d2 == 11)
var/turf/controllerlocation = locate(1, 1, z)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
if(controller.down)
var/turf/below = locate(src.x, src.y, controller.down_target)
for(var/obj/structure/cable/c in below)
if(c.d1 == 12 || c.d2 == 12)
qdel(c)
///// Z-Level Stuff
if(d1 == 11 || d2 == 11)
var/turf/turf = GetBelow(src)
if(turf)
for(var/obj/structure/cable/c in turf)
if(c.d1 == 12 || c.d2 == 12)
qdel(c)
investigate_log("was cut by [key_name(usr, usr.client)] in [user.loc.loc]","wires")
qdel(src)
@@ -348,17 +354,15 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/turf/T
// Handle up/down cables
if(d1 == 11 || d1 == 12 || d2 == 11 || d2 == 12)
var/turf/controllerlocation = locate(1, 1, z)
for(var/obj/effect/landmark/zcontroller/controller in controllerlocation)
if(controller.up && (d1 == 12 || d2 == 12))
T = locate(src.x, src.y, controller.up_target)
if(T)
. += power_list(T, src, 11, 1)
if(controller.down && (d1 == 11 || d2 == 11))
T = locate(src.x, src.y, controller.down_target)
if(T)
. += power_list(T, src, 12, 1)
if(d1 == 11 || d2 == 11)
T = GetBelow(src)
if(T)
. += power_list(T, src, 12, 1)
if(d1 == 12 || d2 == 12)
T = GetAbove(src)
if(T)
. += power_list(T, src, 11, 1)
// Handle standard cables in adjacent turfs
for(var/cable_dir in list(d1, d2))
@@ -479,14 +483,6 @@ obj/structure/cable/proc/cableColor(var/colorC)
matter = null
uses_charge = 1
charge_costs = list(1)
stacktype = /obj/item/stack/cable_coil
/obj/item/stack/cable_coil/suicide_act(mob/user)
if(locate(/obj/item/weapon/stool) in user.loc)
user.visible_message("<span class='suicide'>[user] is making a noose with the [src.name]! It looks like \he's trying to commit suicide.</span>")
else
user.visible_message("<span class='suicide'>[user] is strangling \himself with the [src.name]! It looks like \he's trying to commit suicide.</span>")
return(OXYLOSS)
/obj/item/stack/cable_coil/New(loc, length = MAXCOIL, var/param_color = null)
..()
@@ -503,24 +499,26 @@ obj/structure/cable/proc/cableColor(var/colorC)
///////////////////////////////////
//you can use wires to heal robotics
/obj/item/stack/cable_coil/attack(mob/M as mob, mob/user as mob)
if(istype(M,/mob/living/carbon/human))
/obj/item/stack/cable_coil/afterattack(var/mob/M, var/mob/user)
if(ishuman(M))
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/S = H.get_organ(user.zone_sel.selecting)
if(!(S.status & ORGAN_ROBOT) || user.a_intent != "help")
var/obj/item/organ/external/S = H.organs_by_name[user.zone_sel.selecting]
if (!S) return
if(!(S.status & ORGAN_ROBOT) || user.a_intent != I_HELP)
return ..()
if(H.species.flags & IS_SYNTHETIC)
if(M == user)
user << "\red You can't repair damage to your own body - it's against OH&S."
return
if(S.burn_dam > 0 && use(1))
S.heal_damage(0,15,0,1)
user.visible_message("\red \The [user] repairs some burn damage on \the [M]'s [S.name] with \the [src].")
return
else
user << "Nothing to fix!"
if(S.burn_dam)
if(S.burn_dam < ROBOLIMB_SELF_REPAIR_CAP)
S.heal_damage(0,15,0,1)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.visible_message("<span class='danger'>\The [user] patches some damaged wiring on \the [M]'s [S.name] with \the [src].</span>")
else if(S.open != 2)
user << "<span class='danger'>The damage is far too severe to patch over externally.</span>"
return 1
else if(S.open != 2)
user << "<span class='notice'>Nothing to fix!</span>"
else
return ..()
@@ -528,7 +526,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
/obj/item/stack/cable_coil/update_icon()
if (!color)
color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
color = pick(COLOR_RED, COLOR_BLUE, COLOR_LIME, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
if(amount == 1)
icon_state = "coil1"
name = "cable piece"
@@ -539,6 +537,17 @@ obj/structure/cable/proc/cableColor(var/colorC)
icon_state = "coil"
name = "cable coil"
/obj/item/stack/cable_coil/proc/set_cable_color(var/selected_color, var/user)
if(!selected_color)
return
var/final_color = possible_cable_coil_colours[selected_color]
if(!final_color)
final_color = possible_cable_coil_colours["Red"]
selected_color = "red"
color = final_color
user << "<span class='notice'>You change \the [src]'s color to [lowertext(selected_color)].</span>"
/obj/item/stack/cable_coil/proc/update_wclass()
if(amount == 1)
w_class = 1.0
@@ -579,26 +588,8 @@ obj/structure/cable/proc/cableColor(var/colorC)
set name = "Change Colour"
set category = "Object"
var/list/possible_colours = list ("Yellow", "Green", "Pink", "Blue", "Orange", "Cyan", "Red")
var/selected_type = input("Pick new colour.", "Cable Colour", null, null) as null|anything in possible_colours
if(selected_type)
switch(selected_type)
if("Yellow")
color = COLOR_YELLOW
if("Green")
color = COLOR_GREEN
if("Pink")
color = COLOR_PINK
if("Blue")
color = COLOR_BLUE
if("Orange")
color = COLOR_ORANGE
if("Cyan")
color = COLOR_CYAN
else
color = COLOR_RED
usr << "You change your cable coil's colour to [selected_type]"
var/selected_type = input("Pick new colour.", "Cable Colour", null, null) as null|anything in possible_cable_coil_colours
set_cable_color(selected_type, usr)
// Items usable on a cable coil :
// - Wirecutters : cut them duh !
@@ -644,7 +635,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
user << "You can't lay cable at a place that far away."
return
if(F.intact) // Ff floor is intact, complain
if(!F.is_plating()) // Ff floor is intact, complain
user << "You can't lay cable there unless the floor tiles are removed."
return
@@ -662,15 +653,14 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
///// Z-Level Stuff
// check if the target is open space
if(istype(F, /turf/simulated/floor/open))
if(istype(F, /turf/simulated/open))
for(var/obj/structure/cable/LC in F)
if((LC.d1 == dirn && LC.d2 == 11 ) || ( LC.d2 == dirn && LC.d1 == 11))
user << "<span class='warning'>There's already a cable at that position.</span>"
return
var/turf/simulated/floor/open/temp = F
var/obj/structure/cable/C = new(F)
var/obj/structure/cable/D = new(temp.floorbelow)
var/obj/structure/cable/D = new(GetBelow(F))
C.cableColor(color)
@@ -739,7 +729,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/turf/T = C.loc
if(!isturf(T) || T.intact) // sanity checks, also stop use interacting with T-scanner revealed cable
if(!isturf(T) || !T.is_plating()) // sanity checks, also stop use interacting with T-scanner revealed cable
return
if(get_dist(C, user) > 1) // make sure it's close enough
@@ -755,7 +745,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
// one end of the clicked cable is pointing towards us
if(C.d1 == dirn || C.d2 == dirn)
if(U.intact) // can't place a cable if the floor is complete
if(!U.is_plating()) // can't place a cable if the floor is complete
user << "You can't lay cable there unless the floor tiles are removed."
return
else
@@ -868,7 +858,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
color = COLOR_BLUE
/obj/item/stack/cable_coil/green
color = COLOR_GREEN
color = COLOR_LIME
/obj/item/stack/cable_coil/pink
color = COLOR_PINK
@@ -883,5 +873,5 @@ obj/structure/cable/proc/cableColor(var/colorC)
color = COLOR_WHITE
/obj/item/stack/cable_coil/random/New()
color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
color = pick(COLOR_RED, COLOR_BLUE, COLOR_LIME, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
..()
+1 -1
View File
@@ -12,7 +12,7 @@
/obj/structure/cable/heavyduty/attackby(obj/item/W, mob/user)
var/turf/T = src.loc
if(T.intact)
if(!T.is_plating())
return
if(istype(W, /obj/item/weapon/wirecutters))
-14
View File
@@ -67,12 +67,6 @@
if(maxcharge < amount) return 0
var/amount_used = min(maxcharge-charge,amount)
if(crit_fail) return 0
if(!prob(reliability))
minor_fault++
if(prob(minor_fault))
crit_fail = 1
return 0
charge += amount_used
return amount_used
@@ -85,8 +79,6 @@
user << "[desc]\nThe manufacturer's label states this cell has a power rating of [maxcharge], and that you should not swallow it.\nThe charge meter reads [round(src.percent() )]%."
else
user << "This power cell has an exciting chrome finish, as it is an uber-capacity cell type! It has a power rating of [maxcharge]!\nThe charge meter reads [round(src.percent() )]%."
if(crit_fail)
user << "\red This power cell seems to be faulty."
/obj/item/weapon/cell/attackby(obj/item/W, mob/user)
..()
@@ -155,8 +147,6 @@
charge -= maxcharge / severity
if (charge < 0)
charge = 0
if(reliability != 100 && prob(50/severity))
reliability -= 10 / severity
..()
/obj/item/weapon/cell/ex_act(severity)
@@ -179,10 +169,6 @@
corrupt()
return
/obj/item/weapon/cell/blob_act()
if(prob(75))
explode()
/obj/item/weapon/cell/proc/get_electrocute_damage()
switch (charge)
/* if (9000 to INFINITY)
-37
View File
@@ -1,37 +0,0 @@
/turf/simulated/floor/engine/attack_hand(var/mob/user as mob)
if ((!( user.canmove ) || user.restrained() || !( user.pulling )))
return
if (user.pulling.anchored)
return
if ((user.pulling.loc != user.loc && get_dist(user, user.pulling) > 1))
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/atom/movable/t = M.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
M.start_pulling(t)
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
/turf/simulated/floor/engine/ex_act(severity)
switch(severity)
if(1.0)
ChangeTurf(/turf/space)
qdel(src)
return
if(2.0)
if (prob(50))
ChangeTurf(/turf/space)
qdel(src)
return
else
return
/turf/simulated/floor/engine/blob_act()
if (prob(25))
ChangeTurf(/turf/space)
qdel(src)
return
return
+6 -5
View File
@@ -171,6 +171,11 @@
brightness_power = 2
brightness_color = "#da0205"
/obj/machinery/light/small/red
brightness_range = 5
brightness_power = 1
brightness_color = "#da0205"
/obj/machinery/light/spot
name = "spotlight"
fitting = "large tube"
@@ -548,10 +553,6 @@
//blob effect
/obj/machinery/light/blob_act()
if(prob(75))
broken()
// timed process
// use power
@@ -594,7 +595,7 @@
icon = 'icons/obj/lighting.dmi'
force = 2
throwforce = 5
w_class = 2
w_class = 1
var/status = 0 // LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
var/base_state
var/switchcount = 0 // number of times switched
+6 -16
View File
@@ -43,21 +43,16 @@
RefreshParts()
var/temp_rating = 0
var/temp_reliability = 0
for(var/obj/item/weapon/stock_parts/SP in component_parts)
if(istype(SP, /obj/item/weapon/stock_parts/matter_bin))
//max_coins = SP.rating * SP.rating * 1000
else if(istype(SP, /obj/item/weapon/stock_parts/micro_laser) || istype(SP, /obj/item/weapon/stock_parts/capacitor))
temp_rating += SP.rating
for(var/obj/item/weapon/CP in component_parts)
temp_reliability += CP.reliability
reliability = min(round(temp_reliability / 4), 100)
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
examine(mob/user)
..(user)
user << "\blue The generator has [P.air_contents.phoron] units of fuel left, producing [power_gen] per cycle."
if(crit_fail) user << "\red The generator seems to have broken down."
handleInactive()
heat -= 2
@@ -81,14 +76,6 @@
user.drop_item()
O.loc = src
user << "\blue You add the phoron tank to the generator."
else if (istype(O, /obj/item/weapon/card/emag))
var/obj/item/weapon/card/emag/E = O
if(E.uses)
E.uses--
else
return
emagged = 1
emp_act(1)
else if(!active)
if(istype(O, /obj/item/weapon/wrench))
anchored = !anchored
@@ -108,8 +95,6 @@
else if(istype(O, /obj/item/weapon/crowbar) && !open)
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)
if(I.reliability < 100)
I.crit_fail = 1
I.loc = src.loc
new_frame.state = 2
new_frame.icon_state = "box_1"
@@ -159,7 +144,7 @@
src.add_fingerprint(usr)
if(href_list["action"])
if(href_list["action"] == "enable")
if(!active && HasFuel() && !crit_fail)
if(!active && HasFuel())
active = 1
icon_state = "portgen1"
src.updateUsrDialog()
@@ -179,3 +164,8 @@
if (href_list["action"] == "close")
usr << browse(null, "window=port_gen")
usr.machine = null
/obj/machinery/power/port_gen/pacman2/emag_act(var/remaining_uses, var/mob/user)
emagged = 1
emp_act(1)
return 1
+10 -20
View File
@@ -15,7 +15,7 @@
var/power_output = 1
/obj/machinery/power/port_gen/proc/IsBroken()
return (crit_fail || (stat & (BROKEN|EMPED)))
return (stat & (BROKEN|EMPED))
/obj/machinery/power/port_gen/proc/HasFuel() //Placeholder for fuel check.
return 1
@@ -127,7 +127,7 @@
/obj/machinery/power/port_gen/pacman/Destroy()
DropFuel()
..()
return ..()
/obj/machinery/power/port_gen/pacman/RefreshParts()
var/temp_rating = 0
@@ -137,13 +137,6 @@
else if(istype(SP, /obj/item/weapon/stock_parts/micro_laser) || istype(SP, /obj/item/weapon/stock_parts/capacitor))
temp_rating += SP.rating
var/temp_reliability = 0
var/part_count = 0
for(var/obj/item/weapon/CP in component_parts)
temp_reliability += CP.reliability
part_count++
reliability = min(round(temp_reliability / part_count), 100)
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
/obj/machinery/power/port_gen/pacman/examine(mob/user)
@@ -168,13 +161,6 @@
sheets -= amount
/obj/machinery/power/port_gen/pacman/UseFuel()
//break down sometimes
if (reliability < 100)
if (prob(1) && prob(1) && prob(100 - reliability))
stat |= BROKEN
crit_fail = 1
if (prob(100 - reliability))
explode()
//how much material are we using this iteration?
var/needed_sheets = power_output / time_per_sheet
@@ -260,6 +246,14 @@
sheet_left = 0
..()
/obj/machinery/power/port_gen/pacman/emag_act(var/remaining_charges, var/mob/user)
if (active && prob(25))
explode() //if they're foolish enough to emag while it's running
if (!emagged)
emagged = 1
return 1
/obj/machinery/power/port_gen/pacman/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, sheet_path))
var/obj/item/stack/addstack = O
@@ -272,10 +266,6 @@
addstack.use(amount)
updateUsrDialog()
return
else if (istype(O, /obj/item/weapon/card/emag))
emagged = 1
if (active && prob(25))
explode() //if they're foolish enough to emag while it's running
else if(!active)
if(istype(O, /obj/item/weapon/wrench))
+3 -1
View File
@@ -37,6 +37,8 @@
/obj/machinery/power/proc/add_avail(var/amount)
if(powernet)
powernet.newavail += amount
return 1
return 0
/obj/machinery/power/proc/draw_power(var/amount)
if(powernet)
@@ -126,7 +128,7 @@
var/turf/T = user.loc
if(T.intact || !istype(T, /turf/simulated/floor))
if(!T.is_plating() || !istype(T, /turf/simulated/floor))
return
if(get_dist(src, user) > 1)
+41 -5
View File
@@ -8,6 +8,12 @@
var/viewload = 0 // the load as it appears on the power console (gradually updated)
var/number = 0 // Unused //TODEL
var/smes_demand = 0 // Amount of power demanded by all SMESs from this network. Needed for load balancing.
var/list/inputting = list() // List of SMESs that are demanding power from this network. Needed for load balancing.
var/smes_avail = 0 // Amount of power (avail) from SMESes. Used by SMES load balancing
var/smes_newavail = 0 // As above, just for newavail
var/perapc = 0 // per-apc avilability
var/perapc_excess = 0
var/netexcess = 0 // excess power on the powernet (typically avail-load)
@@ -19,8 +25,14 @@
..()
/datum/powernet/Destroy()
for(var/obj/structure/cable/C in cables)
cables -= C
C.powernet = null
for(var/obj/machinery/power/M in nodes)
nodes -= M
M.powernet = null
powernets -= src
..()
return ..()
//Returns the amount of excess power (before refunding to SMESs) from last tick.
//This is for machines that might adjust their power consumption using this data.
@@ -107,9 +119,18 @@
perapc = avail/numapc + perapc_excess
if(netexcess > 100 && nodes && nodes.len) // if there was excess power last cycle
for(var/obj/machinery/power/smes/S in nodes) // find the SMESes in the network
S.restore() // and restore some of the power that was used
// At this point, all other machines have finished using power. Anything left over may be used up to charge SMESs.
if(inputting.len && smes_demand)
var/smes_input_percentage = between(0, (netexcess / smes_demand) * 100, 100)
for(var/obj/machinery/power/smes/S in inputting)
S.input_power(smes_input_percentage)
netexcess = avail - load
if(netexcess)
var/perc = get_percent_load(1)
for(var/obj/machinery/power/smes/S in nodes)
S.restore(perc)
//updates the viewed load (as seen on power computers)
viewload = round(load)
@@ -117,7 +138,22 @@
//reset the powernet
load = 0
avail = newavail
smes_avail = smes_newavail
inputting.Cut()
smes_demand = 0
newavail = 0
smes_newavail = 0
/datum/powernet/proc/get_percent_load(var/smes_only = 0)
if(smes_only)
var/smes_used = load - (avail - smes_avail) // SMESs are always last to provide power
if(!smes_used || smes_used < 0 || !smes_avail) // SMES power isn't available or being used at all, SMES load is therefore 0%
return 0
return between(0, (smes_used / smes_avail) * 100, 100) // Otherwise return percentage load of SMESs.
else
if(!load)
return 0
return between(0, (avail / load) * 100, 100)
/datum/powernet/proc/get_electrocute_damage()
switch(avail)
@@ -142,7 +178,7 @@
// return a knot cable (O-X) if one is present in the turf
// null if there's none
/turf/proc/get_cable_node()
if(!istype(src, /turf/simulated/floor))
if(!istype(src, /turf/simulated))
return null
for(var/obj/structure/cable/C in src)
if(C.d1 == 0)
@@ -12,7 +12,7 @@
desc = "Small machine which transmits data about specific powernet"
anchored = 1
density = 0
layer = 2.46 // Above cables, but should be below floors.
level = 1
icon = 'icons/obj/objects.dmi'
icon_state = "floor_beacon" // If anyone wants to make better sprite, feel free to do so without asking me.
@@ -7,7 +7,8 @@
name = "Power Monitoring Console"
desc = "Computer designed to remotely monitor power levels around the station"
icon = 'icons/obj/computer.dmi'
icon_state = "power"
icon_keyboard = "power_key"
icon_screen = "power"
light_color = "#ffcc33"
//computer stuff
@@ -18,7 +19,7 @@
use_power = 1
idle_power_usage = 300
active_power_usage = 300
var/obj/nano_module/power_monitor/power_monitor
var/datum/nano_module/power_monitor/power_monitor
// Checks the sensors for alerts. If change (alerts cleared or detected) occurs, calls for icon update.
/obj/machinery/computer/power_monitor/process()
+3 -3
View File
@@ -34,7 +34,7 @@
src << "<span class = 'warning'>The [S] pulls \the [hand] from your grip!</span>"
apply_effect(current_size * 3, IRRADIATE)
if(shoes)
if(shoes.flags & NOSLIP) return 0
if(shoes.item_flags & NOSLIP) return 0
..()
/obj/singularity_act()
@@ -101,13 +101,13 @@
return 1000
/turf/singularity_act(S, current_size)
if(intact)
if(!is_plating())
for(var/obj/O in contents)
if(O.level != 1)
continue
if(O.invisibility == 101)
O.singularity_act(src, current_size)
ChangeTurf(/turf/space)
ChangeTurf(get_base_turf_by_area(src))
return 2
/turf/simulated/wall/singularity_pull(S, current_size)
@@ -10,6 +10,7 @@
unacidable = 1
use_power = 0
light_range = 4
flags = PROXMOVE
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.
@@ -29,16 +30,9 @@
return 1
/obj/machinery/containment_field/blob_act()
return 0
/obj/machinery/containment_field/ex_act(severity)
return 0
/obj/machinery/containment_field/meteorhit()
return 0
/obj/machinery/containment_field/HasProximity(atom/movable/AM as mob|obj)
if(istype(AM,/mob/living/silicon) && prob(40))
shock(AM)
@@ -65,7 +59,7 @@
user.throw_at(target, 200, 4)
sleep(20)
hasShocked = 0
return
+14 -12
View File
@@ -24,6 +24,8 @@
var/state = 0
var/locked = 0
var/_wifi_id
var/datum/wifi/receiver/button/emitter/wifi_receiver
/obj/machinery/power/emitter/verb/rotate()
set name = "Rotate"
@@ -40,12 +42,16 @@
..()
if(state == 2 && anchored)
connect_to_network()
if(_wifi_id)
wifi_receiver = new(_wifi_id, src)
/obj/machinery/power/emitter/Destroy()
message_admins("Emitter deleted at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("Emitter deleted at ([x],[y],[z])")
investigate_log("<font color='red'>deleted</font> at ([x],[y],[z])","singulo")
..()
qdel(wifi_receiver)
wifi_receiver = null
return ..()
/obj/machinery/power/emitter/update_icon()
if (active && powernet && avail(active_power_usage))
@@ -93,9 +99,6 @@
src.use_power = 1 */
return 1
/obj/machinery/containment_field/meteorhit()
return 0
/obj/machinery/power/emitter/process()
if(stat & (BROKEN))
return
@@ -130,15 +133,15 @@
var/burst_time = (min_burst_delay + max_burst_delay)/2 + 2*(burst_shots-1)
var/power_per_shot = active_power_usage * (burst_time/10) / burst_shots
playsound(src.loc, 'sound/weapons/emitter.ogg', 25, 1)
if(prob(35))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
var/obj/item/projectile/beam/emitter/A = new /obj/item/projectile/beam/emitter( src.loc )
playsound(src.loc, 'sound/weapons/emitter.ogg', 25, 1)
A.damage = round(power_per_shot/EMITTER_DAMAGE_POWER_TRANSFER)
A.launch(get_step(src.loc, src.dir))
A.launch( get_step(src.loc, src.dir) )
/obj/machinery/power/emitter/attackby(obj/item/W, mob/user)
@@ -215,13 +218,12 @@
else
user << "<span class='warning'>Access denied.</span>"
return
..()
return
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
/obj/machinery/power/emitter/emag_act(var/remaining_charges, var/mob/user)
if(!emagged)
locked = 0
emagged = 1
user.visible_message("[user.name] emags [src].","<span class='warning'>You short out the lock.</span>")
return
..()
return
return 1
@@ -159,16 +159,6 @@ field_generator power level display
/obj/machinery/field_generator/emp_act()
return 0
/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)
if(istype(Proj, /obj/item/projectile/beam))
power += Proj.damage * EMITTER_DAMAGE_POWER_TRANSFER
@@ -157,18 +157,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
else
return
/obj/structure/particle_accelerator/blob_act()
if(prob(50))
qdel(src)
return
/obj/structure/particle_accelerator/meteorhit()
if(prob(50))
qdel(src)
return
/obj/structure/particle_accelerator/update_icon()
switch(construction_state)
if(0,1)
@@ -345,18 +333,6 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return
/obj/machinery/particle_accelerator/blob_act()
if(prob(50))
qdel(src)
return
/obj/machinery/particle_accelerator/meteorhit()
if(prob(50))
qdel(src)
return
/obj/machinery/particle_accelerator/proc/update_state()
return 0
@@ -30,7 +30,9 @@
/obj/machinery/particle_accelerator/control_box/Destroy()
if(active)
toggle_power()
..()
qdel(wires)
wires = null
return ..()
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
if(construction_state >= 3)
@@ -53,9 +53,6 @@
consume(user)
return 1
/obj/singularity/blob_act(severity)
return
/obj/singularity/ex_act(severity)
if(current_size == STAGE_SUPER)//IT'S UNSTOPPABLE
return
@@ -266,12 +263,10 @@
allowed_size = STAGE_SUPER
if (current_size != allowed_size && current_size != STAGE_SUPER)
expand(null, current_size > allowed_size)
expand(null, current_size < allowed_size)
return 1
/obj/singularity/proc/eat()
set background = BACKGROUND_ENABLED
for(var/atom/X in orange(grav_pull, src))
var/dist = get_dist(X, src)
var/obj/singularity/S = src
+104 -80
View File
@@ -22,22 +22,28 @@
var/input_level_max = 200000 // cap on input_level
var/input_available = 0 // amount of charge available from input last tick
var/output_attempt = 1 // 1 = attempting to output, 0 = not attempting to output
var/outputting = 1 // 1 = actually outputting, 0 = not outputting
var/output_attempt = 0 // 1 = attempting to output, 0 = not attempting to output
var/outputting = 0 // 1 = actually outputting, 0 = not outputting
var/output_level = 50000 // amount of power the SMES attempts to output
var/output_level_max = 200000 // cap on output_level
var/output_used = 0 // amount of power actually outputted. may be less than output_level if the powernet returns excess power
//Holders for powerout event.
var/last_output_attempt = 0
var/last_input_attempt = 0
var/last_charge = 0
//var/last_output_attempt = 0
//var/last_input_attempt = 0
//var/last_charge = 0
//For icon overlay updates
var/last_disp
var/last_chrg
var/last_onln
var/input_cut = 0
var/input_pulsed = 0
var/output_cut = 0
var/output_pulsed = 0
var/failure_timer = 0 // Set by gridcheck event, temporarily disables the SMES.
var/target_load = 0
var/open_hatch = 0
var/name_tag = null
var/building_terminal = 0 //Suggestions about how to avoid clickspam building several terminals accepted!
@@ -83,6 +89,12 @@
return
/obj/machinery/power/smes/add_avail(var/amount)
if(..(amount))
powernet.smes_newavail += amount
return 1
return 0
/obj/machinery/power/smes/disconnect_terminal()
if(terminal)
@@ -101,65 +113,74 @@
overlays += image('icons/obj/power.dmi', "smes-oc2")
else if (inputting == 1)
overlays += image('icons/obj/power.dmi', "smes-oc1")
else
if(input_attempt)
overlays += image('icons/obj/power.dmi', "smes-oc0")
else if (input_attempt)
overlays += image('icons/obj/power.dmi', "smes-oc0")
var/clevel = chargedisplay()
if(clevel>0)
if(clevel)
overlays += image('icons/obj/power.dmi', "smes-og[clevel]")
return
if(outputting == 2)
overlays += image('icons/obj/power.dmi', "smes-op2")
else if (outputting == 1)
overlays += image('icons/obj/power.dmi', "smes-op1")
else
overlays += image('icons/obj/power.dmi', "smes-op0")
/obj/machinery/power/smes/proc/chargedisplay()
return round(5.5*charge/(capacity ? capacity : 5e6))
/obj/machinery/power/smes/proc/input_power(var/percentage)
var/inputted_power = target_load * (percentage/100)
inputted_power = between(0, inputted_power, target_load)
if(terminal && terminal.powernet)
inputted_power = terminal.powernet.draw_power(inputted_power)
charge += inputted_power * SMESRATE
if(percentage == 100)
inputting = 2
else if(percentage)
inputting = 1
// else inputting = 0, as set in process()
/obj/machinery/power/smes/process()
if(stat & BROKEN) return
//store machine state to see if we need to update the icon overlays
var/last_disp = chargedisplay()
var/last_chrg = inputting
var/last_onln = outputting
//inputting
if(input_attempt && (!input_pulsed && !input_cut))
var/target_load = min((capacity-charge)/SMESRATE, input_level) // charge at set rate, limited to spare capacity
var/actual_load = draw_power(target_load) // add the load to the terminal side network
charge += actual_load * SMESRATE // increase the charge
if (actual_load >= target_load) // Did we charge at full rate?
inputting = 2
else if (actual_load) // If not, did we charge at least partially?
inputting = 1
else // Or not at all?
inputting = 0
//outputting
if(outputting && (!output_pulsed && !output_cut))
output_used = min( charge/SMESRATE, output_level) //limit output to that stored
charge -= output_used*SMESRATE // reduce the storage (may be recovered in /restore() if excessive)
add_avail(output_used) // add output to powernet (smes side)
if(output_used < 0.0001) // either from no charge or set to 0
outputting(0)
investigate_log("lost power and turned <font color='red'>off</font>","singulo")
else if(output_attempt && output_level > 0)
outputting = 1
else
output_used = 0
if(failure_timer) // Disabled by gridcheck.
failure_timer--
return
// only update icon if state changed
if(last_disp != chargedisplay() || last_chrg != inputting || last_onln != outputting)
update_icon()
//store machine state to see if we need to update the icon overlays
last_disp = chargedisplay()
last_chrg = inputting
last_onln = outputting
//inputting
if(input_attempt && (!input_pulsed && !input_cut))
target_load = min((capacity-charge)/SMESRATE, input_level) // Amount we will request from the powernet.
if(terminal && terminal.powernet)
terminal.powernet.smes_demand += target_load
terminal.powernet.inputting.Add(src)
else
target_load = 0 // We won't input any power without powernet connection.
inputting = 0
//outputting
if(output_attempt && (!output_pulsed && !output_cut) && powernet && charge)
output_used = min( charge/SMESRATE, output_level) //limit output to that stored
charge -= output_used*SMESRATE // reduce the storage (may be recovered in /restore() if excessive)
add_avail(output_used) // add output to powernet (smes side)
outputting = 2
else if(!powernet || !charge)
outputting = 1
else
outputting = 0
// called after all power processes are finished
// restores charge level to smes if there was excess this ptick
/obj/machinery/power/smes/proc/restore()
/obj/machinery/power/smes/proc/restore(var/percent_load)
if(stat & BROKEN)
return
@@ -167,20 +188,18 @@
output_used = 0
return
var/excess = powernet.netexcess // this was how much wasn't used on the network last ptick, minus any removed by other SMESes
excess = min(output_used, excess) // clamp it to how much was actually output by this SMES last ptick
excess = min((capacity-charge)/SMESRATE, excess) // for safety, also limit recharge by space capacity of SMES (shouldn't happen)
var/total_restore = output_used * (percent_load / 100) // First calculate amount of power used from our output
total_restore = between(0, total_restore, output_used) // Now clamp the value between 0 and actual output, just for clarity.
total_restore = output_used - total_restore // And, at last, subtract used power from outputted power, to get amount of power we will give back to the SMES.
// now recharge this amount
var/clev = chargedisplay()
charge += excess * SMESRATE // restore unused power
powernet.netexcess -= excess // remove the excess from the powernet, so later SMESes don't try to use it
charge += total_restore * SMESRATE // restore unused power
powernet.netexcess -= total_restore // remove the excess from the powernet, so later SMESes don't try to use it
output_used -= excess
output_used -= total_restore
if(clev != chargedisplay() ) //if needed updates the icons overlay
update_icon()
@@ -204,7 +223,7 @@
user << "<span class='warning'>You can't build a terminal on space.</span>"
return 1
else if (istype(tempLoc))
if(tempLoc.intact)
if(!tempLoc.is_plating())
user << "<span class='warning'>You must remove the floor plating first.</span>"
return 1
user << "<span class='notice'>You start adding cable to the [src].</span>"
@@ -223,10 +242,7 @@
/obj/machinery/power/smes/attack_ai(mob/user)
add_fingerprint(user)
ui_interact(user)
/obj/machinery/power/smes/attack_ghost(mob/user)
add_hiddenprint(user)
ui_interact(user)
/obj/machinery/power/smes/attack_hand(mob/user)
@@ -246,7 +262,7 @@
return 0
if (!open_hatch)
user << "<span class='warning'>You need to open access hatch on [src] first!</spann>"
user << "<span class='warning'>You need to open access hatch on [src] first!</span>"
return 0
if(istype(W, /obj/item/stack/cable_coil) && !terminal && !building_terminal)
@@ -272,7 +288,7 @@
building_terminal = 1
var/turf/tempTDir = terminal.loc
if (istype(tempTDir))
if(tempTDir.intact)
if(!tempTDir.is_plating())
user << "<span class='warning'>You must remove the floor plating first.</span>"
else
user << "<span class='notice'>You begin to cut the cables...</span>"
@@ -311,13 +327,9 @@
data["outputLevel"] = output_level
data["outputMax"] = output_level_max
data["outputLoad"] = round(output_used)
data["failTime"] = failure_timer * 2
data["outputting"] = outputting
if(outputting)
data["outputting"] = 2 // smes is outputting
else if(!outputting && output_attempt)
data["outputting"] = 1 // smes is online but not outputting because it's charge level is too low
else
data["outputting"] = 0 // smes is not outputting
// update the ui if it exists, returns null if no ui is passed/found
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
@@ -346,6 +358,9 @@
else if( href_list["online"] )
outputting(!output_attempt)
update_icon()
else if( href_list["reboot"] )
failure_timer = 0
update_icon()
else if( href_list["input"] )
switch( href_list["input"] )
if("min")
@@ -366,10 +381,12 @@
output_level = input(usr, "Enter new output level (0-[output_level_max])", "SMES Output Power Control", output_level) as num
output_level = max(0, min(output_level_max, output_level)) // clamp to range
investigate_log("input/output; [input_level>output_level?"<font color='green'>":"<font color='red'>"][input_level]/[output_level]</font> | Output-mode: [output_attempt?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [input_attempt?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [usr.key]","singulo")
investigate_log("input/output; <font color='[input_level>output_level?"green":"red"][input_level]/[output_level]</font> | Output-mode: [output_attempt?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [input_attempt?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [usr.key]","singulo")
return 1
/obj/machinery/power/smes/proc/energy_fail(var/duration)
failure_timer = max(failure_timer, duration)
/obj/machinery/power/smes/proc/ion_act()
if(src.z in config.station_levels)
@@ -384,7 +401,7 @@
explosion(src.loc, -1, 0, 1, 3, 1, 0)
qdel(src)
return
if(prob(15)) //Power drain
else if(prob(15)) //Power drain
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
@@ -392,11 +409,13 @@
emp_act(1)
else
emp_act(2)
if(prob(5)) //smoke only
else if(prob(5)) //smoke only
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
else
energy_fail(rand(0, 30))
/obj/machinery/power/smes/proc/inputting(var/do_input)
input_attempt = do_input
@@ -409,21 +428,26 @@
outputting = 0
/obj/machinery/power/smes/emp_act(severity)
inputting(rand(0,1))
outputting(rand(0,1))
output_level = rand(0, output_level_max)
input_level = rand(0, input_level_max)
charge -= 1e6/severity
if (charge < 0)
charge = 0
if(prob(50))
inputting(rand(0,1))
outputting(rand(0,1))
if(prob(50))
output_level = rand(0, output_level_max)
input_level = rand(0, input_level_max)
if(prob(50))
charge -= 1e6/severity
if (charge < 0)
charge = 0
if(prob(50))
energy_fail(rand(0 + (severity * 30),30 + (severity * 30)))
update_icon()
..()
/obj/machinery/power/smes/magical
name = "magical power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
capacity = 9000000
name = "quantum power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Gains energy from quantum entanglement link."
capacity = 5000000
output_level = 250000
should_be_mapped = 1
+13 -10
View File
@@ -76,11 +76,11 @@
should_be_mapped = 1
/obj/machinery/power/smes/buildable/Destroy()
..()
qdel(wires)
for(var/obj/nano_module/rcon/R in world)
wires = null
for(var/datum/nano_module/rcon/R in world)
R.FindDevices()
return ..()
// Proc: process()
// Parameters: None
@@ -93,7 +93,7 @@
s.start()
charge -= (output_level_max * SMESRATE)
if(prob(1)) // Small chance of overload occuring since grounding is disabled.
apcs_overload(5,10)
apcs_overload(5,10,20)
..()
@@ -214,6 +214,7 @@
h_user.Paralyse(5)
spawn(0)
empulse(src.loc, 2, 4)
apcs_overload(0, 5, 10)
charge = 0
if (36 to 60)
@@ -232,7 +233,8 @@
spawn(0)
empulse(src.loc, 8, 16)
charge = 0
apcs_overload(1, 10)
apcs_overload(1, 10, 20)
energy_fail(10)
src.ping("Caution. Output regulators malfunction. Uncontrolled discharge detected.")
if (61 to INFINITY)
@@ -247,7 +249,8 @@
spawn(0)
empulse(src.loc, 32, 64)
charge = 0
apcs_overload(5, 25)
apcs_overload(5, 25, 100)
energy_fail(30)
src.ping("Caution. Output regulators malfunction. Significant uncontrolled discharge detected.")
if (prob(50))
@@ -270,9 +273,9 @@
// Proc: apcs_overload()
// Parameters: 2 (failure_chance - chance to actually break the APC, overload_chance - Chance of breaking lights)
// Parameters: 3 (failure_chance - chance to actually break the APC, overload_chance - Chance of breaking lights, reboot_chance - Chance of temporarily disabling the APC)
// Description: Damages output powernet by power surge. Destroys few APCs and lights, depending on parameters.
/obj/machinery/power/smes/buildable/proc/apcs_overload(var/failure_chance, var/overload_chance)
/obj/machinery/power/smes/buildable/proc/apcs_overload(var/failure_chance, var/overload_chance, var/reboot_chance)
if (!src.powernet)
return
@@ -283,6 +286,8 @@
A.overload_lighting()
if (prob(failure_chance))
A.set_broken()
if(prob(reboot_chance))
A.energy_fail(rand(30,60))
// Proc: update_icon()
// Parameters: None
@@ -349,8 +354,6 @@
M.state = 2
M.icon_state = "box_1"
for(var/obj/I in component_parts)
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
component_parts -= I
qdel(src)
+11 -18
View File
@@ -80,12 +80,6 @@ var/list/solars_list = list()
..()
/obj/machinery/power/solar/blob_act()
src.health--
src.healthcheck()
return
/obj/machinery/power/solar/proc/healthcheck()
if (src.health <= 0)
if(!(stat & BROKEN))
@@ -172,12 +166,6 @@ var/list/solars_list = list()
return
/obj/machinery/power/solar/blob_act()
if(prob(75))
broken()
src.density = 0
/obj/machinery/power/solar/fake/New(var/turf/loc, var/obj/item/solar_assembly/S)
..(loc, S, 0)
@@ -387,7 +375,7 @@ var/list/solars_list = list()
var/t = "<B><span class='highlight'>Generated power</span></B> : [round(lastgen)] W<BR>"
t += "<B><span class='highlight'>Star Orientation</span></B>: [sun.angle]&deg ([angle2text(sun.angle)])<BR>"
t += "<B><span class='highlight'>Array Orientation</span></B>: [rate_control(src,"cdir","[cdir]&deg",1,15)] ([angle2text(cdir)])<BR>"
t += "<B><span class='highlight'>Tracking:</B><div class='statusDisplay'>"
t += "<B><span class='highlight'>Tracking:</span></B><div class='statusDisplay'>"
switch(track)
if(0)
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];track=1'>Timed</A> <A href='?src=\ref[src];track=2'>Auto</A><BR>"
@@ -538,12 +526,17 @@ var/list/solars_list = list()
broken()
return
// Used for mapping in solar array which automatically starts itself (telecomms, for example)
/obj/machinery/power/solar_control/autostart
track = 2 // Auto tracking mode
/obj/machinery/power/solar_control/blob_act()
if (prob(75))
broken()
src.density = 0
/obj/machinery/power/solar_control/autostart/New()
..()
spawn(150) // Wait 15 seconds to ensure everything was set up properly (such as, powernets, solar panels, etc.
src.search_for_connected()
if(connected_tracker && track == 2)
connected_tracker.set_angle(sun.angle)
src.set_panels(cdir)
//
// MISC
+3 -7
View File
@@ -17,7 +17,7 @@
/obj/machinery/power/terminal/New()
..()
var/turf/T = src.loc
if(level==1) hide(T.intact)
if(level==1) hide(!T.is_plating())
return
/obj/machinery/power/terminal/Destroy()
@@ -27,12 +27,8 @@
return ..()
/obj/machinery/power/terminal/hide(var/i)
if(i)
invisibility = 101
icon_state = "term-f"
else
invisibility = 0
icon_state = "term"
invisibility = i ? 101 : initial(invisibility)
icon_state = i ? "term-f" : "term"
// Needed so terminals are not removed from machines list.
// Powernet rebuilds need this to work properly.
+3 -2
View File
@@ -29,7 +29,8 @@
name = "Gas turbine control computer"
desc = "A computer to remotely control a gas turbine"
icon = 'icons/obj/computer.dmi'
icon_state = "turbinecomp"
icon_keyboard = "tech_key"
icon_screen = "turbinecomp"
circuit = /obj/item/weapon/circuitboard/turbine_control
anchored = 1
density = 1
@@ -277,7 +278,7 @@
\n<BR>
\n"}
else
dat += "\red<B>No compatible attached compressor found."
dat += "<span class='danger'>No compatible attached compressor found.</span>"
user << browse(dat, "window=computer;size=400x500")
onclose(user, "computer")