Merge pull request #134 from Abi79/master

TG updates & Ultralight code cleanup
This commit is contained in:
CIB
2011-12-23 14:56:34 -08:00
15 changed files with 8087 additions and 7897 deletions
+1
View File
@@ -972,6 +972,7 @@
#include "code\modules\research\rdmachines.dm"
#include "code\modules\research\research.dm"
#include "code\modules\research\server.dm"
#include "code\modules\security levels\keycard authentication.dm"
#include "code\modules\security levels\security levels.dm"
#include "code\WorkInProgress\AI_Visibility.dm"
#include "code\WorkInProgress\buildmode.dm"
+26
View File
@@ -42,6 +42,14 @@
var/server
var/banappeals
//Alert level description
var/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced."
var/alert_desc_blue_upto = "The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted."
var/alert_desc_blue_downto = "The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed."
var/alert_desc_red_upto = "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised."
var/alert_desc_red_downto = "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised."
var/alert_desc_delta = "The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill."
//game_options.txt configs
var/health_threshold_crit = 0
@@ -220,6 +228,24 @@
if("load_jobs_from_txt")
load_jobs_from_txt = 1
if("alert_red_upto")
config.alert_desc_red_upto = value
if("alert_red_downto")
config.alert_desc_red_downto = value
if("alert_blue_downto")
config.alert_desc_blue_downto = value
if("alert_blue_upto")
config.alert_desc_blue_upto = value
if("alert_green")
config.alert_desc_green = value
if("alert_delta")
config.alert_desc_delta = value
else
diary << "Unknown setting in configuration: '[name]'"
+3 -1
View File
@@ -190,7 +190,9 @@
// command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.")
// world << sound('intercept.ogg')
// set_security_level(1)
// if(security_level < SEC_LEVEL_BLUE)
// set_security_level(SEC_LEVEL_BLUE)
/datum/game_mode/blob/proc/check_quarantine()
var/numDead = 0
var/numAlive = 0
+2 -1
View File
@@ -113,7 +113,8 @@
command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.")
world << sound('intercept.ogg')
set_security_level(1)
if(security_level < SEC_LEVEL_BLUE)
set_security_level(SEC_LEVEL_BLUE)
/datum/game_mode/proc/get_players_for_role(var/role, override_jobbans=1)
+13 -7
View File
@@ -58,6 +58,7 @@
access_hop = 57
access_hos = 58
access_RC_announce = 59 //Request console announcements
access_keycard_auth = 60 //Used for events which require at least two people to confirm them
//BEGIN CENTCOM ACCESS
/*Should leave plenty of room if we need to add more access levels.
@@ -200,7 +201,7 @@
return list(access_medical, access_morgue, access_tox, access_tox_storage, access_chemistry, access_medlab, access_court,
access_teleporter, access_heads, access_tech_storage, access_security, access_brig, access_atmospherics,
access_maint_tunnels, access_bar, access_janitor, access_kitchen, access_robotics, access_armory, access_hydroponics,
access_theatre, access_research, access_hos, access_RC_announce, access_forensics_lockers)
access_theatre, access_research, access_hos, access_RC_announce, access_forensics_lockers, access_keycard_auth)
if("Head of Personnel")
return list(access_security, access_brig, access_court, access_forensics_lockers,
access_tox, access_tox_storage, access_chemistry, access_medical, access_medlab, access_engine,
@@ -208,7 +209,7 @@
access_all_personal_lockers, access_tech_storage, access_maint_tunnels, access_bar, access_janitor,
access_crematorium, access_kitchen, access_robotics, access_cargo, access_cargo_bot, access_hydroponics, access_lawyer,
access_theatre, access_research, access_mining, access_heads_vault, access_mining_station,
access_hop, access_RC_announce)
access_hop, access_RC_announce, access_keycard_auth)
if("Atmospheric Technician")
return list(access_atmospherics, access_maint_tunnels, access_emergency_storage)
if("Bartender")
@@ -235,17 +236,19 @@
return list(access_engine, access_engine_equip, access_tech_storage, access_maint_tunnels,
access_external_airlocks, access_atmospherics, access_emergency_storage, access_eva,
access_heads, access_ai_upload, access_construction, access_robotics,
access_mint, access_ce, access_RC_announce)
access_mint, access_ce, access_RC_announce, access_keycard_auth)
if("Research Director")
return list(access_medlab, access_rd,
access_maint_tunnels, access_heads, access_tox,
access_tox_storage, access_chemistry, access_teleporter,
access_research, access_robotics, access_xenobiology, access_RC_announce)
access_research, access_robotics, access_xenobiology, access_RC_announce,
access_keycard_auth)
if("Virologist")
return list(access_medical, access_morgue, access_virology)
if("Chief Medical Officer")
return list(access_medical, access_morgue, access_medlab, access_heads,
access_chemistry, access_virology, access_cmo, access_surgery, access_RC_announce)
access_chemistry, access_virology, access_cmo, access_surgery, access_RC_announce,
access_keycard_auth)
else
return list()
@@ -280,7 +283,8 @@
access_bar, access_janitor, access_crematorium, access_robotics, access_cargo, access_cargo_bot, access_construction,
access_hydroponics, access_library, access_manufacturing, access_lawyer, access_virology, access_cmo, access_qm, access_clown, access_mime, access_surgery,
access_theatre, access_research, access_mining, access_mailsorting, access_mint_vault, access_mint,
access_heads_vault, access_mining_station, access_xenobiology, access_ce, access_hop, access_hos, access_RC_announce)
access_heads_vault, access_mining_station, access_xenobiology, access_ce, access_hop, access_hos, access_RC_announce,
access_keycard_auth)
/proc/get_all_centcom_access()
return list(access_cent_general, access_cent_thunder, access_cent_specops, access_cent_medical, access_cent_living, access_cent_storage, access_cent_teleporter, access_cent_creed, access_cent_captain)
@@ -301,7 +305,7 @@
if(4) //engineering and maintenance
return list(access_engine, access_engine_equip, access_maint_tunnels, access_external_airlocks, access_emergency_storage, access_tech_storage, access_atmospherics, access_construction, access_robotics, access_ce)
if(5) //command
return list(access_change_ids, access_ai_upload, access_teleporter, access_eva, access_heads, access_captain, access_all_personal_lockers, access_mint_vault, access_heads_vault, access_hop, access_RC_announce)
return list(access_change_ids, access_ai_upload, access_teleporter, access_eva, access_heads, access_captain, access_all_personal_lockers, access_mint_vault, access_heads_vault, access_hop, access_RC_announce, access_keycard_auth)
if(6) //station general
return list(access_chapel_office, access_kitchen,access_bar, access_janitor, access_crematorium, access_library, access_theatre, access_lawyer, access_clown, access_mime)
if(7) //supply
@@ -447,6 +451,8 @@
return "CE Private"
if(access_RC_announce)
return "RC announcements"
if(access_keycard_auth)
return "Keycode auth. device"
/proc/get_centcom_access_desc(A)
switch(A)
@@ -79,6 +79,11 @@
//Only notify the admins if an actual change happened
log_game("[key_name(usr)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].", 1)
switch(get_security_level())
if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_green",1)
if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_blue",1)
tmp_alertlevel = 0
else:
usr << "You are not authorized to do this."
+4 -2
View File
@@ -255,8 +255,9 @@
on = 0
continue
if (selected_glass == 1 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 0 && selected_uranium == 0 && selected_iron == 1 && selected_clown == 0 && selected_adamantine == 0)
if (ore_glass > 0)
if (ore_glass > 0 && ore_iron > 0)
ore_glass--;
ore_iron--;
new /obj/item/stack/sheet/rglass(output.loc)
else
on = 0
@@ -304,8 +305,9 @@
on = 0
continue
if (selected_glass == 0 && selected_gold == 0 && selected_silver == 0 && selected_diamond == 0 && selected_plasma == 1 && selected_uranium == 0 && selected_iron == 1 && selected_clown == 0 && selected_adamantine == 0)
if (ore_iron > 0)
if (ore_iron > 0 && ore_plasma > 0)
ore_iron--;
ore_plasma--;
new /obj/item/stack/sheet/r_metal(output.loc)
else
on = 0
@@ -20,7 +20,7 @@ obj/item/weapon/gun/energy/laser/retro
icon_state = "caplaser"
desc = "This is an antique laser gun. All craftsmanship is of the highest quality. It is decorated with assistant leather and chrome. The object menaces with spikes of energy. On the item is an image of Space Station 13. The station is exploding."
force = 10
origin_tech = "combat=5;magnets=4"
origin_tech = null
var/charge_tick = 0
@@ -0,0 +1,144 @@
/obj/machinery/keycard_auth
name = "Keycard Authentication Device"
desc = "This device is used to trigger station functions, which require more than one ID card to authenticate."
icon = 'monitors.dmi'
icon_state = "auth_off"
var/active = 0 //This gets set to 1 on all devices except the one where the initial request was made.
var/event = ""
var/screen = 1
var/confirmed = 0 //This variable is set by the device that confirms the request.
var/confirm_delay = 20 //(2 seconds)
var/busy = 0 //Busy when waiting for authentication or an event request has been sent from this device.
var/obj/machinery/keycard_auth/event_source
var/mob/event_triggered_by
var/mob/event_confirmed_by
//1 = select event
//2 = authenticate
anchored = 1.0
use_power = 1
idle_power_usage = 2
active_power_usage = 6
power_channel = ENVIRON
/obj/machinery/keycard_auth/attack_ai(mob/user as mob)
user << "The station AI is not to interact with these devices"
return
/obj/machinery/keycard_auth/attack_paw(mob/user as mob)
user << "You are too primitive to use this device"
return
/obj/machinery/keycard_auth/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(stat & (NOPOWER|BROKEN))
user << "This device is not powered."
return
if(istype(W,/obj/item/weapon/card/id))
var/obj/item/weapon/card/id/ID = W
if(access_keycard_auth in ID.access)
if(active == 1)
//This is not the device that made the initial request. It is the device confirming the request.
if(event_source)
event_source.confirmed = 1
event_source.event_confirmed_by = usr
else if(screen == 2)
event_triggered_by = usr
broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices
/obj/machinery/keycard_auth/power_change()
if(powered(ENVIRON))
stat &= ~NOPOWER
icon_state = "auth_off"
else
stat |= NOPOWER
/obj/machinery/keycard_auth/attack_hand(mob/user as mob)
if(user.stat || stat & (NOPOWER|BROKEN))
user << "This device is not powered."
return
if (busy)
user << "This device is busy"
return
user.machine = src
var/dat = "<h1>Keycard Authentication Device</h1>"
dat += "This device is used to trigger some high security events. It requires the simultaneous swipe of two high-level ID cards"
dat += "<br><hr><br>"
if ( screen == 1 )
dat += "Select an event to trigger:<ul>"
dat += "<li><A href='?src=\ref[src];triggerevent=Red alert'>Red alert</A></li>"
dat += "</ul>"
user << browse(dat, "window=keycard_auth;size=500x250")
if ( screen == 2 )
dat += "Please swipe your card to authorize the following event: <b>[event]</b>"
dat += "<p><A href='?src=\ref[src];reset=1'>Back</A>"
user << browse(dat, "window=keycard_auth;size=500x250")
return
/obj/machinery/keycard_auth/Topic(href, href_list)
..()
if (busy)
usr << "This device is busy"
return
if (usr.stat || stat & (BROKEN|NOPOWER))
usr << "This device is without power"
return
if (href_list["triggerevent"])
event = href_list["triggerevent"]
screen = 2
if (href_list["reset"])
reset()
src.updateUsrDialog()
src.add_fingerprint(usr)
return
/obj/machinery/keycard_auth/proc/reset()
active = 0
event = ""
screen = 1
confirmed = 0
event_source = null
icon_state = "auth_off"
event_triggered_by = null
event_confirmed_by = null
/obj/machinery/keycard_auth/proc/broadcast_request()
icon_state = "auth_on"
for(var/obj/machinery/keycard_auth/KA in world)
if(KA == src) continue
KA.reset()
spawn()
KA.receive_request(src)
sleep(confirm_delay)
if(confirmed)
confirmed = 0
trigger_event(event)
log_game("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event]")
message_admins("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event]", 1)
reset()
/obj/machinery/keycard_auth/proc/receive_request(var/obj/machinery/keycard_auth/source)
if(stat & (BROKEN|NOPOWER))
return
event_source = source
busy = 1
active = 1
icon_state = "auth_on"
sleep(confirm_delay)
event_source = null
icon_state = "auth_off"
active = 0
busy = 0
/obj/machinery/keycard_auth/proc/trigger_event()
switch(event)
if("Red alert")
set_security_level(SEC_LEVEL_RED)
feedback_inc("alert_keycard_auth_red",1)
@@ -4,6 +4,8 @@
//2 = code red
//3 = code delta
//config.alert_desc_blue_downto
/proc/set_security_level(var/level)
switch(level)
if("green")
@@ -20,7 +22,7 @@
switch(level)
if(SEC_LEVEL_GREEN)
world << "<font size=4 color='red'>Attention! security level lowered to green</font>"
world << "<font color='red'>All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced.</font>"
world << "<font color='red'>[config.alert_desc_green]</font>"
security_level = SEC_LEVEL_GREEN
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == 1)
@@ -29,10 +31,10 @@
if(SEC_LEVEL_BLUE)
if(security_level < SEC_LEVEL_BLUE)
world << "<font size=4 color='red'>Attention! security level elevated to blue</font>"
world << "<font color='red'>The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted.</font>"
world << "<font color='red'>[config.alert_desc_blue_upto]</font>"
else
world << "<font size=4 color='red'>Attention! security level lowered to blue</font>"
world << "<font color='red'>The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.</font>"
world << "<font color='red'>[config.alert_desc_blue_downto]</font>"
security_level = SEC_LEVEL_BLUE
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == 1)
@@ -41,10 +43,10 @@
if(SEC_LEVEL_RED)
if(security_level < SEC_LEVEL_RED)
world << "<font size=4 color='red'>Attention! Code red!</font>"
world << "<font color='red'>There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.</font>"
world << "<font color='red'>[config.alert_desc_red_upto]</font>"
else
world << "<font size=4 color='red'>Attention! Code red!</font>"
world << "<font color='red'>The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised.</font>"
world << "<font color='red'>[config.alert_desc_red_downto]</font>"
security_level = SEC_LEVEL_RED
/* - At the time of commit, setting status displays didn't work properly
@@ -58,7 +60,7 @@
FA.overlays += image('monitors.dmi', "overlay_red")
if(SEC_LEVEL_DELTA)
world << "<font size=4 color='red'>Attention! Delta security level reached!</font>"
world << "<font color='red'>The ship's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.</font>"
world << "<font color='red'>[config.alert_desc_delta]</font>"
security_level = SEC_LEVEL_DELTA
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == 1)
+248 -254
View File
@@ -2,18 +2,9 @@
var
const
UL_LUMINOSITY = 0
UL_SQUARELIGHT = 0
UL_RGB = 1
UL_ROUNDLIGHT = 2
UL_I_FALLOFF_SQUARE = 0
UL_I_FALLOFF_ROUND = 1
UL_I_LUMINOSITY = 0
UL_I_RGB = 1
UL_I_LIT = 0
UL_I_EXTINGUISHED = 1
UL_I_ONZERO = 2
@@ -21,8 +12,7 @@ var
ul_LightingEnabled = 1
ul_LightingResolution = 1
ul_Steps = 7
ul_LightingModel = UL_I_RGB
ul_FalloffStyle = UL_I_FALLOFF_ROUND
ul_FalloffStyle = UL_I_FALLOFF_ROUND // Sets the lighting falloff to be either squared or circular.
ul_TopLuminosity = 0
ul_Layer = 10
ul_SuppressLightLevelChanges = 0
@@ -32,9 +22,8 @@ var
7, 7)
proc
ul_Clamp(var/Value)
return min(max(Value, 0), ul_Steps)
proc/ul_Clamp(var/Value)
return min(max(Value, 0), ul_Steps)
atom
var
@@ -44,200 +33,205 @@ atom
ul_Extinguished = UL_I_ONZERO
proc
ul_SetLuminosity(var/Red, var/Green = Red, var/Blue = Red)
atom/proc/ul_SetLuminosity(var/Red, var/Green = Red, var/Blue = Red)
if(LuminosityRed == Red && LuminosityGreen == Green && LuminosityBlue == Blue)
return //No point doing all that work if it won't have any effect anyways...
if(LuminosityRed == Red && LuminosityGreen == Green && LuminosityBlue == Blue)
return //No point doing all that work if it won't have any effect anyways...
if (ul_Extinguished == UL_I_EXTINGUISHED)
LuminosityRed = Red
LuminosityGreen = Green
LuminosityBlue = Blue
if (ul_Extinguished == UL_I_EXTINGUISHED)
LuminosityRed = Red
LuminosityGreen = Green
LuminosityBlue = Blue
return
if (ul_IsLuminous())
ul_Extinguish()
LuminosityRed = Red
LuminosityGreen = Green
LuminosityBlue = Blue
ul_Extinguished = UL_I_ONZERO
if (ul_IsLuminous())
ul_Illuminate()
return
ul_Illuminate()
if (ul_Extinguished == UL_I_LIT)
return
ul_Extinguished = UL_I_LIT
ul_UpdateTopLuminosity()
luminosity = ul_Luminosity()
for(var/turf/Affected in view(ul_Luminosity(), src))
var/Falloff = src.ul_FalloffAmount(Affected)
var/DeltaRed = LuminosityRed - Falloff
var/DeltaGreen = LuminosityGreen - Falloff
var/DeltaBlue = LuminosityBlue - Falloff
if(ul_IsLuminous(DeltaRed, DeltaGreen, DeltaBlue))
Affected.LightLevelRed += max(DeltaRed, 0)
Affected.LightLevelGreen += max(DeltaGreen, 0)
Affected.LightLevelBlue += max(DeltaBlue, 0)
Affected.MaxRed += LuminosityRed
Affected.MaxGreen += LuminosityGreen
Affected.MaxBlue += LuminosityBlue
Affected.ul_UpdateLight()
if (ul_SuppressLightLevelChanges == 0)
Affected.ul_LightLevelChanged()
for(var/atom/AffectedAtom in Affected)
AffectedAtom.ul_LightLevelChanged()
return
return
if (ul_IsLuminous())
ul_Extinguish()
if (ul_Extinguished != UL_I_LIT)
return
LuminosityRed = Red
LuminosityGreen = Green
LuminosityBlue = Blue
ul_Extinguished = UL_I_EXTINGUISHED
ul_Extinguished = UL_I_ONZERO
for(var/turf/Affected in view(ul_Luminosity(), src))
if (ul_IsLuminous())
ul_Illuminate()
var/Falloff = ul_FalloffAmount(Affected)
return
var/DeltaRed = LuminosityRed - Falloff
var/DeltaGreen = LuminosityGreen - Falloff
var/DeltaBlue = LuminosityBlue - Falloff
if(ul_IsLuminous(DeltaRed, DeltaGreen, DeltaBlue))
Affected.LightLevelRed -= max(DeltaRed, 0)
Affected.LightLevelGreen -= max(DeltaGreen, 0)
Affected.LightLevelBlue -= max(DeltaBlue, 0)
Affected.MaxRed -= LuminosityRed
Affected.MaxGreen -= LuminosityGreen
Affected.MaxBlue -= LuminosityBlue
Affected.ul_UpdateLight()
if (ul_SuppressLightLevelChanges == 0)
Affected.ul_LightLevelChanged()
for(var/atom/AffectedAtom in Affected)
AffectedAtom.ul_LightLevelChanged()
luminosity = 0
return
ul_FalloffAmount(var/atom/ref)
if (ul_FalloffStyle == UL_I_FALLOFF_ROUND)
var/x = (ref.x - src.x)
var/y = (ref.y - src.y)
if ((x*x + y*y) > ul_FastRoot.len)
for(var/i = ul_FastRoot.len, i <= x*x+y*y, i++)
ul_FastRoot += round(sqrt(x*x+y*y))
return round(ul_LightingResolution * ul_FastRoot[x*x + y*y + 1], 1)
else if (ul_FalloffStyle == UL_I_FALLOFF_SQUARE)
return get_dist(src, ref)
return 0
ul_SetOpacity(var/NewOpacity)
if(opacity != NewOpacity)
var/list/Blanked = ul_BlankLocal()
var/atom/T = src
while(T && !isturf(T))
T = T.loc
opacity = NewOpacity
if(T)
T:LightLevelRed = 0
T:LightLevelGreen = 0
T:LightLevelBlue = 0
ul_UnblankLocal(Blanked)
return
ul_UnblankLocal(var/list/ReApply = view(ul_TopLuminosity, src))
for(var/atom/Light in ReApply)
if(Light.ul_IsLuminous())
Light.ul_Illuminate()
return
ul_BlankLocal()
var/list/Blanked = list( )
var/TurfAdjust = isturf(src) ? 1 : 0
for(var/atom/Affected in view(ul_TopLuminosity, src))
if(Affected.ul_IsLuminous() && Affected.ul_Extinguished == UL_I_LIT && (ul_FalloffAmount(Affected) <= Affected.luminosity + TurfAdjust))
Affected.ul_Extinguish()
Blanked += Affected
return Blanked
ul_UpdateTopLuminosity()
if (ul_TopLuminosity < LuminosityRed)
ul_TopLuminosity = LuminosityRed
if (ul_TopLuminosity < LuminosityGreen)
ul_TopLuminosity = LuminosityGreen
if (ul_TopLuminosity < LuminosityBlue)
ul_TopLuminosity = LuminosityBlue
return
ul_Luminosity()
return max(LuminosityRed, LuminosityGreen, LuminosityBlue)
ul_IsLuminous(var/Red = LuminosityRed, var/Green = LuminosityGreen, var/Blue = LuminosityBlue)
return (Red > 0 || Green > 0 || Blue > 0)
ul_LightLevelChanged()
//Designed for client projects to use. Called on items when the turf they are in has its light level changed
return
New()
..()
if(ul_IsLuminous())
spawn(1)
ul_Illuminate()
atom/proc/ul_Illuminate()
if (ul_Extinguished == UL_I_LIT)
return
Del()
if(ul_IsLuminous())
ul_Extinguish()
ul_Extinguished = UL_I_LIT
..()
ul_UpdateTopLuminosity()
luminosity = ul_Luminosity()
for(var/turf/Affected in view(ul_Luminosity(), src))
var/Falloff = src.ul_FalloffAmount(Affected)
var/DeltaRed = LuminosityRed - Falloff
var/DeltaGreen = LuminosityGreen - Falloff
var/DeltaBlue = LuminosityBlue - Falloff
if(ul_IsLuminous(DeltaRed, DeltaGreen, DeltaBlue))
Affected.LightLevelRed += max(DeltaRed, 0)
Affected.LightLevelGreen += max(DeltaGreen, 0)
Affected.LightLevelBlue += max(DeltaBlue, 0)
Affected.MaxRed += LuminosityRed
Affected.MaxGreen += LuminosityGreen
Affected.MaxBlue += LuminosityBlue
Affected.ul_UpdateLight()
if (ul_SuppressLightLevelChanges == 0)
Affected.ul_LightLevelChanged()
for(var/atom/AffectedAtom in Affected)
AffectedAtom.ul_LightLevelChanged()
return
atom/proc/ul_Extinguish()
if (ul_Extinguished != UL_I_LIT)
return
movable
Move()
ul_Extinguish()
..()
ul_Extinguished = UL_I_EXTINGUISHED
for(var/turf/Affected in view(ul_Luminosity(), src))
var/Falloff = ul_FalloffAmount(Affected)
var/DeltaRed = LuminosityRed - Falloff
var/DeltaGreen = LuminosityGreen - Falloff
var/DeltaBlue = LuminosityBlue - Falloff
if(ul_IsLuminous(DeltaRed, DeltaGreen, DeltaBlue))
Affected.LightLevelRed -= max(DeltaRed, 0)
Affected.LightLevelGreen -= max(DeltaGreen, 0)
Affected.LightLevelBlue -= max(DeltaBlue, 0)
Affected.MaxRed -= LuminosityRed
Affected.MaxGreen -= LuminosityGreen
Affected.MaxBlue -= LuminosityBlue
Affected.ul_UpdateLight()
if (ul_SuppressLightLevelChanges == 0)
Affected.ul_LightLevelChanged()
for(var/atom/AffectedAtom in Affected)
AffectedAtom.ul_LightLevelChanged()
luminosity = 0
return
/*
Calculates the correct lighting falloff value (used to calculate what brightness to set the turf to) to use,
when called on a luminous atom and passed an atom in the turf to be lit.
Supports multiple configurations, BS12 uses the circular falloff setting. This setting uses an array lookup
to avoid the cost of the square root function.
*/
atom/proc/ul_FalloffAmount(var/atom/ref)
if (ul_FalloffStyle == UL_I_FALLOFF_ROUND)
var/x = (ref.x - src.x)
var/y = (ref.y - src.y)
if ((x*x + y*y) > ul_FastRoot.len)
for(var/i = ul_FastRoot.len, i <= x*x+y*y, i++)
ul_FastRoot += round(sqrt(x*x+y*y))
return round(ul_LightingResolution * ul_FastRoot[x*x + y*y + 1], 1)
else if (ul_FalloffStyle == UL_I_FALLOFF_SQUARE)
return get_dist(src, ref)
return 0
atom/proc/ul_SetOpacity(var/NewOpacity)
if(opacity != NewOpacity)
var/list/Blanked = ul_BlankLocal()
var/atom/T = src
while(T && !isturf(T))
T = T.loc
opacity = NewOpacity
if(T)
T:LightLevelRed = 0
T:LightLevelGreen = 0
T:LightLevelBlue = 0
ul_UnblankLocal(Blanked)
return
atom/proc/ul_UnblankLocal(var/list/ReApply = view(ul_TopLuminosity, src))
for(var/atom/Light in ReApply)
if(Light.ul_IsLuminous())
Light.ul_Illuminate()
return
atom/proc/ul_BlankLocal()
var/list/Blanked = list( )
var/TurfAdjust = isturf(src) ? 1 : 0
for(var/atom/Affected in view(ul_TopLuminosity, src))
if(Affected.ul_IsLuminous() && Affected.ul_Extinguished == UL_I_LIT && (ul_FalloffAmount(Affected) <= Affected.luminosity + TurfAdjust))
Affected.ul_Extinguish()
Blanked += Affected
return Blanked
atom/proc/ul_UpdateTopLuminosity()
if (ul_TopLuminosity < LuminosityRed)
ul_TopLuminosity = LuminosityRed
if (ul_TopLuminosity < LuminosityGreen)
ul_TopLuminosity = LuminosityGreen
if (ul_TopLuminosity < LuminosityBlue)
ul_TopLuminosity = LuminosityBlue
return
atom/proc/ul_Luminosity()
return max(LuminosityRed, LuminosityGreen, LuminosityBlue)
atom/proc/ul_IsLuminous(var/Red = LuminosityRed, var/Green = LuminosityGreen, var/Blue = LuminosityBlue)
return (Red > 0 || Green > 0 || Blue > 0)
atom/proc/ul_LightLevelChanged()
//Designed for client projects to use. Called on items when the turf they are in has its light level changed
return
atom/proc/New()
..()
if(ul_IsLuminous())
spawn(1)
ul_Illuminate()
return
return
atom/proc/Del()
if(ul_IsLuminous())
ul_Extinguish()
..()
return
atom/proc/movable/Move()
ul_Extinguish()
..()
ul_Illuminate()
return
turf
var
@@ -249,59 +243,59 @@ turf
list/MaxGreen = list( )
list/MaxBlue = list( )
proc
ul_GetRed()
return ul_Clamp(min(LightLevelRed, max(MaxRed)))
ul_GetGreen()
return ul_Clamp(min(LightLevelGreen, max(MaxGreen)))
ul_GetBlue()
return ul_Clamp(min(LightLevelBlue, max(MaxBlue)))
ul_UpdateLight()
var/area/CurrentArea = loc
if(!isarea(CurrentArea) || !CurrentArea.ul_Lighting)
return
var/LightingTag = copytext(CurrentArea.tag, 1, findtext(CurrentArea.tag, ":UL")) + ":UL[ul_GetRed()]_[ul_GetGreen()]_[ul_GetBlue()]"
if(CurrentArea.tag != LightingTag)
var/area/NewArea = locate(LightingTag)
if(!NewArea)
NewArea = new CurrentArea.type()
NewArea.tag = LightingTag
for(var/V in CurrentArea.vars - "contents")
if(issaved(CurrentArea.vars[V]))
NewArea.vars[V] = CurrentArea.vars[V]
NewArea.tag = LightingTag
NewArea.ul_Light(ul_GetRed(), ul_GetGreen(), ul_GetBlue())
NewArea.contents += src
turf/proc/ul_GetRed()
return ul_Clamp(min(LightLevelRed, max(MaxRed)))
turf/proc/ul_GetGreen()
return ul_Clamp(min(LightLevelGreen, max(MaxGreen)))
turf/proc/ul_GetBlue()
return ul_Clamp(min(LightLevelBlue, max(MaxBlue)))
return
turf/proc/ul_UpdateLight()
ul_Recalculate()
var/area/CurrentArea = loc
ul_SuppressLightLevelChanges++
if(!isarea(CurrentArea) || !CurrentArea.ul_Lighting)
return
var/list/Lights = ul_BlankLocal()
var/LightingTag = copytext(CurrentArea.tag, 1, findtext(CurrentArea.tag, ":UL")) + ":UL[ul_GetRed()]_[ul_GetGreen()]_[ul_GetBlue()]"
LightLevelRed = 0
LightLevelGreen = 0
LightLevelBlue = 0
if(CurrentArea.tag != LightingTag)
var/area/NewArea = locate(LightingTag)
ul_UnblankLocal(Lights)
if(!NewArea)
NewArea = new CurrentArea.type()
NewArea.tag = LightingTag
ul_SuppressLightLevelChanges--
for(var/V in CurrentArea.vars - "contents")
if(issaved(CurrentArea.vars[V]))
NewArea.vars[V] = CurrentArea.vars[V]
return
NewArea.tag = LightingTag
NewArea.ul_Light(ul_GetRed(), ul_GetGreen(), ul_GetBlue())
NewArea.contents += src
return
turf/proc/ul_Recalculate()
ul_SuppressLightLevelChanges++
var/list/Lights = ul_BlankLocal()
LightLevelRed = 0
LightLevelGreen = 0
LightLevelBlue = 0
ul_UnblankLocal(Lights)
ul_SuppressLightLevelChanges--
return
area
var
@@ -312,33 +306,33 @@ area
LightLevelGreen = 0
LightLevelBlue = 0
proc
ul_Light(var/Red = LightLevelRed, var/Green = LightLevelGreen, var/Blue = LightLevelBlue)
if(!src || !src.ul_Lighting)
return
area/proc/ul_Light(var/Red = LightLevelRed, var/Green = LightLevelGreen, var/Blue = LightLevelBlue)
overlays -= ul_Overlay
if(!src || !src.ul_Lighting)
return
LightLevelRed = Red
LightLevelGreen = Green
LightLevelBlue = Blue
overlays -= ul_Overlay
luminosity = ul_IsLuminous(LightLevelRed, LightLevelGreen, LightLevelBlue)
LightLevelRed = Red
LightLevelGreen = Green
LightLevelBlue = Blue
ul_Overlay = image('ULIcons.dmi', , num2text(LightLevelRed) + "-" + num2text(LightLevelGreen) + "-" + num2text(LightLevelBlue), ul_Layer)
luminosity = ul_IsLuminous(LightLevelRed, LightLevelGreen, LightLevelBlue)
overlays += ul_Overlay
ul_Overlay = image('ULIcons.dmi', , num2text(LightLevelRed) + "-" + num2text(LightLevelGreen) + "-" + num2text(LightLevelBlue), ul_Layer)
return
overlays += ul_Overlay
ul_Prep()
return
if(!tag)
tag = "[type]"
if(ul_Lighting)
if(!findtext(tag,":UL"))
ul_Light()
//world.log << tag
area/proc/ul_Prep()
return
if(!tag)
tag = "[type]"
if(ul_Lighting)
if(!findtext(tag,":UL"))
ul_Light()
//world.log << tag
return
+8
View File
@@ -1,3 +1,11 @@
## Alert levels
ALERT_GREEN All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced.
ALERT_BLUE_UPTO The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted.
ALERT_BLUE_DOWNTO The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.
ALERT_RED_UPTO There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.
ALERT_RED_DOWNTO The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised.
ALERT_DELTA The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.
## log OOC channel
LOG_OOC
Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

+1321 -1321
View File
File diff suppressed because it is too large Load Diff
+6303 -6304
View File
File diff suppressed because it is too large Load Diff