Reverted r3944, with the exception of stock_parts.dmi

Fixed issue 605.

Committing minor adjustments to watercloset.dm and paperbin.dm too!

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3947 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
petethegoat@gmail.com
2012-06-29 15:56:51 +00:00
parent feeb0fa395
commit 7f5de70b91
15 changed files with 654 additions and 293 deletions

View File

@@ -28,11 +28,9 @@
requires_power = 1
always_unpowered = 1
sd_SetLuminosity(1)
sd_lighting = 0
power_light = 0
power_equip = 0
power_environ = 0
luminosity = 1
//has_gravity = 0 // Space has gravity. Because.. because.
if(!requires_power)
@@ -42,8 +40,7 @@
luminosity = 1
sd_lighting = 0 // *DAL*
else
if(name != "Space")
luminosity = 0
luminosity = 0
area_lights_luminosity = rand(6,9)
//sd_SetLuminosity(0) // *DAL*

View File

@@ -138,9 +138,6 @@ datum/controller/game_controller
sun.calc_position()
sun_ready = 1
spawn(0)
sd_Update()
sleep(-1)
spawn(0)

View File

@@ -177,13 +177,11 @@ var/global/list/obj/item/device/pda/PDAs = list()
if (fon)
sd_SetLuminosity(0)
user.total_luminosity += f_lum
sd_Update()
/obj/item/device/pda/dropped(mob/user)
if (fon)
user.total_luminosity -= f_lum
sd_SetLuminosity(f_lum)
sd_Update()
/obj/item/device/pda/New()
..()

View File

@@ -85,14 +85,12 @@
if(on)
user.total_luminosity += brightness_on
src.sd_SetLuminosity(0)
sd_Update()
/obj/item/device/flashlight/dropped(mob/user)
if(on)
user.total_luminosity -= brightness_on
src.sd_SetLuminosity(brightness_on)
sd_Update()
/obj/item/device/flashlight/pen

View File

@@ -144,7 +144,7 @@
wash(M)
check_heat(M)
/obj/machinery/shower/attackby(var/obj/item/I as obj, var/mob/user as mob)
/obj/machinery/shower/attackby(obj/item/I as obj, mob/user as mob)
if(I.type == /obj/item/device/analyzer)
user << "<span class='notice'>The water temperature seems to be [watertemp].</span>"
if(istype(I, /obj/item/weapon/wrench))
@@ -312,7 +312,7 @@
for(var/mob/V in viewers(src, null))
V.show_message("\blue [M] washes their hands using \the [src].")
/obj/structure/sink/attackby(var/obj/item/O as obj, var/mob/user as mob)
/obj/structure/sink/attackby(obj/item/O as obj, mob/user as mob)
if(busy)
user << "\red Someone's already washing here."
return
@@ -383,7 +383,7 @@
..()
icon_state = "puddle"
/obj/structure/sink/puddle/attackby(var/obj/item/O as obj, var/mob/user as mob)
/obj/structure/sink/puddle/attackby(obj/item/O as obj, mob/user as mob)
icon_state = "puddle-splash"
..()
icon_state = "puddle"

View File

@@ -94,8 +94,8 @@
if(client) client.screen -= l_hand
l_hand.layer = initial(l_hand.layer)
if(Target) l_hand.Move(Target.loc)
else l_hand.Move(loc)
if(Target) l_hand.loc = Target.loc
else l_hand.loc = loc
var/turf/T = get_turf(loc)
if(isturf(T))
@@ -113,8 +113,8 @@
if(client) client.screen -= r_hand
r_hand.layer = initial(r_hand.layer)
if(Target) r_hand.Move(Target.loc)
else r_hand.Move(loc)
if(Target) r_hand.loc = Target.loc
else r_hand.loc = loc
var/turf/T = get_turf(Target)
if(istype(T))

View File

@@ -46,9 +46,8 @@
P.loc = user.loc
if(ishuman(user))
if(!user.get_active_hand())
user.put_in_hands(P)
user << "You take a paper out of the bin."
user.put_in_hands(P)
user << "You take a paper out of the bin."
else
P.loc = get_turf_loc(src)
user << "You take a paper out of the bin."

View File

@@ -1,163 +1,580 @@
// ROBUST LIGHTING
// Made by Tobba, submitted to #coderbus vultures
// CREDITS TO WHOEVER THE FUCK WROTE THAT PEICE OF SHIT THAT IS SD LIGHITING THAT I RIPPED APART AND MADE ACTUALLY WORK
/* Overview of sd_DynamicAreaLighting as modified for SS13
*
*
* Use sd_SetLuminosity(value) to change the luminosity of an atom
* rather than setting the luminosity var directly.
* Avoid having luminous objects at compile-time since this can mess up
* the lighting system during map load. Instead use sd_SetLuminosity() in
* the atom's New() proc after a small spawn delay.
*
* Use sd_SetOpacity(value) to change the opacity of an atom (e.g. doors)
* rather than setting the opacity var directly. This ensures that lighting
* will be blocked/unblocked as necessary.
*
* If creating a new opaque atom (e.g. a wall) at runtime, create the atom,
* set its opacity var to zero, then perform sd_SetOpacity(1)
* e.g.:
*
* var/obj/block/B = new(loc)
* B.opacity = 0
* B.sd_SetOpacity(1)
*
*
* The library creates multiple instances of each /area to split a mapped area
* into different lighting levels. Each area created has a "master" variable
* which is a reference to the original un-split area, and a "related" variable
* which is a reference to the list of split areas.
*/
/********************************************************************\
sd_DynamicAreaLighting.dm
Shadowdarke (shadowdarke@hotmail.com)
December 12, 2002
The sd_DynamicAreaLighting library provides dynamic lighting
with minimal cpu and bandwidth usage by shifting turfs between
five areas which represent varying shades of darkness.
**********************************************************************
Using sd_DynamicAreaLighting
This library uses BYOND's built in luminousity variable. In most
cases, all you have to do is set luminosity and let the library
worry about the work.
There are three cases that the library does not automatically
compensate for, so you will need to use library procs:
1) Luminosity changes at run time.
If your program makes changes in luminosity while it is
running, you need to use sd_SetLuminosity(new_luminosity)
so the library can remove the effect of the old luminosity
and apply the new effect.
2) Opacity changes at run time.
As with luminosity changes, you need to use
sd_SetOpacity(new_opacity) if your program changes the opacity
of atoms at runtime.
3) New atoms that change the opacity of a location.
This is somewhat more complex, and the library doesn't
have a simple proc to take care of it yet. You should use
sd_StripLocalLum() to strip the luminosity effect of
anything shining on that space, create the new atom, then
use sd_ApplyLocalLum() to reapply the luminosity effect.
Examine the sd_SetOpacity() proc for an example of the
procedure.
All areas will automatically use the sd_DynamicAreaLighting
library when it is included in your project. You may disable
lighting effect in an area by specifically setting the area's
sd_lighting var to 0. For example:
area/always_lit
luminosity = 1
sd_lighting = 0
This library chops areas into 5 separate areas of differing
light effect, so you may want to modify area Enter(), Exit(),
Entered(), and Exited() procs to make sure the atom has moved
from a different area instead of a different light zone of the
same area.
IMPORTANT NOTE: Since sd_DynamicAreaLighting uses the view()
proc, large luminosity settings may cause strange effect. You
should limit luminosity to (world.view * 2) or less.
----------------------------------------------------------------------
CUSTOM DARKNESS ICONS
sd_DynamicAreaLighting was designed in a barbaric age when BYOND
did not support alpha transperency. Thankfully that age is over.
I left the old icon as the default, since not everyone has
upgraded to BYOND 4.0 or in some cases like software graphics
mode, in which case the old dithered icon is the better choice.
The dithered icon used 4 standard dithers for the darkness shades
and I saw little reason to allow variation. Starting with sd_DAL
version 10, the library can support more or less shades of
darkness as well.
To change the icon and/or number of shades of darkness for your
game, just call the sd_SetDarkIcon(dark_icon, num_shades) proc,
where dark_icon is the new icon and num_shades is the number of
shades of darkness in the icon. This is best done in the
world.New() proc, to set it once for the entire game instance.
For example, to make the included 7 shade alpha transparency icon
your game's darkness icon, use the following code in your game.
world
New()
..()
sd_SetDarkIcon('sd_dark_alpha7.dmi', 7)
There are several demo icons included with this library:
sd_darkstates.dmi - the original 4 shade dithered icon
sd_dark_dither3.dmi - 3 shade dithered icon
sd_dark_alpha4.dmi - 4 shade alpha transparency icon
sd_dark_alpha4b.dmi - lighter version 4 shade alpha
transparency icon
sd_dark_alpha7.dmi - 7 shade alpha transparency icon
If you want to design your own custom darkness icons, they
have to follow a specific format for the library to use them
properly. The shades of darkness should have be numbered from 0
as the darkest shade to the number of shades minus one as the
lightest shade.
For example, the four shade 4 shade transparent icon
sd_dark_alpha4.dmi has 4 icon states:
"0" is black with 204 alpha (80% darkness)
"1" is black with 153 alpha (60% darkness)
"2" is black with 102 alpha (40% darkness)
"3" is black with 51 alpha (20% darkness)
The lightest shade ("3" in this case) is NOT completely clear.
There will be no darkness overlay for completely lit areas. The
lightest shade will only be used for places that are just beginning
to get dark.
The darkest shade ("0") likewise is not 100% obscured. "0" will
be used in completely dark areas, but by leaving it slightly
transparent, characters will be able to barely make out their
immediate surroundings in the darkness (based on the mob
see_in_dark var.) You might prefer to lighten the darkness for
this purpose, like in demo icon sd_dark_alpha4b.dmi.
----------------------------------------------------------------------
DAY/NIGHT CYCLES
sd_DynamicAreaLighting allows for separate indoor and outdoor
lighting. Areas used for outdoor light cycles should be
designated by setting the area's sd_outside var to 1. For example:
area/outside
sd_outside = 1
You will need to write your own routine for the day/night
cycle so that you can control the timing and degree of lighting
changes. There is an example routine in lightingdemo.dm.
After your routine determines the amount of light outdoors,
call sd_OutsideLight(light_level) to update the light levels in
all outside areas. light_level should be a value from 0 to
sd_dark_shades, where 0 is darkest and sd_dark_shades is full
light.
The sd_OutsideLight() proc does not automatically detect a
range out of bounds in case you want to use nonstandard values
for interesting effect. For instance, you could use a negative
value to dampen light sources.
If you want daylight to spill indoors:
You will need to add turfs to sd_light_spill_turfs. The
library will automatically add any turf created with
sd_light_spill set, or you may add the turfs yourself at
runtime.
The turfs in this list act as a source of daylight, shining
into the any areas that are not flagged with sd_outside.
**********************************************************************
LIBRARY PROCS:
Except in the cases noted above, you shouldn't need to use the procs
in this library. This reference is provided for advanced users.
Global vars and procs:
var
sd_dark_icon
This is the icon used for the darkness in your world.
DEFAULT VALUE: 'sd_darkstates.dmi' (A dithered icon
designed for BYOND releases before 4.0.)
sd_dark_shades
The number of darkness icon states in your sd_dark_icon.
DEFAULT VALUE: 4
sd_light_layer
The graphic layer that darkness overlays appear on.
This should be higher than anything on the map, but
lower than any HUD displays.
DEFAULT VALUE: 50
sd_light_outside
This var is how bright it currently is outside. It
should be a number between 0 and sd_dark_shades.
DEFAULT VALUE: 0
sd_top_luminosity
keeps track of the highest luminosity in the world to
prevent getting larger lists than necessary.
list/sd_outside
A list of outside areas.
list/sd_light_spill_turfs
A list of turfs where light spills from outside areas into
inside areas.
proc/sd_OutsideLight(n as num)
Changes the level of light outside (sd_light_outside) to n
and updates all the atoms in sd_outside.
proc/sd_SetDarkIcon(icon, shades)
Changes the darkness icon and the number shades of darkness
in that icon.
All atoms have the following procs:
sd_ApplyLum(list/V = view(luminosity,src), center = src)
This proc adds a value to the sd_lumcount of all the
turfs in V, depending on src.luminosity and the
distance between the turf and center.
sd_StripLum(list/V = view(luminosity,src), center = src)
The reverse of sd_ApplyLum(), sd_StripLum removes luminosity
effect.
sd_ApplyLocalLum(list/affected = viewers(20,src))
Applies the lighting effect of all atoms in affected. This
proc is used with sd_StripLocalLum() for effect that may
change the opacity of a turf.
sd_StripLocalLum()
Strips effect of all local luminous atoms.
RETURNS: list of all the luminous atoms stripped
IMPORTANT! Each sd_StripLocalLum() call should have a matching
sd_ApplyLocalLum() to restore the local effect.
sd_SetLuminosity(new_luminosity as num)
Sets the atom's luminosity, making adjustments to the
sd_lumcount of local turfs.
sd_SetOpacity(new_opacity as num)
Sets the atom's opacity, making adjustments to the
sd_lumcount of local turfs.
Areas have one additional proc and 4 variables:
var
sd_lighting
Turn this flag off to prevent sd_DynamicAreaLighting
from effecting this area.
DEFAULT VALUE: 1 (allow dynamic lighting)
sd_outside
Set this flag to automatically add this area to the
list of outside areas.
DEAFAULT VALUE: 0 (not an outside area)
sd_light_level
The current light level of the area. You should use
the sd_LightLevel() proc to set this value, so the
darkness overlays will be changed as well.
DEFAULT VALUE: 0
sd_darkimage
Tracks the darkness image of the area for easy
removal in the sd_LightLevel() proc
proc
sd_LightLevel(level = sd_light_level as num,keep = 1)
Updates the darkness overlay of the area.
If keep = 1, it also updates the area's
sd_light_level var.
Turfs have these additional procs and vars:
var
sd_lumcount
Used to track the brightness of a turf.
sd_light_spill
If set, the turf will automatically be added to the
global list sd_light_spill_turfs when created.
DEFAULT VALUE: 0
proc
sd_LumUpdate()
Places the turf in the appropriate sd_dark area,
depending on its brightness (sd_lumcount).
sd_LumReset()
Resets a turf's lumcount by stripping local luminosity,
zeroing the lumcount, then reapplying local luminosity.
sd_ApplySpill()
Applies to effect of daylight spilling into inside
areas in view of this turf.
sd_StripSpill()
Removes to effect of daylight spilling into inside
areas in view of this turf.
\********************************************************************/
var
sd_dark_icon = 'ss13_dark_alpha7.dmi' // icon used for darkness
sd_dark_shades = 7 // number of icon state in sd_dark_icon
sd_light_layer = 10 // graphics layer for light effect
sd_light_outside = 0 // how bright it is outside
sd_top_luminosity = 0
// since we're not using these, comment out all occurances to save CPU
/*
list
sd_FastRoot = list()
sd_OpacityUpdates = list()
sd_ToUpdate = list()
sd_outside_areas = list() // list of outside areas
sd_light_spill_turfs = list() // list of turfs to calculate light spill from
*/
// slog = file("DALlog.txt")
/*
proc
sd_Update()
var/list/blankList = list()
for (var/atom/Affected in sd_OpacityUpdates)
var/oldOpacity = sd_OpacityUpdates[Affected]
var/newOpacity = Affected.opacity
Affected.opacity = oldOpacity
for (var/atom/A in view(sd_top_luminosity, Affected))
if (!isarea(A) && A.luminosity > 0 && !blankList[A])
blankList[A] = 1
A.sd_StripLum()
Affected.opacity = newOpacity
for (var/atom/Affected in blankList)
Affected.sd_ApplyLum()
for (var/i = 1; i <= sd_ToUpdate.len; i++)
var/turf/Affected = sd_ToUpdate[i]
if (!istype(Affected))
continue
Affected.sd_LumUpdate()
sd_OutsideLight(n as num)
// set the brightness of the outside sunlight
if(sd_light_outside == n) return // same level, no update
if(sd_light_outside)
for(var/turf/T in sd_light_spill_turfs)
T.sd_StripSpill()
sd_light_outside = n
// make all the outside areas update themselves
for(var/area/A in sd_outside_areas)
A.sd_LightLevel(sd_light_outside + A.sd_light_level,0)
if(n)
for(var/turf/T in sd_light_spill_turfs)
T.sd_ApplySpill()
*/
proc
sd_SetDarkIcon(icon, shades)
// reset the darkness icon and number of shades of darkness
sd_dark_icon = icon
sd_dark_shades = shades
// change existing areas
for(var/area/A)
if(A.sd_darkimage) A.sd_LightLevel(A.sd_light_level,0)
sd_ToUpdate.len = 0
sd_OpacityUpdates.len = 0
atom
New()
..()
// if this is not an area and is luminous
if(!isarea(src)&&(luminosity>0))
spawn(1) // delay to allow map load
sd_ApplyLum()
Del()
// if this is not an area and is luminous
if(!isarea(src) && luminosity > 0)
sd_StripLum(,,1)
if(!isarea(src)&&(luminosity>0))
sd_StripLum()
..()
var
sd_ColorRed = 0.9
sd_ColorGreen = 0.9
sd_ColorBlue = 0.9
proc
sd_ApplyLum(list/V = view(luminosity, src), center = src, updateMode = 0)
if (isarea(src))
return
if(src.luminosity > sd_top_luminosity)
sd_ApplyLum(list/V = view(luminosity,src), center = src)
if(src.luminosity>sd_top_luminosity)
sd_top_luminosity = src.luminosity
var/list/affected = list()
var
d = max(sd_ColorRed, sd_ColorGreen, sd_ColorBlue)
r = sd_ColorRed / d
g = sd_ColorGreen / d
b = sd_ColorBlue / d
// loop through all the turfs in V
for(var/turf/T in V)
var/falloff = 0
if (luminosity > 0)
falloff = sd_FalloffAmount(T)
/* increase the turf's brightness depending on the
brightness and distance of the lightsource */
T.sd_lumcount += (luminosity-get_dist(center,T))
// update the turf's area
if (falloff > luminosity)
continue;
falloff = (luminosity - falloff) / luminosity
T.sd_LightsAlpha[src] = falloff * d
T.sd_LightsRed[src] = r
T.sd_LightsGreen[src] = g
T.sd_LightsBlue[src] = b
if (updateMode == 0)
sd_ToUpdate[T] = 1
else
T.sd_LumUpdate()
affected += T
return affected
//
//if(T.tag == "sdd")
// slog << "\red lc+([luminosity-get_dist(center,T)]) from [center] ([center:x],[center:y])"
// slog << "now [T.sd_lumcount]"
sd_StripLum(list/V = view(luminosity,src), center = src, updateMode = 0)
if (isarea(src))
return
var/list/affected = list()
T.sd_LumUpdate()
sd_StripLum(list/V = view(luminosity,src), center = src)
// loop through all the turfs in V
for(var/turf/T in V)
T.sd_LightsAlpha -= src
T.sd_LightsRed -= src
T.sd_LightsGreen -= src
T.sd_LightsBlue -= src
if (updateMode == 0)
sd_ToUpdate[T] = 1
else
T.sd_LumUpdate()
affected += T
return affected
/* increase the turf's brightness depending on the
brightness and distance of the lightsource */
T.sd_lumcount -= (luminosity-get_dist(center,T))
sd_FalloffAmount(var/atom/ref) // Borrowed from Ultralight
var/x = (ref.x - src.x)
var/y = (ref.y - src.y)
if ((x*x + y*y + 1) > sd_FastRoot.len)
for(var/i = sd_FastRoot.len, i <= x*x+y*y, i++)
sd_FastRoot += sqrt(x*x+y*y) - 0.5
return round(sd_FastRoot[x*x + y*y + 1], 1)
//if(T.tag == "sdd")
// slog << "\red lc-([luminosity-get_dist(center,T)]) from [center] ([center:x],[center:y])"
// slog << "now [T.sd_lumcount]"
// update the turf's area
T.sd_LumUpdate()
sd_ApplyLocalLum(list/affected = view(sd_top_luminosity,src))
// Reapplies the lighting effect of all atoms in affected.
for(var/atom/A in affected)
if(A.luminosity) A.sd_ApplyLum()
//if(sd_light_outside && (A in sd_light_spill_turfs))
// A:sd_ApplySpill()
sd_StripLocalLum()
/* strips all local luminosity
RETURNS: list of all the luminous atoms stripped
IMPORTANT! Each sd_StripLocalLum() call should have a matching
sd_ApplyLocalLum() to restore the local effect. */
var/list/affected = list()
for(var/atom/A in view(sd_top_luminosity,src))
if(A.luminosity)
var/turfflag = (isturf(src)?1:0)
if(A.luminosity && (get_dist(src,A) <= A.luminosity + turfflag))
A.sd_StripLum()
affected += A
//if(sd_light_outside && (A in sd_light_spill_turfs))
// A:sd_StripSpill()
// affected += A
return affected
sd_SetLuminosity(new_luminosity as num)
if (luminosity == new_luminosity)
return
/* This proc should be called everytime you want to change the
luminosity of an atom instead of setting it directly.
if(luminosity > 0)
new_luminosity is the new value for luminosity. */
if(luminosity>0)
sd_StripLum()
luminosity = new_luminosity
if(luminosity > 0)
if(luminosity>0)
sd_ApplyLum()
sd_SetColor(r as num, g as num, b as num)
sd_StripLum()
sd_ColorRed = r
sd_ColorGreen = g
sd_ColorBlue = b
sd_ApplyLum()
sd_SetOpacity(new_opacity as num)
if (opacity != new_opacity)
sd_OpacityUpdates[src] = opacity
/* if(opacity != new_opacity)
var/list/affected = sd_StripLocalLum()
opacity = new_opacity
sd_Update()
sd_ApplyLocalLum(affected) */
if(opacity == (new_opacity ? 1 : 0)) return
var
list
affected = new
//spill
atom/A
turf
T
ATurf
affected = new
for(A in range(sd_top_luminosity,src))
T = A
while(T && !istype(T)) T = T.loc
if(T)
var/list/V = view(A.luminosity,T)
if(!(src in V)) continue
var/turfflag = 0
if(A == T) turfflag = 1
if(A.luminosity && get_dist(A,src)<=A.luminosity+turfflag)
affected[A] = V
//if(sd_light_outside && (A in sd_light_spill_turfs))
// if(!spill) spill=new
// spill[A] = view(sd_light_outside, T)
opacity = new_opacity
if(opacity)
for(A in affected)
ATurf = A
while(ATurf && !istype(ATurf)) ATurf = ATurf.loc
if(ATurf)
for(T in affected[A]-view(A.luminosity, ATurf))
T.sd_lumcount -= (A.luminosity-get_dist(A,T))
//if(T.tag == "sdd")
// slog << "\red lc(1)-([A.luminosity-get_dist(A,T)]) from [A] ([A.x],[A.y])"
// slog << "now [T.sd_lumcount]"
T.sd_LumUpdate()
/*
for(A in spill)
if(A.opacity && A!=src) continue
ATurf = A
while(ATurf && !istype(ATurf)) ATurf = ATurf.loc
if(ATurf)
//spill[A] -= view(sd_light_outside, A)
for(T in (A==src)?spill[A]:(spill[A]-view(sd_light_outside,ATurf)))
if(T.loc:sd_outside) continue
T.sd_lumcount -= (sd_light_outside-get_dist(A,T))
//if(T.tag == "sdd")
// slog << "\red lc(O)-([sd_light_outside-get_dist(A,T)]) from [A] ([A:x],[A:y])"
// slog << "now [T.sd_lumcount]"
T.sd_LumUpdate()
*/
// end new_opacity = 1 block
else
for(A in affected)
ATurf = A
while(ATurf && !istype(ATurf)) ATurf = ATurf.loc
if(ATurf)
for(T in view(A.luminosity, ATurf) - affected[A])
T.sd_lumcount += (A.luminosity-get_dist(A,T))
//if(T.tag == "sdd")
// slog << "\red lc(1)+([A.luminosity-get_dist(A,T)]) from [A] ([A.x],[A.y])"
// slog << "now [T.sd_lumcount]"
T.sd_LumUpdate()
/*
for(A in spill)
if(A.opacity) continue
ATurf = A
while(ATurf && !istype(ATurf)) ATurf = ATurf.loc
if(ATurf)
for(T in (A==src)?spill[A]:(view(sd_light_outside, ATurf)-spill[A]))
if(T.loc:sd_outside) continue
T.sd_lumcount += (sd_light_outside-get_dist(A,T))
//if(T.tag == "sdd")
// slog << "\red lc(O)+([sd_light_outside-get_dist(A,T)]) from [A] ([A:x],[A:y])"
// slog << "now [T.sd_lumcount]"
T.sd_LumUpdate()
*/
// end new_opacity = 0 block
///
sd_NewOpacity(var/new_opacity)
sd_SetOpacity(new_opacity)
if(opacity != new_opacity)
var/list/affected = sd_StripLocalLum()
opacity = new_opacity
var/atom/T = src
while(T && !isturf(T))
T = T.loc
if(T)
T:sd_lumcount = 0
sd_ApplyLocalLum(affected)
///
turf
var
// set to 1 to have outside light spill indoors from this turf
sd_light_spill = 0
tmp
list
sd_LightsAlpha = list()
sd_LightsRed = list()
sd_LightsGreen = list()
sd_LightsBlue = list()
sd_LevelRed = 0
sd_LevelGreen = 0
sd_LevelBlue = 0
sd_lumcount = 0
sd_lumcount = 0 // the brightness of the turf
proc
sd_LumReset()
/* Clear local lum, reset this turf's sd_lumcount, and
re-apply local lum*/
var/list/affected = sd_StripLocalLum()
sd_lumcount = 0
//if(src.tag == "sdd")
// slog << "\red lc(LR)=0"
sd_ApplyLocalLum(affected)
sd_LumUpdate()
@@ -165,72 +582,88 @@ turf
var/area/Loc = loc
if(!istype(Loc) || !Loc.sd_lighting) return
var/light_r = 0
var/light_g = 0
var/light_b = 0
// change the turf's area depending on its brightness
// restrict light to valid levels
var/light = min(max(sd_lumcount,0),sd_dark_shades)
var/ltag = copytext(Loc.tag,1,findtext(Loc.tag,"sd_L")) + "sd_L[light]"
sd_LevelRed = 0
sd_LevelGreen = 0
sd_LevelBlue = 0
var/alpha = 0
for (var/i = 1; i <= sd_LightsAlpha.len; i++)
var/a = sd_LightsAlpha[sd_LightsAlpha[i]]
var/r = sd_LightsRed[sd_LightsRed[i]]
var/g = sd_LightsGreen[sd_LightsGreen[i]]
var/b = sd_LightsBlue[sd_LightsBlue[i]]
alpha = 1 - ((1 - a) * (1 - alpha))
sd_LevelRed += r * a
sd_LevelGreen += g * a
sd_LevelBlue += b * a
if (src.density > 0)
var/a = (sd_LevelRed + sd_LevelGreen + sd_LevelBlue)/3
sd_LevelRed = a
sd_LevelGreen = a
sd_LevelBlue = a
var/d = max(sd_LevelRed, sd_LevelGreen, sd_LevelBlue)
if (d > 0)
sd_LevelRed /= d
sd_LevelGreen /= d
sd_LevelBlue /= d
else
sd_LevelRed = 1
sd_LevelGreen = 1
sd_LevelBlue = 1
sd_LevelRed *= alpha
sd_LevelGreen *= alpha
sd_LevelBlue *= alpha
light_r = round(sd_LevelRed * 7)
light_g = round(sd_LevelGreen * 7)
light_b = round(sd_LevelBlue * 7)
sd_lumcount = light_r + light_g + light_b
var/ltag = copytext(Loc.tag,1,findtext(Loc.tag,"sd_L")) + "sd_L[light_r]-[light_g]-[light_b]"
if (Loc.tag != ltag)
var/area/A = locate(ltag)
if(Loc.tag!=ltag) //skip if already in this area
var/area/A = locate(ltag) // find an appropriate area
if(!A)
A = new Loc.type()
A = new Loc.type() // create area if it wasn't found
A.tag = ltag
// replicate vars
for(var/V in Loc.vars-"contents")
if(issaved(Loc.vars[V])) A.vars[V] = Loc.vars[V]
A.tag = ltag
A.sd_LightLevel(light_r, light_g, light_b)
/*
if(A.sd_outside)
if(!(A in sd_outside_areas))
sd_outside_areas += A
A.sd_light_level = light
A.sd_LightLevel(light + sd_light_outside,0)
else
*/
A.sd_LightLevel(light)
// endelse
A.contents += src
A.contents += src // move the turf into the area
/*
sd_ApplySpill()
if(opacity) return
var/oldlum = luminosity
luminosity = sd_light_outside
// loop through all the turfs in V
for(var/turf/T in view(sd_light_outside,src))
var/area/A = T.loc
if(!istype(A) || A.sd_outside) continue
/* increase the turf's brightness depending on the
brightness and distance of the lightsource */
T.sd_lumcount += (sd_light_outside-get_dist(src,T))
//if(T.tag == "sdd")
// slog << "\red lc(AS)+([sd_light_outside-get_dist(src,T)]) from [src] ([src:x],[src:y])"
// slog << "now [T.sd_lumcount]"
atom/movable/Move()
var/turf/oldloc = loc
// update the turf's area
T.sd_LumUpdate()
luminosity = oldlum
sd_StripSpill()
if(opacity) return
var/oldlum = luminosity
luminosity = sd_light_outside
// loop through all the turfs in V
for(var/turf/T in view(sd_light_outside,src))
var/area/A = T.loc
if(!istype(A) || A.sd_outside) continue
/* increase the turf's brightness depending on the
brightness and distance of the lightsource */
T.sd_lumcount -= (sd_light_outside-get_dist(src,T))
//if(T.tag == "sdd")
// slog << "\red lc(AS)-([sd_light_outside-get_dist(src,T)]) from [src] ([src:x],[src:y])"
// slog << "now [T.sd_lumcount]"
// update the turf's area
T.sd_LumUpdate()
luminosity = oldlum
New()
..()
if(sd_light_spill)
sd_light_spill_turfs += src
*/
atom/movable/Move() // when something moves
//world << "[src]: sd_Move: ([loc.x],[loc.y])"
var/turf/oldloc = loc // remember for range calculations
// list turfs in view and luminosity range of old loc
var/list/oldview
if(luminosity > 0) // if atom is luminous
if(luminosity>0) // if atom is luminous
if(isturf(loc))
oldview = view(luminosity,loc)
else
@@ -238,79 +671,96 @@ atom/movable/Move()
. = ..()
if(. && luminosity > 0)
if(istype(oldloc))
var/list/Affected1 = sd_StripLum(oldview,oldloc, 2)
var/list/Affected2
if (!loc.opacity)
Affected2 = sd_ApplyLum(,,2)
else
Affected2 = list()
var/list/Affected3 = list()
for (var/turf/T in Affected1)
Affected3[T] = 1
for (var/turf/T in Affected2)
Affected3[T] = 1
for (var/i = 1; i <= Affected3.len; i++)
var/turf/T = Affected3[i]
T.sd_LumUpdate()
//world << "[src]: sd_Move: .=[.]"
if(.&&(luminosity>0)) // if the atom actually moved
//world << "[src](luminosity) moved"
if(istype(oldloc))
sd_StripLum(oldview,oldloc)
oldloc.sd_lumcount++ // correct "off by 1" error in oldloc
sd_ApplyLum()
area
var
/* Turn this flag off to prevent sd_DynamicAreaLighting from affecting
this area */
sd_lighting = 1
sd_LevelRed = 0 // the current light level of the area
sd_LevelGreen = 0
sd_LevelBlue = 0
/* This var determines if an area is outside (affected by sunlight) or
not. */
sd_outside = 0
sd_light_level = 0 // the current light level of the area
sd_darkimage // tracks the darkness image of the area for easy removal
proc
sd_LightLevel(rlevel = sd_LevelRed as num, glevel = sd_LevelGreen as num, blevel = sd_LevelBlue as num, keep = 1)
if (!src) return
sd_LightLevel(slevel = sd_light_level as num, keep = 1)
if(!src) return
overlays -= sd_darkimage
if(keep)
sd_LevelRed = rlevel
sd_LevelGreen = glevel
sd_LevelBlue = blevel
if(keep) sd_light_level = slevel
if(rlevel > 0 || glevel > 0 || blevel > 0)
slevel = min(max(slevel,0),sd_dark_shades) // restrict range
if(slevel > 0)
luminosity = 1
else
luminosity = 0
sd_darkimage = image('ULIcons.dmi',,"[rlevel]-[glevel]-[blevel]",sd_light_layer)
sd_darkimage = image(sd_dark_icon,,num2text(slevel),sd_light_layer)
overlays += sd_darkimage
proc/sd_New(sd_created)
/*
New()
..()
if(!tag) tag = "[type]"
spawn(1) // wait a tick
if(sd_lighting)
if(!sd_created)
// see if this area was created by the library
if(!findtext(tag, "sd_L"))
/* show the dark overlay so areas outside of luminous regions
won't be bright as day when they should be dark. */
sd_LightLevel()
if(sd_outside)
sd_outside_areas += src
*/
proc/sd_New(sd_created)
if(!tag) tag = "[type]"
spawn(1) // wait a tick
if(sd_lighting)
// see if this area was created by the library
if(!sd_created)
/* show the dark overlay so areas outside of luminous regions
won't be bright as day when they should be dark. */
sd_LightLevel()
//if(sd_outside)
// sd_outside_areas += src
Del()
..()
related -= src
mob
sd_ApplyLum(list/V, center = src, updateMode)
/* extend the mob procs to compensate for sight settings. */
sd_ApplyLum(list/V, center = src)
if(!V)
if(isturf(loc))
V = view(luminosity,loc)
else
V = view(luminosity,src)
. = ..(V, center, updateMode)
. = ..(V, center)
sd_StripLum(list/V, center = src, updateMode)
sd_StripLum(list/V, center = src)
if(!V)
if(isturf(loc))
V = view(luminosity,loc)
else
V = view(luminosity,src)
. = ..(V, center, updateMode)
. = ..(V, center)
sd_ApplyLocalLum(list/affected)
if(!affected)
@@ -318,4 +768,5 @@ mob
affected = view(sd_top_luminosity,loc)
else
affected = view(sd_top_luminosity,src)
. = ..(affected)
. = ..(affected)

View File

@@ -46,12 +46,7 @@
var/stutter = 0
var/eyeblur = 0
var/drowsy = 0
var/glowstr = 0 // set to nonzero if you want this projectile to emit light (recommend no greater than 4)
New()
..()
if(glowstr > 0)
sd_SetLuminosity(glowstr)
proc/on_hit(var/atom/target, var/blocked = 0)
if(blocked >= 2) return 0//Full block

View File

@@ -7,11 +7,6 @@
flag = "laser"
eyeblur = 2
glowstr = 3
sd_ColorBlue = 0.1
sd_ColorGreen = 0.1
sd_ColorRed = 0.7
/obj/item/projectile/practice
name = "laser"
icon_state = "laser"
@@ -21,59 +16,33 @@
flag = "laser"
eyeblur = 2
glowstr = 3
sd_ColorBlue = 0.1
sd_ColorGreen = 0.1
sd_ColorRed = 0.7
/obj/item/projectile/beam/heavylaser
name = "heavy laser"
icon_state = "heavylaser"
damage = 40
glowstr = 4
sd_ColorBlue = 0.1
sd_ColorGreen = 0.1
sd_ColorRed = 0.8
/obj/item/projectile/beam/xray
name = "xray beam"
icon_state = "xray"
damage = 30
glowstr = 3
sd_ColorBlue = 0.1
sd_ColorGreen = 0.7
sd_ColorRed = 0.1
/obj/item/projectile/beam/pulse
name = "pulse"
icon_state = "u_laser"
damage = 50
glowstr = 4
sd_ColorBlue = 0.9
sd_ColorGreen = 0.2
sd_ColorRed = 0.1
/obj/item/projectile/beam/deathlaser
name = "death laser"
icon_state = "heavylaser"
damage = 60
glowstr = 4
sd_ColorBlue = 0.1
sd_ColorGreen = 0.1
sd_ColorRed = 0.8
/obj/item/projectile/beam/emitter
name = "emitter beam"
icon_state = "emitter"
glowstr = 4
sd_ColorBlue = 0.1
sd_ColorGreen = 0.7
sd_ColorRed = 0.2
/obj/item/projectile/bluetag
name = "lasertag beam"
@@ -83,11 +52,6 @@
damage_type = BURN
flag = "laser"
glowstr = 3
sd_ColorBlue = 0.7
sd_ColorGreen = 0.1
sd_ColorRed = 0.1
on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/M = target
@@ -103,11 +67,6 @@
damage_type = BURN
flag = "laser"
glowstr = 3
sd_ColorBlue = 0.1
sd_ColorGreen = 0.1
sd_ColorRed = 0.7
on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/M = target
@@ -123,11 +82,6 @@
damage_type = BURN
flag = "laser"
glowstr = 3
sd_ColorBlue = 0.9
sd_ColorGreen = 0.3
sd_ColorRed = 0.1
on_hit(var/atom/target, var/blocked = 0)
if(istype(target, /mob/living/carbon/human))
var/mob/living/carbon/human/M = target

View File

@@ -6,11 +6,6 @@
nodamage = 1
flag = "energy"
glowstr = 3
sd_ColorBlue = 0.9
sd_ColorGreen = 0.3
sd_ColorRed = 0.1
on_hit(var/atom/change)
wabbajack(change)

View File

@@ -14,11 +14,6 @@
weaken = 10
stutter = 10
glowstr = 2
sd_ColorBlue = 0.1
sd_ColorGreen = 0.5
sd_ColorRed = 0.5
/obj/item/projectile/energy/declone
name = "declown"
@@ -27,11 +22,6 @@
damage_type = CLONE
irradiate = 40
glowstr = 3
sd_ColorBlue = 0.1
sd_ColorGreen = 0.5
sd_ColorRed = 0.1
/obj/item/projectile/energy/dart
name = "dart"

View File

@@ -6,10 +6,6 @@
nodamage = 1
flag = "energy"
glowstr = 3
sd_ColorBlue = 0.9
sd_ColorGreen = 0.3
sd_ColorRed = 0.1
on_hit(var/atom/target, var/blocked = 0)
empulse(target, 1, 1)
@@ -36,11 +32,6 @@
flag = "energy"
var/temperature = 300
glowstr = 3
sd_ColorBlue = 0.9
sd_ColorGreen = 0.3
sd_ColorRed = 0.1
on_hit(var/atom/target, var/blocked = 0)//These two could likely check temp protection on the mob
if(istype(target, /mob/living))

View File

@@ -56,10 +56,6 @@ should be listed in the changelog upon commit tho. Thanks. -->
<ul class="changes bgimages16">
<li class="rscadd">Alien hunters will now cloak when using the 'stalk' movement intent. Whilst cloaked they will use up their plasma reserves. They can however cloak as long as they like. Using the Lay-down verb will allow them to remain cloaked without depleting their plasma reserves, hence allowing them to lay ambushes for unsuspecting prey. Should a hunter attack anybody, or get knocked down in any way, they will become visible. Hopefully this allows for more strategic/stealthy gameplay from aliens. On the other hand, I may have totally screwed the balance so feedback/other-ideas are welcome.</li>
<li class="rscdel">Removed the invisibility verb from the alien hunter caste. </li>
<h3 class="author">Doohl updated:</h3>
<ul class="changes bgimages16">
<li class="wip">A new lighting system has been implemented, courtesy of <b>Tobba</b>. It should theoretically be much more stable, faster and faster but is still highly experimental. Report any feedback in the forums, and bugs in the issue tracker.</li>
<li class="rscadd">Gave certain lasers and projectiles colors. They should light up pleasantly in dark areas.</li>
</ul>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB