Merge pull request #998 from tigercat2000/LightShit

Baystation12's Lighting Overhaul
This commit is contained in:
ZomgPonies
2015-05-11 17:06:30 -04:00
151 changed files with 1447 additions and 1590 deletions
@@ -56,8 +56,6 @@
/obj/machinery/atmospherics/unary/vent_pump/New()
icon = null
initial_loc = get_area(loc)
if (initial_loc.master)
initial_loc = initial_loc.master
area_uid = initial_loc.uid
if (!id_tag)
assign_uid()
@@ -35,8 +35,6 @@
/obj/machinery/atmospherics/unary/vent_scrubber/New()
icon = null
initial_loc = get_area(loc)
if (initial_loc.master)
initial_loc = initial_loc.master
area_uid = initial_loc.uid
if (!id_tag)
assign_uid()
+11 -1
View File
@@ -47,7 +47,8 @@
icon = 'icons/effects/fire.dmi'
icon_state = "1"
layer = TURF_LAYER
luminosity = 3
blend_mode = BLEND_ADD
var/volume = 125
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
@@ -56,6 +57,8 @@
/obj/effect/hotspot/New()
..()
color = heat2color(temperature)
set_light(3, 1, color)
air_master.hotspots += src
perform_exposure()
@@ -82,6 +85,9 @@
if(item) // It's possible that the item is deleted in temperature_expose
item.fire_act(null, temperature, volume)
animate(src, color = heat2color(temperature), 5)
set_light(l_color = color)
return 0
@@ -112,6 +118,7 @@
if(bypassing)
icon_state = "3"
set_light(7,3)
location.burn_tile()
//Possible spread due to radiated heat
@@ -127,8 +134,10 @@
else
if(volume > CELL_VOLUME*0.4)
icon_state = "2"
set_light(5, 2)
else
icon_state = "1"
set_light(3, 1)
if(temperature > location.max_fire_temperature_sustained)
location.max_fire_temperature_sustained = temperature
@@ -148,6 +157,7 @@
qdel(src)
/obj/effect/hotspot/Destroy()
set_light(0)
if(istype(loc, /turf/simulated))
var/turf/simulated/T = loc
if(T.active_hotspot == src)
+3 -18
View File
@@ -13,7 +13,7 @@
var/area/A = get_area(O)
if (isarea(A))
return A.master
return A
/proc/get_area(O)
var/atom/location = O
@@ -51,21 +51,6 @@
return heard
//Magic constants obtained by using linear regression on right-angled triangles of sides 0<x<1, 0<y<1
//They should approximate pythagoras theorem well enough for our needs.
#define k1 0.934
#define k2 0.427
/proc/cheap_hypotenuse(Ax,Ay,Bx,By) // T is just the second atom to check distance to center with
var/dx = abs(Ax - Bx) //sides of right-angled triangle
var/dy = abs(Ay - By)
if(dx>=dy) return (k1*dx) + (k2*dy) //No sqrt or powers :)
else return (k1*dx) + (k2*dy)
#undef k1
#undef k2
/proc/circlerange(center=usr,radius=3)
var/turf/centerturf = get_turf(center)
@@ -317,7 +302,7 @@ proc/isInSight(var/atom/A, var/atom/B)
if(override_age || player_old_enough_antag(G.client,be_special_flag))
candidates += G.client
afk_bracket += 600 // Add a minute to the bracket, for every attempt
return candidates
/proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480)
@@ -456,6 +441,6 @@ proc/isInSight(var/atom/A, var/atom/B)
/proc/MinutesToTicks(var/minutes as num)
return minutes * 60 * 10
/proc/SecondsToTicks(var/seconds)
return seconds * 10
+29
View File
@@ -366,3 +366,32 @@ proc/tg_text2list(text, glue=",", assocglue=";")
finalNum = copytext(finalNum, 1, pos) + sep + copytext(finalNum, pos)
return finalNum
// heat2color functions. Adapted from: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
/proc/heat2color(temp)
return rgb(heat2color_r(temp), heat2color_g(temp), heat2color_b(temp))
/proc/heat2color_r(temp)
temp /= 100
if(temp <= 66)
. = 255
else
. = max(0, min(255, 329.698727446 * (temp - 60) ** -0.1332047592))
/proc/heat2color_g(temp)
temp /= 100
if(temp <= 66)
. = max(0, min(255, 99.4708025861 * log(temp) - 161.1195681661))
else
. = max(0, min(255, 288.1221695283 * ((temp - 60) ** -0.0755148492)))
/proc/heat2color_b(temp)
temp /= 100
if(temp >= 66)
. = 255
else
if(temp <= 16)
. = 0
else
. = max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307))
+2 -2
View File
@@ -1019,7 +1019,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
// if(AR.lighting_use_dynamic) //TODO: rewrite this code so it's not messed by lighting ~Carn
// X.opacity = !X.opacity
// X.SetOpacity(!X.opacity)
// X.set_opacity(!X.opacity)
toupdate += X
@@ -1175,7 +1175,7 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0)
// if(AR.lighting_use_dynamic)
// X.opacity = !X.opacity
// X.sd_SetOpacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn
// X.sd_set_opacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn
toupdate += X
-26
View File
@@ -1,26 +0,0 @@
/datum/controller/process/lighting/setup()
name = "lighting"
schedule_interval = 5 // every .5 second
lighting_controller.Initialize()
/datum/controller/process/lighting/doWork()
lighting_controller.lights_workload_max = \
max(lighting_controller.lights_workload_max, lighting_controller.lights.len)
for(var/datum/light_source/L in lighting_controller.lights)
if(L && L.check())
lighting_controller.lights.Remove(L)
scheck()
lighting_controller.changed_turfs_workload_max = \
max(lighting_controller.changed_turfs_workload_max, lighting_controller.changed_turfs.len)
for(var/turf/T in lighting_controller.changed_turfs)
if(T && T.lighting_changed)
T.shift_to_subarea()
scheck()
if(lighting_controller.changed_turfs && lighting_controller.changed_turfs.len)
lighting_controller.changed_turfs.len = 0 // reset the changed list
-449
View File
@@ -1,449 +0,0 @@
/*
Modified DynamicAreaLighting for TGstation - Coded by Carnwennan
This is TG's 'new' lighting system. It's basically a heavily modified combination of Forum_Account's and
ShadowDarke's respective lighting libraries. Credits, where due, to them.
Like sd_DAL (what we used to use), it changes the shading overlays of areas by splitting each type of area into sub-areas
by using the var/tag variable and moving turfs into the contents list of the correct sub-area. This method is
much less costly than using overlays or objects.
Unlike sd_DAL however it uses a queueing system. Everytime we call a change to opacity or luminosity
(through SetOpacity() or SetLuminosity()) we are simply updating variables and scheduling certain lights/turfs for an
update. Actual updates are handled periodically by the lighting_controller. This carries additional overheads, however it
means that each thing is changed only once per lighting_controller.processing_interval ticks. Allowing for greater control
over how much priority we'd like lighting updates to have. It also makes it possible for us to simply delay updates by
setting lighting_controller.processing = 0 at say, the start of a large explosion, waiting for it to finish, and then
turning it back on with lighting_controller.processing = 1.
Unlike our old system there are hardcoded maximum luminositys (different for certain atoms).
This is to cap the cost of creating lighting effects.
(without this, an atom with luminosity of 20 would have to update 41^2 turfs!) :s
Also, in order for the queueing system to work, each light remembers the effect it casts on each turf. This is going to
have larger memory requirements than our previous system but it's easily worth the hassle for the greater control we
gain. It also reduces cost of removing lighting effects by a lot!
Known Issues/TODO:
Shuttles still do not have support for dynamic lighting (I hope to fix this at some point)
No directional lighting support. (prototype looked ugly)
*/
#define LIGHTING_CIRCULAR 1 //comment this out to use old square lighting effects.
#define LIGHTING_LAYER 10 //Drawing layer for lighting overlays
#define LIGHTING_ICON 'icons/effects/ss13_dark_alpha6.dmi' //Icon used for lighting shading effects
datum/light_source
var/atom/owner
var/changed = 1
var/list/effect = list()
var/__x = 0 //x coordinate at last update
var/__y = 0 //y coordinate at last update
var/__z = 0 //z coordinate at last update
var/_l_color //do not use directly, only used as reference for updating
var/col_r
var/col_g
var/col_b
New(atom/A)
if(!istype(A))
CRASH("The first argument to the light object's constructor must be the atom that is the light source. Expected atom, received '[A]' instead.")
..()
owner = A
readrgb(owner.l_color)
__x = owner.x
__y = owner.y
__z = owner.z
// the lighting object maintains a list of all light sources
lighting_controller.lights += src
//Check a light to see if its effect needs reprocessing. If it does, remove any old effect and create a new one
proc/check()
if(!owner)
remove_effect()
return 1 //causes it to be removed from our list of lights. The garbage collector will then destroy it.
// check to see if we've moved since last update
if(owner.x != __x || owner.y != __y || owner.z != __z)
__x = owner.x
__y = owner.y
__z = owner.z
changed = 1
if (owner.l_color != _l_color)
changed = 1
if(changed)
changed = 0
remove_effect()
return add_effect()
return 0
proc/remove_effect()
// before we apply the effect we remove the light's current effect.
for(var/turf/T in effect) // negate the effect of this light source
T.update_lumcount(-effect[T], col_r, col_g, col_b, 1)
effect.Cut() // clear the effect list
proc/add_effect()
// only do this if the light is turned on and is on the map
if(owner.loc && owner.luminosity > 0)
readrgb(owner.l_color)
effect = list()
for(var/turf/T in view(owner.get_light_range(),get_turf(owner)))
var/delta_lumen = lum(T)
if(delta_lumen > 0)
effect[T] = delta_lumen
T.update_lumcount(delta_lumen, col_r, col_g, col_b, 0)
return 0
else
owner.light = null
return 1 //cause the light to be removed from the lights list and garbage collected once it's no
//longer referenced by the queue
proc/lum(turf/A)
if (owner.trueLuminosity < 1)
return 0
var/dist
if(!A)
dist = 0
else
#ifdef LIGHTING_CIRCULAR
dist = cheap_hypotenuse(A.x, A.y, __x, __y)
#else
dist = max(abs(A.x - __x), abs(A.y - __y))
#endif
if (owner.trueLuminosity > 100) // This will never happen... right?
return sqrt(owner.trueLuminosity) - dist
else
return sqrtTable[owner.trueLuminosity] - dist
proc/readrgb(col)
_l_color = col
if(col)
col_r = GetRedPart(col)
col_g = GetGreenPart(col)
col_b = GetBluePart(col)
else
col_r = null
atom
var/datum/light_source/light
var/trueLuminosity = 0 // Typically 'luminosity' squared. The builtin luminosity must remain linear.
// We may read it, but NEVER set it directly.
var/l_color
//Turfs with opacity when they are constructed will trigger nearby lights to update
//Turfs and atoms with luminosity when they are constructed will create a light_source automatically
turf/New()
..()
if(luminosity)
if(light) WARNING("[type] - Don't set lights up manually during New(), We do it automatically.")
trueLuminosity = luminosity * luminosity
light = new(src)
//Movable atoms with opacity when they are constructed will trigger nearby lights to update
//Movable atoms with luminosity when they are constructed will create a light_source automatically
atom/movable/New()
..()
if(opacity)
if(isturf(loc))
if(loc:lighting_lumcount > 1)
UpdateAffectingLights()
if(luminosity)
if(light) WARNING("[type] - Don't set lights up manually during New(), We do it automatically.")
trueLuminosity = luminosity * luminosity
light = new(src)
//Sets our luminosity.
//If we have no light it will create one.
//If we are setting luminosity to 0 the light will be cleaned up by the controller and garbage collected once all its
//queues are complete.
//if we have a light already it is merely updated, rather than making a new one.
atom/proc/SetLuminosity(new_luminosity, trueLum = FALSE)
if(new_luminosity < 0)
new_luminosity = 0
if(!trueLum)
new_luminosity *= new_luminosity
if(light)
if(trueLuminosity != new_luminosity) //non-luminous lights are removed from the lights list in add_effect()
light.changed = 1
else
if(new_luminosity)
light = new(src)
trueLuminosity = new_luminosity
if (trueLuminosity < 1)
luminosity = 0
else if (trueLuminosity <= 100)
luminosity = sqrtTable[trueLuminosity]
else
luminosity = sqrt(trueLuminosity)
atom/proc/AddLuminosity(delta_luminosity)
if(delta_luminosity > 0)
SetLuminosity(trueLuminosity + delta_luminosity*delta_luminosity, TRUE)
else if(delta_luminosity < 0)
SetLuminosity(trueLuminosity - delta_luminosity*delta_luminosity, TRUE)
area/SetLuminosity(new_luminosity) //we don't want dynamic lighting for areas
luminosity = !!new_luminosity
trueLuminosity = luminosity
//change our opacity (defaults to toggle), and then update all lights that affect us.
atom/proc/SetOpacity(new_opacity)
if(new_opacity == null)
new_opacity = !opacity //default = toggle opacity
else if(opacity == new_opacity)
return 0 //opacity hasn't changed! don't bother doing anything
opacity = new_opacity //update opacity, the below procs now call light updates.
return 1
turf/SetOpacity(new_opacity)
if(..()==1) //only bother if opacity changed
if(lighting_lumcount) //only bother with an update if our turf is currently affected by a light
UpdateAffectingLights()
/atom/movable/SetOpacity(new_opacity)
if(..()==1) //only bother if opacity changed
if(isturf(loc)) //only bother with an update if we're on a turf
var/turf/T = loc
if(T.lighting_lumcount) //only bother with an update if our turf is currently affected by a light
UpdateAffectingLights()
turf
var/lighting_lumcount = 0
var/lighting_changed = 0
var/color_lighting_lumcount = 0
var/lumcount_r = 0
var/lumcount_g = 0
var/lumcount_b = 0
var/light_col_sources = 0
turf/space
lighting_lumcount = 4 //starlight
turf/proc/update_lumcount(amount, col_r, col_g, col_b, removing = 0)
lighting_lumcount += amount
if(!isnull(col_r)) //col_r is the "key" var, if it's null so will the rest
if(removing)
light_col_sources--
lumcount_r -= col_r
lumcount_g -= col_g
lumcount_b -= col_b
else
light_col_sources++
lumcount_r += col_r
lumcount_g += col_g
lumcount_b += col_b
if(light_col_sources)
var/r_avg = max(0, min(255, round(lumcount_r / light_col_sources, 16) + 15))
var/g_avg = max(0, min(255, round(lumcount_g / light_col_sources, 16) + 15))
var/b_avg = max(0, min(255, round(lumcount_b / light_col_sources, 16) + 15))
l_color = rgb(r_avg, g_avg, b_avg)
else
l_color = null
color_lighting_lumcount = max(color_lighting_lumcount + amount, 0) // Minimum of 0.
if(!lighting_changed)
lighting_controller.changed_turfs += src
lighting_changed = 1
turf/proc/lighting_tag(const/level)
var/area/A = loc
return A.tagbase + "sd_L[level]"
turf/proc/build_lighting_area(const/tag, const/level, const/color_light)
var/area/Area = loc
var/area/A = new Area.type() // create area if it wasn't found
// replicate vars
for(var/V in Area.vars)
switch(V)
if ("contents","lighting_overlay", "color_overlay", "overlays")
continue
else
if(issaved(Area.vars[V])) A.vars[V] = Area.vars[V]
A.tag = tag
A.lighting_subarea = 1
A.lighting_space = 0 // in case it was copied from a space subarea
if (l_color != A.l_color)
A.l_color = l_color
//color_light = min(max(round(color_lighting_lumcount, 1), 0), lighting_controller.lighting_states)
//world << "[color_light] [color_lighting_lumcount]"
A.SetLightLevel(level, color_light)
Area.related += A
return A
turf/proc/shift_to_subarea()
lighting_changed = 0
var/area/Area = loc
if(!istype(Area) || !Area.lighting_use_dynamic) return
var/level = min(max(round(lighting_lumcount,1),0),lighting_controller.lighting_states)
var/new_tag = lighting_tag(level)
// pomf - If we have a lighting color that is not null, apply the new tag to seperate the areas.
if (l_color)
// pomf - We append the (rounded!) color lighting lumcount so we can have colored lights.
new_tag += "[l_color][min(max(round(color_lighting_lumcount,1),0),lighting_controller.lighting_states)]"
if(Area.tag!=new_tag) //skip if already in this area
var/area/A = locate(new_tag) // find an appropriate area
var/color_light = min(max(round(color_lighting_lumcount,1),0),lighting_controller.lighting_states)
if (!A)
A = build_lighting_area(new_tag, level, color_light)
else if (l_color != A.l_color)
A.l_color = l_color
//color_light = min(max(round(color_lighting_lumcount, 1), 0), lighting_controller.lighting_states)
A.SetLightLevel(level, color_light)
A.contents += src // move the turf into the area
// Dedicated lighting sublevel for space turfs
// helps us depower things in space, remove space fire alarms,
// and evens out space lighting
turf/space/lighting_tag(var/level)
var/area/A = loc
return A.tagbase + "sd_L_space"
turf/space/build_lighting_area(var/tag,var/level)
var/area/A = ..(tag,4)
A.lighting_space = 1
A.SetLightLevel(4)
A.icon_state = null
return A
area
var/lighting_use_dynamic = 1 //Turn this flag off to prevent sd_DynamicAreaLighting from affecting this area
var/image/lighting_overlay //tracks the darkness image of the area for easy removal
var/lighting_subarea = 0 //tracks whether we're a lighting sub-area
var/lighting_space = 0 // true for space-only lighting subareas
var/tagbase
var/image/color_overlay //Tracks the color image.
proc/SetLightLevel(light, color_light = 0)
if(!src) return
if(light <= 0)
light = 0
luminosity = 0
else
if(light > lighting_controller.lighting_states)
light = lighting_controller.lighting_states
luminosity = 1
if(lighting_overlay)
overlays -= lighting_overlay
lighting_overlay.icon_state = "[light]"
else
lighting_overlay = image(LIGHTING_ICON,,num2text(light),LIGHTING_LAYER)
if (color_overlay)
overlays.Remove(color_overlay)
color_overlay.icon_state = "5"
else
if (l_color)
color_overlay = image('icons/effects/effects.dmi', ,"5", 10.1)
//color_overlay = image('icons/effects/effects.dmi', ,"white", 10.1)
if (istype(color_overlay))
color_overlay.color = l_color
switch (color_light)
if (6)
color_overlay.icon_state = "5"
//color_overlay.alpha = 180
if (5)
color_overlay.icon_state = "4"
//color_overlay.alpha = 150
if (4)
color_overlay.icon_state = "3"
//color_overlay.alpha = 120
if (3)
color_overlay.icon_state = "2"
//color_overlay.alpha = 90
if (2)
color_overlay.icon_state = "1"
//color_overlay.alpha = 60
if (1)
color_overlay.icon_state = "1"
color_overlay.alpha = 200
//color_overlay.alpha = 30
if (-INFINITY to 0)
//world << "Zero or below, [color_light]."
color_overlay.alpha = 0
else
//world << "Setting the alpha to max... color_light [color_light]."
color_overlay.alpha = 180
color_overlay.blend_mode = BLEND_ADD
if (color_overlay.color)
overlays.Add(color_overlay)
if (isnull(color_overlay))
overlays.Add(lighting_overlay)
else if (light < 6)
overlays.Add(lighting_overlay)
proc/SetDynamicLighting()
src.lighting_use_dynamic = 1
for(var/turf/T in src.contents)
T.update_lumcount(0)
proc/InitializeLighting() //TODO: could probably improve this bit ~Carn
tagbase = "[type]"
if(!tag) tag = tagbase
if(!lighting_use_dynamic)
if(!lighting_subarea) // see if this is a lighting subarea already
//show the dark overlay so areas, not yet in a lighting subarea, won't be bright as day and look silly.
SetLightLevel(4)
//#undef LIGHTING_LAYER
#undef LIGHTING_CIRCULAR
//#undef LIGHTING_ICON
#define LIGHTING_MAX_LUMINOSITY_STATIC 8 //Maximum luminosity to reduce lag.
#define LIGHTING_MAX_LUMINOSITY_MOBILE 5 //Moving objects have a lower max luminosity since these update more often. (lag reduction)
#define LIGHTING_MAX_LUMINOSITY_TURF 1 //turfs have a severely shortened range to protect from inevitable floor-lighttile spam.
//set the changed status of all lights which could have possibly lit this atom.
//We don't need to worry about lights which lit us but moved away, since they will have change status set already
//This proc can cause lots of lights to be updated. :(
atom/proc/UpdateAffectingLights()
for(var/atom/A in oview(LIGHTING_MAX_LUMINOSITY_STATIC-1,src))
if(A.light)
A.light.changed = 1 //force it to update at next process()
//caps luminosity effects max-range based on what type the light's owner is.
atom/proc/get_light_range()
return min(luminosity, LIGHTING_MAX_LUMINOSITY_STATIC)
atom/movable/get_light_range()
return min(luminosity, LIGHTING_MAX_LUMINOSITY_MOBILE)
obj/machinery/light/get_light_range()
return min(luminosity, LIGHTING_MAX_LUMINOSITY_STATIC)
turf/get_light_range()
return min(luminosity, LIGHTING_MAX_LUMINOSITY_TURF)
#undef LIGHTING_MAX_LUMINOSITY_STATIC
#undef LIGHTING_MAX_LUMINOSITY_MOBILE
#undef LIGHTING_MAX_LUMINOSITY_TURF
+6
View File
@@ -152,6 +152,8 @@
// 15, 45, 70 minutes respectively
var/list/event_delay_upper = list(EVENT_LEVEL_MUNDANE = 9000, EVENT_LEVEL_MODERATE = 27000, EVENT_LEVEL_MAJOR = 42000)
var/starlight = 0 // Whether space turfs have ambient light or not
/datum/configuration/New()
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
for (var/T in L)
@@ -501,6 +503,10 @@
config.event_delay_upper[EVENT_LEVEL_MODERATE] = MinutesToTicks(values[2])
config.event_delay_upper[EVENT_LEVEL_MAJOR] = MinutesToTicks(values[3])
if("starlight")
var/vvalue = text2num(value)
config.starlight = vvalue >= 0 ? vvalue : 0
else
diary << "Unknown setting in configuration: '[name]'"
-21
View File
@@ -14,10 +14,6 @@ var/global/datum/controller/failsafe/failsafe
var/masterControllerIteration = 0
var/masterControllerAlertLevel = 0
// lighting
var/lightingControllerIteration = 0
var/lightingControllerAlertLevel = 0
/datum/controller/failsafe/New()
. = ..()
@@ -58,21 +54,4 @@ var/global/datum/controller/failsafe/failsafe
masterControllerAlertLevel = 0
masterControllerIteration = master_controller.iteration
if(lighting_controller.processing)
if(lightingControllerIteration == lighting_controller.iteration) // Lighting controller hasn't finished processing in the defined interval.
switch(lightingControllerAlertLevel)
if(0 to 3)
lightingControllerAlertLevel++
if(4)
admins << "<font color='red' size='2'><b>Warning. The lighting_controller controller has not fired in the last [lightingControllerAlertLevel * processing_interval] ticks. Automatic restart in [processing_interval] ticks.</b></font>"
lightingControllerAlertLevel = 5
if(5)
admins << "<font color='red' size='2'><b>Warning. The lighting_controller controller has still not fired within the last [lightingControllerAlertLevel * processing_interval] ticks. Killing and restarting...</b></font>"
new /datum/controller/lighting() // Replace the old lighting_controller (hence killing the old one's process).
lighting_controller.process() // Start it rolling again.
lightingControllerAlertLevel = 0
else
lightingControllerAlertLevel = 0
lightingControllerIteration = lighting_controller.iteration
sleep(processing_interval)
-127
View File
@@ -1,127 +0,0 @@
var/datum/controller/lighting/lighting_controller = new ()
datum/controller/lighting
processing_interval = 5 //setting this too low will probably kill the server. Don't be silly with it!
var/process_cost = 0
var/lighting_states = 7
var/list/lights = list()
var/lights_workload_max = 0
// var/list/changed_lights() //TODO: possibly implement this to reduce on overheads?
var/list/changed_turfs = list()
var/changed_turfs_workload_max = 0
datum/controller/lighting/New()
lighting_states = max( 0, length(icon_states(LIGHTING_ICON))-1 )
if(lighting_controller != src)
if(istype(lighting_controller,/datum/controller/lighting))
Recover() //if we are replacing an existing lighting_controller (due to a crash) we attempt to preserve as much as we can
qdel(lighting_controller)
lighting_controller = src
//Workhorse of lighting. It cycles through each light to see which ones need their effects updating. It updates their
//effects and then processes every turf in the queue, moving the turfs to the corresponing lighting sub-area.
//All queue lists prune themselves, which will cause lights with no luminosity to be garbage collected (cheaper and safer
//than deleting them). Processing interval should be roughly half a second for best results.
//By using queues we are ensuring we don't perform more updates than are necessary
datum/controller/lighting/proc/process()
processing = 1
spawn(0)
//set background = 1
while(1)
if(processing)
iteration++
var/started = world.timeofday
lights_workload_max = max(lights_workload_max,lights.len)
for(var/i=1, i<=lights.len, i++)
var/datum/light_source/L = lights[i]
if(L && !L.check())
continue
lights.Cut(i,i+1)
i--
sleep(-1)
changed_turfs_workload_max = max(changed_turfs_workload_max,changed_turfs.len)
for(var/i=1, i<=changed_turfs.len, i++)
var/turf/T = changed_turfs[i]
if(T && T.lighting_changed)
T.shift_to_subarea()
changed_turfs.Cut() // reset the changed list
process_cost = (world.timeofday - started)
sleep(processing_interval)
//same as above except it attempts to shift ALL turfs in the world regardless of lighting_changed status
//Does not loop. Should be run prior to process() being called for the first time.
//Note: if we get additional z-levels at runtime (e.g. if the gateway thin ever gets finished) we can initialize specific
//z-levels with the z_level argument
datum/controller/lighting/proc/Initialize(var/z_level)
processing = 0
spawn(-1)
//set background = 1
for(var/i=1, i<=lights.len, i++)
var/datum/light_source/L = lights[i]
if(L.check())
lights.Cut(i,i+1)
i--
var/z_start = 1
var/z_finish = world.maxz
if(z_level)
z_level = round(z_level,1)
if(z_level > 0 && z_level <= world.maxz)
z_start = z_level
z_finish = z_level
for(var/k=z_start,k<=z_finish,k++)
for(var/i=1,i<=world.maxx,i++)
for(var/j=1,j<=world.maxy,j++)
var/turf/T = locate(i,j,k)
if(T) T.shift_to_subarea()
changed_turfs.Cut() // reset the changed list
//Used to strip valid information from an existing controller and transfer it to a replacement
//It works by using spawn(-1) to transfer the data, if there is a runtime the data does not get transfered but the loop
//does not crash
datum/controller/lighting/proc/Recover()
if(!istype(lighting_controller.changed_turfs,/list))
lighting_controller.changed_turfs = list()
if(!istype(lighting_controller.lights,/list))
lighting_controller.lights = list()
for(var/i=1, i<=lighting_controller.lights.len, i++)
var/datum/light_source/L = lighting_controller.lights[i]
if(istype(L))
spawn(-1) //so we don't crash the loop (inefficient)
L.check()
lights += L //If we didn't runtime then this will get transferred over
for(var/i=1, i<=lighting_controller.changed_turfs.len, i++)
var/turf/T = lighting_controller.changed_turfs[i]
if(istype(T) && T.lighting_changed)
spawn(-1)
T.shift_to_subarea()
var/msg = "## DEBUG: [time2text(world.timeofday)] lighting_controller restarted. Reports:\n"
for(var/varname in lighting_controller.vars)
switch(varname)
if("tag","bestF","type","parent_type","vars") continue
else
var/varval1 = lighting_controller.vars[varname]
var/varval2 = vars[varname]
if(istype(varval1,/list))
varval1 = "/list([length(varval1)])"
varval2 = "/list([length(varval2)])"
msg += "\t [varname] = [varval1] -> [varval2]\n"
world.log << msg
#undef LIGHTING_ICON
+6 -1
View File
@@ -74,6 +74,7 @@ datum/controller/game_controller/proc/setup()
color_windows_init()
setup_objects()
setup_starlight()
setupgenetics()
setupfactions()
setup_economy()
@@ -83,7 +84,6 @@ datum/controller/game_controller/proc/setup()
make_mining_asteroid_secret()
populate_spawn_points()
/* MOVED TO SCHEDULER
spawn(0)
@@ -125,6 +125,11 @@ datum/controller/game_controller/proc/setup_objects()
world << "\red \b Initializations complete."
sleep(-1)
datum/controller/game_controller/proc/setup_starlight()
world << "\red \b Initializing Starlight"
for(var/turf/space/S in world)
S.update_starlight()
world << "\red \b Starlight Initilization Complete"
datum/controller/game_controller/proc/process()
processing = 1
+2 -9
View File
@@ -22,7 +22,7 @@
master_controller.asteroid_ore_map = new /datum/ore_distribution()
master_controller.asteroid_ore_map.populate_distribution_map()
/client/proc/restart_controller(controller in list("Master","Failsafe","Lighting","Supply"))
/client/proc/restart_controller(controller in list("Master","Failsafe","Supply"))
set category = "Debug"
set name = "Restart Controller"
set desc = "Restart one of the various periodic loop controllers for the game (be careful!)"
@@ -38,10 +38,6 @@
if("Failsafe")
new /datum/controller/failsafe()
feedback_add_details("admin_verb","RFailsafe")
if("Lighting")
new /datum/controller/lighting()
lighting_controller.process()
feedback_add_details("admin_verb","RLighting")
if("Supply")
supply_controller.process()
feedback_add_details("admin_verb","RSupply")
@@ -49,7 +45,7 @@
return
/client/proc/debug_controller(controller in list("Master","failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras","Garbage", "Transfer Controller","Event","Scheduler"))
/client/proc/debug_controller(controller in list("Master","failsafe","Ticker","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras","Garbage", "Transfer Controller","Event","Scheduler"))
set category = "Debug"
set name = "Debug Controller"
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
@@ -65,9 +61,6 @@
if("Ticker")
debug_variables(ticker)
feedback_add_details("admin_verb","DTicker")
if("Lighting")
debug_variables(lighting_controller)
feedback_add_details("admin_verb","DLighting")
if("Air")
debug_variables(air_master)
feedback_add_details("admin_verb","DAir")
+5 -19
View File
@@ -28,8 +28,8 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
icon = 'icons/turf/areas.dmi'
icon_state = "unknown"
layer = 10
luminosity = 1
mouse_opacity = 0
invisibility = INVISIBILITY_LIGHTING
var/lightswitch = 1
var/eject = null
@@ -50,9 +50,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
var/has_gravity = 1
var/list/apc = list()
var/no_air = null
var/area/master // master area used for power calcluations
// (original area before splitting due to sd_DAL)
var/list/related // the other areas of the same type as this
// var/list/lights // list of all lights on this area
var/list/all_doors = list() //Added by Strumpetplaya - Alarm Change - Contains a list of doors adjacent to this area
var/air_doors_activated = 0
@@ -113,25 +110,23 @@ var/list/ghostteleportlocs = list()
/area/admin/
name = "\improper Admin Room"
icon_state = "start"
lighting_use_dynamic = 0
requires_power = 0
lighting_use_dynamic = 0
/area/adminconstruction
name = "\improper Admin Testing Area"
icon_state = "start"
lighting_use_dynamic = 0
requires_power = 0
lighting_use_dynamic = 0
//These are shuttle areas, they must contain two areas in a subgroup if you want to move a shuttle from one
//place to another. Look at escape shuttle for example.
//All shuttles show now be under shuttle since we have smooth-wall code.
/area/shuttle //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS.
/area/shuttle
requires_power = 0
luminosity = 1
lighting_use_dynamic = 0
/area/shuttle/arrival
name = "\improper Arrival Shuttle"
@@ -232,29 +227,21 @@ var/list/ghostteleportlocs = list()
icon_state = "shuttle"
name = "\improper Alien Shuttle Base"
requires_power = 1
luminosity = 0
lighting_use_dynamic = 1
/area/shuttle/alien/mine
icon_state = "shuttle"
name = "\improper Alien Shuttle Mine"
requires_power = 1
luminosity = 0
lighting_use_dynamic = 1
/area/shuttle/gamma/space
icon_state = "shuttle"
name = "\improper Gamma Armory"
requires_power = 0
luminosity = 0
lighting_use_dynamic = 1
/area/shuttle/gamma/station
icon_state = "shuttle"
name = "\improper Gamma Armory Station"
requires_power = 0
luminosity = 0
lighting_use_dynamic = 1
/area/shuttle/prison/
name = "\improper Prison Shuttle"
@@ -429,6 +416,7 @@ var/list/ghostteleportlocs = list()
name = "\improper Centcom"
icon_state = "centcom"
requires_power = 0
lighting_use_dynamic = 0
/area/centcom/control
name = "\improper Centcom Control"
@@ -1113,7 +1101,6 @@ var/list/ghostteleportlocs = list()
/area/holodeck
name = "\improper Holodeck"
icon_state = "Holodeck"
luminosity = 1
lighting_use_dynamic = 0
/area/holodeck/alphadeck
@@ -1249,7 +1236,6 @@ var/list/ghostteleportlocs = list()
/area/solar
requires_power = 0
luminosity = 1
lighting_use_dynamic = 0
auxport
+61 -82
View File
@@ -8,8 +8,6 @@
/proc/area_contents(var/area/A)
if(!istype(A)) return null
var/list/contents = list()
for(var/area/LSA in A.related)
contents += LSA.contents
return contents
// ===
@@ -20,9 +18,7 @@
/area/New()
icon_state = ""
layer = 10
master = src //moved outside the spawn(1) to avoid runtimes in lighting.dm when it references loc.loc.master ~Carn
uid = ++global_uid
related = list(src)
active_areas += src
all_areas += src
@@ -36,20 +32,15 @@
// lighting_state = 4
//has_gravity = 0 // Space has gravity. Because.. because.
if(requires_power)
luminosity = 0
else
if(!requires_power)
power_light = 0 //rastaf0
power_equip = 0 //rastaf0
power_environ = 0 //rastaf0
luminosity = 1
lighting_use_dynamic = 0
..()
// spawn(15)
power_change() // all machines set to current power level, also updates lighting icon
InitializeLighting()
/area/proc/poweralert(var/state, var/obj/source as obj)
@@ -57,16 +48,15 @@
poweralm = state
if(istype(source)) //Only report power alarms on the z-level where the source is located.
var/list/cameras = list()
for (var/area/RA in related)
for (var/obj/machinery/camera/C in RA)
if(!report_alerts)
break
cameras += C
if(state == 1)
for (var/obj/machinery/camera/C in src)
if(!report_alerts)
break
cameras += C
if(state == 1)
C.network.Remove("Power Alarms")
else
C.network.Add("Power Alarms")
C.network.Remove("Power Alarms")
else
C.network.Add("Power Alarms")
for (var/mob/living/silicon/aiPlayer in player_list)
if(!report_alerts)
break
@@ -93,15 +83,14 @@
var/danger_level = 0
// Determine what the highest DL reported by air alarms is
for (var/area/RA in related)
for(var/obj/machinery/alarm/AA in RA)
if((AA.stat & (NOPOWER|BROKEN)) || AA.shorted || AA.buildstage != 2)
continue
var/reported_danger_level=AA.local_danger_level
if(AA.alarmActivated)
reported_danger_level=2
if(reported_danger_level>danger_level)
danger_level=reported_danger_level
for(var/obj/machinery/alarm/AA in src)
if((AA.stat & (NOPOWER|BROKEN)) || AA.shorted || AA.buildstage != 2)
continue
var/reported_danger_level=AA.local_danger_level
if(AA.alarmActivated)
reported_danger_level=2
if(reported_danger_level>danger_level)
danger_level=reported_danger_level
// testing("Danger level at [AA.name]: [AA.local_danger_level] (reported [reported_danger_level])")
// testing("Danger level decided upon in [name]: [danger_level] (from [atmosalm])")
@@ -111,13 +100,11 @@
// Going to danger level 2 from something else
if (danger_level == 2)
var/list/cameras = list()
for(var/area/RA in related)
//updateicon()
for(var/obj/machinery/camera/C in RA)
if(!report_alerts)
break
cameras += C
C.network.Add("Atmosphere Alarms")
for(var/obj/machinery/camera/C in src)
if(!report_alerts)
break
cameras += C
C.network.Add("Atmosphere Alarms")
for(var/mob/living/silicon/aiPlayer in player_list)
if(!report_alerts)
break
@@ -130,11 +117,10 @@
CloseFirelocks()
// Dropping from danger level 2.
else if (atmosalm == 2)
for(var/area/RA in related)
for(var/obj/machinery/camera/C in RA)
if(!report_alerts)
break
C.network.Remove("Atmosphere Alarms")
for(var/obj/machinery/camera/C in src)
if(!report_alerts)
break
C.network.Remove("Atmosphere Alarms")
for(var/mob/living/silicon/aiPlayer in player_list)
if(!report_alerts)
break
@@ -179,12 +165,11 @@
mouse_opacity = 0
CloseFirelocks()
var/list/cameras = list()
for(var/area/RA in related)
for (var/obj/machinery/camera/C in RA)
if(!report_alerts)
continue
cameras.Add(C)
C.network.Add("Fire Alarms")
for (var/obj/machinery/camera/C in src)
if(!report_alerts)
continue
cameras.Add(C)
C.network.Add("Fire Alarms")
for (var/mob/living/silicon/ai/aiPlayer in player_list)
if(!report_alerts)
continue
@@ -199,11 +184,10 @@
fire = 0
mouse_opacity = 0
updateicon()
for(var/area/RA in related)
for (var/obj/machinery/camera/C in RA)
if(!report_alerts)
continue
C.network.Remove("Fire Alarms")
for (var/obj/machinery/camera/C in src)
if(!report_alerts)
continue
C.network.Remove("Fire Alarms")
for (var/mob/living/silicon/ai/aiPlayer in player_list)
if(!report_alerts)
continue
@@ -293,67 +277,66 @@
/area/proc/powered(var/chan) // return true if the area has power to given channel
if(!master.requires_power)
if(!requires_power)
return 1
if(master.always_unpowered)
if(always_unpowered)
return 0
switch(chan)
if(EQUIP)
return master.power_equip
return power_equip
if(LIGHT)
return master.power_light
return power_light
if(ENVIRON)
return master.power_environ
return power_environ
return 0
// called when power status changes
/area/proc/power_change()
master.powerupdate = 2
for(var/area/RA in related)
for(var/obj/machinery/M in RA) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)
if (fire || eject || party)
RA.updateicon()
powerupdate = 2
for(var/obj/machinery/M in src) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)
if (fire || eject || party)
updateicon()
/area/proc/usage(var/chan)
var/used = 0
switch(chan)
if(LIGHT)
used += master.used_light
used += used_light
if(EQUIP)
used += master.used_equip
used += used_equip
if(ENVIRON)
used += master.used_environ
used += used_environ
if(TOTAL)
used += master.used_light + master.used_equip + master.used_environ
used += used_light + used_equip + used_environ
return used
/area/proc/clear_usage()
master.used_equip = 0
master.used_light = 0
master.used_environ = 0
used_equip = 0
used_light = 0
used_environ = 0
/area/proc/use_power(var/amount, var/chan)
switch(chan)
if(EQUIP)
master.used_equip += amount
used_equip += amount
if(LIGHT)
master.used_light += amount
used_light += amount
if(ENVIRON)
master.used_environ += amount
used_environ += amount
/area/proc/use_battery_power(var/amount, var/chan)
switch(chan)
if(EQUIP)
master.used_equip += amount
used_equip += amount
if(LIGHT)
master.used_light += amount
used_light += amount
if(ENVIRON)
master.used_environ += amount
used_environ += amount
/area/Entered(A)
@@ -418,15 +401,11 @@
L.client.played = 0
/area/proc/gravitychange(var/gravitystate = 0, var/area/A)
A.has_gravity = gravitystate
for(var/area/SubA in A.related)
SubA.has_gravity = gravitystate
if(gravitystate)
for(var/mob/living/carbon/human/M in SubA)
thunk(M)
if(gravitystate)
for(var/mob/living/carbon/human/M in A)
thunk(M)
/area/proc/thunk(var/mob/living/carbon/human/M)
if(istype(M,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to.
+1 -1
View File
@@ -34,7 +34,7 @@ var/global/list/ghdel_profiling = list()
/atom/Destroy()
SetOpacity(0)
set_opacity(0)
if(reagents)
+3 -17
View File
@@ -14,6 +14,7 @@
var/no_spin = 0
var/moved_recently = 0
var/mob/pulledby = null
var/simulated //filter for actions - used by lighting overlays
var/area/areaMaster
var/hard_deleted = 0
@@ -24,23 +25,8 @@
/atom/movable/Destroy()
if(opacity)
if(isturf(loc))
if(loc:lighting_lumcount > 1)
UpdateAffectingLights()
gcDestroyed = "Bye, world!"
tag = null
. = ..()
loc = null
/*
if(istype(beams) && beams.len)
for(var/obj/effect/beam/B in beams)
if(B && B.target == src)
B.target = null
if(B.master && B.master.target == src)
B.master.target = null
beams.len = 0
*/
..()
/proc/delete_profile(var/type, code = 0)
if(!ticker || !ticker.current_state < 3) return
@@ -283,4 +269,4 @@
return 1
/atom/movable/proc/water_act(var/volume, var/temperature, var/source) //amount of water acting : temperature of water in kelvin : object that called it (for shennagins)
return 1
return 1
+7 -1
View File
@@ -56,7 +56,13 @@
var/turf/simulated/T = get_turf(M)
if(!istype(T))
return
if(T.lighting_lumcount <= 2)
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
var/light_available
if(L)
light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
else
light_available = 5
if(light_available <= 2)
M.alpha = round(255 * 1.15)
else
M.alpha = round(255 * 0.80)
+2 -2
View File
@@ -2,7 +2,7 @@
/obj/effect/blob
name = "blob"
icon = 'icons/mob/blob.dmi'
luminosity = 0
light_range = 0
desc = "Some blob creature thingy"
density = 0
opacity = 0
@@ -146,7 +146,7 @@
health -= damage
update_icon()
return
attack_animal(mob/living/simple_animal/M as mob)
M.changeNext_move(CLICK_CD_MELEE)
M.do_attack_animation(src)
+2 -1
View File
@@ -18,7 +18,8 @@
name = "Pylon"
desc = "A floating crystal that hums with an unearthly energy"
icon_state = "pylon"
luminosity = 5
light_range = 5
light_color = "#3e0000"
/obj/structure/cult/tome
+3 -4
View File
@@ -166,10 +166,9 @@
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
for(var/areapath in typesof(/area/hallway))
var/area/A = locate(areapath)
for(var/area/B in A.related)
for(var/turf/simulated/floor/F in B.contents)
if(!F.contents.len)
turfs += F
for(var/turf/simulated/floor/F in A.contents)
if(!F.contents.len)
turfs += F
if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/floor/T = pick(turfs)
+3 -4
View File
@@ -5,10 +5,9 @@
var/list/turf/simulated/floor/turfs = list() //list of all the empty floor turfs in the hallway areas
for(var/areapath in typesof(/area/hallway))
var/area/A = locate(areapath)
for(var/area/B in A.related)
for(var/turf/simulated/floor/F in B.contents)
if(!F.contents.len)
turfs += F
for(var/turf/simulated/floor/F in A.contents)
if(!F.contents.len)
turfs += F
if(turfs.len) //Pick a turf to spawn at if we can
var/turf/simulated/floor/T = pick(turfs)
@@ -55,7 +55,7 @@
L.update(0)
for(var/obj/item/device/pda/P in T.contents)
P.fon = 0
P.SetLuminosity(0)
P.set_light(0)
for(var/obj/effect/glowshroom/G in orange(2, usr)) //Very small radius
G.visible_message("<span class='warning'>\The [G] withers away!</span>")
qdel(G)
@@ -69,15 +69,15 @@
F.update_brightness()
for(var/obj/item/device/pda/P in H)
P.fon = 0
P.SetLuminosity(0) //failsafe
P.set_light(0) //failsafe
for(var/obj/item/clothing/head/helmet/space/rig/R in H)
if(R.on)
R.on = 0
R.icon_state = "rig[R.on]-[R._color]"
H.update_inv_head()
R.visible_message("<span class='danger'>[R]'s light fades and turns off.</span>")
H.SetLuminosity(H.luminosity - R.brightness_on)
R.SetLuminosity(0)
H.set_light(H.luminosity - R.brightness_on)
R.set_light(0)
if(H != usr)
H << "<span class='boldannounce'>You feel a chill and are plunged into darkness.</span>"
H.luminosity = 0 //This might not be required, but it just acts as another failsafe.
+11 -2
View File
@@ -270,6 +270,12 @@
alpha = 255
return
var/turf/simulated/T = get_turf(src)
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
var/light_available
if(L)
light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
else
light_available = 5
if(!istype(T))
return 0
@@ -277,7 +283,7 @@
if(!mind.vampire.iscloaking)
alpha = 255
return 0
if(T.lighting_lumcount <= 2)
if(light_available <= 2)
alpha = round((255 * 0.15))
return 1
else
@@ -439,8 +445,11 @@
if(T.x>world.maxx-outer_tele_radius || T.x<outer_tele_radius) continue //putting them at the edge is dumb
if(T.y>world.maxy-outer_tele_radius || T.y<outer_tele_radius) continue
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
var/lightingcount = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
// LIGHTING CHECK
if(T.lighting_lumcount > max_lum) continue
if(lightingcount > max_lum) continue
turfs += T
if(!turfs.len)
+3 -3
View File
@@ -222,14 +222,14 @@
idle_power_usage = 1250
active_power_usage = 2500
l_color = "#7BF9FF"
light_color = "#7BF9FF"
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
/obj/machinery/sleeper/New()
..()
+3 -3
View File
@@ -10,14 +10,14 @@
idle_power_usage = 1250
active_power_usage = 2500
l_color = "#00FF00"
light_color = "#00FF00"
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
/obj/machinery/bodyscanner/New()
..()
+14 -24
View File
@@ -95,11 +95,10 @@
/obj/machinery/alarm/proc/apply_preset(var/no_cycle_after=0)
// Propogate settings.
for (var/area/A in alarm_area.related)
for (var/obj/machinery/alarm/AA in A)
if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted && AA.preset != src.preset)
AA.preset=preset
apply_preset(1) // Only this air alarm should send a cycle.
for (var/obj/machinery/alarm/AA in alarm_area)
if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted && AA.preset != src.preset)
AA.preset=preset
apply_preset(1) // Only this air alarm should send a cycle.
TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa
TLV["nitrogen"] = list(-1, -1, -1, -1) // Partial pressure, kpa
@@ -151,8 +150,6 @@
/obj/machinery/alarm/proc/first_run()
alarm_area = get_area(src)
if (alarm_area.master)
alarm_area = alarm_area.master
area_uid = alarm_area.uid
if (name == "alarm")
name = "[alarm_area.name] Air Alarm"
@@ -296,11 +293,10 @@
/obj/machinery/alarm/proc/elect_master()
for (var/area/A in alarm_area.related)
for (var/obj/machinery/alarm/AA in A)
if (!(AA.stat & (NOPOWER|BROKEN)))
alarm_area.master_air_alarm = AA
return 1
for (var/obj/machinery/alarm/AA in alarm_area)
if (!(AA.stat & (NOPOWER|BROKEN)))
alarm_area.master_air_alarm = AA
return 1
return 0
/obj/machinery/alarm/proc/get_danger_level(var/current_value, var/list/danger_levels)
@@ -471,9 +467,9 @@
/obj/machinery/alarm/proc/air_doors_close(manual)
var/area/A = get_area(src)
if(!A.master.air_doors_activated)
A.master.air_doors_activated = 1
for(var/obj/machinery/door/E in A.master.all_doors)
if(!A.air_doors_activated)
A.air_doors_activated = 1
for(var/obj/machinery/door/E in A.all_doors)
if(istype(E,/obj/machinery/door/firedoor))
if(!E:blocked)
if(E.operating)
@@ -507,9 +503,9 @@
/obj/machinery/alarm/proc/air_doors_open(manual)
var/area/A = get_area(loc)
if(A.master.air_doors_activated)
A.master.air_doors_activated = 0
for(var/obj/machinery/door/E in A.master.all_doors)
if(A.air_doors_activated)
A.air_doors_activated = 0
for(var/obj/machinery/door/E in A.all_doors)
if(istype(E, /obj/machinery/door/firedoor))
if(!E:blocked)
if(E.operating)
@@ -1381,8 +1377,6 @@ Just a object used in constructing fire alarms
user.machine = src
var/area/A = get_area(src)
ASSERT(isarea(A))
if(A.master)
A = A.master
var/d1
var/d2
if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai))
@@ -1421,8 +1415,6 @@ Just a object used in constructing fire alarms
return
var/area/A = get_area(src)
ASSERT(isarea(A))
if(A.master)
A = A.master
A.partyreset()
return
@@ -1431,8 +1423,6 @@ Just a object used in constructing fire alarms
return
var/area/A = get_area(src)
ASSERT(isarea(A))
if(A.master)
A = A.master
A.partyalert()
return
@@ -9,13 +9,13 @@
var/range = 25
l_color = "#7BF9FF"
light_color = "#7BF9FF"
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
//Simple variable to prevent me from doing attack_hand in both this and the child computer
var/zone = "This computer is working on a wireless range, the range is currently limited to 25 meters."
@@ -151,14 +151,10 @@
var/turf/T_src = get_turf(src)
if(!T_src.loc) return 0
var/area/A_src = T_src.loc
if (A_src.master)
A_src = A_src.master
var/turf/T_scrub = get_turf(scrubber)
if(!T_scrub.loc) return 0
var/area/A_scrub = T_scrub.loc
if (A_scrub.master)
A_scrub = A_scrub.master
if(A_scrub != A_src)
return 0
@@ -177,7 +173,7 @@
var/turf/T2 = get_turf(scrubber)
if(T2 && T2.loc)
var/area/A2 = T2.loc
if(istype(A2) && A2.master && A2.master == A )
if(istype(A2) && A2 == A )
connectedscrubbers += scrubber
found = 1
+3 -3
View File
@@ -2,7 +2,7 @@
/obj/machinery/bot
icon = 'icons/obj/aibots.dmi'
layer = MOB_LAYER
luminosity = 3
light_range = 3
use_power = 0
var/obj/item/weapon/card/id/botcard // the ID card that the bot "holds"
var/list/prev_access = list()
@@ -87,12 +87,12 @@
/obj/machinery/bot/proc/turn_on()
if(stat) return 0
on = 1
SetLuminosity(initial(luminosity))
set_light(initial(light_range))
return 1
/obj/machinery/bot/proc/turn_off()
on = 0
SetLuminosity(0)
set_light(0)
bot_reset() //Resets an AI's call, should it exist.
/obj/machinery/bot/New()
+1 -1
View File
@@ -71,7 +71,7 @@
network = list()
cameranet.removeCamera(src)
stat |= EMPED
SetLuminosity(0)
set_light(0)
triggerCameraAlarm()
emped = emped+1 //Increase the number of consecutive EMP's
var/thisemp = emped //Take note of which EMP this proc is for
+3 -3
View File
@@ -24,13 +24,13 @@
var/speed_coeff
var/efficiency
l_color = "#00FF00"
light_color = "#00FF00"
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
/obj/machinery/clonepod/New()
..()
@@ -9,7 +9,7 @@
var/damaged = 0
var/last_change = 0
l_color = "#7BF9FF"
light_color = "#7BF9FF"
attack_ai(var/mob/user as mob)
@@ -163,7 +163,7 @@
/obj/machinery/computer/HolodeckControl/attackby(var/obj/item/weapon/D as obj, var/mob/user as mob, params)
return
/obj/machinery/computer/HolodeckControl/emag_act(user as mob)
if(!emagged)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
+1 -1
View File
@@ -9,7 +9,7 @@
var/mob/living/carbon/human/victim = null
var/obj/machinery/optable/table = null
l_color = "#0000FF"
light_color = "#0000FF"
/obj/machinery/computer/operating/New()
..()
+2 -2
View File
@@ -7,7 +7,7 @@
var/mob/living/silicon/ai/occupant = null
var/active = 0
l_color = "#CD00CD"
light_color = "#CD00CD"
/obj/machinery/computer/aifixer/New()
src.overlays += image('icons/obj/computer.dmi', "ai-fixer-empty")
@@ -19,7 +19,7 @@
user << "This terminal isn't functioning right now, get it working!"
return
I:transfer_ai("AIFIXER","AICARD",src,user)
..()
return
+3 -3
View File
@@ -3,7 +3,7 @@
desc = "random arcade machine"
icon = 'icons/obj/computer.dmi'
icon_state = "arcade"
l_color = "#00FF00"
light_color = "#00FF00"
var/list/prizes = list( /obj/item/weapon/storage/box/snappops = 2,
/obj/item/clothing/under/syndicate/tacticool = 2,
@@ -47,9 +47,9 @@
/obj/machinery/computer/arcade/power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
/obj/machinery/computer/arcade/New()
..()
+1 -1
View File
@@ -11,7 +11,7 @@
var/receive_frequency = 1437
var/datum/radio_frequency/radio_connection
l_color = "#7BF9FF"
light_color = "#7BF9FF"
/obj/machinery/computer/atmos_alert/initialize()
+32 -30
View File
@@ -1,7 +1,8 @@
var/camera_cache_id = 1
/proc/invalidateCameraCache()
for(var/obj/machinery/computer/security/s in world)
s.camera_cache = null
camera_cache_id = (++camera_cache_id % 999999)
/obj/machinery/computer/security
name = "Camera Monitor"
desc = "Used to access the various cameras networks on the station."
@@ -10,8 +11,9 @@
var/obj/machinery/camera/current = null
var/list/network = list("")
var/last_pic = 1.0
l_color = "#B40000"
var/mapping = 0
light_color = "#B40000"
var/mapping = 0
var/cache_id = 0
var/list/networks[0]
var/list/tempnets[0]
var/list/data[0]
@@ -26,21 +28,21 @@
networks["Research"] = list(access_rd,access_hos,access_captain)
networks["Prison"] = list(access_hos,access_captain)
networks["Labor"] = list(access_hos,access_captain)
networks["Interrogation"] = list(access_hos,access_captain)
networks["Interrogation"] = list(access_hos,access_captain)
networks["Atmosphere Alarms"] = list(access_ce,access_hos,access_captain)
networks["Fire Alarms"] = list(access_ce,access_hos,access_captain)
networks["Fire Alarms"] = list(access_ce,access_hos,access_captain)
networks["Power Alarms"] = list(access_ce,access_hos,access_captain)
networks["Supermatter"] = list(access_ce,access_hos,access_captain)
networks["MiniSat"] = list(access_rd,access_hos,access_captain)
networks["Singularity"] = list(access_ce,access_hos,access_captain)
networks["Supermatter"] = list(access_ce,access_hos,access_captain)
networks["MiniSat"] = list(access_rd,access_hos,access_captain)
networks["Singularity"] = list(access_ce,access_hos,access_captain)
networks["Anomaly Isolation"] = list(access_rd,access_hos,access_captain)
networks["Toxins"] = list(access_rd,access_hos,access_captain)
networks["Telepad"] = list(access_rd,access_hos,access_captain)
networks["TestChamber"] = list(access_rd,access_hos,access_captain)
networks["ERT"] = list(access_cent_specops_commander,access_cent_commander)
networks["ERT"] = list(access_cent_specops_commander,access_cent_commander)
networks["CentCom"] = list(access_cent_security,access_cent_commander)
networks["Thunderdome"] = list(access_cent_thunder,access_cent_commander)
attack_ai(var/mob/user as mob)
return attack_hand(user)
@@ -52,17 +54,17 @@
return null
user.reset_view(current)
return 1
// Network configuration
attackby(I as obj, user as mob, params)
access = list()
if(istype(I,/obj/item/weapon/card/id)) // If hit by a regular ID card.
var/obj/item/weapon/card/id/E = I
var/obj/item/weapon/card/id/E = I
access = E.access
ui_interact(user)
else
..()
emag_act(user as mob)
if(!emagged)
emagged = 1
@@ -70,12 +72,12 @@
ui_interact(user)
else
ui_interact(user)
ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(src.z > 6) return
if(stat & (NOPOWER|BROKEN)) return
if(user.stat) return
if(user.stat) return
var/data[0]
@@ -104,14 +106,14 @@
data["current"] = cam
data["cameras"] = cameras
tempnets.Cut()
if(emagged)
access = list(access_captain) // Assume captain level access when emagged
data["emagged"] = 1
if(isAI(user) || isrobot(user))
access = list(access_captain) // Assume captain level access when AI
// Loop through the ID's permission, and check which networks the ID has access to.
for(var/l in networks) // Loop through networks.
for(var/m in networks[l]) // Loop through access levels of the networks.
@@ -119,10 +121,10 @@
if(l in network) // Checks if the network is currently active.
tempnets.Add(list(list("name" = l, "active" = 1)))
else
tempnets.Add(list(list("name" = l, "active" = 0)))
tempnets.Add(list(list("name" = l, "active" = 0)))
break
data["networks"] = tempnets
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "sec_camera.tmpl", "Camera Console", 900, 800)
@@ -135,7 +137,7 @@
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
Topic(href, href_list)
if(href_list["switchTo"])
if(src.z>6 || stat&(NOPOWER|BROKEN)) return
@@ -165,7 +167,7 @@
nanomanager.update_uis(src)
else
. = ..()
attack_hand(var/mob/user as mob)
access = list()
if (src.z > 6)
@@ -175,22 +177,22 @@
if(!isAI(user))
user.set_machine(src)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.wear_id)
var/obj/item/weapon/card/id/gold/C = H.wear_id
access = C.access
ui_interact(user)
// Check if camera is accessible when jumping
proc/can_access_camera(var/obj/machinery/camera/C)
var/list/shared_networks = src.network & C.network
if(shared_networks.len)
return 1
return 0
// Switching to cameras
proc/switch_to_camera(var/mob/user, var/obj/machinery/camera/C)
if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.can_use() )) && (!istype(user, /mob/living/silicon/ai)))
@@ -239,14 +241,14 @@
return
if(can_access_camera(jump_to))
switch_to_camera(user,jump_to)
// Camera control: mouse.
/atom/DblClick()
..()
if(istype(usr.machine,/obj/machinery/computer/security))
var/obj/machinery/computer/security/console = usr.machine
console.jump_on_click(usr,src)
// Camera control: arrow keys.
/mob/Move(n,direct)
if(istype(machine,/obj/machinery/computer/security))
+1 -1
View File
@@ -11,7 +11,7 @@
var/mode = 0.0
var/printing = null
l_color = "#0000FF"
light_color = "#0000FF"
proc/is_centcom()
return istype(src, /obj/machinery/computer/card/centcom)
+12 -12
View File
@@ -16,7 +16,7 @@
var/autoprocess = 0
var/data[0]
l_color = "#0000FF"
light_color = "#0000FF"
/obj/machinery/computer/cloning/New()
..()
@@ -36,8 +36,8 @@
for(var/datum/dna2/record/R in src.records)
if(!(pod1.occupant || pod1.mess))
if(pod1.growclone(R))
records.Remove(R)
records.Remove(R)
/obj/machinery/computer/cloning/proc/updatemodules()
src.scanner = findscanner()
src.pod1 = findcloner()
@@ -113,7 +113,7 @@
data["pod"] = src.pod1
data["loading"] = loading
data["autoprocess"] = autoprocess
if(scanner && pod1 && ((scanner.scan_level > 2) || (pod1.efficiency > 5)))
if(scanner && pod1 && ((scanner.scan_level > 2) || (pod1.efficiency > 5)))
data["autoallowed"] = 1
else
data["autoallowed"] = 0
@@ -123,19 +123,19 @@
data["temp"] = temp
data["scantemp"] = scantemp
data["disk"] = src.diskette
var/list/temprecords[0]
var/list/temprecords[0]
for(var/datum/dna2/record/R in src.records)
var tempRealName = R.dna.real_name
temprecords.Add(list(list("record" = "\ref[R]", "realname" = tempRealName)))
data["records"] = temprecords
if(src.menu == 3)
if (src.active_record)
data["activerecord"] = "\ref[src.active_record]"
var/obj/item/weapon/implant/health/H = null
if(src.active_record.implant)
H = locate(src.active_record.implant)
if ((H) && (istype(H)))
data["health"] = H.sensehealth()
data["realname"] = src.active_record.dna.real_name
@@ -145,13 +145,13 @@
data["enoughbiomass"] = 1
else
data["enoughbiomass"] = 0
// Set up the Nano UI
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "cloning_console.tmpl", "Cloning Console UI", 640, 480)
ui.set_initial_data(data)
ui.open()
ui.set_initial_data(data)
ui.open()
/obj/machinery/computer/cloning/Topic(href, href_list)
if(..())
@@ -179,7 +179,7 @@
nanomanager.update_uis(src)
if("stopautoprocess")
autoprocess = 0
nanomanager.update_uis(src)
nanomanager.update_uis(src)
//No locking an open scanner.
else if ((href_list["lock"]) && (!isnull(src.scanner)))
@@ -267,7 +267,7 @@
else if (href_list["refresh"])
nanomanager.update_uis(src)
else if (href_list["clone"])
else if (href_list["clone"])
var/datum/dna2/record/C = locate(href_list["clone"])
//Look for that player! They better be dead!
if(C)
@@ -55,11 +55,11 @@ var/shuttle_call/shuttle_calls[0]
var/stat_msg1
var/stat_msg2
var/display_type="blank"
var/datum/announcement/priority/crew_announcement = new
l_color = "#0000FF"
light_color = "#0000FF"
/obj/machinery/computer/communications/New()
..()
crew_announcement.newscast = 1
@@ -252,7 +252,7 @@ var/shuttle_call/shuttle_calls[0]
if(!emagged)
src.emagged = 1
user << "You scramble the communication routing circuits!"
/obj/machinery/computer/communications/attack_ai(var/mob/user as mob)
return src.attack_hand(user)
@@ -426,7 +426,7 @@ var/shuttle_call/shuttle_calls[0]
if(world.time < 54000) // 30 minute grace period to let the game get going
user << "The shuttle is refueling. Please wait another [round((54000-world.time)/60)] minutes before trying again."
return
if(ticker.mode.name == "epidemic")
user << "Under directive 7-10, [station_name()] is quarantined until further notice."
return
+4 -4
View File
@@ -93,9 +93,9 @@
..()
update_icon()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
/obj/machinery/computer/proc/set_broken()
@@ -106,7 +106,7 @@
// Adds line breaks
text = replacetext(text, "\n", "<BR>")
return text
/obj/machinery/computer/attack_ghost(user as mob)
return src.attack_hand(user)
@@ -114,7 +114,7 @@
/* Observers can view computers, but not actually use them via Topic*/
if(istype(user, /mob/dead/observer)) return 0
return ..()
/obj/machinery/computer/attackby(I as obj, user as mob, params)
if(istype(I, /obj/item/weapon/screwdriver) && circuit)
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
+2 -2
View File
@@ -8,7 +8,7 @@
var/mob/living/silicon/ai/current = null
var/opened = 0
l_color = "#FFFFFF"
light_color = "#FFFFFF"
verb/AccessInternals()
@@ -86,6 +86,6 @@
else
usr << "[src.current.name] selected for law changes."
return
attack_ghost(user as mob)
return 1
+1 -1
View File
@@ -16,7 +16,7 @@
var/temp = null
var/printing = null
l_color = "#0000FF"
light_color = "#0000FF"
/obj/machinery/computer/med_data/attack_ai(user as mob)
return src.attack_hand(user)
+2 -2
View File
@@ -33,7 +33,7 @@
var/customjob = "Admin"
var/custommessage = "This is a test, please ignore."
l_color = "#50AB00"
light_color = "#50AB00"
/obj/machinery/computer/message_monitor/attackby(obj/item/weapon/O as obj, mob/living/user as mob, params)
@@ -48,7 +48,7 @@
..()
return
/obj/machinery/computer/message_monitor/emag_act(user as mob)
// Will create sparks and print out the console's password. You will then have to wait a while for the console to be back online.
// It'll take more time if there's more characters in the password..
+4 -4
View File
@@ -11,7 +11,7 @@
idle_power_usage = 20
active_power_usage = 80
l_color = "#FF9933"
light_color = "#FF9933"
//fix for issue 521, by QualityVan.
//someone should really look into why circuits have a powernet var, it's several kinds of retarded.
@@ -23,14 +23,14 @@
if(isturf(T))
attached = locate() in T
if(attached)
powernet = attached.get_powernet()
powernet = attached.get_powernet()
/obj/machinery/power/monitor/attack_ai(mob/user)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
interact(user)
interact(user)
/obj/machinery/power/monitor/attack_hand(mob/user)
add_fingerprint(user)
+1 -1
View File
@@ -14,7 +14,7 @@
var/screen = 0 // 0 - No Access Denied, 1 - Access allowed
var/obj/item/weapon/card/id/prisoner/inserted_id
l_color = "#B40000"
light_color = "#B40000"
attack_ai(var/mob/user as mob)
+1 -1
View File
@@ -10,7 +10,7 @@
circuit = /obj/item/weapon/circuitboard/robotics
var/temp = null
l_color = "#CD00CD"
light_color = "#CD00CD"
/obj/machinery/computer/robotics/proc/can_control(var/mob/user, var/mob/living/silicon/robot/R)
if(!istype(R))
+1 -1
View File
@@ -22,7 +22,7 @@
var/sortBy = "name"
var/order = 1 // -1 = Descending - 1 = Ascending
l_color = "#B40000"
light_color = "#B40000"
/obj/machinery/computer/secure_data/attackby(obj/item/O as obj, user as mob, params)
+2 -2
View File
@@ -5,7 +5,7 @@
var/auth_need = 3.0
var/list/authorized = list( )
l_color = "#7BF9FF"
light_color = "#7BF9FF"
attackby(var/obj/item/weapon/card/W as obj, var/mob/user as mob, params)
@@ -57,7 +57,7 @@
src.authorized.len = 0
src.authorized = list( )
return
emag_act(user as mob)
if (!emagged)
var/choice = alert(user, "Would you like to launch the shuttle?","Shuttle control", "Launch", "Cancel")
@@ -6,7 +6,7 @@
circuit = "/obj/item/weapon/circuitboard/stationalert"
var/alarms = list("Fire"=list(), "Atmosphere"=list(), "Power"=list())
l_color = "#7BF9FF"
light_color = "#7BF9FF"
attack_ai(mob/user)
+1 -1
View File
@@ -4,7 +4,7 @@
icon_state = "comm_logs"
circuit = "/obj/item/weapon/circuitboard/merch"
l_color = "#50AB00"
light_color = "#50AB00"
/obj/item/weapon/circuitboard/merch
name = "\improper Merchandise Computer Circuitboard"
+3 -3
View File
@@ -17,13 +17,13 @@
var/current_heat_capacity = 50
var/efficiency
l_color = "#FFFFFF"
light_color = "#FFFFFF"
power_change()
..()
if(!(stat & (BROKEN|NOPOWER)))
SetLuminosity(2)
set_light(2)
else
SetLuminosity(0)
set_light(0)
/obj/machinery/atmospherics/unary/cryo_cell/New()
..()
+1 -1
View File
@@ -926,7 +926,7 @@ About the new airlock wires panel:
sleep(5)
update_icon()
if(visible && !glass)
SetOpacity(1)
set_opacity(1)
operating = 0
air_update_turf(1)
update_freelok_sight()
-2
View File
@@ -29,8 +29,6 @@
var/alert = signal.data["alert"]
var/area/our_area = get_area(src)
if (our_area.master)
our_area = our_area.master
if(alarm_area == our_area.name)
switch(alert)
+2 -2
View File
@@ -38,11 +38,11 @@
pixel_y = ((src.dir & 3)? (src.dir ==1 ? 24 : -32) : (0))
spawn(20)
for(var/obj/machinery/door/window/brigdoor/M in world)
for(var/obj/machinery/door/window/brigdoor/M in machines)
if (M.id == src.id)
targets += M
for(var/obj/machinery/flasher/F in world)
for(var/obj/machinery/flasher/F in machines)
if(F.id == src.id)
targets += F
+3 -3
View File
@@ -235,13 +235,13 @@
if(!operating) operating = 1
do_animate("opening")
src.SetOpacity(0)
src.set_opacity(0)
sleep(5)
src.density = 0
sleep(5)
src.layer = 2.7
update_icon()
SetOpacity(0)
set_opacity(0)
operating = 0
air_update_turf(1)
update_freelok_sight()
@@ -269,7 +269,7 @@
sleep(5)
update_icon()
if(visible && !glass)
SetOpacity(1) //caaaaarn!
set_opacity(1) //caaaaarn!
operating = 0
air_update_turf(1)
update_freelok_sight()
+69 -69
View File
@@ -58,7 +58,7 @@
src.operating = 1
flick("pdoorc0", src)
src.icon_state = "pdoor0"
src.SetOpacity(0)
src.set_opacity(0)
sleep(15)
src.density = 0
src.operating = 0
@@ -74,7 +74,7 @@
src.operating = 1
flick("pdoorc0", src)
src.icon_state = "pdoor0"
src.SetOpacity(0)
src.set_opacity(0)
sleep(5)
src.density = 0
sleep(5)
@@ -94,7 +94,7 @@
src.operating = 1
flick("pdoorc1", src)
src.icon_state = "pdoor1"
src.SetOpacity(initial(opacity))
src.set_opacity(initial(opacity))
air_update_turf(1)
update_freelok_sight()
sleep(5)
@@ -115,9 +115,9 @@
src.operating = 1
flick("pdoorc0", src)
src.icon_state = "pdoor0"
src.SetOpacity(0)
f1.SetOpacity(0)
f2.SetOpacity(0)
src.set_opacity(0)
f1.set_opacity(0)
f2.set_opacity(0)
sleep(10)
src.density = 0
@@ -145,9 +145,9 @@
f2.density = 1
sleep(10)
src.SetOpacity(initial(opacity))
f1.SetOpacity(initial(opacity))
f2.SetOpacity(initial(opacity))
src.set_opacity(initial(opacity))
f1.set_opacity(initial(opacity))
f2.set_opacity(initial(opacity))
update_nearby_tiles()
@@ -165,14 +165,14 @@
src.icon_state = "pdoor0"
sleep(10)
src.density = 0
src.SetOpacity(0)
src.set_opacity(0)
f1.density = 0
f1.SetOpacity(0)
f1.set_opacity(0)
f2.density = 0
f2.SetOpacity(0)
f2.set_opacity(0)
f3.density = 0
f3.SetOpacity(0)
f3.set_opacity(0)
air_update_turf(1)
update_freelok_sight()
@@ -193,14 +193,14 @@
src.density = 1
f1.density = 1
f1.SetOpacity(1)
f1.set_opacity(1)
f2.density = 1
f2.SetOpacity(1)
f2.set_opacity(1)
f3.density = 1
f3.SetOpacity(1)
f3.set_opacity(1)
if (src.visible)
src.SetOpacity(1)
src.set_opacity(1)
air_update_turf(1)
update_freelok_sight()
@@ -219,16 +219,16 @@
src.icon_state = "pdoor0"
sleep(10)
src.density = 0
src.SetOpacity(0)
src.set_opacity(0)
f1.density = 0
f1.SetOpacity(0)
f1.set_opacity(0)
f2.density = 0
f2.SetOpacity(0)
f2.set_opacity(0)
f3.density = 0
f3.SetOpacity(0)
f3.set_opacity(0)
f4.density = 0
f4.SetOpacity(0)
f4.set_opacity(0)
air_update_turf(1)
update_freelok_sight()
@@ -249,16 +249,16 @@
src.density = 1
f1.density = 1
f1.SetOpacity(1)
f1.set_opacity(1)
f2.density = 1
f2.SetOpacity(1)
f2.set_opacity(1)
f3.density = 1
f3.SetOpacity(1)
f3.set_opacity(1)
f4.density = 1
f4.SetOpacity(1)
f4.set_opacity(1)
if (src.visible)
src.SetOpacity(1)
src.set_opacity(1)
air_update_turf(1)
update_freelok_sight()
@@ -277,12 +277,12 @@
src.icon_state = "pdoor0"
sleep(10)
src.density = 0
src.sd_SetOpacity(0)
src.sd_set_opacity(0)
f1.density = 0
f1.sd_SetOpacity(0)
f1.sd_set_opacity(0)
f2.density = 0
f2.sd_SetOpacity(0)
f2.sd_set_opacity(0)
update_nearby_tiles()
@@ -302,12 +302,12 @@
src.density = 1
f1.density = 1
f1.sd_SetOpacity(1)
f1.sd_set_opacity(1)
f2.density = 1
f2.sd_SetOpacity(1)
f2.sd_set_opacity(1)
if (src.visible)
src.sd_SetOpacity(1)
src.sd_set_opacity(1)
update_nearby_tiles()
sleep(10)
@@ -326,14 +326,14 @@
src.icon_state = "pdoor0"
sleep(10)
src.density = 0
src.SetOpacity(0)
src.set_opacity(0)
f1.density = 0
f1.SetOpacity(0)
f1.set_opacity(0)
f2.density = 0
f2.SetOpacity(0)
f2.set_opacity(0)
f3.density = 0
f3.SetOpacity(0)
f3.set_opacity(0)
air_update_turf(1)
update_freelok_sight()
@@ -354,14 +354,14 @@
src.density = 1
f1.density = 1
f1.SetOpacity(1)
f1.set_opacity(1)
f2.density = 1
f2.SetOpacity(1)
f2.set_opacity(1)
f3.density = 1
f3.SetOpacity(1)
f3.set_opacity(1)
if (src.visible)
src.SetOpacity(1)
src.set_opacity(1)
air_update_turf(1)
update_freelok_sight()
@@ -380,16 +380,16 @@
src.icon_state = "pdoor0"
sleep(10)
src.density = 0
src.SetOpacity(0)
src.set_opacity(0)
f1.density = 0
f1.SetOpacity(0)
f1.set_opacity(0)
f2.density = 0
f2.SetOpacity(0)
f2.set_opacity(0)
f3.density = 0
f3.SetOpacity(0)
f3.set_opacity(0)
f4.density = 0
f4.SetOpacity(0)
f4.set_opacity(0)
air_update_turf(1)
update_freelok_sight()
@@ -410,16 +410,16 @@
src.density = 1
f1.density = 1
f1.SetOpacity(1)
f1.set_opacity(1)
f2.density = 1
f2.SetOpacity(1)
f2.set_opacity(1)
f3.density = 1
f3.SetOpacity(1)
f3.set_opacity(1)
f4.density = 1
f4.SetOpacity(1)
f4.set_opacity(1)
if (src.visible)
src.SetOpacity(1)
src.set_opacity(1)
air_update_turf(1)
update_freelok_sight()
@@ -441,8 +441,8 @@
f2 = new/obj/machinery/door/poddoor/filler_object (get_step(src,EAST))
f1.density = density
f2.density = density
f1.sd_SetOpacity(opacity)
f2.sd_SetOpacity(opacity)
f1.sd_set_opacity(opacity)
f2.sd_set_opacity(opacity)
Destroy()
del f1
@@ -460,8 +460,8 @@
f2 = new/obj/machinery/door/poddoor/filler_object (get_step(src,NORTH))
f1.density = density
f2.density = density
f1.sd_SetOpacity(opacity)
f2.sd_SetOpacity(opacity)
f1.sd_set_opacity(opacity)
f2.sd_set_opacity(opacity)
Destroy()
del f1
@@ -482,9 +482,9 @@
f1.density = density
f2.density = density
f3.density = density
f1.SetOpacity(opacity)
f2.SetOpacity(opacity)
f3.SetOpacity(opacity)
f1.set_opacity(opacity)
f2.set_opacity(opacity)
f3.set_opacity(opacity)
Destroy()
del f1
@@ -506,9 +506,9 @@
f1.density = density
f2.density = density
f3.density = density
f1.SetOpacity(opacity)
f2.SetOpacity(opacity)
f3.SetOpacity(opacity)
f1.set_opacity(opacity)
f2.set_opacity(opacity)
f3.set_opacity(opacity)
Destroy()
del f1
@@ -533,10 +533,10 @@
f2.density = density
f3.density = density
f4.density = density
f1.SetOpacity(opacity)
f2.SetOpacity(opacity)
f3.SetOpacity(opacity)
f4.SetOpacity(opacity)
f1.set_opacity(opacity)
f2.set_opacity(opacity)
f3.set_opacity(opacity)
f4.set_opacity(opacity)
Destroy()
del f1
@@ -562,10 +562,10 @@
f2.density = density
f3.density = density
f4.density = density
f1.SetOpacity(opacity)
f2.SetOpacity(opacity)
f3.SetOpacity(opacity)
f4.SetOpacity(opacity)
f1.set_opacity(opacity)
f2.set_opacity(opacity)
f3.set_opacity(opacity)
f4.set_opacity(opacity)
Destroy()
del f1
+3 -3
View File
@@ -24,7 +24,7 @@
icon_state = "shutter0"
sleep(15)
density = 0
SetOpacity(0)
set_opacity(0)
operating = 0
return
return
@@ -40,7 +40,7 @@
icon_state = "shutter0"
sleep(10)
density = 0
SetOpacity(0)
set_opacity(0)
air_update_turf(1)
update_freelok_sight()
@@ -59,7 +59,7 @@
icon_state = "shutter1"
density = 1
if(visible)
SetOpacity(1)
set_opacity(1)
air_update_turf(1)
update_freelok_sight()
+2 -2
View File
@@ -118,7 +118,7 @@
sleep(10)
src.density = 0
// src.sd_SetOpacity(0) //TODO: why is this here? Opaque windoors? ~Carn
// src.sd_set_opacity(0) //TODO: why is this here? Opaque windoors? ~Carn
air_update_turf(1)
update_freelok_sight()
@@ -142,7 +142,7 @@
src.density = 1
// if(src.visible)
// SetOpacity(1) //TODO: why is this here? Opaque windoors? ~Carn
// set_opacity(1) //TODO: why is this here? Opaque windoors? ~Carn
air_update_turf(1)
update_freelok_sight()
sleep(10)
+3 -3
View File
@@ -25,17 +25,17 @@
/*
/obj/machinery/flasher/New()
sleep(4) //<--- What the fuck are you doing? D=
src.sd_SetLuminosity(2)
src.sd_set_light(2)
*/
/obj/machinery/flasher/power_change()
if ( powered() )
stat &= ~NOPOWER
icon_state = "[base_state]1"
// src.sd_SetLuminosity(2)
// src.sd_set_light(2)
else
stat |= ~NOPOWER
icon_state = "[base_state]1-p"
// src.sd_SetLuminosity(0)
// src.sd_set_light(0)
//Don't want to render prison breaks impossible
/obj/machinery/flasher/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
+3 -3
View File
@@ -26,7 +26,7 @@
if(cell.charge <= 0)
on = 0
updateicon()
SetLuminosity(0)
set_light(0)
src.visible_message("<span class='warning'>[src] shuts down due to lack of power!</span>")
return
@@ -50,7 +50,7 @@
if(on)
on = 0
user << "\blue You turn off the light"
SetLuminosity(0)
set_light(0)
else
if(!cell)
return
@@ -58,7 +58,7 @@
return
on = 1
user << "\blue You turn on the light"
SetLuminosity(brightness_on)
set_light(brightness_on)
updateicon()
+6 -6
View File
@@ -105,8 +105,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
hologram.layer = FLY_LAYER//Above all the other objects/mobs. Or the vast majority of them.
hologram.anchored = 1//So space wind cannot drag it.
hologram.name = "[A.name] (Hologram)"//If someone decides to right click.
hologram.SetLuminosity(2) //hologram lighting
SetLuminosity(2) //pad lighting
hologram.set_light(2) //hologram lighting
set_light(2) //pad lighting
icon_state = "holopad1"
A.holo = src
master = A//AI is the master.
@@ -114,12 +114,12 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
return 1
/obj/machinery/hologram/holopad/proc/clear_holo()
// hologram.SetLuminosity(0)//Clear lighting. //handled by the lighting controller when its ower is deleted
// hologram.set_light(0)//Clear lighting. //handled by the lighting controller when its ower is deleted
del(hologram)//Get rid of hologram.
if(master.holo == src)
master.holo = null
master = null//Null the master, since no-one is using it now.
SetLuminosity(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted)
set_light(0) //pad lighting (hologram lighting will be handled automatically since its owner was deleted)
icon_state = "holopad0"
use_power = 1//Passive power usage.
return 1
@@ -136,7 +136,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
var/area/holo_area = get_area(src)
var/area/eye_area = get_area(master.eyeobj)
if(eye_area in holo_area.master.related)
if(eye_area != holo_area)
return 1
clear_holo()//If not, we want to get rid of the hologram.
@@ -148,7 +148,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
hologram.loc = get_turf(master.eyeobj)
return 1
// Simple helper to face what you clicked on, in case it should be needed in more than one place
/obj/machinery/hologram/holopad/proc/face_atom(var/atom/A)
if( !hologram || !A || !hologram.x || !hologram.y || !A.x || !A.y ) return
+2 -2
View File
@@ -65,11 +65,11 @@
if ( powered() && disable == 0 )
stat &= ~NOPOWER
icon_state = "[base_state]"
// src.sd_SetLuminosity(2)
// src.sd_set_light(2)
else
stat |= ~NOPOWER
icon_state = "[base_state]-p"
// src.sd_SetLuminosity(0)
// src.sd_set_light(0)
/obj/machinery/sparker/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/device/detective_scanner))
+6 -7
View File
@@ -50,15 +50,14 @@
on = !on
for(var/area/A in area.master.related)
A.lightswitch = on
A.updateicon()
area.lightswitch = on
area.updateicon()
for(var/obj/machinery/light_switch/L in A)
L.on = on
L.updateicon()
for(var/obj/machinery/light_switch/L in area)
L.on = on
L.updateicon()
area.master.power_change()
area.power_change()
/obj/machinery/light_switch/power_change()
+1 -1
View File
@@ -98,7 +98,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
var/c_locked=0; //Will our new channel be locked to public submissions?
var/hitstaken = 0 //Death at 3 hits from an item with force>=15
var/datum/feed_channel/viewing_channel = null
luminosity = 0
light_range = 0
anchored = 1
+2 -2
View File
@@ -1,7 +1,7 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/machinery/computer/telecomms
l_color = "#50AB00"
light_color = "#50AB00"
/obj/machinery/computer/telecomms/server
name = "Telecommunications Server Monitor"
@@ -246,7 +246,7 @@
del(src)
src.updateUsrDialog()
return
emag_act(user as mob)
if(!emagged)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
+2 -2
View File
@@ -19,8 +19,8 @@
var/temp = "" // temporary feedback messages
circuit = "/obj/item/weapon/circuitboard/comm_monitor"
l_color = "#50AB00"
light_color = "#50AB00"
attack_hand(mob/user as mob)
if(stat & (BROKEN|NOPOWER))
@@ -14,10 +14,10 @@
var/storedcode = "" // code stored
l_color = "#50AB00"
light_color = "#50AB00"
req_access = list(access_tcomsat)
circuit = "/obj/item/weapon/circuitboard/comm_traffic"
circuit = "/obj/item/weapon/circuitboard/comm_traffic"
proc/update_ide()
@@ -235,7 +235,7 @@
del(src)
src.updateUsrDialog()
return
/obj/machinery/computer/telecomms/traffic/emag_act(user as mob)
if(!emagged)
playsound(get_turf(src), 'sound/effects/sparks4.ogg', 75, 1)
+8 -11
View File
@@ -57,17 +57,16 @@
// M.music = 1
var/area/A = src.loc.loc
for(var/area/RA in A.related)
for(var/obj/machinery/party/lasermachine/L in RA)
L.turnon()
for(var/obj/machinery/party/lasermachine/L in A)
L.turnon()
playing = 1
while(playing == 1)
for(var/mob/M in world)
if((M.loc.loc in A.related) && M.music == 0)
if((M.loc.loc in A) && M.music == 0)
//world << "Found the song..."
M << S
M.music = 1
else if(!(M.loc.loc in A.related) && M.music == 1)
else if(!(M.loc.loc in A) && M.music == 1)
var/sound/Soff = sound(null)
Soff.channel = 10
M << Soff
@@ -148,9 +147,8 @@
M.music = 0
playing = 0
var/area/A = src.loc.loc
for(var/area/RA in A.related)
for(var/obj/machinery/party/lasermachine/L in RA)
L.turnoff()
for(var/obj/machinery/party/lasermachine/L in A)
L.turnoff()
@@ -278,6 +276,5 @@
/obj/machinery/party/lasermachine/proc/turnoff()
var/area/A = src.loc.loc
for(var/area/RA in A.related)
for(var/obj/effects/laser/F in RA)
del(F)
for(var/obj/effects/laser/F in A)
del(F)
+6 -8
View File
@@ -46,12 +46,11 @@
/obj/machinery/turretid/initialize()
if(!control_area)
var/area/CA = get_area(src)
control_area = CA.master
control_area = get_area(src)
else if(istext(control_area))
for(var/area/A in world)
if(A.name && A.name==control_area)
control_area = A.master
control_area = A
break
if(control_area)
@@ -88,7 +87,7 @@
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the panel.</span>"
return
return ..()
/obj/machinery/turretid/emag_act(user as mob)
if(!emagged)
user << "<span class='danger'>You short out the turret controls' access analysis module.</span>"
@@ -137,7 +136,7 @@
/obj/machinery/turretid/Topic(href, href_list, var/nowindow = 0)
if(..())
return 1
if(isLocked(usr))
return 1
@@ -176,9 +175,8 @@
TC.ailock = ailock
if(istype(control_area))
for(var/area/sub_area in control_area.related)
for (var/obj/machinery/porta_turret/aTurret in sub_area)
aTurret.setState(TC)
for (var/obj/machinery/porta_turret/aTurret in control_area)
aTurret.setState(TC)
update_icon()
+1 -9
View File
@@ -13,9 +13,6 @@
/area/turret_protected/Entered(O)
..()
if( master && master != src )
return master.Entered(O)
if( iscarbon(O) )
turretTargets |= O
else if( istype(O, /obj/mecha) )
@@ -31,9 +28,6 @@
return 1
/area/turret_protected/Exited(O)
if( master && master != src )
return master.Exited(O)
if( ismob(O) && !issilicon(O) )
turretTargets -= O
else if( istype(O, /obj/mecha) )
@@ -125,8 +119,6 @@
/obj/machinery/turret/proc/get_protected_area()
var/area/turret_protected/TP = get_area(src)
if(istype(TP))
if(TP.master && TP.master != TP)
TP = TP.master
return TP
return
@@ -331,7 +323,7 @@
spawn(13)
qdel(src)
/obj/machinery/turret/attack_animal(mob/living/simple_animal/M as mob)
M.changeNext_move(CLICK_CD_MELEE)
M.do_attack_animation(src)
+3 -3
View File
@@ -782,7 +782,7 @@
var/pow_chan
if(A)
for(var/c in use_channels)
if(A.master && A.master.powered(c))
if(A.powered(c))
pow_chan = c
break
return pow_chan
@@ -829,13 +829,13 @@
if(A)
var/pow_chan
for(var/c in list(EQUIP,ENVIRON,LIGHT))
if(A.master.powered(c))
if(A.powered(c))
pow_chan = c
break
if(pow_chan)
var/delta = min(12, ER.chassis.cell.maxcharge-cur_charge)
ER.chassis.give_power(delta)
A.master.use_power(delta*ER.coeff, pow_chan)
A.use_power(delta*ER.coeff, pow_chan)
return
+2 -2
View File
@@ -1007,8 +1007,8 @@
set popup_menu = 0
if(usr!=occupant) return
lights = !lights
if(lights) SetLuminosity(luminosity + lights_power)
else SetLuminosity(luminosity - lights_power)
if(lights) set_light(light_range + lights_power)
else set_light(light_range - lights_power)
src.occupant_message("Toggled lights [lights?"on":"off"].")
log_message("Toggled lights [lights?"on":"off"].")
return
+1 -1
View File
@@ -272,7 +272,7 @@
name = "glowing resin"
desc = "Blue bioluminescence shines from beneath the surface."
icon_state = "weednode"
luminosity = 1
light_range = 1
var/node_range = NODERANGE
+1 -1
View File
@@ -12,7 +12,7 @@
var/obj/item/device/assembly/signaler/anomaly/aSignal = null
/obj/effect/anomaly/New()
SetLuminosity(initial(luminosity))
set_light(initial(luminosity))
aSignal = new(src)
aSignal.code = rand(1,100)
@@ -67,7 +67,7 @@
density = 0
anchored = 1
layer = 2
luminosity = 1
light_range = 1
icon = 'icons/effects/effects.dmi'
icon_state = "greenglow"
+1 -1
View File
@@ -45,7 +45,7 @@
processing_objects += src
SetLuminosity(round(potency/10))
set_light(round(potency/10))
lastTick = world.timeofday
+5 -5
View File
@@ -56,8 +56,8 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
msg_admin_attack("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ([epicenter.x],[epicenter.y],[epicenter.z]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[epicenter.x];Y=[epicenter.y];Z=[epicenter.z]'>JMP</a>)")
log_game("Explosion with size ([devastation_range], [heavy_impact_range], [light_impact_range]) in area [epicenter.loc.name] ")
var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit
lighting_controller.processing = 0
//var/lighting_controller_was_processing = lighting_controller.processing //Pause the lighting updates for a bit
//lighting_controller.processing = 0
var/powernet_rebuild_was_deferred_already = defer_powernet_rebuild
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 1
@@ -72,7 +72,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
var/z0 = epicenter.z
for(var/turf/T in trange(max_range, epicenter))
var/dist = cheap_pythag(T.x - x0,T.y - y0)
var/dist = sqrt((T.x - x0)**2 + (T.y - y0)**2)
if(config.reactionary_explosions)
var/turf/Trajectory = T
@@ -95,7 +95,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
if(T)
for(var/atom_movable in T.contents) //bypass type checking since only atom/movable can be contained by turfs anyway
var/atom/movable/AM = atom_movable
if(AM) AM.ex_act(dist)
if(AM && AM.simulated) AM.ex_act(dist)
// if(flame_dist && prob(40) && !istype(T, /turf/space) && !T.density)
// PoolOrNew(/obj/effect/hotspot, T) //Mostly for ambience!
if(dist > 0)
@@ -124,7 +124,7 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa
sleep(8)
if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing
//if(!lighting_controller.processing) lighting_controller.processing = lighting_controller_was_processing
if(!powernet_rebuild_was_deferred_already)
if(defer_powernet_rebuild != 2)
defer_powernet_rebuild = 0
+11 -17
View File
@@ -103,7 +103,6 @@
/obj/item/areaeditor/proc/get_area()
var/turf/T = get_turf(usr)
var/area/A = T.loc
A = A.master
return A
@@ -150,7 +149,6 @@
return
var/area/A = new
A.name = str
A.tagbase="[A.type]_[md5(str)]" // without this dynamic light system ruin everithing
//var/ma
//ma = A.master ? "[A.master]" : "(null)"
//world << "DEBUG: create_area: <br>A.name=[A.name]<br>A.tag=[A.tag]<br>A.master=[ma]"
@@ -159,7 +157,6 @@
A.power_environ = 0
A.always_unpowered = 0
move_turfs_to_area(turfs, A)
A.SetDynamicLighting()
interact()
return
@@ -179,8 +176,7 @@
usr << "<span class='warning'>The given name is too long. The area's name is unchanged.</span>"
return
set_area_machinery_title(A,str,prevname)
for(var/area/RA in A.related)
RA.name = str
A.name = str
usr << "<span class='notice'>You rename the '[prevname]' to '[str]'.</span>"
interact()
return
@@ -189,20 +185,18 @@
/obj/item/areaeditor/proc/set_area_machinery_title(var/area/A,var/title,var/oldtitle)
if (!oldtitle) // or replacetext goes to infinite loop
return
for(var/area/RA in A.related)
for(var/obj/machinery/alarm/M in RA)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/power/apc/M in RA)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in RA)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/atmospherics/unary/vent_pump/M in RA)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/door/M in RA)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/alarm/M in A)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/power/apc/M in A)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/atmospherics/unary/vent_scrubber/M in A)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/atmospherics/unary/vent_pump/M in A)
M.name = replacetext(M.name,oldtitle,title)
for(var/obj/machinery/door/M in A)
M.name = replacetext(M.name,oldtitle,title)
//TODO: much much more. Unnamed airlocks, cameras, etc.
/obj/item/areaeditor/proc/check_tile_is_border(var/turf/T2,var/dir)
if (istype(T2, /turf/space))
return BORDER_SPACE //omg hull breach we all going to die here
+2 -15
View File
@@ -48,7 +48,7 @@
//src.damtype = "fire"
for(var/mob/O in viewers(usr, null))
O.show_message(flavor_text, 1)
SetLuminosity(CANDLE_LUM)
set_light(CANDLE_LUM)
processing_objects.Add(src)
@@ -72,17 +72,4 @@
if(lit)
lit = 0
update_icon()
SetLuminosity(0)
user.SetLuminosity(user.luminosity - CANDLE_LUM)
pickup(mob/user)
if(lit)
SetLuminosity(0)
user.SetLuminosity(user.luminosity + CANDLE_LUM)
dropped(mob/user)
if(lit)
user.SetLuminosity(user.luminosity - CANDLE_LUM)
SetLuminosity(CANDLE_LUM)
set_light(0)
+2 -14
View File
@@ -327,16 +327,6 @@ var/global/list/obj/item/device/pda/PDAs = list()
/*
* The Actual PDA
*/
/obj/item/device/pda/pickup(mob/user)
if(fon)
SetLuminosity(0)
user.SetLuminosity(user.luminosity + f_lum)
/obj/item/device/pda/dropped(mob/user)
if(fon)
user.SetLuminosity(user.luminosity - f_lum)
SetLuminosity(f_lum)
/obj/item/device/pda/New()
..()
PDAs += src
@@ -623,12 +613,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
if("Light")
if(fon)
fon = 0
if(src in U.contents) U.SetLuminosity(U.luminosity - f_lum)
else SetLuminosity(0)
set_light(0)
else
fon = 1
if(src in U.contents) U.SetLuminosity(U.luminosity + f_lum)
else SetLuminosity(f_lum)
set_light(f_lum)
if("Medical Scan")
if(scanmode == 1)
scanmode = 0
+5 -24
View File
@@ -17,24 +17,18 @@
..()
if(on)
icon_state = "[initial(icon_state)]-on"
SetLuminosity(brightness_on)
set_light(brightness_on)
else
icon_state = initial(icon_state)
SetLuminosity(0)
set_light(0)
/obj/item/device/flashlight/proc/update_brightness(var/mob/user = null)
if(on)
icon_state = "[initial(icon_state)]-on"
if(loc == user)
user.SetLuminosity(user.luminosity + brightness_on)
else if(isturf(loc))
SetLuminosity(brightness_on)
set_light(brightness_on)
else
icon_state = initial(icon_state)
if(loc == user)
user.SetLuminosity(user.luminosity - brightness_on)
else if(isturf(loc))
SetLuminosity(0)
set_light(0)
/obj/item/device/flashlight/attack_self(mob/user)
if(!isturf(user.loc))
@@ -87,19 +81,6 @@
else
return ..()
/obj/item/device/flashlight/pickup(mob/user)
if(on)
user.SetLuminosity(user.luminosity + brightness_on)
SetLuminosity(0)
/obj/item/device/flashlight/dropped(mob/user)
if(on)
user.SetLuminosity(user.luminosity - brightness_on)
SetLuminosity(brightness_on)
/obj/item/device/flashlight/pen
name = "penlight"
desc = "A pen-sized light, used by medical staff."
@@ -197,7 +178,7 @@
on = 1 //Bio-luminesence has one setting, on.
/obj/item/device/flashlight/slime/New()
SetLuminosity(brightness_on)
set_light(brightness_on)
spawn(1) //Might be sloppy, but seems to be necessary to prevent further runtimes and make these work as intended... don't judge me!
update_brightness()
icon_state = initial(icon_state)
@@ -103,7 +103,7 @@
/obj/item/device/lightreplacer/emag_act(user as mob)
if(!emagged)
Emag()
/obj/item/device/lightreplacer/attack_self(mob/user)
/* // This would probably be a bit OP. If you want it though, uncomment the code.
if(isrobot(user))
@@ -147,7 +147,9 @@
var/obj/item/weapon/light/L1 = new target.light_type(target.loc)
L1.status = target.status
L1.rigged = target.rigged
L1.brightness = target.brightness
L1.brightness_range = target.brightness_range
L1.brightness_power = target.brightness_power
L1.brightness_color = target.brightness_color
L1.switchcount = target.switchcount
target.switchcount = 0
L1.update()
@@ -160,7 +162,9 @@
target.status = L2.status
target.switchcount = L2.switchcount
target.rigged = emagged
target.brightness = L2.brightness
target.brightness_range = L2.brightness_range
target.brightness_power = L2.brightness_power
target.brightness_color = L2.brightness_color
target.on = target.has_power()
target.update()
del(L2)
+4 -4
View File
@@ -53,7 +53,7 @@
for(var/mob/M in viewers(user))
if(M == user) continue
M << "[user] detaches the power sink from the cable."
SetLuminosity(0)
set_light(0)
icon_state = "powersink0"
return
@@ -61,7 +61,7 @@
..()
Destroy()
SetLuminosity(0)
set_light(0)
processing_objects.Remove(src)
// attached.attached = null
attached = null
@@ -93,7 +93,7 @@
if(M == user) continue
M << "[user] deactivates the power sink!"
mode = 1
SetLuminosity(0)
set_light(0)
icon_state = "powersink0"
processing_objects.Remove(src)
@@ -101,7 +101,7 @@
if(attached)
var/datum/powernet/PN = attached.get_powernet()
if(PN)
SetLuminosity(12)
set_light(12)
// found a powernet, so drain up to max power from it
@@ -442,7 +442,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
user.adjustFireLoss(5)
user.visible_message("<span class='notice'>After a few attempts, [user] manages to light the [src], they however burn their finger in the process.</span>")
user.SetLuminosity(user.luminosity + 2)
set_light(2)
processing_objects.Add(src)
else
lit = 0
@@ -455,7 +455,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
else
user.visible_message("<span class='notice'>[user] quietly shuts off the [src].")
user.SetLuminosity(user.luminosity - 2)
set_light(0)
processing_objects.Remove(src)
else
return ..()
@@ -488,19 +488,6 @@ CIGARETTE PACKETS ARE IN FANCY.DM
return
/obj/item/weapon/lighter/pickup(mob/user)
if(lit)
SetLuminosity(0)
user.SetLuminosity(user.luminosity+2)
return
/obj/item/weapon/lighter/dropped(mob/user)
if(lit)
user.SetLuminosity(user.luminosity-2)
SetLuminosity(2)
return
///////////
//ROLLING//
///////////
+2 -2
View File
@@ -65,7 +65,7 @@
do_the_flick()
sleep(4)
density = 0
SetOpacity(0)
set_opacity(0)
update_icon(0)
else
var/srcturf = get_turf(src)
@@ -75,7 +75,7 @@
do_the_flick()
density = 1
sleep(4)
SetOpacity(1)
set_opacity(1)
update_icon()
opening = 0
@@ -179,7 +179,7 @@
/obj/structure/mineral_door/uranium
mineralType = "uranium"
hardness = 3
luminosity = 2
light_range = 2
/obj/structure/mineral_door/sandstone
mineralType = "sandstone"
+5 -7
View File
@@ -62,13 +62,11 @@
//lighting check
var/light_amount = 0
var/turf/T = get_turf(src)
var/area/A = T.loc
if(A)
if(A.lighting_use_dynamic)
light_amount = T.lighting_lumcount
else
light_amount = 10
var/atom/movable/lighting_overlay/LO = locate(/atom/movable/lighting_overlay) in T
if(LO)
light_amount = max(0,min(10,LO.lum_r + LO.lum_g + LO.lum_b)-5)
else
light_amount = 5
if(light_amount > 2)
M << "<span class='warning'>It's too bright here to use [src.name]!</span>"
+51 -1
View File
@@ -467,4 +467,54 @@ var/global/wcColored
desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window."
icon_state = "fwindow"
basestate = "fwindow"
health = 30
health = 30
/obj/structure/window/reinforced/polarized
name = "electrochromic window"
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
var/id
/obj/structure/window/reinforced/polarized/proc/toggle()
if(opacity)
animate(src, color="#FFFFFF", time=5)
set_opacity(0)
else
animate(src, color="#222222", time=5)
set_opacity(1)
/obj/machinery/button/windowtint
name = "window tint control"
icon = 'icons/obj/power.dmi'
icon_state = "light0"
desc = "A remote control switch for polarized windows."
var/range = 7
var/id = 0
var/active = 0
/obj/machinery/button/windowtint/attack_hand(mob/user as mob)
if(..())
return 1
toggle_tint()
/obj/machinery/button/windowtint/proc/toggle_tint()
use_power(5)
active = !active
update_icon()
for(var/obj/structure/window/reinforced/polarized/W in range(src,range))
if (W.id == src.id || !W.id)
spawn(0)
W.toggle()
return
/obj/machinery/button/windowtint/power_change()
..()
if(active && !powered(power_channel))
toggle_tint()
/obj/machinery/button/windowtint/update_icon()
icon_state = "light[active]"
+2 -6
View File
@@ -20,18 +20,14 @@ var/list/mechtoys = list(
/obj/item/toy/prize/phazon
)
/area/supply/station //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS.
/area/supply/station
name = "Supply Shuttle"
icon_state = "shuttle3"
luminosity = 1
lighting_use_dynamic = 0
requires_power = 0
/area/supply/dock //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS.
/area/supply/dock
name = "Supply Shuttle"
icon_state = "shuttle3"
luminosity = 1
lighting_use_dynamic = 0
requires_power = 0
//SUPPLY PACKS MOVED TO /code/defines/obj/supplypacks.dm
+7 -7
View File
@@ -109,19 +109,19 @@ turf/simulated/floor/proc/update_icon()
switch(T.state)
if(0)
icon_state = "light_on"
SetLuminosity(5)
set_light(5)
if(1)
var/num = pick("1","2","3","4")
icon_state = "light_on_flicker[num]"
SetLuminosity(5)
set_light(5)
if(2)
icon_state = "light_on_broken"
SetLuminosity(5)
set_light(5)
if(3)
icon_state = "light_off"
SetLuminosity(0)
set_light(0)
else
SetLuminosity(0)
set_light(0)
icon_state = "light_off"
else if(is_grass_floor())
if(!broken && !burnt)
@@ -338,7 +338,7 @@ turf/simulated/floor/proc/update_icon()
if(!floor_tile) return
del(floor_tile)
icon_plating = "plating"
SetLuminosity(0)
set_light(0)
floor_tile = null
intact = 0
broken = 0
@@ -354,7 +354,7 @@ turf/simulated/floor/proc/update_icon()
broken = 0
burnt = 0
intact = 1
SetLuminosity(0)
set_light(0)
if(T)
if(istype(T,/obj/item/stack/tile/plasteel))
floor_tile = T
+2 -3
View File
@@ -11,7 +11,7 @@
/turf/simulated/floor/light
name = "Light floor"
luminosity = 5
light_range = 5
icon_state = "light_on"
floor_tile = new/obj/item/stack/tile/light
@@ -273,12 +273,11 @@
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
heat_capacity = 700000
lighting_lumcount = 4 //starlight
// accepts_lighting=0 // Don't apply overlays
New()
..()
// Fucking cockshit dickfuck shitslut
set_light(4) //starlight
name = "catwalk"
update_icon(1)
+12
View File
@@ -2,6 +2,7 @@
icon = 'icons/turf/space.dmi'
name = "\proper space"
icon_state = "0"
dynamic_lighting = 0
temperature = TCMB
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
@@ -10,6 +11,17 @@
/turf/space/New()
if(!istype(src, /turf/space/transit))
icon_state = "[((x + y) ^ ~(x * y) + z) % 25]"
if(config)
update_starlight() //MC will initialize all the space turfs that get created before config
/turf/space/proc/update_starlight()
if(!config) return
if(!config.starlight)
return
if(locate(/turf/simulated) in orange(src,1))
set_light(config.starlight)
else
set_light(0)
/turf/space/attack_paw(mob/user as mob)
return src.attack_hand(user)
+16 -10
View File
@@ -28,6 +28,8 @@
var/PathNode/PNode = null //associated PathNode in the A* algorithm
var/dynamic_lighting = 1
/turf/New()
..()
for(var/atom/movable/AM as mob|obj in src)
@@ -226,8 +228,9 @@
/turf/proc/ChangeTurf(var/path)
if(!path) return
if(path == type) return src
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/old_opacity = opacity
var/old_dynamic_lighting = dynamic_lighting
var/list/old_affecting_lights = affecting_lights
if(air_master)
air_master.remove_from_active(src)
@@ -237,18 +240,21 @@
W:Assimilate_Air()
W.RemoveLattice()
W.lighting_lumcount += old_lumcount
if(old_lumcount != W.lighting_lumcount) //light levels of the turf have changed. We need to shift it to another lighting-subarea
W.lighting_changed = 1
lighting_controller.changed_turfs += W
if(old_opacity != W.opacity) //opacity has changed. Need to update surrounding lights
if(W.lighting_lumcount) //unless we're being illuminated, don't bother (may be buggy, hard to test)
W.UpdateAffectingLights()
for(var/turf/space/S in range(W,1))
S.update_starlight()
W.levelupdate()
W.CalculateAdjacentTurfs()
return W
. = W
affecting_lights = old_affecting_lights
if((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting))
reconsider_lights()
if(dynamic_lighting != old_dynamic_lighting)
if(dynamic_lighting)
lighting_build_overlays()
else
lighting_clear_overlays()
//////Assimilate Air//////
/turf/simulated/proc/Assimilate_Air()
+2 -2
View File
@@ -800,9 +800,9 @@ obj/spacepod/verb/toggleLights()
/obj/spacepod/proc/lightsToggle()
lights = !lights
if(lights)
SetLuminosity(luminosity + lights_power)
set_light(luminosity + lights_power)
else
SetLuminosity(luminosity - lights_power)
set_light(luminosity - lights_power)
occupant << "Toggled lights [lights?"on":"off"]."
return
+14 -14
View File
@@ -208,8 +208,8 @@
O.vars[variable]) as num|null
if(new_value == null) return
if(variable=="luminosity")
O.SetLuminosity(new_value)
if(variable=="light_range")
O.set_light(new_value)
else
O.vars[variable] = new_value
@@ -217,24 +217,24 @@
if(istype(O, /mob))
for(var/mob/M in mob_list)
if ( istype(M , O.type) )
if(variable=="luminosity")
M.SetLuminosity(new_value)
if(variable=="light_range")
M.set_light(new_value)
else
M.vars[variable] = O.vars[variable]
else if(istype(O, /obj))
for(var/obj/A in world)
if ( istype(A , O.type) )
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
else if(istype(O, /turf))
for(var/turf/A in world)
if ( istype(A , O.type) )
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
@@ -242,24 +242,24 @@
if(istype(O, /mob))
for(var/mob/M in mob_list)
if (M.type == O.type)
if(variable=="luminosity")
M.SetLuminosity(new_value)
if(variable=="light_range")
M.set_light(new_value)
else
M.vars[variable] = O.vars[variable]
else if(istype(O, /obj))
for(var/obj/A in world)
if (A.type == O.type)
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
else if(istype(O, /turf))
for(var/turf/A in world)
if (A.type == O.type)
if(variable=="luminosity")
A.SetLuminosity(new_value)
if(variable=="light_range")
A.set_light(new_value)
else
A.vars[variable] = O.vars[variable]
+2 -2
View File
@@ -448,10 +448,10 @@ var/list/forbidden_varedit_object_types = list(
O.vars[variable] = var_new
if("num")
if(variable=="luminosity")
if(variable=="light_range")
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new == null) return
O.SetLuminosity(var_new)
O.set_light(var_new)
else if(variable=="stat")
var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num
if(var_new == null) return
+2 -14
View File
@@ -21,20 +21,8 @@
icon_state = "hardhat[on]_[_color]"
item_state = "hardhat[on]_[_color]"
if(on) user.SetLuminosity(user.luminosity + brightness_on)
else user.SetLuminosity(user.luminosity - brightness_on)
pickup(mob/user)
if(on)
user.SetLuminosity(user.luminosity + brightness_on)
// user.UpdateLuminosity() //TODO: Carn
SetLuminosity(0)
dropped(mob/user)
if(on)
user.SetLuminosity(user.luminosity - brightness_on)
// user.UpdateLuminosity()
SetLuminosity(brightness_on)
if(on) set_light(brightness_on)
else set_light(0)
/obj/item/clothing/head/hardhat/orange
@@ -57,22 +57,22 @@
return
on = !on
icon_state = "[base_state][on]"
if(on) user.SetLuminosity(user.luminosity + brightness_on)
else user.SetLuminosity(user.luminosity - brightness_on)
if(on) user.set_light(user.luminosity + brightness_on)
else user.set_light(user.luminosity - brightness_on)
user.update_inv_head()
/obj/item/clothing/head/helmet/space/eva/plasmaman/pickup(mob/user)
if(on)
user.SetLuminosity(user.luminosity + brightness_on)
user.set_light(user.luminosity + brightness_on)
// user.UpdateLuminosity()
SetLuminosity(0)
set_light(0)
/obj/item/clothing/head/helmet/space/eva/plasmaman/dropped(mob/user)
if(on)
user.SetLuminosity(user.luminosity - brightness_on)
user.set_light(user.luminosity - brightness_on)
// user.UpdateLuminosity()
SetLuminosity(brightness_on)
set_light(brightness_on)
+4 -16
View File
@@ -35,25 +35,13 @@
icon_state = "rig[on]-[_color]"
// item_state = "rig[on]-[color]"
if(on) user.SetLuminosity(user.luminosity + brightness_on)
else user.SetLuminosity(user.luminosity - brightness_on)
if(on) set_light(brightness_on)
else set_light(0)
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
H.update_inv_head()
pickup(mob/user)
if(on)
user.SetLuminosity(user.luminosity + brightness_on)
// user.UpdateLuminosity()
SetLuminosity(0)
dropped(mob/user)
if(on)
user.SetLuminosity(user.luminosity - brightness_on)
// user.UpdateLuminosity()
SetLuminosity(brightness_on)
/obj/item/clothing/suit/space/rig
name = "hardsuit"
desc = "A special space suit for environments that might pose hazards beyond just the vacuum of space. Provides more protection than a standard space suit."
@@ -393,7 +381,7 @@
flags = HEADCOVERSEYES | BLOCKHAIR | HEADCOVERSMOUTH | STOPSPRESSUREDMAGE | THICKMATERIAL
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
cold_protection = HEAD
user.AddLuminosity(brightness_on)
set_light(brightness_on)
else
user << "<span class='notice'>You switch your helmet to combat mode.</span>"
name = "blood-red hardsuit helmet (combat)"
@@ -401,7 +389,7 @@
flags = BLOCKHAIR
flags_inv = HIDEEARS
cold_protection = null
user.AddLuminosity(-brightness_on)
set_light(0)
update_icon()
playsound(src.loc, 'sound/mecha/mechmove03.ogg', 50, 1)

Some files were not shown because too many files have changed in this diff Show More