mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge branch 'master' of https://github.com/PolarisSS13/Polaris into dice_thing
This commit is contained in:
@@ -4,3 +4,48 @@
|
||||
for(type in view(range, dview_mob))
|
||||
|
||||
#define END_FOR_DVIEW dview_mob.loc = null
|
||||
|
||||
#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
|
||||
#define LIGHTING_LAMBERTIAN 0 // use lambertian shading for light sources
|
||||
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
|
||||
|
||||
#define LIGHTING_LAYER 10 // drawing layer for lighting overlays
|
||||
#define LIGHTING_ICON 'icons/effects/lighting_overlay.dmi' // icon used for lighting shading effects
|
||||
#define LIGHTING_ICON_STATE_DARK "soft_dark" // Change between "soft_dark" and "dark" to swap soft darkvision
|
||||
|
||||
#define LIGHTING_ROUND_VALUE (1 / 64) // Value used to round lumcounts, values smaller than 1/69 don't matter (if they do, thanks sinking points), greater values will make lighting less precise, but in turn increase performance, VERY SLIGHTLY.
|
||||
|
||||
#define LIGHTING_SOFT_THRESHOLD 0.05 // If the max of the lighting lumcounts of each spectrum drops below this, disable luminosity on the lighting overlays. This also should be the transparancy of the "soft_dark" icon state.
|
||||
|
||||
// If I were you I'd leave this alone.
|
||||
#define LIGHTING_BASE_MATRIX \
|
||||
list \
|
||||
( \
|
||||
LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, 0, \
|
||||
LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, 0, \
|
||||
LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, 0, \
|
||||
LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, LIGHTING_SOFT_THRESHOLD, 0, \
|
||||
0, 0, 0, 1 \
|
||||
) \
|
||||
|
||||
// Helpers so we can (more easily) control the colour matrices.
|
||||
#define CL_MATRIX_RR 1
|
||||
#define CL_MATRIX_RG 2
|
||||
#define CL_MATRIX_RB 3
|
||||
#define CL_MATRIX_RA 4
|
||||
#define CL_MATRIX_GR 5
|
||||
#define CL_MATRIX_GG 6
|
||||
#define CL_MATRIX_GB 7
|
||||
#define CL_MATRIX_GA 8
|
||||
#define CL_MATRIX_BR 9
|
||||
#define CL_MATRIX_BG 10
|
||||
#define CL_MATRIX_BB 11
|
||||
#define CL_MATRIX_BA 12
|
||||
#define CL_MATRIX_AR 13
|
||||
#define CL_MATRIX_AG 14
|
||||
#define CL_MATRIX_AB 15
|
||||
#define CL_MATRIX_AA 16
|
||||
#define CL_MATRIX_CR 17
|
||||
#define CL_MATRIX_CG 18
|
||||
#define CL_MATRIX_CB 19
|
||||
#define CL_MATRIX_CA 20
|
||||
|
||||
@@ -952,7 +952,7 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0)
|
||||
|
||||
// var/area/AR = X.loc
|
||||
|
||||
// if(AR.lighting_use_dynamic)
|
||||
// if(AR.dynamic_lighting)
|
||||
// X.opacity = !X.opacity
|
||||
// X.sd_SetOpacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn
|
||||
|
||||
|
||||
@@ -162,6 +162,12 @@
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
/obj/screen/zone_sel/proc/set_selected_zone(bodypart)
|
||||
var/old_selecting = selecting
|
||||
selecting = bodypart
|
||||
if(old_selecting != selecting)
|
||||
update_icon()
|
||||
|
||||
/obj/screen/zone_sel/update_icon()
|
||||
overlays.Cut()
|
||||
overlays += image('icons/mob/zone_sel.dmi', "[selecting]")
|
||||
|
||||
98
code/controllers/Processes/lighting.dm
Normal file
98
code/controllers/Processes/lighting.dm
Normal file
@@ -0,0 +1,98 @@
|
||||
/var/lighting_overlays_initialised = FALSE
|
||||
|
||||
/var/list/lighting_update_lights = list() // List of lighting sources queued for update.
|
||||
/var/list/lighting_update_corners = list() // List of lighting corners queued for update.
|
||||
/var/list/lighting_update_overlays = list() // List of lighting overlays queued for update.
|
||||
|
||||
/var/list/lighting_update_lights_old = list() // List of lighting sources currently being updated.
|
||||
/var/list/lighting_update_corners_old = list() // List of lighting corners currently being updated.
|
||||
/var/list/lighting_update_overlays_old = list() // List of lighting overlays currently being updated.
|
||||
|
||||
|
||||
/datum/controller/process/lighting
|
||||
// Queues of update counts, waiting to be rolled into stats lists
|
||||
var/list/stats_queues = list(
|
||||
"Source" = list(), "Corner" = list(), "Overlay" = list())
|
||||
// Stats lists
|
||||
var/list/stats_lists = list(
|
||||
"Source" = list(), "Corner" = list(), "Overlay" = list())
|
||||
var/update_stats_every = (1 SECONDS)
|
||||
var/next_stats_update = 0
|
||||
var/stat_updates_to_keep = 5
|
||||
|
||||
/datum/controller/process/lighting/setup()
|
||||
name = "lighting"
|
||||
|
||||
schedule_interval = 0 // run as fast as you possibly can
|
||||
sleep_interval = 10 // Yield every 10% of a tick
|
||||
defer_usage = 80 // Defer at 80% of a tick
|
||||
create_all_lighting_overlays()
|
||||
lighting_overlays_initialised = TRUE
|
||||
|
||||
// Pre-process lighting once before the round starts. Wait 30 seconds so the away mission has time to load.
|
||||
spawn(300)
|
||||
doWork(1)
|
||||
|
||||
/datum/controller/process/lighting/doWork(roundstart)
|
||||
|
||||
lighting_update_lights_old = lighting_update_lights //We use a different list so any additions to the update lists during a delay from scheck() don't cause things to be cut from the list without being updated.
|
||||
lighting_update_lights = list()
|
||||
for(var/datum/light_source/L in lighting_update_lights_old)
|
||||
|
||||
if(L.check() || L.destroyed || L.force_update)
|
||||
L.remove_lum()
|
||||
if(!L.destroyed)
|
||||
L.apply_lum()
|
||||
|
||||
else if(L.vis_update) //We smartly update only tiles that became (in) visible to use.
|
||||
L.smart_vis_update()
|
||||
|
||||
L.vis_update = FALSE
|
||||
L.force_update = FALSE
|
||||
L.needs_update = FALSE
|
||||
|
||||
SCHECK
|
||||
|
||||
lighting_update_corners_old = lighting_update_corners //Same as above.
|
||||
lighting_update_corners = list()
|
||||
for(var/A in lighting_update_corners_old)
|
||||
var/datum/lighting_corner/C = A
|
||||
|
||||
C.update_overlays()
|
||||
|
||||
C.needs_update = FALSE
|
||||
|
||||
SCHECK
|
||||
|
||||
lighting_update_overlays_old = lighting_update_overlays //Same as above.
|
||||
lighting_update_overlays = list()
|
||||
|
||||
for(var/A in lighting_update_overlays_old)
|
||||
var/atom/movable/lighting_overlay/O = A
|
||||
O.update_overlay()
|
||||
O.needs_update = 0
|
||||
SCHECK
|
||||
|
||||
stats_queues["Source"] += lighting_update_lights_old.len
|
||||
stats_queues["Corner"] += lighting_update_corners_old.len
|
||||
stats_queues["Overlay"] += lighting_update_overlays_old.len
|
||||
|
||||
if(next_stats_update <= world.time)
|
||||
next_stats_update = world.time + update_stats_every
|
||||
for(var/stat_name in stats_queues)
|
||||
var/stat_sum = 0
|
||||
var/list/stats_queue = stats_queues[stat_name]
|
||||
for(var/count in stats_queue)
|
||||
stat_sum += count
|
||||
stats_queue.Cut()
|
||||
|
||||
var/list/stats_list = stats_lists[stat_name]
|
||||
stats_list.Insert(1, stat_sum)
|
||||
if(stats_list.len > stat_updates_to_keep)
|
||||
stats_list.Cut(stats_list.len)
|
||||
|
||||
/datum/controller/process/lighting/statProcess()
|
||||
..()
|
||||
stat(null, "[total_lighting_sources] sources, [total_lighting_corners] corners, [total_lighting_overlays] overlays")
|
||||
for(var/stat_type in stats_lists)
|
||||
stat(null, "[stat_type] updates: [jointext(stats_lists[stat_type], " | ")]")
|
||||
@@ -1,11 +1,16 @@
|
||||
var/datum/controller/process/planet/planet_controller = null
|
||||
|
||||
/datum/controller/process/planet
|
||||
var/list/planets = list()
|
||||
|
||||
/datum/controller/process/planet/setup()
|
||||
name = "planet"
|
||||
planet_controller = src
|
||||
schedule_interval = 600 // every minute
|
||||
planet_sif = new()
|
||||
planets.Add(planet_sif)
|
||||
var/list/planet_datums = typesof(/datum/planet) - /datum/planet
|
||||
for(var/P in planet_datums)
|
||||
var/datum/planet/NP = new P()
|
||||
planets.Add(NP)
|
||||
|
||||
/datum/controller/process/planet/doWork()
|
||||
for(var/datum/planet/P in planets)
|
||||
|
||||
@@ -100,7 +100,7 @@ var/list/ghostteleportlocs = list()
|
||||
icon_state = "space"
|
||||
requires_power = 1
|
||||
always_unpowered = 1
|
||||
lighting_use_dynamic = 1
|
||||
dynamic_lighting = 1
|
||||
power_light = 0
|
||||
power_equip = 0
|
||||
power_environ = 0
|
||||
@@ -293,7 +293,7 @@ area/space/atmosalert()
|
||||
/area/shuttle/mining
|
||||
name = "\improper Mining Elevator"
|
||||
music = "music/escape.ogg"
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
base_turf = /turf/simulated/mineral/floor/ignore_mapgen
|
||||
|
||||
/area/shuttle/mining/station
|
||||
@@ -392,7 +392,7 @@ area/space/atmosalert()
|
||||
/area/shuttle/research
|
||||
name = "\improper Research Elevator"
|
||||
music = "music/escape.ogg"
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
base_turf = /turf/simulated/mineral/floor/ignore_mapgen
|
||||
|
||||
/area/shuttle/research/station
|
||||
@@ -418,7 +418,7 @@ area/space/atmosalert()
|
||||
name = "\improper CentCom"
|
||||
icon_state = "centcom"
|
||||
requires_power = 0
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/centcom/control
|
||||
name = "\improper CentCom Control"
|
||||
@@ -491,7 +491,7 @@ area/space/atmosalert()
|
||||
name = "\improper Mercenary Base"
|
||||
icon_state = "syndie-ship"
|
||||
requires_power = 0
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/syndicate_mothership/control
|
||||
name = "\improper Mercenary Control Room"
|
||||
@@ -543,7 +543,7 @@ area/space/atmosalert()
|
||||
name = "\improper Thunderdome"
|
||||
icon_state = "thunder"
|
||||
requires_power = 0
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
sound_env = ARENA
|
||||
|
||||
/area/tdome/tdome1
|
||||
@@ -624,7 +624,7 @@ area/space/atmosalert()
|
||||
name = "\improper Wizard's Den"
|
||||
icon_state = "yellow"
|
||||
requires_power = 0
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/skipjack_station
|
||||
name = "\improper Skipjack"
|
||||
@@ -1485,7 +1485,7 @@ area/space/atmosalert()
|
||||
/area/holodeck
|
||||
name = "\improper Holodeck"
|
||||
icon_state = "Holodeck"
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
sound_env = LARGE_ENCLOSED
|
||||
|
||||
/area/holodeck/alphadeck
|
||||
@@ -1638,7 +1638,7 @@ area/space/atmosalert()
|
||||
/area/solar
|
||||
requires_power = 1
|
||||
always_unpowered = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
base_turf = /turf/space
|
||||
|
||||
auxport
|
||||
@@ -2336,7 +2336,7 @@ area/space/atmosalert()
|
||||
/area/shuttle/constructionsite
|
||||
name = "\improper Construction Site Shuttle"
|
||||
icon_state = "yellow"
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
base_turf = /turf/simulated/mineral/floor/ignore_mapgen
|
||||
|
||||
/area/shuttle/constructionsite/station
|
||||
@@ -2493,25 +2493,25 @@ area/space/atmosalert()
|
||||
name = "\improper AI Sat Ext"
|
||||
icon_state = "storage"
|
||||
luminosity = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/AIsatextFS
|
||||
name = "\improper AI Sat Ext"
|
||||
icon_state = "storage"
|
||||
luminosity = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/AIsatextAS
|
||||
name = "\improper AI Sat Ext"
|
||||
icon_state = "storage"
|
||||
luminosity = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/AIsatextAP
|
||||
name = "\improper AI Sat Ext"
|
||||
icon_state = "storage"
|
||||
luminosity = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
/area/NewAIMain
|
||||
name = "\improper AI Main New"
|
||||
@@ -2685,7 +2685,7 @@ area/space/atmosalert()
|
||||
name = "Beach"
|
||||
icon_state = "null"
|
||||
luminosity = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
requires_power = 0
|
||||
ambience = list()
|
||||
var/sound/mysound = null
|
||||
@@ -2807,7 +2807,7 @@ var/list/the_station_areas = list (
|
||||
name = "Keelin's private beach"
|
||||
icon_state = "null"
|
||||
luminosity = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
requires_power = 0
|
||||
var/sound/mysound = null
|
||||
/*
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
power_equip = 0
|
||||
power_environ = 0
|
||||
|
||||
if(lighting_use_dynamic)
|
||||
if(dynamic_lighting)
|
||||
luminosity = 0
|
||||
else
|
||||
luminosity = 1
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
/area/outpost/engineering/solarsoutside
|
||||
requires_power = 1
|
||||
always_unpowered = 1
|
||||
lighting_use_dynamic = 0
|
||||
dynamic_lighting = 0
|
||||
|
||||
aft
|
||||
name = "\improper Engineering Outpost Solar Array"
|
||||
|
||||
@@ -40,7 +40,13 @@
|
||||
reagents = null
|
||||
for(var/atom/movable/AM in contents)
|
||||
qdel(AM)
|
||||
var/turf/un_opaque
|
||||
if(opacity && isturf(loc))
|
||||
un_opaque = loc
|
||||
|
||||
loc = null
|
||||
if(un_opaque)
|
||||
un_opaque.recalc_atom_opacity()
|
||||
if (pulledby)
|
||||
if (pulledby.pulling == src)
|
||||
pulledby.pulling = null
|
||||
|
||||
@@ -62,7 +62,7 @@ In short:
|
||||
|
||||
/datum/universal_state/hell/OverlayAndAmbientSet()
|
||||
spawn(0)
|
||||
for(var/atom/movable/lighting_overlay/L in world)
|
||||
for(var/datum/lighting_corner/L in world)
|
||||
L.update_lumcount(1, 0, 0)
|
||||
|
||||
for(var/turf/space/T in turfs)
|
||||
|
||||
@@ -93,7 +93,7 @@ The access requirements on the Asteroid Shuttles' consoles have now been revoked
|
||||
|
||||
/datum/universal_state/supermatter_cascade/OverlayAndAmbientSet()
|
||||
spawn(0)
|
||||
for(var/atom/movable/lighting_overlay/L in world)
|
||||
for(var/datum/lighting_corner/L in world)
|
||||
if(L.z in using_map.admin_levels)
|
||||
L.update_lumcount(1,1,1)
|
||||
else
|
||||
|
||||
@@ -83,11 +83,8 @@
|
||||
continue
|
||||
|
||||
if(!true_sight)
|
||||
var/atom/movable/lighting_overlay/light = locate(/atom/movable/lighting_overlay) in get_turf(L)
|
||||
var/light_amount = 1 // Unsimulated tiles are pretend-lit, so we need to be pretend too if that somehow happens.
|
||||
if(light)
|
||||
light_amount = (light.lum_r + light.lum_g + light.lum_b) / 3
|
||||
|
||||
var/turf/T = get_turf(L)
|
||||
var/light_amount = T.get_lumcount()
|
||||
if(light_amount <= 0.5)
|
||||
continue // Too dark to see.
|
||||
|
||||
|
||||
@@ -162,9 +162,9 @@
|
||||
smoke.pixel_x = -32 + rand(-8, 8)
|
||||
smoke.pixel_y = -32 + rand(-8, 8)
|
||||
walk_to(smoke, T)
|
||||
smoke.opacity = 1 //switching opacity on after the smoke has spawned, and then
|
||||
smoke.set_opacity(1) //switching opacity on after the smoke has spawned, and then
|
||||
sleep(150+rand(0,20)) // turning it off before it is deleted results in cleaner
|
||||
smoke.opacity = 0 // lighting and view range updates
|
||||
smoke.set_opacity(0) // lighting and view range updates
|
||||
fadeOut(smoke)
|
||||
qdel(src)
|
||||
|
||||
|
||||
@@ -1113,10 +1113,10 @@
|
||||
"}
|
||||
|
||||
/obj/item/weapon/book/manual/evaguide
|
||||
name = "EVA Gear and You: Not Spending All Day Inside"
|
||||
name = "EVA Gear and You: Not Spending All Day Inside, 2nd Edition"
|
||||
icon_state = "evabook"
|
||||
author = "Maria Crash, Senior Atmospherics Technician"
|
||||
title = "EVA Gear and You: Not Spending All Day Inside"
|
||||
title = "EVA Gear and You: Not Spending All Day Inside, 2nd Edition"
|
||||
dat = {"<html>
|
||||
<head>
|
||||
<style>
|
||||
@@ -1130,27 +1130,32 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1><a name="Foreword">EVA Gear and You: Not Spending All Day Inside</a></h1>
|
||||
<h1><a name="Foreword">EVA Gear and You: Not Spending All Day Inside, 2nd Edition</a></h1>
|
||||
<I>Or: How not to suffocate because there's a hole in your shoes</I><BR>
|
||||
|
||||
<h2><a name="Contents">Contents</a></h2>
|
||||
<ol>
|
||||
<li><a href="#Foreword">A foreword on using EVA gear</a></li>
|
||||
<li><a href="#Civilian">Donning a Civilian Suit</a></li>
|
||||
<li><a href="#Hardsuit">Putting on a Hardsuit</a></li>
|
||||
<li><a href="#Softsuits">Use of Softsuits</a></li>
|
||||
<li><a href="#Voidsuits">Putting on a Voidsuit</a></li>
|
||||
<li><a href="#Hardsuits">Operation of Hardsuits</a></li>
|
||||
<li><a href="#Equipment">Cyclers and Other Modification Equipment</a></li>
|
||||
<li><a href="#Advice">Miscellaneous Advice</a></li>
|
||||
<li><a href="#Final">Final Checks</a></li>
|
||||
</ol>
|
||||
<br>
|
||||
|
||||
EVA gear. Wonderful to use. It's useful for mining, engineering, and occasionally just surviving, if things are that bad. Most people have EVA training,
|
||||
but apparently there are some on a space station who don't. This guide should give you a basic idea of how to use this gear, safely. It's split into two sections:
|
||||
Civilian suits and hardsuits.<BR><BR>
|
||||
but apparently there are some on a space station who don't. This guide should give you a basic idea of how to use this gear, safely. It's split into three main sections:
|
||||
softsuits, voidsuits, and hardsuits. General advice and instructions for modification are present as well.<BR><BR>
|
||||
|
||||
<h2><a name="Civilian">Civilian Suits</a></h2>
|
||||
One important point for synthetics and people using full-body prosthetics: You obviously don't need oxygen, but you do run the risk of overheating in vacuum.
|
||||
Rather than oxygen, use a suit cooling unit. Many emergency equipment stores don't hold them, unfortunately, but dedicated EVA stores will. Be aware of your heat tolerances.<BR><BR>
|
||||
|
||||
<h2><a name="Softsuits">Softsuits and Emergency Equipment</a></h2>
|
||||
<I>The bulkiest things this side of Alpha Centauri</I><BR>
|
||||
These suits are the grey ones that are stored in EVA. They're the more simple to get on, but are also a lot bulkier, and provide less protection from environmental hazards such as radiation or physical impact.
|
||||
As Medical, Engineering, Security, and Mining all have hardsuits of their own, these don't see much use, but knowing how to put them on is quite useful anyways.<BR><BR>
|
||||
These suits are the both grey ones that are stored in EVA and orange emergency suits in emergency lockers. They're the more simple to get on, but are also a lot bulkier, and provide less protection from environmental hazards such as radiation or physical impact.
|
||||
As Medical, Engineering, Security, and Mining all have voidsuits of their own, these don't see much use outside of emergencies. In an emergency, knowing how to put one on can save your life.<BR><BR>
|
||||
|
||||
First, take the suit. It should be in three pieces: A top, a bottom, and a helmet. Put the bottom on first, shoes and the like will fit in it. If you have magnetic boots, however,
|
||||
put them on on top of the suit's feet. Next, get the top on, as you would a shirt. It can be somewhat awkward putting these pieces on, due to the makeup of the suit,
|
||||
@@ -1160,35 +1165,68 @@
|
||||
There is a small slot on the side of the suit where an emergency oxygen tank or extended emergency oxygen tank will fit,
|
||||
but it is recommended to have a full-sized tank on your back for EVA.<BR><BR>
|
||||
|
||||
Important note: When using these, especially in emergencies, be aware of your surroundings! These suits can tear or breach more easily than any other type, especially in an environment with broken glass and metal everywhere.
|
||||
If your suit is breached, you will be in deep trouble. Pressure issues can inhibit breathing even with internals.<BR><BR>
|
||||
|
||||
These suits tend to be wearable by most species. They're large and flexible. They might be pretty uncomfortable for some, though, so keep that in mind.<BR><BR>
|
||||
|
||||
<h2><a name="Hardsuit">Hardsuits</a></h2>
|
||||
<h2><a name="Voidsuits">Voidsuits</a></h2>
|
||||
<I>Heavy, uncomfortable, still the best option.</I><BR>
|
||||
These suits come in Engineering, Mining, and the Armory. There's also a couple Medical Hardsuits in EVA. These provide a lot more protection than the standard suits.<BR><BR>
|
||||
These suits come in many specialized varieties. The most common are engineering, atmospherics, security, medical, and mining varieties.
|
||||
These provide a lot more protection than the standard suits, and depending on the specialization, can offer different protections.
|
||||
For example, security suits have armor plating, engineering suits have radiation protection, and atmospherics suits are rated for extremely high temperatures.<BR><BR>
|
||||
|
||||
Similarly to the other suits, these are split into three parts. Fastening the pant and top are mostly the same as the other spacesuits, with the exception that these are a bit heavier,
|
||||
Similarly to the softsuits, these are split into three parts. Fastening the pant and top are mostly the same as the softsuits, with the exception that these are a bit heavier,
|
||||
though not as bulky. The helmet goes on differently, with the air tube feeding into the suit and out a hole near the left shoulder, while the helmet goes on turned ninety degrees counter-clockwise,
|
||||
and then is screwed in for one and a quarter full rotations clockwise, leaving the faceplate directly in front of you. There is a small button on the right side of the helmet that activates the helmet light.
|
||||
and then is turned to face the front and sealed. There is a small button on the right side of the helmet that activates the helmet light.
|
||||
The tanks that fasten onto the side slot are emergency tanks, as well as full-sized oxygen tanks, leaving your back free for a backpack or satchel.<BR><BR>
|
||||
|
||||
These suits generally only fit one species. NanoTrasen's are usually human-fitting by default, but there's equipment that can make modifications to the hardsuits to fit them to other species.<BR><BR>
|
||||
|
||||
Later-model voidsuits can have magboots and helmets installed into the suit and deployed when needed. Check the operator's manual for individual suits to see how the helmets are installed.
|
||||
If a helmet is installed, you can skip it while putting the suit on, obviously. When deployed, it will deploy from the back of your neck, covering the head and sealing at the front.<BR><BR>
|
||||
|
||||
<h2><a name="Hardsuits">Hardsuits/Rigs</a></h2>
|
||||
<I>The fancy stuff.</I><BR>
|
||||
Proper hardsuits are the most complex sort of EVA equipment available, and blur the line between spacesuits and smaller exosuits. They're sometimes known as 'rigs' or 'powered armor'.
|
||||
These are the suits with the widest variety of uses, owing to the wide variety of equipment that can be installed on them. Like voidsuits, they come in different, specialized varieties, each one offering different protections and different equipment.
|
||||
Equipment that can be installed includes weapons, power tools, mining equipment, medical equipment, AI assistants, and more.<BR><BR>
|
||||
|
||||
Putting these on is relatively simple. They come as compact packs, worn like a backpack and secured with a harness. Activating them, though, is a more complex process. The suit deploys from the module similarly to helmets deploying from voidsuits.
|
||||
After it covers the whole body, the suit can be started. The startup sequence takes some time. The suit will automatically fit itself to your body, sealing each section individually - boots, gloves, pants, torso, and helmet - then connecting them.<BR><BR>
|
||||
|
||||
Operating a hardsuit is a much more complicated proposal than operating other EVA equipment. While putting them on is relatively simple, and operating basic functions like oxygen and magboots is the same as other suits, the rest is far more complex.
|
||||
Consult the operator's manual for invidual pieces of equipment that you plan to use. Use of these for heavy work is only reccomended for people who have specialized training and extensive EVA experience.
|
||||
The potential of a suit breach is always there, and the use of powered equipment raises it significantly.<BR><BR>
|
||||
|
||||
<h2><a name="Advice">Miscellaneous Advice</a></h2>
|
||||
<I>Pro tip: Safety first.</I><BR>
|
||||
There's a lot of general advice that can be helpful for people who haven't taken a long-form instruction course. Much of this is going to be fairly obvious safety advice, but it's never bad to remind yourself of that.<BR><BR>
|
||||
|
||||
<ul>
|
||||
<li>Magboots are important. They can be the difference between keeping your footing and needing a rescue team. A tie-off or a jetpack can substitute if necessary.</li>
|
||||
<li>Be aware of breach hazards, especially in softsuits. Loss of suit pressure can be a fatal disaster.</li>
|
||||
<li>Keep an eye on your internals. Having to make two trips outside is better than running out of air.</li>
|
||||
<li>Similarly, keep an eye on the battery status of cooling units and other equipment.</li>
|
||||
<li>In vacuum, sound doesn't carry. Use a radio or sign language for communication.</li><BR><BR>
|
||||
</ul>
|
||||
|
||||
<h2><a name="Equipment">Modification Equipment</a></h2>
|
||||
<I>How to actually make hardsuits fit you.</I><BR>
|
||||
<I>How to actually make voidsuits fit you.</I><BR>
|
||||
There's a variety of equipment that can modify hardsuits to fit species that can't fit into them, making life quite a bit easier.<BR><BR>
|
||||
|
||||
The first piece of equipment is a suit cycler. This is a large machine resembling the storage pods that are in place in some places. These are machines that will automatically tailor a suit to certain specifications.
|
||||
The largest uses of them are for their cleaning functions and their ability to tailor suits for a species. Do not enter them physically. You will die from any of the functions being activated, and it will be painful.
|
||||
The largest uses of them are for their cleaning functions and their ability to tailor suits for a species. Do not enter them physically. You will die from any of the functions being activated, and it will hurt the whole time you're dying.
|
||||
These machines can both tailor a suit between species, and between types. This means you can convert engineering hardsuits to atmospherics, or the other way. This is useful. Use it if you can.<BR><BR>
|
||||
|
||||
There's also modification kits that let you modify suits yourself. These are extremely difficult to use unless you understand the actual construction of the suit. I do not reccomend using them unless no other option is available.
|
||||
There's also modification kits that let you modify suits yourself. These are extremely difficult to use unless you understand the actual construction of the suit. I do not reccomend using them unless no other option is available.<BR><BR>
|
||||
|
||||
<h2><a name="Final">Final Checks</a></h2>
|
||||
<ul>
|
||||
<li>Are all seals fastened correctly?</li>
|
||||
<li>If you have modified it manually, is absolutely everything sealed perfectly?</li>
|
||||
<li>Do you either have shoes on under the suit, or magnetic boots on over it?</li>
|
||||
<li>Do you have a mask on and internals on the suit or your back?</li>
|
||||
<li>Do you have internals connected and activated?</li>
|
||||
<li>Do you have a way to communicate with the station in case something goes wrong?</li>
|
||||
<li>Do you have a second person watching if this is a training session?</li><BR>
|
||||
</ul>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
..()
|
||||
|
||||
/obj/structure/curtain/proc/toggle()
|
||||
opacity = !opacity
|
||||
set_opacity(!opacity)
|
||||
if(opacity)
|
||||
icon_state = "closed"
|
||||
layer = SHOWER_CLOSED_LAYER
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
name = "[material.display_name] door"
|
||||
color = material.icon_colour
|
||||
if(material.opacity < 0.5)
|
||||
opacity = 0
|
||||
set_opacity(0)
|
||||
else
|
||||
opacity = 1
|
||||
set_opacity(1)
|
||||
if(material.products_need_process())
|
||||
processing_objects |= src
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
@@ -99,7 +99,7 @@
|
||||
flick("[material.door_icon_base]opening",src)
|
||||
sleep(10)
|
||||
density = 0
|
||||
opacity = 0
|
||||
set_opacity(0)
|
||||
state = 1
|
||||
update_icon()
|
||||
isSwitchingStates = 0
|
||||
@@ -111,7 +111,7 @@
|
||||
flick("[material.door_icon_base]closing",src)
|
||||
sleep(10)
|
||||
density = 1
|
||||
opacity = 1
|
||||
set_opacity(1)
|
||||
state = 0
|
||||
update_icon()
|
||||
isSwitchingStates = 0
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
update_icon()
|
||||
set_light(0)
|
||||
src.blocks_air = 0
|
||||
src.opacity = 0
|
||||
set_opacity(0)
|
||||
for(var/turf/simulated/turf in loc)
|
||||
air_master.mark_for_update(turf)
|
||||
else
|
||||
@@ -21,7 +21,7 @@
|
||||
update_icon()
|
||||
set_light(1)
|
||||
src.blocks_air = 1
|
||||
src.opacity = 1
|
||||
set_opacity(1)
|
||||
for(var/turf/simulated/turf in loc)
|
||||
air_master.mark_for_update(turf)
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
var/icon_old = null
|
||||
var/pathweight = 1 // How much does it cost to pathfind over this turf?
|
||||
var/blessed = 0 // Has the turf been blessed?
|
||||
var/dynamic_lighting = 1 // Does the turf use dynamic lighting?
|
||||
|
||||
var/list/decals
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
var/obj/fire/old_fire = fire
|
||||
var/old_opacity = opacity
|
||||
var/old_dynamic_lighting = dynamic_lighting
|
||||
var/list/old_affecting_lights = affecting_lights
|
||||
var/old_affecting_lights = affecting_lights
|
||||
var/old_lighting_overlay = lighting_overlay
|
||||
var/old_weather_overlay = weather_overlay
|
||||
var/old_corners = corners
|
||||
|
||||
//world << "Replacing [src.type] with [N]"
|
||||
|
||||
@@ -94,15 +95,16 @@
|
||||
W.post_change()
|
||||
. = W
|
||||
|
||||
lighting_overlay = old_lighting_overlay
|
||||
affecting_lights = old_affecting_lights
|
||||
if((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting) || force_lighting_update)
|
||||
reconsider_lights()
|
||||
if(dynamic_lighting != old_dynamic_lighting)
|
||||
if(dynamic_lighting)
|
||||
lighting_build_overlays()
|
||||
else
|
||||
lighting_clear_overlays()
|
||||
else
|
||||
if(lighting_overlay)
|
||||
lighting_overlay.update_overlay()
|
||||
recalc_atom_opacity()
|
||||
|
||||
if(lighting_overlays_initialised)
|
||||
lighting_overlay = old_lighting_overlay
|
||||
affecting_lights = old_affecting_lights
|
||||
corners = old_corners
|
||||
if((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting))
|
||||
reconsider_lights()
|
||||
if(dynamic_lighting != old_dynamic_lighting)
|
||||
if(dynamic_lighting)
|
||||
lighting_build_overlay()
|
||||
else
|
||||
lighting_clear_overlay()
|
||||
|
||||
@@ -977,7 +977,7 @@
|
||||
if(!check_rights(R_DEBUG))
|
||||
return
|
||||
|
||||
var/datum/planet/planet = input(usr, "Which planet do you want to modify the weather on?", "Change Weather") in list(planet_sif)
|
||||
var/datum/planet/planet = input(usr, "Which planet do you want to modify the weather on?", "Change Weather") in planet_controller.planets
|
||||
var/datum/weather/new_weather = input(usr, "What weather do you want to change to?", "Change Weather") as null|anything in planet.weather_holder.allowed_weather_types
|
||||
if(new_weather)
|
||||
planet.weather_holder.change_weather(new_weather)
|
||||
@@ -993,7 +993,7 @@
|
||||
if(!check_rights(R_DEBUG))
|
||||
return
|
||||
|
||||
var/datum/planet/planet = input(usr, "Which planet do you want to modify time on?", "Change Time") in list(planet_sif)
|
||||
var/datum/planet/planet = input(usr, "Which planet do you want to modify time on?", "Change Time") in planet_controller.planets
|
||||
|
||||
var/datum/time/current_time_datum = planet.current_time
|
||||
var/new_hour = input(usr, "What hour do you want to change to?", "Change Time", text2num(current_time_datum.show_time("hh"))) as null|num
|
||||
|
||||
@@ -296,11 +296,7 @@
|
||||
|
||||
// Handle light requirements.
|
||||
if(!light_supplied)
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in current_turf
|
||||
if(L)
|
||||
light_supplied = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
|
||||
else
|
||||
light_supplied = 5
|
||||
light_supplied = current_turf.get_lumcount() * 5
|
||||
if(light_supplied)
|
||||
if(abs(light_supplied - get_trait(TRAIT_IDEAL_LIGHT)) > get_trait(TRAIT_LIGHT_TOLERANCE))
|
||||
health_change += rand(1,3) * HYDRO_SPEED_MULTIPLIER
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
|
||||
if(growth>2 && growth == max_growth)
|
||||
layer = 5
|
||||
opacity = 1
|
||||
set_opacity(1)
|
||||
if(!isnull(seed.chems["woodpulp"]))
|
||||
density = 1
|
||||
else
|
||||
|
||||
@@ -625,12 +625,7 @@
|
||||
if(closed_system && mechanical)
|
||||
light_string = "that the internal lights are set to [tray_light] lumens"
|
||||
else
|
||||
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
|
||||
var/light_available = T.get_lumcount() * 5
|
||||
light_string = "a light level of [light_available] lumens"
|
||||
|
||||
usr << "The tray's sensor suite is reporting [light_string] and a temperature of [environment.temperature]K at [environment.return_pressure()] kPa in the [environment_type] environment"
|
||||
|
||||
@@ -21,11 +21,8 @@
|
||||
var/max_power = 1
|
||||
|
||||
/obj/item/integrated_circuit/passive/power/solar_cell/make_energy()
|
||||
var/atom/movable/lighting_overlay/light = locate(/atom/movable/lighting_overlay) in get_turf(src)
|
||||
var/light_amount = 1 // Unsimulated tiles are pretend-lit, so we need to be pretend too if that somehow happens.
|
||||
if(light)
|
||||
light_amount = (light.lum_r + light.lum_g + light.lum_b) / 3
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
var/light_amount = T ? T.get_lumcount() : 0
|
||||
var/adjusted_power = max(max_power * light_amount, 0)
|
||||
adjusted_power = round(adjusted_power, 0.1)
|
||||
if(adjusted_power)
|
||||
|
||||
@@ -14,9 +14,9 @@ Changes from tg DAL:
|
||||
- light_range; range in tiles of the light, used for calculating falloff,
|
||||
- light_power; multiplier for the brightness of lights,
|
||||
- light_color; hex string representing the RGB colour of the light.
|
||||
- SetLuminosity() is now set_light() and takes the three variables above.
|
||||
- setLuminousity() is now set_light() and takes the three variables above.
|
||||
- Variables can be left as null to not update them.
|
||||
- SetOpacity() is now set_opacity().
|
||||
- set_opacity() is now set_opacity().
|
||||
- Areas have luminosity set to 1 permanently, no hard-lighting.
|
||||
- Objects inside other objects can have lights and they properly affect the turf. (flashlights)
|
||||
- area/master and area/list/related have been eviscerated since subareas aren't needed.
|
||||
@@ -51,7 +51,7 @@ turf: (lighting_turf.dm)
|
||||
- proc/lighting_clear_overlays():
|
||||
- Delete (manual GC) all light overlays on this turf, used when changing turf to space
|
||||
- proc/lighting_build_overlays():
|
||||
- Create lighting overlays for this turf. Called by ChangeTurf in case the turf is being changed to use dynamic lighting.
|
||||
- Create lighting overlays for this turf
|
||||
|
||||
|
||||
atom/movable/lighting_overlay: (lighting_overlay.dm)
|
||||
@@ -64,4 +64,4 @@ atom/movable/lighting_overlay: (lighting_overlay.dm)
|
||||
- Change the lumcount vars and queue the overlay for update
|
||||
- proc/update_overlay()
|
||||
- Called by the lighting process to update the color of the overlay
|
||||
*/
|
||||
*/
|
||||
@@ -1,9 +0,0 @@
|
||||
#define LIGHTING_INTERVAL 5 // frequency, in 1/10ths of a second, of the lighting process
|
||||
|
||||
#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
|
||||
#define LIGHTING_LAMBERTIAN 1 // use lambertian shading for light sources
|
||||
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
|
||||
#define LIGHTING_ROUND_VALUE (1 / 128) //Value used to round lumcounts, values smaller than 1/255 don't matter (if they do, thanks sinking points), greater values will make lighting less precise, but in turn increase performance, VERY SLIGHTLY.
|
||||
|
||||
#define LIGHTING_LAYER 10 // drawing layer for lighting overlays
|
||||
#define LIGHTING_ICON 'icons/effects/lighting_overlay.dmi' // icon used for lighting shading effects
|
||||
@@ -1,300 +0,0 @@
|
||||
//So much copypasta in this file, supposedly in the name of performance. If you change anything make sure to consider other places where the code may have been copied.
|
||||
|
||||
/datum/light_source
|
||||
var/atom/top_atom
|
||||
var/atom/source_atom
|
||||
|
||||
var/turf/source_turf
|
||||
var/light_power
|
||||
var/light_range
|
||||
var/light_color // string, decomposed by parse_light_color()
|
||||
|
||||
var/lum_r
|
||||
var/lum_g
|
||||
var/lum_b
|
||||
|
||||
//hold onto the actual applied lum values so we can undo them when the lighting changes
|
||||
var/tmp/applied_lum_r
|
||||
var/tmp/applied_lum_g
|
||||
var/tmp/applied_lum_b
|
||||
|
||||
var/list/effect_str
|
||||
var/list/effect_turf
|
||||
|
||||
var/applied
|
||||
|
||||
var/vis_update //Whetever we should smartly recalculate visibility. and then only update tiles that became (in) visible to us
|
||||
var/needs_update
|
||||
var/destroyed
|
||||
var/force_update
|
||||
|
||||
/datum/light_source/New(atom/owner, atom/top)
|
||||
source_atom = owner
|
||||
if(!source_atom.light_sources) source_atom.light_sources = list()
|
||||
source_atom.light_sources += src
|
||||
top_atom = top
|
||||
if(top_atom != source_atom)
|
||||
if(!top.light_sources) top.light_sources = list()
|
||||
top_atom.light_sources += src
|
||||
|
||||
source_turf = top_atom
|
||||
light_power = source_atom.light_power
|
||||
light_range = source_atom.light_range
|
||||
light_color = source_atom.light_color
|
||||
|
||||
parse_light_color()
|
||||
|
||||
effect_str = list()
|
||||
effect_turf = list()
|
||||
|
||||
update()
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/light_source/proc/destroy()
|
||||
destroyed = 1
|
||||
force_update()
|
||||
if(source_atom && source_atom.light_sources) source_atom.light_sources -= src
|
||||
if(top_atom && top_atom.light_sources) top_atom.light_sources -= src
|
||||
|
||||
/datum/light_source/proc/update(atom/new_top_atom)
|
||||
if(new_top_atom && new_top_atom != top_atom)
|
||||
if(top_atom != source_atom) top_atom.light_sources -= src
|
||||
top_atom = new_top_atom
|
||||
if(top_atom != source_atom)
|
||||
if(!top_atom.light_sources) top_atom.light_sources = list()
|
||||
top_atom.light_sources += src
|
||||
|
||||
if(!needs_update) //Incase we're already updating either way.
|
||||
lighting_update_lights += src
|
||||
needs_update = 1
|
||||
|
||||
/datum/light_source/proc/force_update()
|
||||
force_update = 1
|
||||
if(!needs_update) //Incase we're already updating either way.
|
||||
needs_update = 1
|
||||
lighting_update_lights += src
|
||||
|
||||
/datum/light_source/proc/vis_update()
|
||||
if(!needs_update)
|
||||
needs_update = 1
|
||||
lighting_update_lights += src
|
||||
|
||||
vis_update = 1
|
||||
|
||||
/datum/light_source/proc/check()
|
||||
if(!source_atom || !light_range || !light_power)
|
||||
destroy()
|
||||
return 1
|
||||
|
||||
if(!top_atom)
|
||||
top_atom = source_atom
|
||||
. = 1
|
||||
|
||||
if(istype(top_atom, /turf))
|
||||
if(source_turf != top_atom)
|
||||
source_turf = top_atom
|
||||
. = 1
|
||||
else if(top_atom.loc != source_turf)
|
||||
source_turf = top_atom.loc
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_power != light_power)
|
||||
light_power = source_atom.light_power
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_range != light_range)
|
||||
light_range = source_atom.light_range
|
||||
. = 1
|
||||
|
||||
if(light_range && light_power && !applied)
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_color != light_color)
|
||||
light_color = source_atom.light_color
|
||||
parse_light_color()
|
||||
. = 1
|
||||
|
||||
/datum/light_source/proc/parse_light_color()
|
||||
if(light_color)
|
||||
lum_r = GetRedPart(light_color) / 255
|
||||
lum_g = GetGreenPart(light_color) / 255
|
||||
lum_b = GetBluePart(light_color) / 255
|
||||
else
|
||||
lum_r = 1
|
||||
lum_g = 1
|
||||
lum_b = 1
|
||||
|
||||
#if LIGHTING_FALLOFF == 1 //circular
|
||||
#define LUM_DISTANCE(swapvar, O, T) swapvar = (O.x - T.x)**2 + (O.y - T.y)**2 + LIGHTING_HEIGHT
|
||||
#if LIGHTING_LAMBERTIAN == 1
|
||||
#define LUM_ATTENUATION(swapvar) swapvar = CLAMP01((1 - CLAMP01(sqrt(swapvar) / max(1,light_range))) * (1 / sqrt(swapvar + 1)))
|
||||
#else
|
||||
#define LUM_ATTENUATION(swapvar) swapvar = 1 - CLAMP01(sqrt(swapvar) / max(1,light_range))
|
||||
#endif
|
||||
#elif LIGHTING_FALLOFF == 2 //square
|
||||
#define LUM_DISTANCE(swapvar, O, T) swapvar = abs(O.x - T.x) + abs(O.y - T.y) + LIGHTING_HEIGHT
|
||||
#if LIGHTING_LAMBERTIAN == 1
|
||||
#define LUM_ATTENUATION(swapvar) swapvar = CLAMP01((1 - CLAMP01(swapvar / max(1,light_range))) * (1 / sqrt(swapvar**2 + 1)))
|
||||
#else
|
||||
#define LUM_ATTENUATION(swapvar) swapvar = CLAMP01(swapvar / max(1,light_range))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define LUM_FALLOFF(swapvar, O, T) \
|
||||
LUM_DISTANCE(swapvar, O, T); \
|
||||
LUM_ATTENUATION(swapvar);
|
||||
|
||||
/datum/light_source/proc/apply_lum()
|
||||
applied = 1
|
||||
|
||||
//Keep track of the last applied lum values so that the lighting can be reversed
|
||||
applied_lum_r = lum_r
|
||||
applied_lum_g = lum_g
|
||||
applied_lum_b = lum_b
|
||||
|
||||
if(istype(source_turf))
|
||||
FOR_DVIEW(var/turf/T, light_range, source_turf, INVISIBILITY_LIGHTING)
|
||||
if(T.lighting_overlay)
|
||||
var/strength
|
||||
LUM_FALLOFF(strength, T, source_turf)
|
||||
strength *= light_power
|
||||
|
||||
if(!strength) //Don't add turfs that aren't affected to the affected turfs.
|
||||
continue
|
||||
|
||||
strength = round(strength, LIGHTING_ROUND_VALUE) //Screw sinking points.
|
||||
|
||||
effect_str += strength
|
||||
|
||||
T.lighting_overlay.update_lumcount(
|
||||
applied_lum_r * strength,
|
||||
applied_lum_g * strength,
|
||||
applied_lum_b * strength
|
||||
)
|
||||
|
||||
else
|
||||
effect_str += 0
|
||||
|
||||
if(!T.affecting_lights)
|
||||
T.affecting_lights = list()
|
||||
|
||||
T.affecting_lights += src
|
||||
effect_turf += T
|
||||
END_FOR_DVIEW
|
||||
|
||||
/datum/light_source/proc/remove_lum()
|
||||
applied = 0
|
||||
var/i = 1
|
||||
for(var/turf/T in effect_turf)
|
||||
if(T.affecting_lights)
|
||||
T.affecting_lights -= src
|
||||
|
||||
if(T.lighting_overlay)
|
||||
var/str = effect_str[i]
|
||||
T.lighting_overlay.update_lumcount(
|
||||
-str * applied_lum_r,
|
||||
-str * applied_lum_g,
|
||||
-str * applied_lum_b
|
||||
)
|
||||
|
||||
i++
|
||||
|
||||
effect_str.Cut()
|
||||
effect_turf.Cut()
|
||||
|
||||
//Smartly updates the lighting, only removes lum from and adds lum to turfs that actually got changed.
|
||||
//This is for lights that need to reconsider due to nearby opacity changes.
|
||||
//Stupid dumb copy pasta because BYOND and speed.
|
||||
/datum/light_source/proc/smart_vis_update()
|
||||
var/list/view[0]
|
||||
FOR_DVIEW(var/turf/T, light_range, source_turf, INVISIBILITY_LIGHTING)
|
||||
view += T //Filter out turfs.
|
||||
END_FOR_DVIEW
|
||||
//This is the part where we calculate new turfs (if any)
|
||||
var/list/new_turfs = view - effect_turf //This will result with all the tiles that are added.
|
||||
for(var/turf/T in new_turfs)
|
||||
if(T.lighting_overlay)
|
||||
LUM_FALLOFF(., T, source_turf)
|
||||
. *= light_power
|
||||
|
||||
if(!.) //Don't add turfs that aren't affected to the affected turfs.
|
||||
continue
|
||||
|
||||
. = round(., LIGHTING_ROUND_VALUE)
|
||||
|
||||
effect_str += .
|
||||
|
||||
T.lighting_overlay.update_lumcount(
|
||||
applied_lum_r * .,
|
||||
applied_lum_g * .,
|
||||
applied_lum_b * .
|
||||
)
|
||||
|
||||
else
|
||||
effect_str += 0
|
||||
|
||||
if(!T.affecting_lights)
|
||||
T.affecting_lights = list()
|
||||
|
||||
T.affecting_lights += src
|
||||
effect_turf += T
|
||||
|
||||
var/list/old_turfs = effect_turf - view
|
||||
for(var/turf/T in old_turfs)
|
||||
//Insert not-so-huge copy paste from remove_lum().
|
||||
var/idx = effect_turf.Find(T) //Get the index, luckily Find() is cheap in small lists like this. (with small I mean under a couple thousand len)
|
||||
if(T.affecting_lights)
|
||||
T.affecting_lights -= src
|
||||
|
||||
if(T.lighting_overlay)
|
||||
var/str = effect_str[idx]
|
||||
T.lighting_overlay.update_lumcount(-str * applied_lum_r, -str * applied_lum_g, -str * applied_lum_b)
|
||||
|
||||
effect_turf.Cut(idx, idx + 1)
|
||||
effect_str.Cut(idx, idx + 1)
|
||||
|
||||
//Whoop yet not another copy pasta because speed ~~~~BYOND.
|
||||
//Calculates and applies lighting for a single turf. This is intended for when a turf switches to
|
||||
//using dynamic lighting when it was not doing so previously (when constructing a floor on space, for example).
|
||||
//Assumes the turf is visible and such.
|
||||
//For the love of god don't call this proc when it's not needed! Lighting artifacts WILL happen!
|
||||
/datum/light_source/proc/calc_turf(var/turf/T)
|
||||
var/idx = effect_turf.Find(T)
|
||||
if(!idx)
|
||||
return //WHY.
|
||||
|
||||
if(T.lighting_overlay)
|
||||
#if LIGHTING_FALLOFF == 1 // circular
|
||||
. = (T.lighting_overlay.x - source_turf.x)**2 + (T.lighting_overlay.y - source_turf.y)**2 + LIGHTING_HEIGHT
|
||||
#if LIGHTING_LAMBERTIAN == 1
|
||||
. = CLAMP01((1 - CLAMP01(sqrt(.) / light_range)) * (1 / (sqrt(. + 1))))
|
||||
#else
|
||||
. = 1 - CLAMP01(sqrt(.) / light_range)
|
||||
#endif
|
||||
|
||||
#elif LIGHTING_FALLOFF == 2 // square
|
||||
. = abs(T.lighting_overlay.x - source_turf.x) + abs(T.lighting_overlay.y - source_turf.y) + LIGHTING_HEIGHT
|
||||
#if LIGHTING_LAMBERTIAN == 1
|
||||
. = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + )))
|
||||
#else
|
||||
. = 1 - CLAMP01(. / light_range)
|
||||
#endif
|
||||
#endif
|
||||
. *= light_power
|
||||
|
||||
. = round(., LIGHTING_ROUND_VALUE)
|
||||
|
||||
effect_str[idx] = .
|
||||
|
||||
//Since the applied_lum values are what are (later) removed by remove_lum.
|
||||
//Anything we apply to the lighting overlays HAS to match what remove_lum uses.
|
||||
T.lighting_overlay.update_lumcount(
|
||||
applied_lum_r * .,
|
||||
applied_lum_g * .,
|
||||
applied_lum_b * .
|
||||
)
|
||||
|
||||
#undef LUM_FALLOFF
|
||||
#undef LUM_DISTANCE
|
||||
#undef LUM_ATTENUATION
|
||||
9
code/modules/lighting/lighting_area.dm
Normal file
9
code/modules/lighting/lighting_area.dm
Normal file
@@ -0,0 +1,9 @@
|
||||
/area
|
||||
luminosity = TRUE
|
||||
var/dynamic_lighting = TRUE
|
||||
|
||||
/area/New()
|
||||
. = ..()
|
||||
|
||||
if(dynamic_lighting)
|
||||
luminosity = FALSE
|
||||
@@ -1,12 +1,14 @@
|
||||
/atom
|
||||
var/light_power = 1 // intensity of the light
|
||||
var/light_range = 0 // range in tiles of the light
|
||||
var/light_color // RGB string representing the colour of the light
|
||||
var/light_color // Hexadecimal RGB string representing the colour of the light
|
||||
|
||||
var/datum/light_source/light
|
||||
var/list/light_sources
|
||||
|
||||
/atom/proc/set_light(l_range, l_power, l_color)
|
||||
// Nonsensical value for l_color default, so we can detect if it gets set to null.
|
||||
#define NONSENSICAL_VALUE -99999
|
||||
/atom/proc/set_light(l_range, l_power, l_color = NONSENSICAL_VALUE)
|
||||
. = 0 //make it less costly if nothing's changed
|
||||
|
||||
if(l_power != null && l_power != light_power)
|
||||
@@ -15,16 +17,17 @@
|
||||
if(l_range != null && l_range != light_range)
|
||||
light_range = l_range
|
||||
. = 1
|
||||
if(l_color != null && l_color != light_color)
|
||||
if(l_color != NONSENSICAL_VALUE && l_color != light_color)
|
||||
light_color = l_color
|
||||
. = 1
|
||||
|
||||
if(.) update_light()
|
||||
|
||||
/atom/proc/copy_light(atom/A)
|
||||
set_light(A.light_range, A.light_power, A.light_color)
|
||||
#undef NONSENSICAL_VALUE
|
||||
|
||||
/atom/proc/update_light()
|
||||
set waitfor = FALSE
|
||||
|
||||
if(!light_power || !light_range)
|
||||
if(light)
|
||||
light.destroy()
|
||||
@@ -42,9 +45,14 @@
|
||||
|
||||
/atom/New()
|
||||
. = ..()
|
||||
|
||||
if(light_power && light_range)
|
||||
update_light()
|
||||
|
||||
if(opacity && isturf(loc))
|
||||
var/turf/T = loc
|
||||
T.has_opaque_atom = TRUE // No need to recalculate it in this case, it's guranteed to be on afterwards anyways.
|
||||
|
||||
/atom/Destroy()
|
||||
if(light)
|
||||
light.destroy()
|
||||
@@ -57,19 +65,38 @@
|
||||
T.reconsider_lights()
|
||||
return ..()
|
||||
|
||||
/atom/Entered(atom/movable/obj, atom/prev_loc)
|
||||
/atom/movable/Move()
|
||||
var/turf/old_loc = loc
|
||||
. = ..()
|
||||
|
||||
if(obj && prev_loc != src)
|
||||
for(var/datum/light_source/L in obj.light_sources)
|
||||
if(loc != old_loc)
|
||||
for(var/datum/light_source/L in light_sources)
|
||||
L.source_atom.update_light()
|
||||
|
||||
var/turf/new_loc = loc
|
||||
if(istype(old_loc) && opacity)
|
||||
old_loc.reconsider_lights()
|
||||
|
||||
if(istype(new_loc) && opacity)
|
||||
new_loc.reconsider_lights()
|
||||
|
||||
/atom/proc/set_opacity(new_opacity)
|
||||
var/old_opacity = opacity
|
||||
if(new_opacity == opacity)
|
||||
return
|
||||
|
||||
opacity = new_opacity
|
||||
var/turf/T = loc
|
||||
if(old_opacity != new_opacity && istype(T))
|
||||
var/turf/T = isturf(src) ? src : loc
|
||||
if(!isturf(T))
|
||||
return
|
||||
|
||||
if(new_opacity == TRUE)
|
||||
T.has_opaque_atom = TRUE
|
||||
T.reconsider_lights()
|
||||
else
|
||||
var/old_has_opaque_atom = T.has_opaque_atom
|
||||
T.recalc_atom_opacity()
|
||||
if(old_has_opaque_atom != T.has_opaque_atom)
|
||||
T.reconsider_lights()
|
||||
|
||||
/obj/item/equipped()
|
||||
. = ..()
|
||||
|
||||
133
code/modules/lighting/lighting_corner.dm
Normal file
133
code/modules/lighting/lighting_corner.dm
Normal file
@@ -0,0 +1,133 @@
|
||||
/var/total_lighting_corners = 0
|
||||
/var/datum/lighting_corner/dummy/dummy_lighting_corner = new
|
||||
// Because we can control each corner of every lighting overlay.
|
||||
// And corners get shared between multiple turfs (unless you're on the corners of the map, then 1 corner doesn't).
|
||||
// For the record: these should never ever ever be deleted, even if the turf doesn't have dynamic lighting.
|
||||
|
||||
// This list is what the code that assigns corners listens to, the order in this list is the order in which corners are added to the /turf/corners list.
|
||||
/var/list/LIGHTING_CORNER_DIAGONAL = list(NORTHEAST, SOUTHEAST, SOUTHWEST, NORTHWEST)
|
||||
|
||||
/datum/lighting_corner
|
||||
var/list/turf/masters = list()
|
||||
var/list/datum/light_source/affecting = list() // Light sources affecting us.
|
||||
var/active = FALSE // TRUE if one of our masters has dynamic lighting.
|
||||
|
||||
var/x = 0
|
||||
var/y = 0
|
||||
var/z = 0
|
||||
|
||||
var/lum_r = 0
|
||||
var/lum_g = 0
|
||||
var/lum_b = 0
|
||||
|
||||
var/needs_update = FALSE
|
||||
|
||||
var/cache_r = LIGHTING_SOFT_THRESHOLD
|
||||
var/cache_g = LIGHTING_SOFT_THRESHOLD
|
||||
var/cache_b = LIGHTING_SOFT_THRESHOLD
|
||||
var/cache_mx = 0
|
||||
|
||||
var/update_gen = 0
|
||||
|
||||
/datum/lighting_corner/New(var/turf/new_turf, var/diagonal)
|
||||
. = ..()
|
||||
|
||||
total_lighting_corners++
|
||||
|
||||
masters[new_turf] = turn(diagonal, 180)
|
||||
z = new_turf.z
|
||||
|
||||
var/vertical = diagonal & ~(diagonal - 1) // The horizontal directions (4 and 8) are bigger than the vertical ones (1 and 2), so we can reliably say the lsb is the horizontal direction.
|
||||
var/horizontal = diagonal & ~vertical // Now that we know the horizontal one we can get the vertical one.
|
||||
|
||||
x = new_turf.x + (horizontal == EAST ? 0.5 : -0.5)
|
||||
y = new_turf.y + (vertical == NORTH ? 0.5 : -0.5)
|
||||
|
||||
// My initial plan was to make this loop through a list of all the dirs (horizontal, vertical, diagonal).
|
||||
// Issue being that the only way I could think of doing it was very messy, slow and honestly overengineered.
|
||||
// So we'll have this hardcode instead.
|
||||
var/turf/T
|
||||
var/i
|
||||
|
||||
// Diagonal one is easy.
|
||||
T = get_step(new_turf, diagonal)
|
||||
if (T) // In case we're on the map's border.
|
||||
if (!T.corners)
|
||||
T.corners = list(null, null, null, null)
|
||||
|
||||
masters[T] = diagonal
|
||||
i = LIGHTING_CORNER_DIAGONAL.Find(turn(diagonal, 180))
|
||||
T.corners[i] = src
|
||||
|
||||
// Now the horizontal one.
|
||||
T = get_step(new_turf, horizontal)
|
||||
if (T) // Ditto.
|
||||
if (!T.corners)
|
||||
T.corners = list(null, null, null, null)
|
||||
|
||||
masters[T] = ((T.x > x) ? EAST : WEST) | ((T.y > y) ? NORTH : SOUTH) // Get the dir based on coordinates.
|
||||
i = LIGHTING_CORNER_DIAGONAL.Find(turn(masters[T], 180))
|
||||
T.corners[i] = src
|
||||
|
||||
// And finally the vertical one.
|
||||
T = get_step(new_turf, vertical)
|
||||
if (T)
|
||||
if (!T.corners)
|
||||
T.corners = list(null, null, null, null)
|
||||
|
||||
masters[T] = ((T.x > x) ? EAST : WEST) | ((T.y > y) ? NORTH : SOUTH) // Get the dir based on coordinates.
|
||||
i = LIGHTING_CORNER_DIAGONAL.Find(turn(masters[T], 180))
|
||||
T.corners[i] = src
|
||||
|
||||
update_active()
|
||||
|
||||
/datum/lighting_corner/proc/update_active()
|
||||
active = FALSE
|
||||
for (var/turf/T in masters)
|
||||
if (T.lighting_overlay)
|
||||
active = TRUE
|
||||
|
||||
// God that was a mess, now to do the rest of the corner code! Hooray!
|
||||
/datum/lighting_corner/proc/update_lumcount(var/delta_r, var/delta_g, var/delta_b)
|
||||
lum_r += delta_r
|
||||
lum_g += delta_g
|
||||
lum_b += delta_b
|
||||
|
||||
if (!needs_update)
|
||||
needs_update = TRUE
|
||||
lighting_update_corners += src
|
||||
|
||||
/datum/lighting_corner/proc/update_overlays()
|
||||
// Cache these values a head of time so 4 individual lighting overlays don't all calculate them individually.
|
||||
var/lum_r = src.lum_r
|
||||
var/lum_g = src.lum_g
|
||||
var/lum_b = src.lum_b
|
||||
var/mx = max(lum_r, lum_g, lum_b) // Scale it so 1 is the strongest lum, if it is above 1.
|
||||
. = 1 // factor
|
||||
if (mx > 1)
|
||||
. = 1 / mx
|
||||
|
||||
#if LIGHTING_SOFT_THRESHOLD != 0
|
||||
else if (mx < LIGHTING_SOFT_THRESHOLD)
|
||||
. = 0 // 0 means soft lighting.
|
||||
|
||||
cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
|
||||
cache_g = round(lum_g * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
|
||||
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
|
||||
#else
|
||||
cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE)
|
||||
cache_g = round(lum_g * ., LIGHTING_ROUND_VALUE)
|
||||
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE)
|
||||
#endif
|
||||
cache_mx = round(mx, LIGHTING_ROUND_VALUE)
|
||||
|
||||
for (var/TT in masters)
|
||||
var/turf/T = TT
|
||||
if (T.lighting_overlay)
|
||||
if (!T.lighting_overlay.needs_update)
|
||||
T.lighting_overlay.needs_update = TRUE
|
||||
lighting_update_overlays += T.lighting_overlay
|
||||
|
||||
|
||||
/datum/lighting_corner/dummy/New()
|
||||
return
|
||||
@@ -1,102 +1,125 @@
|
||||
/var/total_lighting_overlays = 0
|
||||
/atom/movable/lighting_overlay
|
||||
name = ""
|
||||
mouse_opacity = 0
|
||||
simulated = 0
|
||||
anchored = 1
|
||||
|
||||
icon = LIGHTING_ICON
|
||||
icon_state = "light1"
|
||||
layer = LIGHTING_LAYER
|
||||
invisibility = INVISIBILITY_LIGHTING
|
||||
color = "#000000"
|
||||
color = LIGHTING_BASE_MATRIX
|
||||
icon_state = "light1"
|
||||
auto_init = 0 // doesn't need special init
|
||||
blend_mode = BLEND_MULTIPLY
|
||||
|
||||
var/lum_r
|
||||
var/lum_g
|
||||
var/lum_b
|
||||
var/lum_r = 0
|
||||
var/lum_g = 0
|
||||
var/lum_b = 0
|
||||
|
||||
var/needs_update
|
||||
var/needs_update = FALSE
|
||||
|
||||
/atom/movable/lighting_overlay/New()
|
||||
/atom/movable/lighting_overlay/New(var/atom/loc, var/no_update = FALSE)
|
||||
. = ..()
|
||||
verbs.Cut()
|
||||
total_lighting_overlays++
|
||||
|
||||
var/turf/T = loc //If this runtimes atleast we'll know what's creating overlays in things that aren't turfs.
|
||||
var/turf/T = loc //If this runtimes atleast we'll know what's creating overlays outside of turfs.
|
||||
T.lighting_overlay = src
|
||||
T.luminosity = 0
|
||||
|
||||
/atom/movable/lighting_overlay/proc/update_lumcount(delta_r, delta_g, delta_b)
|
||||
if(!delta_r && !delta_g && !delta_b) //Nothing is being changed all together.
|
||||
if(no_update)
|
||||
return
|
||||
|
||||
var/should_update = 0
|
||||
|
||||
if(!needs_update) //If this isn't true, we're already updating anyways.
|
||||
if(max(lum_r, lum_g, lum_b) < 1) //Any change that could happen WILL change appearance.
|
||||
should_update = 1
|
||||
|
||||
else if(max(lum_r + delta_r, lum_g + delta_g, lum_b + delta_b) < 1) //The change would bring us under 1 max lum, again, guaranteed to change appearance.
|
||||
should_update = 1
|
||||
|
||||
else //We need to make sure that the colour ratios won't change in this code block.
|
||||
var/mx1 = max(lum_r, lum_g, lum_b)
|
||||
var/mx2 = max(lum_r + delta_r, lum_g + delta_g, lum_b + delta_b)
|
||||
|
||||
if(lum_r / mx1 != (lum_r + delta_r) / mx2 || lum_g / mx1 != (lum_g + delta_g) / mx2 || lum_b / mx1 != (lum_b + delta_b) / mx2) //Stuff would change.
|
||||
should_update = 1
|
||||
|
||||
lum_r += delta_r
|
||||
lum_g += delta_g
|
||||
lum_b += delta_b
|
||||
|
||||
if(!needs_update && should_update)
|
||||
needs_update = 1
|
||||
lighting_update_overlays += src
|
||||
update_overlay()
|
||||
|
||||
/atom/movable/lighting_overlay/proc/update_overlay()
|
||||
set waitfor = FALSE
|
||||
var/turf/T = loc
|
||||
|
||||
if(istype(T)) //Incase we're not on a turf, pool ourselves, something happened.
|
||||
if(lum_r == lum_g && lum_r == lum_b) //greyscale
|
||||
blend_mode = BLEND_OVERLAY
|
||||
if(lum_r <= 0)
|
||||
T.luminosity = 0
|
||||
color = "#000000"
|
||||
alpha = 255
|
||||
else
|
||||
T.luminosity = 1
|
||||
color = "#000000"
|
||||
alpha = (1 - min(lum_r, 1)) * 255
|
||||
if(!istype(T))
|
||||
if(loc)
|
||||
log_debug("A lighting overlay realised its loc was NOT a turf (actual loc: [loc][loc ? ", " + loc.type : "null"]) in update_overlay() and got qdel'ed!")
|
||||
else
|
||||
alpha = 255
|
||||
var/mx = max(lum_r, lum_g, lum_b)
|
||||
. = 1 // factor
|
||||
if(mx > 1)
|
||||
. = 1/mx
|
||||
blend_mode = BLEND_MULTIPLY
|
||||
color = rgb(lum_r * 255 * ., lum_g * 255 * ., lum_b * 255 * .)
|
||||
if(color != "#000000")
|
||||
T.luminosity = 1
|
||||
else //No light, set the turf's luminosity to 0 to remove it from view()
|
||||
T.luminosity = 0
|
||||
else
|
||||
warning("A lighting overlay realised its loc was NOT a turf (actual loc: [loc][loc ? ", " + loc.type : ""]) in update_overlay() and got pooled!")
|
||||
log_debug("A lighting overlay realised it was in nullspace in update_overlay() and got pooled!")
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/atom/movable/lighting_overlay/ResetVars()
|
||||
loc = null
|
||||
// To the future coder who sees this and thinks
|
||||
// "Why didn't he just use a loop?"
|
||||
// Well my man, it's because the loop performed like shit.
|
||||
// And there's no way to improve it because
|
||||
// without a loop you can make the list all at once which is the fastest you're gonna get.
|
||||
// Oh it's also shorter line wise.
|
||||
// Including with these comments.
|
||||
|
||||
lum_r = 0
|
||||
lum_g = 0
|
||||
lum_b = 0
|
||||
// See LIGHTING_CORNER_DIAGONAL in lighting_corner.dm for why these values are what they are.
|
||||
// No I seriously cannot think of a more efficient method, fuck off Comic.
|
||||
var/datum/lighting_corner/cr = T.corners[3] || dummy_lighting_corner
|
||||
var/datum/lighting_corner/cg = T.corners[2] || dummy_lighting_corner
|
||||
var/datum/lighting_corner/cb = T.corners[4] || dummy_lighting_corner
|
||||
var/datum/lighting_corner/ca = T.corners[1] || dummy_lighting_corner
|
||||
|
||||
color = "#000000"
|
||||
var/max = max(cr.cache_mx, cg.cache_mx, cb.cache_mx, ca.cache_mx)
|
||||
|
||||
needs_update = 0
|
||||
var/rr = cr.cache_r
|
||||
var/rg = cr.cache_g
|
||||
var/rb = cr.cache_b
|
||||
|
||||
var/gr = cg.cache_r
|
||||
var/gg = cg.cache_g
|
||||
var/gb = cg.cache_b
|
||||
|
||||
var/br = cb.cache_r
|
||||
var/bg = cb.cache_g
|
||||
var/bb = cb.cache_b
|
||||
|
||||
var/ar = ca.cache_r
|
||||
var/ag = ca.cache_g
|
||||
var/ab = ca.cache_b
|
||||
|
||||
#if LIGHTING_SOFT_THRESHOLD != 0
|
||||
var/set_luminosity = max > LIGHTING_SOFT_THRESHOLD
|
||||
#else
|
||||
// Because of floating points, it won't even be a flat 0.
|
||||
// This number is mostly arbitrary.
|
||||
var/set_luminosity = max > 1e-6
|
||||
#endif
|
||||
|
||||
if((rr & gr & br & ar) && (rg + gg + bg + ag + rb + gb + bb + ab == 8))
|
||||
//anything that passes the first case is very likely to pass the second, and addition is a little faster in this case
|
||||
icon_state = "transparent"
|
||||
color = null
|
||||
else if(!set_luminosity)
|
||||
icon_state = LIGHTING_ICON_STATE_DARK
|
||||
color = null
|
||||
else
|
||||
icon_state = null
|
||||
color = list(
|
||||
rr, rg, rb, 00,
|
||||
gr, gg, gb, 00,
|
||||
br, bg, bb, 00,
|
||||
ar, ag, ab, 00,
|
||||
00, 00, 00, 01
|
||||
)
|
||||
|
||||
luminosity = set_luminosity
|
||||
|
||||
// Variety of overrides so the overlays don't get affected by weird things.
|
||||
/atom/movable/lighting_overlay/ex_act()
|
||||
return
|
||||
|
||||
/atom/movable/lighting_overlay/singularity_act()
|
||||
return
|
||||
|
||||
/atom/movable/lighting_overlay/singularity_pull()
|
||||
return
|
||||
|
||||
/atom/movable/lighting_overlay/Destroy()
|
||||
lighting_update_overlays -= src
|
||||
total_lighting_overlays--
|
||||
global.lighting_update_overlays -= src
|
||||
global.lighting_update_overlays_old -= src
|
||||
|
||||
var/turf/T = loc
|
||||
if(istype(T))
|
||||
T.lighting_overlay = null
|
||||
|
||||
..()
|
||||
T.luminosity = 1
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/datum/controller/process/lighting/setup()
|
||||
name = "lighting"
|
||||
schedule_interval = LIGHTING_INTERVAL
|
||||
|
||||
create_lighting_overlays()
|
||||
|
||||
/datum/controller/process/lighting/doWork()
|
||||
var/list/lighting_update_lights_old = lighting_update_lights //We use a different list so any additions to the update lists during a delay from scheck() don't cause things to be cut from the list without being updated.
|
||||
lighting_update_lights = null //Nulling it first because of http://www.byond.com/forum/?post=1854520
|
||||
lighting_update_lights = list()
|
||||
|
||||
for(var/datum/light_source/L in lighting_update_lights_old)
|
||||
if(L.destroyed || L.check() || L.force_update)
|
||||
L.remove_lum()
|
||||
if(!L.destroyed)
|
||||
L.apply_lum()
|
||||
|
||||
else if(L.vis_update) //We smartly update only tiles that became (in) visible to use.
|
||||
L.smart_vis_update()
|
||||
|
||||
L.vis_update = 0
|
||||
L.force_update = 0
|
||||
L.needs_update = 0
|
||||
|
||||
SCHECK
|
||||
|
||||
var/list/lighting_update_overlays_old = lighting_update_overlays //Same as above.
|
||||
lighting_update_overlays = null //Same as above
|
||||
lighting_update_overlays = list()
|
||||
|
||||
for(var/atom/movable/lighting_overlay/O in lighting_update_overlays_old)
|
||||
O.update_overlay()
|
||||
O.needs_update = 0
|
||||
|
||||
SCHECK
|
||||
16
code/modules/lighting/lighting_setup.dm
Normal file
16
code/modules/lighting/lighting_setup.dm
Normal file
@@ -0,0 +1,16 @@
|
||||
/proc/create_all_lighting_overlays()
|
||||
for(var/zlevel = 1 to world.maxz)
|
||||
create_lighting_overlays_zlevel(zlevel)
|
||||
|
||||
/proc/create_lighting_overlays_zlevel(var/zlevel)
|
||||
ASSERT(zlevel)
|
||||
|
||||
for(var/turf/T in block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel)))
|
||||
if(!T.dynamic_lighting)
|
||||
continue
|
||||
|
||||
var/area/A = T.loc
|
||||
if(!A.dynamic_lighting)
|
||||
continue
|
||||
|
||||
new /atom/movable/lighting_overlay(T, TRUE)
|
||||
290
code/modules/lighting/lighting_source.dm
Normal file
290
code/modules/lighting/lighting_source.dm
Normal file
@@ -0,0 +1,290 @@
|
||||
/var/total_lighting_sources = 0
|
||||
// This is where the fun begins.
|
||||
// These are the main datums that emit light.
|
||||
|
||||
/datum/light_source
|
||||
var/atom/top_atom // The atom we're emitting light from(for example a mob if we're from a flashlight that's being held).
|
||||
var/atom/source_atom // The atom that we belong to.
|
||||
|
||||
var/turf/source_turf // The turf under the above.
|
||||
var/light_power // Intensity of the emitter light.
|
||||
var/light_range // The range of the emitted light.
|
||||
var/light_color // The colour of the light, string, decomposed by parse_light_color()
|
||||
|
||||
// Variables for keeping track of the colour.
|
||||
var/lum_r
|
||||
var/lum_g
|
||||
var/lum_b
|
||||
|
||||
// The lumcount values used to apply the light.
|
||||
var/tmp/applied_lum_r
|
||||
var/tmp/applied_lum_g
|
||||
var/tmp/applied_lum_b
|
||||
|
||||
var/list/datum/lighting_corner/effect_str // List used to store how much we're affecting corners.
|
||||
var/list/turf/affecting_turfs
|
||||
|
||||
var/applied = FALSE // Whether we have applied our light yet or not.
|
||||
|
||||
var/vis_update // Whether we should smartly recalculate visibility. and then only update tiles that became(in)visible to us.
|
||||
var/needs_update // Whether we are queued for an update.
|
||||
var/destroyed // Whether we are destroyed and need to stop emitting light.
|
||||
var/force_update
|
||||
|
||||
/datum/light_source/New(var/atom/owner, var/atom/top)
|
||||
total_lighting_sources++
|
||||
source_atom = owner // Set our new owner.
|
||||
if(!source_atom.light_sources)
|
||||
source_atom.light_sources = list()
|
||||
|
||||
source_atom.light_sources += src // Add us to the lights of our owner.
|
||||
top_atom = top
|
||||
if(top_atom != source_atom)
|
||||
if(!top.light_sources)
|
||||
top.light_sources = list()
|
||||
|
||||
top_atom.light_sources += src
|
||||
|
||||
source_turf = top_atom
|
||||
light_power = source_atom.light_power
|
||||
light_range = source_atom.light_range
|
||||
light_color = source_atom.light_color
|
||||
|
||||
parse_light_color()
|
||||
|
||||
effect_str = list()
|
||||
affecting_turfs = list()
|
||||
|
||||
update()
|
||||
|
||||
|
||||
return ..()
|
||||
|
||||
// Kill ourselves.
|
||||
/datum/light_source/proc/destroy()
|
||||
total_lighting_sources--
|
||||
destroyed = TRUE
|
||||
force_update()
|
||||
if(source_atom)
|
||||
if(!source_atom.light_sources)
|
||||
log_runtime(EXCEPTION("Atom [source_atom] was a light source, but lacked a light source list!\n"), source_atom)
|
||||
else
|
||||
source_atom.light_sources -= src
|
||||
|
||||
if(top_atom)
|
||||
top_atom.light_sources -= src
|
||||
|
||||
// Call it dirty, I don't care.
|
||||
// This is here so there's no performance loss on non-instant updates from the fact that the engine can also do instant updates.
|
||||
// If you're wondering what's with the "BYOND" argument: BYOND won't let me have a() macro that has no arguments :|.
|
||||
#define effect_update(BYOND) \
|
||||
if(!needs_update) \
|
||||
{ \
|
||||
lighting_update_lights += src; \
|
||||
needs_update = TRUE; \
|
||||
}
|
||||
|
||||
// This proc will cause the light source to update the top atom, and add itself to the update queue.
|
||||
/datum/light_source/proc/update(var/atom/new_top_atom)
|
||||
// This top atom is different.
|
||||
if(new_top_atom && new_top_atom != top_atom)
|
||||
if(top_atom != source_atom) // Remove ourselves from the light sources of that top atom.
|
||||
top_atom.light_sources -= src
|
||||
|
||||
top_atom = new_top_atom
|
||||
|
||||
if(top_atom != source_atom)
|
||||
if(!top_atom.light_sources)
|
||||
top_atom.light_sources = list()
|
||||
|
||||
top_atom.light_sources += src // Add ourselves to the light sources of our new top atom.
|
||||
|
||||
effect_update(null)
|
||||
|
||||
// Will force an update without checking if it's actually needed.
|
||||
/datum/light_source/proc/force_update()
|
||||
force_update = 1
|
||||
|
||||
effect_update(null)
|
||||
|
||||
// Will cause the light source to recalculate turfs that were removed or added to visibility only.
|
||||
/datum/light_source/proc/vis_update()
|
||||
vis_update = 1
|
||||
|
||||
effect_update(null)
|
||||
|
||||
// Will check if we actually need to update, and update any variables that may need to be updated.
|
||||
/datum/light_source/proc/check()
|
||||
if(!source_atom || !light_range || !light_power)
|
||||
destroy()
|
||||
return 1
|
||||
|
||||
if(!top_atom)
|
||||
top_atom = source_atom
|
||||
. = 1
|
||||
|
||||
if(isturf(top_atom))
|
||||
if(source_turf != top_atom)
|
||||
source_turf = top_atom
|
||||
. = 1
|
||||
else if(top_atom.loc != source_turf)
|
||||
source_turf = top_atom.loc
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_power != light_power)
|
||||
light_power = source_atom.light_power
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_range != light_range)
|
||||
light_range = source_atom.light_range
|
||||
. = 1
|
||||
|
||||
if(light_range && light_power && !applied)
|
||||
. = 1
|
||||
|
||||
if(source_atom.light_color != light_color)
|
||||
light_color = source_atom.light_color
|
||||
parse_light_color()
|
||||
. = 1
|
||||
|
||||
// Decompile the hexadecimal colour into lumcounts of each perspective.
|
||||
/datum/light_source/proc/parse_light_color()
|
||||
if(light_color)
|
||||
lum_r = GetRedPart (light_color) / 255
|
||||
lum_g = GetGreenPart(light_color) / 255
|
||||
lum_b = GetBluePart (light_color) / 255
|
||||
else
|
||||
lum_r = 1
|
||||
lum_g = 1
|
||||
lum_b = 1
|
||||
|
||||
// Macro that applies light to a new corner.
|
||||
// It is a macro in the interest of speed, yet not having to copy paste it.
|
||||
// If you're wondering what's with the backslashes, the backslashes cause BYOND to not automatically end the line.
|
||||
// As such this all gets counted as a single line.
|
||||
// The braces and semicolons are there to be able to do this on a single line.
|
||||
|
||||
#define APPLY_CORNER(C) \
|
||||
. = LUM_FALLOFF(C, source_turf); \
|
||||
\
|
||||
. *= light_power; \
|
||||
\
|
||||
effect_str[C] = .; \
|
||||
\
|
||||
C.update_lumcount \
|
||||
( \
|
||||
. * applied_lum_r, \
|
||||
. * applied_lum_g, \
|
||||
. * applied_lum_b \
|
||||
);
|
||||
|
||||
// I don't need to explain what this does, do I?
|
||||
#define REMOVE_CORNER(C) \
|
||||
. = -effect_str[C]; \
|
||||
C.update_lumcount \
|
||||
( \
|
||||
. * applied_lum_r, \
|
||||
. * applied_lum_g, \
|
||||
. * applied_lum_b \
|
||||
);
|
||||
|
||||
// This is the define used to calculate falloff.
|
||||
#define LUM_FALLOFF(C, T)(1 - CLAMP01(sqrt((C.x - T.x) ** 2 +(C.y - T.y) ** 2 + LIGHTING_HEIGHT) / max(1, light_range)))
|
||||
|
||||
/datum/light_source/proc/apply_lum()
|
||||
var/static/update_gen = 1
|
||||
applied = 1
|
||||
|
||||
// Keep track of the last applied lum values so that the lighting can be reversed
|
||||
applied_lum_r = lum_r
|
||||
applied_lum_g = lum_g
|
||||
applied_lum_b = lum_b
|
||||
|
||||
FOR_DVIEW(var/turf/T, light_range, source_turf, INVISIBILITY_LIGHTING)
|
||||
if(!T.lighting_corners_initialised)
|
||||
T.generate_missing_corners()
|
||||
|
||||
for(var/datum/lighting_corner/C in T.get_corners())
|
||||
if(C.update_gen == update_gen)
|
||||
continue
|
||||
|
||||
C.update_gen = update_gen
|
||||
C.affecting += src
|
||||
|
||||
if(!C.active)
|
||||
effect_str[C] = 0
|
||||
continue
|
||||
|
||||
APPLY_CORNER(C)
|
||||
|
||||
if(!T.affecting_lights)
|
||||
T.affecting_lights = list()
|
||||
|
||||
T.affecting_lights += src
|
||||
affecting_turfs += T
|
||||
|
||||
update_gen++
|
||||
|
||||
/datum/light_source/proc/remove_lum()
|
||||
applied = FALSE
|
||||
|
||||
for(var/turf/T in affecting_turfs)
|
||||
if(!T.affecting_lights)
|
||||
T.affecting_lights = list()
|
||||
else
|
||||
T.affecting_lights -= src
|
||||
|
||||
affecting_turfs.Cut()
|
||||
|
||||
for(var/datum/lighting_corner/C in effect_str)
|
||||
REMOVE_CORNER(C)
|
||||
|
||||
C.affecting -= src
|
||||
|
||||
effect_str.Cut()
|
||||
|
||||
/datum/light_source/proc/recalc_corner(var/datum/lighting_corner/C)
|
||||
if(effect_str.Find(C)) // Already have one.
|
||||
REMOVE_CORNER(C)
|
||||
|
||||
APPLY_CORNER(C)
|
||||
|
||||
/datum/light_source/proc/smart_vis_update()
|
||||
var/list/datum/lighting_corner/corners = list()
|
||||
var/list/turf/turfs = list()
|
||||
FOR_DVIEW(var/turf/T, light_range, source_turf, 0)
|
||||
if(!T.lighting_corners_initialised)
|
||||
T.generate_missing_corners()
|
||||
corners |= T.get_corners()
|
||||
turfs += T
|
||||
|
||||
var/list/L = turfs - affecting_turfs // New turfs, add us to the affecting lights of them.
|
||||
affecting_turfs += L
|
||||
for(var/turf/T in L)
|
||||
if(!T.affecting_lights)
|
||||
T.affecting_lights = list(src)
|
||||
else
|
||||
T.affecting_lights += src
|
||||
|
||||
L = affecting_turfs - turfs // Now-gone turfs, remove us from the affecting lights.
|
||||
affecting_turfs -= L
|
||||
for(var/turf/T in L)
|
||||
T.affecting_lights -= src
|
||||
|
||||
for(var/datum/lighting_corner/C in corners - effect_str) // New corners
|
||||
C.affecting += src
|
||||
if(!C.active)
|
||||
effect_str[C] = 0
|
||||
continue
|
||||
|
||||
APPLY_CORNER(C)
|
||||
|
||||
for(var/datum/lighting_corner/C in effect_str - corners) // Old, now gone, corners.
|
||||
REMOVE_CORNER(C)
|
||||
C.affecting -= src
|
||||
effect_str -= C
|
||||
|
||||
#undef effect_update
|
||||
#undef LUM_FALLOFF
|
||||
#undef REMOVE_CORNER
|
||||
#undef APPLY_CORNER
|
||||
@@ -1,25 +0,0 @@
|
||||
/var/list/lighting_update_lights = list()
|
||||
/var/list/lighting_update_overlays = list()
|
||||
|
||||
/area/var/lighting_use_dynamic = 1
|
||||
|
||||
// duplicates lots of code, but this proc needs to be as fast as possible.
|
||||
/proc/create_lighting_overlays(zlevel = 0)
|
||||
var/area/A
|
||||
if(zlevel == 0) // populate all zlevels
|
||||
for(var/turf/T in world)
|
||||
if(T.dynamic_lighting)
|
||||
A = T.loc
|
||||
if(A.lighting_use_dynamic)
|
||||
var/atom/movable/lighting_overlay/O = PoolOrNew(/atom/movable/lighting_overlay, T)
|
||||
T.lighting_overlay = O
|
||||
|
||||
else
|
||||
for(var/x = 1; x <= world.maxx; x++)
|
||||
for(var/y = 1; y <= world.maxy; y++)
|
||||
var/turf/T = locate(x, y, zlevel)
|
||||
if(T.dynamic_lighting)
|
||||
A = T.loc
|
||||
if(A.lighting_use_dynamic)
|
||||
var/atom/movable/lighting_overlay/O = PoolOrNew(/atom/movable/lighting_overlay, T)
|
||||
T.lighting_overlay = O
|
||||
@@ -1,32 +1,102 @@
|
||||
/turf
|
||||
var/list/affecting_lights
|
||||
var/atom/movable/lighting_overlay/lighting_overlay
|
||||
var/dynamic_lighting = TRUE // Does the turf use dynamic lighting?
|
||||
luminosity = 1
|
||||
|
||||
var/tmp/lighting_corners_initialised = FALSE
|
||||
|
||||
var/tmp/list/datum/light_source/affecting_lights // List of light sources affecting this turf.
|
||||
var/tmp/atom/movable/lighting_overlay/lighting_overlay // Our lighting overlay.
|
||||
var/tmp/list/datum/lighting_corner/corners
|
||||
var/tmp/has_opaque_atom = FALSE // Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile.
|
||||
|
||||
/turf/New()
|
||||
. = ..()
|
||||
|
||||
if(opacity)
|
||||
has_opaque_atom = TRUE
|
||||
|
||||
// Causes any affecting light sources to be queued for a visibility update, for example a door got opened.
|
||||
/turf/proc/reconsider_lights()
|
||||
for(var/datum/light_source/L in affecting_lights)
|
||||
L.vis_update()
|
||||
|
||||
/turf/proc/lighting_clear_overlays()
|
||||
/turf/proc/lighting_clear_overlay()
|
||||
if(lighting_overlay)
|
||||
qdel(lighting_overlay)
|
||||
|
||||
/turf/proc/lighting_build_overlays()
|
||||
for(var/datum/lighting_corner/C in corners)
|
||||
C.update_active()
|
||||
|
||||
// Builds a lighting overlay for us, but only if our area is dynamic.
|
||||
/turf/proc/lighting_build_overlay()
|
||||
if(lighting_overlay)
|
||||
return
|
||||
|
||||
var/area/A = loc
|
||||
if(A.dynamic_lighting)
|
||||
if(!lighting_corners_initialised)
|
||||
generate_missing_corners()
|
||||
|
||||
new /atom/movable/lighting_overlay(src)
|
||||
|
||||
for(var/datum/lighting_corner/C in corners)
|
||||
if(!C.active) // We would activate the corner, calculate the lighting for it.
|
||||
for(var/L in C.affecting)
|
||||
var/datum/light_source/S = L
|
||||
S.recalc_corner(C)
|
||||
|
||||
C.active = TRUE
|
||||
|
||||
// Used to get a scaled lumcount.
|
||||
/turf/proc/get_lumcount(var/minlum = 0, var/maxlum = 1)
|
||||
if(!lighting_overlay)
|
||||
var/area/A = loc
|
||||
if(A.lighting_use_dynamic)
|
||||
var/atom/movable/lighting_overlay/O = PoolOrNew(/atom/movable/lighting_overlay, src)
|
||||
lighting_overlay = O
|
||||
return 1
|
||||
|
||||
//Make the light sources recalculate us so the lighting overlay updates immediately
|
||||
for(var/datum/light_source/L in affecting_lights)
|
||||
L.calc_turf(src)
|
||||
var/totallums = 0
|
||||
for(var/datum/lighting_corner/L in corners)
|
||||
totallums += max(L.lum_r, L.lum_g, L.lum_b)
|
||||
|
||||
/turf/Entered(atom/movable/obj)
|
||||
totallums /= 4 // 4 corners, max channel selected, return the average
|
||||
|
||||
totallums =(totallums - minlum) /(maxlum - minlum)
|
||||
|
||||
return CLAMP01(totallums)
|
||||
|
||||
// Can't think of a good name, this proc will recalculate the has_opaque_atom variable.
|
||||
/turf/proc/recalc_atom_opacity()
|
||||
has_opaque_atom = FALSE
|
||||
for(var/atom/A in src.contents + src) // Loop through every movable atom on our tile PLUS ourselves (we matter too...)
|
||||
if(A.opacity)
|
||||
has_opaque_atom = TRUE
|
||||
|
||||
// If an opaque movable atom moves around we need to potentially update visibility.
|
||||
/turf/Entered(var/atom/movable/Obj, var/atom/OldLoc)
|
||||
. = ..()
|
||||
if(obj && obj.opacity)
|
||||
|
||||
if(Obj && Obj.opacity)
|
||||
has_opaque_atom = TRUE // Make sure to do this before reconsider_lights(), incase we're on instant updates. Guaranteed to be on in this case.
|
||||
reconsider_lights()
|
||||
|
||||
/turf/Exited(atom/movable/obj)
|
||||
/turf/Exited(var/atom/movable/Obj, var/atom/newloc)
|
||||
. = ..()
|
||||
if(obj && obj.opacity)
|
||||
|
||||
if(Obj && Obj.opacity)
|
||||
recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates.
|
||||
reconsider_lights()
|
||||
|
||||
/turf/proc/get_corners()
|
||||
if(has_opaque_atom)
|
||||
return null // Since this proc gets used in a for loop, null won't be looped though.
|
||||
|
||||
return corners
|
||||
|
||||
/turf/proc/generate_missing_corners()
|
||||
lighting_corners_initialised = TRUE
|
||||
if(!corners)
|
||||
corners = list(null, null, null, null)
|
||||
|
||||
for(var/i = 1 to 4)
|
||||
if(corners[i]) // Already have a corner on this direction.
|
||||
continue
|
||||
|
||||
corners[i] = new /datum/lighting_corner(src, LIGHTING_CORNER_DIAGONAL[i])
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#undef LIGHTING_INTERVAL
|
||||
|
||||
#undef LIGHTING_FALLOFF
|
||||
#undef LIGHTING_LAMBERTIAN
|
||||
#undef LIGHTING_HEIGHT
|
||||
|
||||
#undef LIGHTING_RESOLUTION
|
||||
#undef LIGHTING_LAYER
|
||||
#undef LIGHTING_ICON
|
||||
|
||||
#undef LIGHTING_BASE_MATRIX
|
||||
|
||||
@@ -81,6 +81,7 @@ var/list/mining_overlay_cache = list()
|
||||
|
||||
/turf/simulated/mineral/proc/update_general()
|
||||
update_icon(1)
|
||||
recalc_atom_opacity()
|
||||
if(ticker && ticker.current_state == GAME_STATE_PLAYING)
|
||||
reconsider_lights()
|
||||
if(air_master)
|
||||
|
||||
@@ -4,12 +4,7 @@
|
||||
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
|
||||
if(isturf(loc)) //else, there's considered to be no light
|
||||
var/turf/T = loc
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = 2 * (min(5,L.lum_r + L.lum_g + L.lum_b) - 2.5) //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 5
|
||||
|
||||
light_amount = T.get_lumcount() * 5
|
||||
|
||||
nutrition += light_amount
|
||||
|
||||
|
||||
@@ -817,11 +817,7 @@
|
||||
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
|
||||
if(isturf(loc)) //else, there's considered to be no light
|
||||
var/turf/T = loc
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 2 //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 10
|
||||
light_amount = T.get_lumcount() * 10
|
||||
nutrition += light_amount
|
||||
traumatic_shock -= light_amount
|
||||
|
||||
@@ -840,11 +836,7 @@
|
||||
var/light_amount = 0
|
||||
if(isturf(loc))
|
||||
var/turf/T = loc
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L)
|
||||
light_amount = L.lum_r + L.lum_g + L.lum_b //hardcapped so it's not abused by having a ton of flashlights
|
||||
else
|
||||
light_amount = 10
|
||||
light_amount = T.get_lumcount() * 10
|
||||
if(light_amount > species.light_dam) //if there's enough light, start dying
|
||||
take_overall_damage(1,1)
|
||||
else //heal in the dark
|
||||
@@ -1358,8 +1350,7 @@
|
||||
//0.1% chance of playing a scary sound to someone who's in complete darkness
|
||||
if(isturf(loc) && rand(1,1000) == 1)
|
||||
var/turf/T = loc
|
||||
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
|
||||
if(L && L.lum_r + L.lum_g + L.lum_b == 0)
|
||||
if(T.get_lumcount() <= LIGHTING_SOFT_THRESHOLD)
|
||||
playsound_local(src,pick(scarySounds),50, 1, -1)
|
||||
|
||||
/mob/living/carbon/human/handle_stomach()
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
|
||||
if("halt")
|
||||
if (istype(module,/obj/item/weapon/robot_module/robot/security))
|
||||
message = "<B>[src]</B>'s speakers skreech, \"Halt! Security!\"."
|
||||
message = "<B>'s</B> speakers skreech, \"Halt! Security!\"."
|
||||
|
||||
playsound(src.loc, 'sound/voice/halt.ogg', 50, 0)
|
||||
m_type = 2
|
||||
|
||||
@@ -1017,3 +1017,47 @@ mob/proc/yank_out_object()
|
||||
/mob/proc/is_muzzled()
|
||||
return 0
|
||||
|
||||
|
||||
/client/proc/check_has_body_select()
|
||||
return mob && mob.hud_used && istype(mob.zone_sel, /obj/screen/zone_sel)
|
||||
|
||||
/client/verb/body_toggle_head()
|
||||
set name = "body-toggle-head"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_HEAD, O_EYES, O_MOUTH))
|
||||
|
||||
/client/verb/body_r_arm()
|
||||
set name = "body-r-arm"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_R_ARM,BP_R_HAND))
|
||||
|
||||
/client/verb/body_l_arm()
|
||||
set name = "body-l-arm"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_L_ARM,BP_L_HAND))
|
||||
|
||||
/client/verb/body_chest()
|
||||
set name = "body-chest"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_TORSO))
|
||||
|
||||
/client/verb/body_groin()
|
||||
set name = "body-groin"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_GROIN))
|
||||
|
||||
/client/verb/body_r_leg()
|
||||
set name = "body-r-leg"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_R_LEG,BP_R_FOOT))
|
||||
|
||||
/client/verb/body_l_leg()
|
||||
set name = "body-l-leg"
|
||||
set hidden = 1
|
||||
toggle_zone_sel(list(BP_L_LEG,BP_L_FOOT))
|
||||
|
||||
/client/proc/toggle_zone_sel(list/zones)
|
||||
if(!check_has_body_select())
|
||||
return
|
||||
var/obj/screen/zone_sel/selector = mob.zone_sel
|
||||
selector.set_selected_zone(next_in_list(mob.zone_sel.selecting,zones))
|
||||
@@ -1090,11 +1090,13 @@
|
||||
name = "Color Patches"
|
||||
icon_state = "patches"
|
||||
body_parts = list(BP_L_FOOT,BP_R_FOOT,BP_L_LEG,BP_R_LEG,BP_L_ARM,BP_R_ARM,BP_L_HAND,BP_R_HAND,BP_TORSO,BP_GROIN)
|
||||
species_allowed = list("Tajara")
|
||||
|
||||
patchesface
|
||||
name = "Color Patches (Face)"
|
||||
icon_state = "patchesface"
|
||||
body_parts = list(BP_HEAD)
|
||||
species_allowed = list("Tajara")
|
||||
|
||||
bands
|
||||
name = "Color Bands"
|
||||
|
||||
@@ -492,7 +492,7 @@ This function completely restores a damaged organ to perfect condition.
|
||||
|
||||
//Burn damage can cause fluid loss due to blistering and cook-off
|
||||
if((damage > 5 || damage + burn_dam >= 15) && type == BURN && (robotic < ORGAN_ROBOT))
|
||||
var/fluid_loss = (damage/(owner.maxHealth - config.health_threshold_dead)) * owner.species.blood_volume*(1 - BLOOD_VOLUME_SURVIVE/100)
|
||||
var/fluid_loss = 0.75 * (damage/(owner.maxHealth - config.health_threshold_dead)) * owner.species.blood_volume*(1 - BLOOD_VOLUME_SURVIVE/100)
|
||||
owner.remove_blood(fluid_loss)
|
||||
|
||||
// first check whether we can widen an existing wound
|
||||
|
||||
@@ -36,7 +36,12 @@
|
||||
if(weather_holder)
|
||||
weather_holder.process()
|
||||
|
||||
// Returns the time datum of Sif.
|
||||
/proc/get_sif_time()
|
||||
if(planet_sif)
|
||||
return planet_sif.current_time
|
||||
/datum/planet/proc/update_sun_deferred(var/new_range, var/new_brightness, var/new_color)
|
||||
set background = 1
|
||||
set waitfor = 0
|
||||
var/i = 0
|
||||
for(var/turf/simulated/floor/T in outdoor_turfs)
|
||||
T.set_light(new_range, new_brightness, new_color)
|
||||
i++
|
||||
if(i % 30 == 0)
|
||||
sleep(1)
|
||||
|
||||
@@ -13,6 +13,7 @@ var/datum/planet/sif/planet_sif = null
|
||||
|
||||
/datum/planet/sif/New()
|
||||
..()
|
||||
planet_sif = src
|
||||
weather_holder = new /datum/weather_holder/sif(src) // Cold weather is also nice.
|
||||
|
||||
// This code is horrible.
|
||||
@@ -95,12 +96,11 @@ var/datum/planet/sif/planet_sif = null
|
||||
spawn(1)
|
||||
update_sun_deferred(2, new_brightness, new_color)
|
||||
|
||||
/datum/planet/proc/update_sun_deferred(var/new_range, var/new_brightness, var/new_color)
|
||||
set background = 1
|
||||
set waitfor = 0
|
||||
var/i = 0
|
||||
for(var/turf/simulated/floor/T in outdoor_turfs)
|
||||
T.set_light(new_range, new_brightness, new_color)
|
||||
i++
|
||||
if(i % 30 == 0)
|
||||
sleep(1)
|
||||
// We're gonna pretend there are 32 hours in a Sif day instead of 32.64 for the purposes of not losing sanity. We lose 38m 24s but the alternative is a path to madness.
|
||||
/datum/time/sif
|
||||
seconds_in_day = 60 * 60 * 32 * 10 // 115,200 seconds. If we did 32.64 hours/day it would be around 117,504 seconds instead.
|
||||
|
||||
// Returns the time datum of Sif.
|
||||
/proc/get_sif_time()
|
||||
if(planet_sif)
|
||||
return planet_sif.current_time
|
||||
|
||||
@@ -70,7 +70,3 @@
|
||||
answer = replacetext(answer, "mm", minute_text)
|
||||
answer = replacetext(answer, "ss", second_text)
|
||||
return answer
|
||||
|
||||
// We're gonna pretend there are 32 hours in a Sif day instead of 32.64 for the purposes of not losing sanity. We lose 38m 24s but the alternative is a path to madness.
|
||||
/datum/time/sif
|
||||
seconds_in_day = 60 * 60 * 32 * 10 // 115,200 seconds. If we did 32.64 hours/day it would be around 117,504 seconds instead.
|
||||
@@ -70,11 +70,11 @@
|
||||
|
||||
// Create a decorative ramp bottom and flatten out our current ramp.
|
||||
density = 0
|
||||
opacity = 0
|
||||
set_opacity(0)
|
||||
icon_state = "ramptop"
|
||||
var/obj/structure/droppod_door/door_bottom = new(T)
|
||||
door_bottom.deployed = 1
|
||||
door_bottom.density = 0
|
||||
door_bottom.opacity = 0
|
||||
door_bottom.set_opacity(0)
|
||||
door_bottom.dir = src.dir
|
||||
door_bottom.icon_state = "rampbottom"
|
||||
@@ -134,7 +134,7 @@
|
||||
if(rag)
|
||||
var/underlay_image = image(icon='icons/obj/drinks.dmi', icon_state=rag.on_fire? "[rag_underlay]_lit" : rag_underlay)
|
||||
underlays += underlay_image
|
||||
copy_light(rag)
|
||||
set_light(rag.light_range, rag.light_power, rag.light_color)
|
||||
else
|
||||
set_light(0)
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
playsound(src.loc, 'sound/effects/EMPulse.ogg', 75, 1)
|
||||
|
||||
check_failure()
|
||||
opacity = 1
|
||||
spawn(20) if(src) opacity = 0
|
||||
set_opacity(1)
|
||||
spawn(20) if(!deleted(src)) set_opacity(0)
|
||||
|
||||
..()
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
health -= Proj.get_structure_damage()
|
||||
..()
|
||||
check_failure()
|
||||
opacity = 1
|
||||
spawn(20) if(src) opacity = 0
|
||||
set_opacity(1)
|
||||
spawn(20) if(!deleted(src)) set_opacity(0)
|
||||
|
||||
/obj/machinery/shield/ex_act(severity)
|
||||
switch(severity)
|
||||
@@ -113,8 +113,8 @@
|
||||
check_failure()
|
||||
|
||||
//The shield becomes dense to absorb the blow.. purely asthetic.
|
||||
opacity = 1
|
||||
spawn(20) if(src) opacity = 0
|
||||
set_opacity(1)
|
||||
spawn(20) if(!deleted(src)) set_opacity(0)
|
||||
|
||||
..()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user