Files
CHOMPStation2/code/game/objects/structures.dm
elly1989@rocketmail.com 6e274cd395 New lighting, it's essentially just the old DAL system with a queue.
Comments for lighting:
	Like sd_DAL (what we used to use), it changes the shading overlays of areas by splitting each type of area into sub-areas
	by using the var/tag variable and moving turfs into the contents list of the correct sub-area.

	Unlike sd_DAL however it uses a queueing system. Everytime we  call a change to opacity or luminosity
	(through SetOpacity() or SetLuminosity()) we are  simply updating variables and scheduling certain lights/turfs for an
	update. Actual updates are handled periodically by the lighting_controller. This carries additional overheads, however it
	means that each thing is changed only once per lighting_controller.processing_interval ticks. Allowing for greater control
	over how much priority we'd like lighting updates to have. It also makes it possible for us to simply delay updates by
	setting lighting_controller.processing = 0 at say, the start of a large explosion, waiting for it to finish, and then
	turning it back on with lighting_controller.processing = 1.

	Unlike our old system there is a hardcoded maximum luminosity. This is to discourage coders using large luminosity values
	for dynamic lighting, as the cost of lighting grows rapidly at large luminosity levels (especially when changing opacity
	at runtime)

	Also, in order for the queueing system to work, each light remembers the effect it casts on each turf. This is going to
	have larger memory requirements than our previous system but hopefully it's worth the hassle for the greater control we
	gain. Besides, there are far far worse uses of needless lists in the game, it'd be worth pruning some of them to offset
	costs.

	Known Issues/TODO:
		admin-spawned turfs will have broken lumcounts. Not willing to fix it at this moment
		mob luminosity will be lower than expected when one of multiple light sources is dropped after exceeding the maximum luminosity
		Shuttles still do not have support for dynamic lighting (I hope to fix this at some point)
		No directional lighting support. Fairly easy to add this and the code is ready.
		When opening airlocks etc, lighting does not always update to account for the change in opacity.

Explosions now cause lighting to cease processing temporarily.

Moved controller datums to the code/controllers directory. I plan on standardising them.
"Master","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI" controller datums can be accessed via the debug controller verb (used to be the debug master controller verb)
Supply shuttle now uses a controller datum. Shuttles tend to arrive up to 30 seconds late, this is not a bug.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4537 316c924e-a436-60f5-8080-3fe189b3f50e
2012-08-25 16:06:57 +00:00

642 lines
18 KiB
Plaintext

obj/structure
icon = 'icons/obj/structures.dmi'
obj/structure/blob_act()
if(prob(50))
del(src)
obj/structure/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if(prob(50))
del(src)
return
if(3.0)
return
obj/structure/meteorhit(obj/O as obj)
del(src)
/obj/structure/girder
icon_state = "girder"
anchored = 1
density = 1
layer = 2
var/state = 0
attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench) && state == 0)
if(anchored && !istype(src,/obj/structure/girder/displaced))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "\blue Now disassembling the girder"
if(do_after(user,40))
if(!src) return
user << "\blue You dissasembled the girder!"
new /obj/item/stack/sheet/metal(get_turf(src))
del(src)
else if(!anchored)
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "\blue Now securing the girder"
if(get_turf(user, 40))
user << "\blue You secured the girder!"
new/obj/structure/girder( src.loc )
del(src)
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
user << "\blue Now slicing apart the girder"
if(do_after(user,30))
if(!src) return
user << "\blue You slice apart the girder!"
new /obj/item/stack/sheet/metal(get_turf(src))
del(src)
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
user << "\blue You drill through the girder!"
new /obj/item/stack/sheet/metal(get_turf(src))
del(src)
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 && istype(src,/obj/structure/girder/reinforced))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user << "\blue Now unsecuring support struts"
if(do_after(user,40))
if(!src) return
user << "\blue You unsecured the support struts!"
state = 1
else if(istype(W, /obj/item/weapon/wirecutters) && istype(src,/obj/structure/girder/reinforced) && state == 1)
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
user << "\blue Now removing support struts"
if(do_after(user,40))
if(!src) return
user << "\blue You removed the support struts!"
new/obj/structure/girder( src.loc )
del(src)
else if(istype(W, /obj/item/weapon/crowbar) && state == 0 && anchored )
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user << "\blue Now dislodging the girder"
if(do_after(user, 40))
if(!src) return
user << "\blue You dislodged the girder!"
new/obj/structure/girder/displaced( src.loc )
del(src)
else if(istype(W, /obj/item/stack/sheet))
var/obj/item/stack/sheet/S = W
switch(S.type)
if(/obj/item/stack/sheet/metal)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithWall()
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/plasteel)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falserwall (src.loc)
else
if (src.icon_state == "reinforced") //I cant believe someone would actually write this line of code...
if(S.amount < 1) return ..()
user << "\blue Now finalising reinforced wall."
if(do_after(user, 50))
if(!src || !S || S.amount < 1) return
S.use(1)
user << "\blue Wall fully reinforced!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithRWall()
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/r_wall/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
else
if(S.amount < 1) return ..()
user << "\blue Now reinforcing girders"
if (do_after(user,60))
if(!src || !S || S.amount < 1) return
S.use(1)
user << "\blue Girders reinforced!"
new/obj/structure/girder/reinforced( src.loc )
del(src)
return
if(/obj/item/stack/sheet/gold)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/gold (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("gold")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/silver)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/silver (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("silver")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/diamond)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/diamond (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("diamond")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/uranium)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/uranium (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("uranium")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/plasma)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/plasma (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("plasma")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/clown)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/clown (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("clown")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
if(/obj/item/stack/sheet/sandstone)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall/sandstone (src.loc)
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithMineralWall("sandstone")
for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1
for(var/turf/simulated/wall/mineral/X in Tsrc.loc)
if(X) X.add_hiddenprint(usr)
del(src)
return
add_hiddenprint(usr)
del(src)
else if(istype(W, /obj/item/pipe))
var/obj/item/pipe/P = W
if (P.pipe_type in list(0, 1, 5)) //simple pipes, simple bends, and simple manifolds.
user.drop_item()
P.loc = src.loc
user << "\blue You fit the pipe into the [src]!"
else
..()
blob_act()
if(prob(40))
del(src)
ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(30))
var/remains = pick(/obj/item/stack/rods,/obj/item/stack/sheet/metal)
new remains(loc)
del(src)
return
if(3.0)
if (prob(5))
var/remains = pick(/obj/item/stack/rods,/obj/item/stack/sheet/metal)
new remains(loc)
del(src)
return
else
return
/obj/structure/girder/displaced
icon_state = "displaced"
anchored = 0
/obj/structure/girder/reinforced
icon_state = "reinforced"
state = 2
/obj/structure/cultgirder
icon= 'icons/obj/cult.dmi'
icon_state= "cultgirder"
anchored = 1
density = 1
layer = 2
attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "\blue Now disassembling the girder"
if(do_after(user,40))
user << "\blue You dissasembled the girder!"
new /obj/effect/decal/remains/human(get_turf(src))
del(src)
else if(istype(W, /obj/item/weapon/pickaxe/plasmacutter))
user << "\blue Now slicing apart the girder"
if(do_after(user,30))
user << "\blue You slice apart the girder!"
new /obj/effect/decal/remains/human(get_turf(src))
del(src)
else if(istype(W, /obj/item/weapon/pickaxe/diamonddrill))
user << "\blue You drill through the girder!"
new /obj/effect/decal/remains/human(get_turf(src))
del(src)
blob_act()
if(prob(40))
del(src)
ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
if (prob(30))
new /obj/effect/decal/remains/human(loc)
del(src)
return
if(3.0)
if (prob(5))
new /obj/effect/decal/remains/human(loc)
del(src)
return
else
return
// LATTICE
/obj/structure/lattice/blob_act()
del(src)
return
/obj/structure/lattice/ex_act(severity)
switch(severity)
if(1.0)
del(src)
return
if(2.0)
del(src)
return
if(3.0)
return
else
return
/obj/structure/lattice/attackby(obj/item/C as obj, mob/user as mob)
if (istype(C, /obj/item/stack/tile/plasteel))
var/turf/T = get_turf(src)
T.attackby(C, user) //BubbleWrap - hand this off to the underlying turf instead
return
if (istype(C, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = C
if(WT.remove_fuel(0, user))
user << "\blue Slicing lattice joints ..."
new /obj/item/stack/rods(src.loc)
del(src)
return
/obj/structure/falsewall
var/mineral = "metal"
/obj/structure/falserwall
var/mineral = "metal"
/obj/structure/falsewall/gold
mineral = "gold"
/obj/structure/falsewall/silver
mineral = "silver"
/obj/structure/falsewall/diamond
mineral = "diamond"
/obj/structure/falsewall/uranium
mineral = "uranium"
var/active = null
var/last_event = 0
/obj/structure/falsewall/plasma
mineral = "plasma"
/obj/structure/falsewall/clown
mineral = "clown"
/obj/structure/falsewall/sandstone
mineral = "sandstone"
/*/obj/structure/falsewall/wood
mineral = "wood"*/
/obj/structure/falsewall/attack_hand(mob/user as mob)
if(density)
// Open wall
icon_state = "[mineral]fwall_open"
flick("[mineral]fwall_opening", src)
sleep(15)
src.density = 0
SetOpacity(0)
else
flick("[mineral]fwall_closing", src)
icon_state = "[mineral]0"
sleep(15)
src.density = 1
SetOpacity(1)
src.relativewall()
/obj/structure/falsewall/uranium/attack_hand(mob/user as mob)
radiate()
..()
/obj/structure/falsewall/update_icon()//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open
..()
if(density)
icon_state = "[mineral]0"
src.relativewall()
else
icon_state = "[mineral]fwall_open"
/obj/structure/falsewall/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/screwdriver))
var/turf/T = get_turf(src)
user.visible_message("[user] tightens some bolts on the wall.", "You tighten the bolts on the wall.")
if(!mineral)
T.ReplaceWithWall()
else
T.ReplaceWithMineralWall(mineral)
del(src)
if( istype(W, /obj/item/weapon/weldingtool) )
var/obj/item/weapon/weldingtool/WT = W
if( WT:welding )
var/turf/T = get_turf(src)
if(!mineral)
T.ReplaceWithWall()
else
T.ReplaceWithMineralWall(mineral)
if(mineral != "plasma")//Stupid shit keeps me from pushing the attackby() to plasma walls -Sieve
T = get_turf(src)
T.attackby(W,user)
del(src)
else if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) )
var/turf/T = get_turf(src)
if(!mineral)
T.ReplaceWithWall()
else
T.ReplaceWithMineralWall(mineral)
if(mineral != "plasma")
T = get_turf(src)
T.attackby(W,user)
del(src)
//DRILLING
else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill))
var/turf/T = get_turf(src)
if(!mineral)
T.ReplaceWithWall()
else
T.ReplaceWithMineralWall(mineral)
T = get_turf(src)
T.attackby(W,user)
del(src)
else if( istype(W, /obj/item/weapon/melee/energy/blade) )
var/turf/T = get_turf(src)
if(!mineral)
T.ReplaceWithWall()
else
T.ReplaceWithMineralWall(mineral)
if(mineral != "plasma")
T = get_turf(src)
T.attackby(W,user)
del(src)
/*
var/turf/T = get_turf(user)
user << "\blue Now adding plating..."
sleep(40)
if (get_turf(user) == T)
user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithWall()
*/
/obj/structure/falsewall/uranium/attackby(obj/item/weapon/W as obj, mob/user as mob)
radiate()
..()
/obj/structure/falsewall/update_icon()//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open
..()
if(density)
icon_state = "[mineral]0"
src.relativewall()
else
icon_state = "[mineral]fwall_open"
/obj/structure/falserwall/
attack_hand(mob/user as mob)
if(density)
// Open wall
icon_state = "frwall_open"
flick("frwall_opening", src)
sleep(15)
density = 0
SetOpacity(0)
else
icon_state = "r_wall"
flick("frwall_closing", src)
sleep(15)
density = 1
SetOpacity(1)
relativewall()
attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/screwdriver))
var/turf/T = get_turf(src)
user.visible_message("[user] tightens some bolts on the r wall.", "You tighten the bolts on the wall.")
T.ReplaceWithWall() //Intentionally makes a regular wall instead of an r-wall (no cheap r-walls for you).
del(src)
if( istype(W, /obj/item/weapon/weldingtool) )
var/obj/item/weapon/weldingtool/WT = W
if( WT.remove_fuel(0,user) )
var/turf/T = get_turf(src)
T.ReplaceWithWall()
T = get_turf(src)
T.attackby(W,user)
del(src)
else if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) )
var/turf/T = get_turf(src)
T.ReplaceWithWall()
T = get_turf(src)
T.attackby(W,user)
del(src)
//DRILLING
else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill))
var/turf/T = get_turf(src)
T.ReplaceWithWall()
T = get_turf(src)
T.attackby(W,user)
del(src)
else if( istype(W, /obj/item/weapon/melee/energy/blade) )
var/turf/T = get_turf(src)
T.ReplaceWithWall()
T = get_turf(src)
T.attackby(W,user)
del(src)
/obj/structure/falsewall/uranium/proc/radiate()
if(!active)
if(world.time > last_event+15)
active = 1
for(var/mob/living/L in range(3,src))
L.apply_effect(12,IRRADIATE,0)
for(var/turf/simulated/wall/mineral/T in range(3,src))
if(T.mineral == "uranium")
T.radiate()
last_event = world.time
active = null
return
return