Merge remote-tracking branch 'upstream/master' into pol-baycomps

This commit is contained in:
Aronai Sieyes
2020-03-31 10:47:47 -04:00
664 changed files with 25682 additions and 5900 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
icon_state = "control"
anchored = 1
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 100
active_power_usage = 1000
@@ -211,10 +211,10 @@
/obj/machinery/power/am_control_unit/proc/toggle_power()
active = !active
if(active)
use_power = 2
update_use_power(USE_POWER_ACTIVE)
visible_message("The [src.name] starts up.")
else
use_power = 1
update_use_power(USE_POWER_IDLE)
visible_message("The [src.name] shuts down.")
update_icon()
return
+1 -1
View File
@@ -16,7 +16,7 @@ proc/cardinalrange(var/center)
anchored = 1
density = 1
dir = 1
use_power = 0//Living things generally dont use power
use_power = USE_POWER_OFF //Living things generally dont use power
idle_power_usage = 0
active_power_usage = 0
+12 -2
View File
@@ -67,7 +67,7 @@
plane = TURF_PLANE
layer = ABOVE_TURF_LAYER
anchored = 1
use_power = 0
use_power = USE_POWER_OFF
clicksound = "switch"
req_access = list(access_engine_equip)
var/area/area
@@ -105,6 +105,7 @@
var/beenhit = 0 // used for counting how many times it has been hit, used for Aliens at the moment
var/longtermpower = 10
var/datum/wires/apc/wires = null
var/emergency_lights = FALSE
var/update_state = -1
var/update_overlay = -1
var/is_critical = 0
@@ -795,6 +796,7 @@
"gridCheck" = grid_check,
"coverLocked" = coverlocked,
"siliconUser" = issilicon(user) || isobserver(user), //I add observer here so admins can have more control, even if it makes 'siliconUser' seem inaccurate.
"emergencyLights" = !emergency_lights,
"powerChannels" = list(
list(
@@ -835,7 +837,7 @@
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 520, data["siliconUser"] ? 465 : 440)
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 520, data["siliconUser"] ? 490 : 465)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
@@ -932,6 +934,14 @@
update_icon()
update()
else if (href_list["emergency_lighting"])
emergency_lights = !emergency_lights
for(var/obj/machinery/light/L in area)
if(!initial(L.no_emergency)) //If there was an override set on creation, keep that override
L.no_emergency = emergency_lights
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
CHECK_TICK
else if (href_list["breaker"])
toggle_breaker()
+13
View File
@@ -132,3 +132,16 @@
overlays.Cut()
target.nutrition += amount
user.custom_emote(message = "connects \the [src] to [user == target ? "their" : "[target]'s"] charging port, expending it.")
/obj/item/weapon/cell/emergency_light
name = "miniature power cell"
desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage."
maxcharge = 120 //Emergency lights use 0.2 W per tick, meaning ~10 minutes of emergency power from a cell
matter = list("glass" = 20)
w_class = ITEMSIZE_TINY
/obj/item/weapon/cell/emergency_light/Initialize()
. = ..()
var/area/A = get_area(src)
if(!A.lightswitch || !A.light_power)
charge = 0 //For naturally depowered areas, we start with no power
+3 -3
View File
@@ -13,7 +13,7 @@ var/list/fusion_cores = list()
icon = 'icons/obj/machines/power/fusion.dmi'
icon_state = "core0"
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 50
active_power_usage = 500 //multiplied by field strength
anchored = 0
@@ -70,7 +70,7 @@ var/list/fusion_cores = list()
owned_field = new(loc, src)
owned_field.ChangeFieldStrength(field_strength)
icon_state = "core1"
use_power = 2
update_use_power(USE_POWER_ACTIVE)
. = 1
/obj/machinery/power/fusion_core/proc/Shutdown(var/force_rupture)
@@ -82,7 +82,7 @@ var/list/fusion_cores = list()
owned_field.RadiateAll()
qdel(owned_field)
owned_field = null
use_power = 1
update_use_power(USE_POWER_IDLE)
/obj/machinery/power/fusion_core/proc/AddParticles(var/name, var/quantity = 1)
if(owned_field)
@@ -7,7 +7,7 @@ var/list/fuel_injectors = list()
density = 1
anchored = 0
req_access = list(access_engine)
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 10
active_power_usage = 500
@@ -103,13 +103,13 @@ var/list/fuel_injectors = list()
if(!injecting && cur_assembly)
icon_state = "injector1"
injecting = 1
use_power = 1
update_use_power(USE_POWER_IDLE)
/obj/machinery/fusion_fuel_injector/proc/StopInjecting()
if(injecting)
injecting = 0
icon_state = "injector0"
use_power = 0
update_use_power(USE_POWER_OFF)
/obj/machinery/fusion_fuel_injector/proc/Inject()
if(!injecting)
@@ -6,7 +6,7 @@ var/list/gyrotrons = list()
desc = "It is a heavy duty industrial gyrotron suited for powering fusion reactors."
icon_state = "emitter-off"
req_access = list(access_engine)
use_power = 1
use_power = USE_POWER_IDLE
active_power_usage = 50000
circuit = /obj/item/weapon/circuitboard/gyrotron
+2 -2
View File
@@ -5,7 +5,7 @@
density = 1
anchored = 0
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 100 //Watts, I hope. Just enough to do the computer and display things.
var/max_power = 500000
@@ -156,7 +156,7 @@
user.visible_message("[user.name] [anchored ? "secures" : "unsecures"] the bolts holding [src.name] to the floor.", \
"You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.", \
"You hear a ratchet.")
use_power = anchored
update_use_power(anchored ? USE_POWER_IDLE : USE_POWER_ACTIVE)
if(anchored) // Powernet connection stuff.
connect_to_network()
else
+1 -1
View File
@@ -4,7 +4,7 @@
icon_state = "teg"
anchored = 1
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/obj/machinery/atmospherics/unary/generator_input/input1
var/obj/machinery/atmospherics/unary/generator_input/input2
+1 -1
View File
@@ -16,7 +16,7 @@
icon_state = "TheSingGen"
anchored = 1
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 200
active_power_usage = 1000
var/on = 1
+128 -7
View File
@@ -10,6 +10,7 @@
#define LIGHT_BURNED 3
#define LIGHT_BULB_TEMPERATURE 400 //K - used value for a 60W bulb
#define LIGHTING_POWER_FACTOR 5 //5W per luminosity * range
#define LIGHT_EMERGENCY_POWER_USE 0.2 //How much power emergency lights will consume per tick
var/global/list/light_type_cache = list()
/proc/get_light_type_instance(var/light_type)
@@ -29,6 +30,10 @@ var/global/list/light_type_cache = list()
var/stage = 1
var/fixture_type = /obj/machinery/light
var/sheets_refunded = 2
var/obj/machinery/light/newlight = null
var/obj/item/weapon/cell/cell = null
var/cell_connectors = TRUE
/obj/machinery/light_construct/New(var/atom/newloc, var/newdir, var/building = 0, var/datum/frame/frame_types/frame_type, var/obj/machinery/light/fixture = null)
..(newloc)
@@ -61,9 +66,44 @@ var/global/list/light_type_cache = list()
to_chat(user, "It's wired.")
if(3)
to_chat(user, "The casing is closed.")
if(cell_connectors)
if(cell)
to_chat(user, "You see [cell] inside the casing.")
else
to_chat(user, "The casing has no power cell for backup power.")
else
to_chat(user, "<span class='danger'>This casing doesn't support power cells for backup power.</span>")
/obj/machinery/light_construct/attack_hand(mob/user)
. = ..()
if(.)
return . // obj/machinery/attack_hand returns 1 if user can't use the machine
if(cell)
user.visible_message("[user] removes [cell] from [src]!","<span class='notice'>You remove [cell].</span>")
user.put_in_hands(cell)
cell.update_icon()
cell = null
/obj/machinery/light_construct/attackby(obj/item/weapon/W as obj, mob/user as mob)
src.add_fingerprint(user)
if(istype(W, /obj/item/weapon/cell/emergency_light))
if(!cell_connectors)
to_chat(user, "<span class='warning'>This [name] can't support a power cell!</span>")
return
if(!user.unEquip(W))
to_chat(user, "<span class='warning'>[W] is stuck to your hand!</span>")
return
if(cell)
to_chat(user, "<span class='warning'>There is a power cell already installed!</span>")
else if(user.drop_from_inventory(W))
user.visible_message("<span class='notice'>[user] hooks up [W] to [src].</span>", \
"<span class='notice'>You add [W] to [src].</span>")
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
W.forceMove(src)
cell = W
add_fingerprint(user)
return
if (W.is_wrench())
if (src.stage == 1)
playsound(src, W.usesound, 75, 1)
@@ -114,6 +154,10 @@ var/global/list/light_type_cache = list()
var/obj/machinery/light/newlight = new fixture_type(src.loc, src)
newlight.set_dir(src.dir)
src.transfer_fingerprints_to(newlight)
if(cell)
newlight.cell = cell
cell.forceMove(newlight)
cell = null
qdel(src)
return
..()
@@ -168,7 +212,7 @@ var/global/list/light_type_cache = list()
anchored = 1
plane = MOB_PLANE
layer = ABOVE_MOB_LAYER
use_power = 2
use_power = USE_POWER_ACTIVE
idle_power_usage = 2
active_power_usage = 10 // Previously 20.
power_channel = LIGHT //Lights are calc'd via area so they dont need to be in the machine list
@@ -187,6 +231,16 @@ var/global/list/light_type_cache = list()
var/auto_flicker = FALSE // If true, will constantly flicker, so long as someone is around to see it (otherwise its a waste of CPU).
var/obj/item/weapon/cell/emergency_light/cell
var/start_with_cell = TRUE // if true, this fixture generates a very weak cell at roundstart
var/emergency_mode = FALSE // if true, the light is in emergency mode
var/no_emergency = FALSE // if true, this light cannot ever have an emergency mode
var/bulb_emergency_brightness_mul = 0.25 // multiplier for this light's base brightness in emergency power mode
var/bulb_emergency_colour = "#FF3232" // determines the colour of the light while it's in emergency mode
var/bulb_emergency_pow_mul = 0.75 // the multiplier for determining the light's power in emergency mode
var/bulb_emergency_pow_min = 0.5 // the minimum value for the light's power in emergency mode
/obj/machinery/light/flicker
auto_flicker = TRUE
@@ -202,6 +256,12 @@ var/global/list/light_type_cache = list()
/obj/machinery/light/small/flicker
auto_flicker = TRUE
/obj/machinery/light/poi
start_with_cell = FALSE
/obj/machinery/light/small/poi
start_with_cell = FALSE
/obj/machinery/light/flamp
icon_state = "flamp1"
base_state = "flamp"
@@ -214,10 +274,14 @@ var/global/list/light_type_cache = list()
/obj/machinery/light/flamp/New(atom/newloc, obj/machinery/light_construct/construct = null)
..(newloc, construct)
if(construct)
start_with_cell = FALSE
lamp_shade = 0
update_icon()
else
if(start_with_cell && !no_emergency)
cell = new/obj/item/weapon/cell/emergency_light(src)
/obj/machinery/light/flamp/flicker
auto_flicker = TRUE
@@ -242,11 +306,14 @@ var/global/list/light_type_cache = list()
..(newloc)
if(construct)
start_with_cell = FALSE
status = LIGHT_EMPTY
construct_type = construct.type
construct.transfer_fingerprints_to(src)
set_dir(construct.dir)
else
if(start_with_cell && !no_emergency)
cell = new/obj/item/weapon/cell/emergency_light(src)
var/obj/item/weapon/light/L = get_light_type_instance(light_type)
update_from_bulb(L)
if(prob(L.broken_chance))
@@ -260,6 +327,7 @@ var/global/list/light_type_cache = list()
if(A)
on = 0
// A.update_lights()
QDEL_NULL(cell)
return ..()
/obj/machinery/light/update_icon()
@@ -320,10 +388,14 @@ var/global/list/light_type_cache = list()
on = 0
set_light(0)
else
use_power = 2
update_use_power(USE_POWER_ACTIVE)
set_light(brightness_range, brightness_power, brightness_color)
else
else if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off())
use_power = 1
emergency_mode = TRUE
START_PROCESSING(SSobj, src)
else
update_use_power(USE_POWER_IDLE)
set_light(0)
active_power_usage = ((light_range * light_power) * LIGHTING_POWER_FACTOR)
@@ -361,6 +433,9 @@ var/global/list/light_type_cache = list()
on = (s && status == LIGHT_OK)
update()
/obj/machinery/light/get_cell()
return cell
// examine verb
/obj/machinery/light/examine(mob/user)
var/fitting = get_fitting_name()
@@ -373,6 +448,8 @@ var/global/list/light_type_cache = list()
to_chat(user, "[desc] The [fitting] is burnt out.")
if(LIGHT_BROKEN)
to_chat(user, "[desc] The [fitting] has been smashed.")
if(cell)
to_chat(user, "Its backup power charge meter reads [round((cell.charge / cell.maxcharge) * 100, 0.1)]%.")
/obj/machinery/light/proc/get_fitting_name()
var/obj/item/weapon/light/L = light_type
@@ -498,6 +575,12 @@ var/global/list/light_type_cache = list()
..()
// returns if the light has power /but/ is manually turned off
// if a light is turned off, it won't activate emergency power
/obj/machinery/light/proc/turned_off()
var/area/A = get_area(src)
return !A.lightswitch && A.power_light || flickering
// returns whether this light has power
// true if area has power and lightswitch is on
/obj/machinery/light/proc/has_power()
@@ -511,6 +594,28 @@ var/global/list/light_type_cache = list()
else
return A && A.lightswitch && (!A.requires_power || A.power_light)
// returns whether this light has emergency power
// can also return if it has access to a certain amount of that power
/obj/machinery/light/proc/has_emergency_power(pwr)
if(no_emergency || !cell)
return FALSE
if(pwr ? cell.charge >= pwr : cell.charge)
return status == LIGHT_OK
// attempts to use power from the installed emergency cell, returns true if it does and false if it doesn't
/obj/machinery/light/proc/use_emergency_power(pwr = LIGHT_EMERGENCY_POWER_USE)
if(turned_off())
return FALSE
if(!has_emergency_power(pwr))
return FALSE
if(cell.charge > 300) //it's meant to handle 120 W, ya doofus
visible_message("<span class='warning'>[src] short-circuits from too powerful of a power cell!</span>")
status = LIGHT_BURNED
return FALSE
cell.use(pwr)
set_light(brightness_range * bulb_emergency_brightness_mul, max(bulb_emergency_pow_min, bulb_emergency_pow_mul * (cell.charge / cell.maxcharge)), bulb_emergency_colour)
return TRUE
/obj/machinery/light/proc/flicker(var/amount = rand(10, 20))
if(flickering) return
flickering = 1
@@ -525,12 +630,17 @@ var/global/list/light_type_cache = list()
update(0)
flickering = 0
// ai attack - make lights flicker, because why not
// ai attack - turn on/off emergency lighting for a specific fixture
/obj/machinery/light/attack_ai(mob/user)
src.flicker(1)
no_emergency = !no_emergency
to_chat(user, "<span class='notice'>Emergency lights for this fixture have been [no_emergency ? "disabled" : "enabled"].</span>")
update(FALSE)
return
// ai alt click - Make light flicker. Very important for atmosphere.
/obj/machinery/light/AIAltClick(mob/user)
flicker(1)
/obj/machinery/light/flamp/attack_ai(mob/user)
attack_hand()
return
@@ -653,6 +763,17 @@ var/global/list/light_type_cache = list()
// use power
/obj/machinery/light/process()
if(!cell)
return PROCESS_KILL
if(has_power())
emergency_mode = FALSE
update(FALSE)
if(cell.charge == cell.maxcharge)
return PROCESS_KILL
cell.charge = min(cell.maxcharge, cell.charge + LIGHT_EMERGENCY_POWER_USE*2) //Recharge emergency power automatically while not using it
if(emergency_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE))
update(FALSE) //Disables emergency mode and sets the color to normal
if(auto_flicker && !flickering)
if(check_for_player_proximity(src, radius = 12, ignore_ghosts = FALSE, ignore_afk = TRUE))
seton(TRUE) // Lights must be on to flicker.
+1 -1
View File
@@ -6,7 +6,7 @@
icon_state = "portgen0"
density = 1
anchored = 0
use_power = 0
use_power = USE_POWER_OFF
var/active = 0
var/power_gen = 5000
+1 -1
View File
@@ -11,7 +11,7 @@
icon = 'icons/obj/power.dmi'
anchored = 1.0
var/datum/powernet/powernet = null
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 0
active_power_usage = 0
@@ -15,7 +15,7 @@
anchored = 1.0
circuit = /obj/item/weapon/circuitboard/powermonitor
var/alerting = 0
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 300
active_power_usage = 300
var/datum/nano_module/power_monitor/power_monitor
@@ -8,7 +8,7 @@
anchored = 1
density = 0
unacidable = 1
use_power = 0
use_power = USE_POWER_OFF
light_range = 4
flags = PROXMOVE
var/obj/machinery/field_generator/FG1 = null
+1 -1
View File
@@ -10,7 +10,7 @@
req_access = list(access_engine_equip)
var/id = null
use_power = 0 //uses powernet power, not APC power
use_power = USE_POWER_OFF //uses powernet power, not APC power
active_power_usage = 30000 //30 kW laser. I guess that means 30 kJ per shot.
var/active = 0
@@ -20,7 +20,7 @@ field_generator power level display
icon_state = "Field_Gen"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/const/num_power_levels = 6 // Total number of power level icon has
var/Varedit_start = 0
var/Varpower = 0
+1 -1
View File
@@ -6,7 +6,7 @@
icon_state = "TheSingGen"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/energy = 0
var/creation_type = /obj/singularity
@@ -258,7 +258,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
icon_state = "none"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 0
active_power_usage = 0
var/construction_state = 0
@@ -383,10 +383,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
if(src.construction_state < 3)//Was taken apart, update state
update_state()
if(use_power)
use_power = 0
update_use_power(USE_POWER_OFF)
src.construction_state = temp_state
if(src.construction_state >= 3)
use_power = 1
update_use_power(USE_POWER_IDLE)
update_icon()
return 1
return 0
@@ -8,7 +8,7 @@
reference = "control_box"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 500
active_power_usage = 70000 //70 kW per unit of strength
construction_state = 0
@@ -42,7 +42,7 @@
/obj/machinery/particle_accelerator/control_box/update_state()
if(construction_state < 3)
update_use_power(0)
update_use_power(USE_POWER_OFF)
assembled = 0
active = 0
for(var/obj/structure/particle_accelerator/part in connected_parts)
@@ -52,7 +52,7 @@
connected_parts = list()
return
if(!part_scan())
update_use_power(1)
update_use_power(USE_POWER_IDLE)
active = 0
connected_parts = list()
@@ -138,9 +138,9 @@
..()
if(stat & NOPOWER)
active = 0
update_use_power(0)
update_use_power(USE_POWER_OFF)
else if(!stat && construction_state == 3)
update_use_power(1)
update_use_power(USE_POWER_IDLE)
/obj/machinery/particle_accelerator/control_box/process()
@@ -212,13 +212,13 @@
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [key_name(usr, usr.client)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) in ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)",0,1)
log_game("PACCEL([x],[y],[z]) [key_name(usr)] turned [active?"ON":"OFF"].")
if(active)
update_use_power(2)
update_use_power(USE_POWER_ACTIVE)
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = src.strength
part.powered = 1
part.update_icon()
else
update_use_power(1)
update_use_power(USE_POWER_IDLE)
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = null
part.powered = 0
@@ -9,7 +9,7 @@
icon_state = "smasher"
anchored = 0
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/successful_craft = FALSE // Are we waiting to be emptied?
var/image/material_layer // Holds the image used for the filled overlay.
+1 -1
View File
@@ -11,7 +11,7 @@
icon_state = "smes"
density = 1
anchored = 1
use_power = 0
use_power = USE_POWER_OFF
circuit = /obj/item/weapon/circuitboard/smes
clicksound = "switch"
+2 -2
View File
@@ -13,7 +13,7 @@ GLOBAL_LIST_EMPTY(solars_list)
icon_state = "sp_base"
anchored = 1
density = 1
use_power = 0
use_power = USE_POWER_OFF
idle_power_usage = 0
active_power_usage = 0
var/id = 0
@@ -285,7 +285,7 @@ GLOBAL_LIST_EMPTY(solars_list)
icon_state = "solar"
anchored = 1
density = 1
use_power = 1
use_power = USE_POWER_IDLE
idle_power_usage = 250
var/id = 0
var/cdir = 0
@@ -126,7 +126,7 @@ GLOBAL_LIST_BOILERPLATE(all_engine_setup_markers, /obj/effect/engine_setup)
log_and_message_admins("## WARNING: Unable to locate pump at [x] [y] [z]!")
return SETUP_WARNING
P.target_pressure = P.max_pressure_setting
P.use_power = 1
P.update_use_power(USE_POWER_IDLE)
P.update_icon()
return SETUP_OK
@@ -259,7 +259,7 @@ GLOBAL_LIST_BOILERPLATE(all_engine_setup_markers, /obj/effect/engine_setup)
return SETUP_WARNING
F.rebuild_filtering_list()
F.use_power = 1
F.update_use_power(USE_POWER_IDLE)
F.update_icon()
return SETUP_OK
+1 -1
View File
@@ -10,7 +10,7 @@
icon_state = "tracker"
anchored = 1
density = 1
use_power = 0
use_power = USE_POWER_OFF
var/id = 0
var/sun_angle = 0 // sun angle as set by sun datum