This commit is contained in:
Seris02
2020-01-18 18:30:51 +08:00
243 changed files with 2866 additions and 1802 deletions
+40 -16
View File
@@ -98,6 +98,7 @@
var/force_update = 0
var/emergency_lights = FALSE
var/nightshift_lights = FALSE
var/nightshift_requires_auth = FALSE
var/last_nightshift_switch = 0
var/update_state = -1
var/update_overlay = -1
@@ -241,6 +242,7 @@
update_icon()
make_terminal()
update_nightshift_auth_requirement()
addtimer(CALLBACK(src, .proc/update), 5)
@@ -862,6 +864,7 @@
/obj/machinery/power/apc/ui_data(mob/user)
var/list/data = list(
"locked" = locked && !(integration_cog && is_servant_of_ratvar(user)) && !hasSiliconAccessInArea(user,area),
"lock_nightshift" = nightshift_requires_auth,
"failTime" = failure_timer,
"isOperating" = operating,
"externalPower" = main_status,
@@ -973,10 +976,21 @@
. = UI_INTERACTIVE
/obj/machinery/power/apc/ui_act(action, params)
if (action == "hijack" && can_use(usr, 1))
if(..() || !can_use(usr, 1))
return
if(failure_timer)
if(action == "reboot")
failure_timer = 0
update_icon()
update()
if (action == "hijack" && can_use(usr, 1)) //don't need auth for hijack button
hijack(usr)
return
if(..() || !can_use(usr, 1) || (locked && !hasSiliconAccessInArea(usr,area) && !usr.has_unlimited_silicon_privilege && !failure_timer && !(integration_cog && (is_servant_of_ratvar(usr)))))
var/authorized = (!locked || usr.has_unlimited_silicon_privilege || hasSiliconAccessInArea(usr,area) || (integration_cog && (is_servant_of_ratvar(usr))))
if((action == "toggle_nightshift") && (!nightshift_requires_auth || authorized))
toggle_nightshift_lights()
return TRUE
if(!authorized)
return
switch(action)
if("lock")
@@ -986,22 +1000,19 @@
else
locked = !locked
update_icon()
. = TRUE
return TRUE
if("cover")
coverlocked = !coverlocked
. = TRUE
return TRUE
if("breaker")
toggle_breaker()
. = TRUE
if("toggle_nightshift")
toggle_nightshift_lights()
. = TRUE
return TRUE
if("charge")
chargemode = !chargemode
if(!chargemode)
charging = APC_NOT_CHARGING
update_icon()
. = TRUE
return TRUE
if("channel")
if(params["eqp"])
equipment = setsubsystem(text2num(params["eqp"]))
@@ -1015,24 +1026,23 @@
environ = setsubsystem(text2num(params["env"]))
update_icon()
update()
. = TRUE
return TRUE
if("overload")
if(usr.has_unlimited_silicon_privilege || hasSiliconAccessInArea(usr,area))
overload_lighting()
. = TRUE
return TRUE
if("hack")
if(get_malf_status(usr))
malfhack(usr)
return TRUE
if("occupy")
if(get_malf_status(usr))
malfoccupy(usr)
return TRUE
if("deoccupy")
if(get_malf_status(usr))
malfvacate()
if("reboot")
failure_timer = 0
update_icon()
update()
return TRUE
if("emergency_lighting")
emergency_lights = !emergency_lights
for(var/obj/machinery/light/L in area)
@@ -1055,7 +1065,7 @@
INVOKE_ASYNC(D,/obj/machinery/door.proc/hostile_lockdown,usr, FALSE)
addtimer(CALLBACK(D,/obj/machinery/door.proc/disable_lockdown, FALSE), 30 SECONDS)
cell.charge -= cell.maxcharge*celluse
return 1
return TRUE
/obj/machinery/power/apc/proc/toggle_breaker()
if(!is_operational() || failure_timer)
@@ -1486,6 +1496,8 @@
/obj/machinery/power/apc/proc/set_nightshift(on)
set waitfor = FALSE
if(nightshift_lights == on)
return
nightshift_lights = on
for(var/obj/machinery/light/L in area)
if(L.nightshift_allowed)
@@ -1500,6 +1512,18 @@
L.update(FALSE)
CHECK_TICK
/obj/machinery/power/apc/proc/update_nightshift_auth_requirement()
nightshift_requires_auth = nightshift_toggle_requires_auth()
/obj/machinery/power/apc/proc/nightshift_toggle_requires_auth()
if(!area)
return FALSE
var/configured_level = CONFIG_GET(number/night_shift_public_areas_only)
var/our_level = area.nightshift_public_area
var/public_requires_auth = CONFIG_GET(flag/nightshift_toggle_public_requires_auth)
var/normal_requires_auth = CONFIG_GET(flag/nightshift_toggle_requires_auth)
return (configured_level && our_level && ((our_level <= configured_level)? public_requires_auth : normal_requires_auth))
#undef UPSTATE_CELL_IN
#undef UPSTATE_OPENED1
#undef UPSTATE_OPENED2
+9 -5
View File
@@ -79,13 +79,17 @@ By design, d1 is the smallest direction and d2 is the highest
color = "#ffffff"
// the power cable object
/obj/structure/cable/Initialize(mapload, param_color)
/obj/structure/cable/Initialize(mapload, param_color, _d1, _d2)
. = ..()
// ensure d1 & d2 reflect the icon_state for entering and exiting cable
var/dash = findtext(icon_state, "-")
d1 = text2num( copytext( icon_state, 1, dash ) )
d2 = text2num( copytext( icon_state, dash+1 ) )
if(isnull(_d1) || isnull(_d2))
// ensure d1 & d2 reflect the icon_state for entering and exiting cable
var/dash = findtext(icon_state, "-")
d1 = text2num( copytext( icon_state, 1, dash ) )
d2 = text2num( copytext( icon_state, dash+1 ) )
else
d1 = _d1
d2 = _d2
var/turf/T = get_turf(src) // hide if turf is not intact
if(level==1)
+1 -1
View File
@@ -74,7 +74,7 @@
addtimer(CALLBACK(GLOBAL_PROC, .proc/explosion, get_turf(src), 2, 3, 4, 8), 100) // Not a normal explosion.
/obj/machinery/power/rtg/abductor/bullet_act(obj/item/projectile/Proj)
..()
. = ..()
if(!going_kaboom && istype(Proj) && !Proj.nodamage && ((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE)))
message_admins("[ADMIN_LOOKUPFLW(Proj.firer)] triggered an Abductor Core explosion at [AREACOORD(src)] via projectile.")
log_game("[key_name(Proj.firer)] triggered an Abductor Core explosion at [AREACOORD(src)] via projectile.")
@@ -113,7 +113,8 @@
/obj/singularity/bullet_act(obj/item/projectile/P)
return 0 //Will there be an impact? Who knows. Will we see it? No.
qdel(P)
return BULLET_ACT_HIT //Will there be an impact? Who knows. Will we see it? No.
/obj/singularity/Bump(atom/A)
@@ -521,7 +521,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
has_been_powered = TRUE
else if(takes_damage)
damage += Proj.damage * config_bullet_energy
return FALSE
return BULLET_ACT_HIT
/obj/machinery/power/supermatter_crystal/singularity_act()
var/gain = 100