Merge remote-tracking branch 'upstream/dev' into APC

Conflicts:
	code/game/gamemodes/events/power_failure.dm
	code/modules/power/smes.dm
This commit is contained in:
PsiOmega
2014-11-11 14:13:02 +01:00
382 changed files with 5618 additions and 4585 deletions
+3 -4
View File
@@ -67,10 +67,9 @@
return
/obj/item/weapon/fuel/examine()
set src in view(1)
if(usr && !usr.stat)
usr << "A magnetic storage ring, it contains [fuel]kg of [content ? content : "nothing"]."
/obj/item/weapon/fuel/examine(mob/user)
if(get_dist(src, user) <= 1)
user << "A magnetic storage ring, it contains [fuel]kg of [content ? content : "nothing"]."
/obj/item/weapon/fuel/proc/injest(mob/M as mob)
switch(content)
+23 -29
View File
@@ -1,8 +1,3 @@
#define APC_WIRE_IDSCAN 1
#define APC_WIRE_MAIN_POWER1 2
#define APC_WIRE_MAIN_POWER2 3
#define APC_WIRE_AI_CONTROL 4
//update_state
#define UPSTATE_CELL_IN 1
#define UPSTATE_OPENED1 2
@@ -153,7 +148,7 @@
/obj/machinery/power/apc/Del()
if(malfai && operating)
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs--
area.power_light = 0
area.power_equip = 0
@@ -199,32 +194,29 @@
spawn(5)
src.update()
/obj/machinery/power/apc/examine()
set src in oview(1)
if(usr /*&& !usr.stat*/)
usr << "A control terminal for the area electrical systems."
..()
/obj/machinery/power/apc/examine(mob/user)
if(..(user, 1))
user << "A control terminal for the area electrical systems."
if(stat & BROKEN)
usr << "Looks broken."
user << "Looks broken."
return
if(opened)
if(has_electronics && terminal)
usr << "The cover is [opened==2?"removed":"open"] and the power cell is [ cell ? "installed" : "missing"]."
user << "The cover is [opened==2?"removed":"open"] and the power cell is [ cell ? "installed" : "missing"]."
else if (!has_electronics && terminal)
usr << "There are some wires but no any electronics."
user << "There are some wires but no any electronics."
else if (has_electronics && !terminal)
usr << "Electronics installed but not wired."
user << "Electronics installed but not wired."
else /* if (!has_electronics && !terminal) */
usr << "There is no electronics nor connected wires."
user << "There is no electronics nor connected wires."
else
if (stat & MAINT)
usr << "The cover is closed. Something wrong with it: it doesn't work."
user << "The cover is closed. Something wrong with it: it doesn't work."
else if (malfhack)
usr << "The cover is broken. It may be hard to force it open."
user << "The cover is broken. It may be hard to force it open."
else
usr << "The cover is closed."
user << "The cover is closed."
// update the APC icon to show the three base states
@@ -824,6 +816,8 @@
return 0
if(!user.client)
return 0
if(inoperable())
return 0
if(!user.IsAdvancedToolUser())
user << "<span class='warning'>You don't have the dexterity to use [src]!</span>"
return 0
@@ -862,12 +856,12 @@
return 0
return 1
/obj/machinery/power/apc/Topic(href, href_list)
/obj/machinery/power/apc/Topic(href, href_list, var/nowindow = 0)
if(..())
return 0
return 1
if(!can_use(usr, 1))
return 0
return 1
if (href_list["lock"])
coverlocked = !coverlocked
@@ -919,7 +913,7 @@
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))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs++
if(usr:parent)
src.malfai = usr:parent
@@ -944,14 +938,14 @@
locked = !locked
update_icon()
return 1
return 0
/obj/machinery/power/apc/proc/toggle_breaker()
operating = !operating
if(malfai)
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
operating ? ticker.mode:apcs++ : ticker.mode:apcs--
src.update()
@@ -968,7 +962,7 @@
/*if(!malf.can_shunt)
malf << "<span class='warning'>You cannot shunt.</span>"
return*/
if(src.z != 1)
if(isNotStationLevel(src.z))
return
src.occupier = new /mob/living/silicon/ai(src,malf.laws,null,1)
src.occupier.adjustOxyLoss(malf.getOxyLoss())
@@ -1017,7 +1011,7 @@
/obj/machinery/power/apc/proc/ion_act()
//intended to be exactly the same as an AI malf attack
if(!src.malfhack && src.z == 1)
if(!src.malfhack && src.z in config.station_levels)
if(prob(3))
src.locked = 1
if (src.cell.charge > 0)
@@ -1283,7 +1277,7 @@ obj/machinery/power/apc/proc/autoset(var/val, var/on)
/obj/machinery/power/apc/proc/set_broken()
if(malfai && operating)
if (ticker.mode.config_tag == "malfunction")
if (src.z == 1) //if (is_type_in_list(get_area(src), the_station_areas))
if (src.z in config.station_levels) //if (is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs--
// Aesthetically much better!
src.visible_message("<span class='notice'>[src]'s screen flickers with warnings briefly!</span>")
+5 -4
View File
@@ -8,6 +8,7 @@
name = "Breaker Box"
icon = 'icons/obj/power.dmi'
icon_state = "bbox_off"
//directwired = 0
var/icon_state_on = "bbox_on"
var/icon_state_off = "bbox_off"
flags = FPRINT
@@ -24,12 +25,12 @@
/obj/machinery/power/breakerbox/activated/initialize()
set_state(1)
/obj/machinery/power/breakerbox/examine()
usr << "Large machine with heavy duty switching circuits used for advanced grid control"
/obj/machinery/power/breakerbox/examine(mob/user)
user << "Large machine with heavy duty switching circuits used for advanced grid control"
if(on)
usr << "\green It seems to be online."
user << "\green It seems to be online."
else
usr << "\red It seems to be offline"
user << "\red It seems to be offline"
/obj/machinery/power/breakerbox/attack_ai(mob/user)
if(busy)
+25 -26
View File
@@ -462,7 +462,8 @@ obj/structure/cable/proc/cableColor(var/colorC)
icon_state = "coil"
amount = MAXCOIL
max_amount = MAXCOIL
item_color = COLOR_RED
color = COLOR_RED
//item_color = COLOR_RED Use regular "color" var instead. No need to have it duplicate in two vars. Causes confusion.
desc = "A coil of power cable."
throwforce = 10
w_class = 2.0
@@ -484,10 +485,8 @@ obj/structure/cable/proc/cableColor(var/colorC)
/obj/item/stack/cable_coil/New(loc, length = MAXCOIL, var/param_color = null)
..()
src.amount = length
if (param_color)
if (param_color) // It should be red by default, so only recolor it if parameter was specified.
color = param_color
else
color = item_color
pixel_x = rand(-2,2)
pixel_y = rand(-2,2)
update_icon()
@@ -524,7 +523,6 @@ 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)
item_color = color
if(amount == 1)
icon_state = "coil1"
name = "cable piece"
@@ -541,15 +539,16 @@ obj/structure/cable/proc/cableColor(var/colorC)
else
w_class = 2.0
/obj/item/stack/cable_coil/examine()
set src in view(1)
/obj/item/stack/cable_coil/examine(mob/user)
if(get_dist(src, user) > 1)
return
if(get_amount() == 1)
usr << "A short piece of power cable."
user << "A short piece of power cable."
else if(get_amount() == 2)
usr << "A piece of power cable."
user << "A piece of power cable."
else
usr << "A coil of power cable. There are [get_amount()] lengths of cable in the coil."
user << "A coil of power cable. There are [get_amount()] lengths of cable in the coil."
/obj/item/stack/cable_coil/verb/make_restraint()
@@ -563,8 +562,8 @@ obj/structure/cable/proc/cableColor(var/colorC)
usr << "\red You need at least 15 lengths to make restraints!"
return
var/obj/item/weapon/handcuffs/cable/B = new /obj/item/weapon/handcuffs/cable(usr.loc)
B.icon_state = "cuff_[item_color]"
usr << "\blue You wind some cable together to make some restraints."
B.color = color
usr << "<span class='notice'>You wind some cable together to make some restraints.</span>"
src.use(15)
else
usr << "\blue You cannot do that."
@@ -577,7 +576,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
..()
if( istype(W, /obj/item/weapon/wirecutters) && src.amount > 1)
src.amount--
new/obj/item/stack/cable_coil(user.loc, 1,item_color)
new/obj/item/stack/cable_coil(user.loc, 1,color)
user << "You cut a piece off the cable coil."
src.update_icon()
return
@@ -674,7 +673,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/obj/structure/cable/C = new(F)
var/obj/structure/cable/D = new(temp.floorbelow)
C.cableColor(item_color)
C.cableColor(color)
C.d1 = 11
C.d2 = dirn
@@ -687,7 +686,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
C.mergeConnectedNetworks(C.d2)
C.mergeConnectedNetworksOnTurf()
D.cableColor(item_color)
D.cableColor(color)
D.d1 = 12
D.d2 = 0
@@ -707,7 +706,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
var/obj/structure/cable/C = new(F)
C.cableColor(item_color)
C.cableColor(color)
//set up the new cable
C.d1 = 0 //it's a O-X node cable
@@ -772,7 +771,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
var/obj/structure/cable/NC = new(U)
NC.cableColor(item_color)
NC.cableColor(color)
NC.d1 = 0
NC.d2 = fdirn
@@ -818,7 +817,7 @@ obj/structure/cable/proc/cableColor(var/colorC)
return
C.cableColor(item_color)
C.cableColor(color)
C.d1 = nd1
C.d2 = nd2
@@ -864,26 +863,26 @@ obj/structure/cable/proc/cableColor(var/colorC)
update_wclass()
/obj/item/stack/cable_coil/yellow
item_color = COLOR_YELLOW
color = COLOR_YELLOW
/obj/item/stack/cable_coil/blue
item_color = COLOR_BLUE
color = COLOR_BLUE
/obj/item/stack/cable_coil/green
item_color = COLOR_GREEN
color = COLOR_GREEN
/obj/item/stack/cable_coil/pink
item_color = COLOR_PINK
color = COLOR_PINK
/obj/item/stack/cable_coil/orange
item_color = COLOR_ORANGE
color = COLOR_ORANGE
/obj/item/stack/cable_coil/cyan
item_color = COLOR_CYAN
color = COLOR_CYAN
/obj/item/stack/cable_coil/white
item_color = COLOR_WHITE
color = COLOR_WHITE
/obj/item/stack/cable_coil/random/New()
item_color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN)
..()
+9 -8
View File
@@ -53,15 +53,16 @@
return amount_used
/obj/item/weapon/cell/examine()
set src in view(1)
if(usr /*&& !usr.stat*/)
if(maxcharge <= 2500)
usr << "[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
usr << "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() )]%."
/obj/item/weapon/cell/examine(mob/user)
if(get_dist(src, user) > 1)
return
if(maxcharge <= 2500)
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)
usr << "\red This power cell seems to be faulty."
user << "\red This power cell seems to be faulty."
/obj/item/weapon/cell/attack_self(mob/user as mob)
src.add_fingerprint(user)
+17 -19
View File
@@ -84,19 +84,19 @@
if (fixture_type == "bulb")
icon_state = "bulb-construct-stage1"
/obj/machinery/light_construct/examine()
set src in view()
..()
if (!(usr in view(2))) return
/obj/machinery/light_construct/examine(mob/user)
if(!..(user, 2))
return
switch(src.stage)
if(1)
usr << "It's an empty frame."
user << "It's an empty frame."
return
if(2)
usr << "It's wired."
user << "It's wired."
return
if(3)
usr << "The casing is closed."
user << "The casing is closed."
return
/obj/machinery/light_construct/attackby(obj/item/weapon/W as obj, mob/user as mob)
@@ -315,18 +315,16 @@
update()
// examine verb
/obj/machinery/light/examine()
set src in oview(1)
if(usr && !usr.stat)
switch(status)
if(LIGHT_OK)
usr << "[desc] It is turned [on? "on" : "off"]."
if(LIGHT_EMPTY)
usr << "[desc] The [fitting] has been removed."
if(LIGHT_BURNED)
usr << "[desc] The [fitting] is burnt out."
if(LIGHT_BROKEN)
usr << "[desc] The [fitting] has been smashed."
/obj/machinery/light/examine(mob/user)
switch(status)
if(LIGHT_OK)
user << "[desc] It is turned [on? "on" : "off"]."
if(LIGHT_EMPTY)
user << "[desc] The [fitting] has been removed."
if(LIGHT_BURNED)
user << "[desc] The [fitting] is burnt out."
if(LIGHT_BROKEN)
user << "[desc] The [fitting] has been smashed."
+4 -4
View File
@@ -54,10 +54,10 @@
reliability = min(round(temp_reliability / 4), 100)
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
examine()
..()
usr << "\blue The generator has [P.air_contents.phoron] units of fuel left, producing [power_gen] per cycle."
if(crit_fail) usr << "\red The generator seems to have broken down."
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
+8 -7
View File
@@ -32,7 +32,7 @@ tank [un]loading stuff
/obj/machinery/power/port_gen/attack_hand(mob/user)
turn on/off
/obj/machinery/power/port_gen/examine()
/obj/machinery/power/port_gen/examine(mob/user)
display round(lastgen) and phorontank amount
*/
@@ -85,8 +85,9 @@ display round(lastgen) and phorontank amount
if(!anchored)
return
/obj/machinery/power/port_gen/examine()
set src in oview(1)
/obj/machinery/power/port_gen/examine(mob/user)
if(!..(user,1 ))
return
if(active)
usr << "\blue The generator is on."
else
@@ -139,10 +140,10 @@ display round(lastgen) and phorontank amount
reliability = min(round(temp_reliability / 4), 100)
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
/obj/machinery/power/port_gen/pacman/examine()
..()
usr << "\blue The generator has [sheets] units of [sheet_name] fuel left, producing [power_gen] per cycle."
if(crit_fail) usr << "\red The generator seems to have broken down."
/obj/machinery/power/port_gen/pacman/examine(mob/user)
..(user)
user << "\blue The generator has [sheets] units of [sheet_name] fuel left, producing [power_gen] per cycle."
if(crit_fail) user << "\red The generator seems to have broken down."
/obj/machinery/power/port_gen/pacman/HasFuel()
if(sheets >= 1 / (time_per_sheet / power_output) - sheet_left)
+3 -4
View File
@@ -98,10 +98,9 @@ var/global/list/rad_collectors = list()
return 1
return ..()
/obj/machinery/power/rad_collector/examine()
..()
if (get_dist(usr, src) <= 3)
usr << "The meter indicates that \the [src] is collecting [last_power] W."
/obj/machinery/power/rad_collector/examine(mob/user)
if (..(user, 3))
user << "The meter indicates that \the [src] is collecting [last_power] W."
return 1
/obj/machinery/power/rad_collector/ex_act(severity)
@@ -105,7 +105,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
src.dir = turn(src.dir, 90)
return 1
/obj/structure/particle_accelerator/examine()
/obj/structure/particle_accelerator/examine(mob/user)
switch(src.construction_state)
if(0)
src.desc = text("A [name], looks like it's not attached to the flooring")
@@ -299,7 +299,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/machinery/particle_accelerator/update_icon()
return
/obj/machinery/particle_accelerator/examine()
/obj/machinery/particle_accelerator/examine(mob/user)
switch(src.construction_state)
if(0)
src.desc = text("A [name], looks like it's not attached to the flooring")
+12 -4
View File
@@ -65,7 +65,9 @@
overlays += image('icons/obj/power.dmi', "smes-op[outputting]")
if(inputting)
if(inputting == 2)
overlays += image('icons/obj/power.dmi', "smes-oc2")
else if (inputting == 1)
overlays += image('icons/obj/power.dmi', "smes-oc1")
else
if(input_attempt)
@@ -96,8 +98,12 @@
if(terminal && input_attempt)
input_available = terminal.surplus()
if(inputting)
if(input_available > 0 && input_available >= input_level) // if there's power available, try to 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
var/load = min((capacity-charge)/SMESRATE, input_level) // charge at set rate, limited to spare capacity
var/actual_load = terminal.draw_power(load) // draw power from the terminal side network
@@ -239,6 +245,7 @@
"<span class='notice'>You added cables to the [src].</span>")
terminal.connect_to_network()
stat = 0
return 0
else if(istype(W, /obj/item/weapon/wirecutters) && terminal && !building_terminal)
building_terminal = 1
@@ -262,6 +269,7 @@
"<span class='notice'>You cut the cables and dismantle the power terminal.</span>")
del(terminal)
building_terminal = 0
return 0
return 1
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
@@ -344,7 +352,7 @@
/obj/machinery/power/smes/proc/ion_act()
if(src.z == 1)
if(src.z in config.station_levels)
if(prob(1)) //explosion
for(var/mob/M in viewers(src))
M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
+7 -4
View File
@@ -113,7 +113,8 @@
h_user << "Medium electrical sparks as you touch the [src], severely burning your hand!"
h_user.adjustFireLoss(rand(10,25))
h_user.Paralyse(5)
empulse(src.loc, 2, 4)
spawn(0)
empulse(src.loc, 2, 4)
charge = 0
if (36 to 60)
@@ -129,7 +130,8 @@
h_user << "Strong electrical arc sparks between you and [src], knocking you out for a while!"
h_user.adjustFireLoss(rand(35,75))
h_user.Paralyse(12)
empulse(src.loc, 8, 16)
spawn(0)
empulse(src.loc, 8, 16)
charge = 0
apcs_overload(1, 10)
src.visible_message("\icon[src] <b>[src]</b> beeps: \"Caution. Output regulators malfunction. Uncontrolled discharge detected.\"")
@@ -143,7 +145,8 @@
// Remember, we have few gigajoules of electricity here.. Turn them into crispy toast.
h_user.adjustFireLoss(rand(150,195))
h_user.Paralyse(25)
empulse(src.loc, 32, 64)
spawn(0)
empulse(src.loc, 32, 64)
charge = 0
apcs_overload(5, 25)
src.visible_message("\icon[src] <b>[src]</b> beeps: \"Caution. Output regulators malfunction. Significant uncontrolled discharge detected.\"")
@@ -228,7 +231,7 @@
for(var/obj/I in component_parts)
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
I.loc = src.loc
del(src)
return
+4
View File
@@ -33,3 +33,7 @@
invisibility = 0
icon_state = "term"
// Needed so terminals are not removed from machines list.
// Powernet rebuilds need this to work properly.
/obj/machinery/power/terminal/process()
return 1