-Changed turf creations, merging everything to only one proc

-Fixes Issue 1085 - Artificers creating turfs with buggy lighting
-Spells now will use the proper proc to create turfs

Due to the amount of files changed, this is just the 'part one'. The merging in turf.dm is not finished, mineral walls and buildmode are still using the old system. The creation of turfs on the game panel is not using the proper procs yet. Stay tuned for this changes, but now, sleep.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5054 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
aranclanos@hotmail.com
2012-11-13 13:39:00 +00:00
parent b81901685e
commit dee7b74a45
20 changed files with 105 additions and 196 deletions

View File

@@ -152,7 +152,7 @@
else else
chance_of_deletion = 100 chance_of_deletion = 100
if(prob(chance_of_deletion)) if(prob(chance_of_deletion))
T.ReplaceWithSpace() T.ChangeTurf(/turf/space)
else else
T.to_be_destroyed = 0 T.to_be_destroyed = 0
T.max_fire_temperature_sustained = 0 T.max_fire_temperature_sustained = 0

View File

@@ -186,28 +186,28 @@
if(istype(object,/turf) && pa.Find("left") && !pa.Find("alt") && !pa.Find("ctrl") ) if(istype(object,/turf) && pa.Find("left") && !pa.Find("alt") && !pa.Find("ctrl") )
if(istype(object,/turf/space)) if(istype(object,/turf/space))
var/turf/T = object var/turf/T = object
T.ReplaceWithFloor() T.ChangeTurf(/turf/simulated/floor)
return return
else if(istype(object,/turf/simulated/floor)) else if(istype(object,/turf/simulated/floor))
var/turf/T = object var/turf/T = object
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
return return
else if(istype(object,/turf/simulated/wall)) else if(istype(object,/turf/simulated/wall))
var/turf/T = object var/turf/T = object
T.ReplaceWithRWall() T.ChangeTurf(/turf/simulated/wall/r_wall)
return return
else if(pa.Find("right")) else if(pa.Find("right"))
if(istype(object,/turf/simulated/wall)) if(istype(object,/turf/simulated/wall))
var/turf/T = object var/turf/T = object
T.ReplaceWithFloor() T.ChangeTurf(/turf/simulated/floor)
return return
else if(istype(object,/turf/simulated/floor)) else if(istype(object,/turf/simulated/floor))
var/turf/T = object var/turf/T = object
T.ReplaceWithSpace() T.ChangeTurf(/turf/space)
return return
else if(istype(object,/turf/simulated/wall/r_wall)) else if(istype(object,/turf/simulated/wall/r_wall))
var/turf/T = object var/turf/T = object
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
return return
else if(istype(object,/obj)) else if(istype(object,/obj))
del(object) del(object)

View File

@@ -967,7 +967,7 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
fromupdate += ttl fromupdate += ttl
else else
T.ReplaceWithSpace() T.ChangeTurf(/turf/space)
refined_src -= T refined_src -= T
refined_trg -= B refined_trg -= B

View File

@@ -29,16 +29,21 @@
var/spawn_place = pick(targets) var/spawn_place = pick(targets)
if(summon_ignore_prev_spawn_points) if(summon_ignore_prev_spawn_points)
targets -= spawn_place targets -= spawn_place
var/atom/summoned_object = new summoned_object_type(spawn_place) if(summoned_object_type in typesof(/turf))
var/turf/O = spawn_place
var/turf/N = summoned_object_type
O.ChangeTurf(N)
else
var/atom/summoned_object = new summoned_object_type(spawn_place)
for(var/varName in newVars) for(var/varName in newVars)
if(varName in summoned_object.vars) if(varName in summoned_object.vars)
summoned_object.vars[varName] = newVars[varName] summoned_object.vars[varName] = newVars[varName]
if(summon_lifespan) if(summon_lifespan)
spawn(summon_lifespan) spawn(summon_lifespan)
if(summoned_object) if(summoned_object)
del(summoned_object) del(summoned_object)
else else
switch(charge_type) switch(charge_type)
if("recharge") if("recharge")

View File

@@ -25,7 +25,7 @@
for(var/obj/O in orange(1,src)) for(var/obj/O in orange(1,src))
del(O) del(O)
for(var/turf/simulated/ST in orange(1,src)) for(var/turf/simulated/ST in orange(1,src))
ST.ReplaceWithSpace() ST.ChangeTurf(/turf/space)
sleep(6) sleep(6)
grav(10, 4, 10, 0 ) grav(10, 4, 10, 0 )
@@ -84,5 +84,5 @@
//Destroying the turf //Destroying the turf
if( T && istype(T,/turf/simulated) && prob(turf_removal_chance) ) if( T && istype(T,/turf/simulated) && prob(turf_removal_chance) )
var/turf/simulated/ST = T var/turf/simulated/ST = T
ST.ReplaceWithSpace() ST.ChangeTurf(/turf/space)
return return

View File

@@ -279,7 +279,7 @@
if(do_after_cooldown(target)) if(do_after_cooldown(target))
if(disabled) return if(disabled) return
chassis.spark_system.start() chassis.spark_system.start()
target:ReplaceWithPlating() target:ChangeTurf(/turf/simulated/floor/plating)
playsound(target, 'sound/items/Deconstruct.ogg', 50, 1) playsound(target, 'sound/items/Deconstruct.ogg', 50, 1)
chassis.use_power(energy_drain) chassis.use_power(energy_drain)
else if (istype(target, /turf/simulated/floor)) else if (istype(target, /turf/simulated/floor))
@@ -288,7 +288,7 @@
if(do_after_cooldown(target)) if(do_after_cooldown(target))
if(disabled) return if(disabled) return
chassis.spark_system.start() chassis.spark_system.start()
target:ReplaceWithSpace() target:ChangeTurf(/turf/space)
playsound(target, 'sound/items/Deconstruct.ogg', 50, 1) playsound(target, 'sound/items/Deconstruct.ogg', 50, 1)
chassis.use_power(energy_drain) chassis.use_power(energy_drain)
else if (istype(target, /obj/machinery/door/airlock)) else if (istype(target, /obj/machinery/door/airlock))
@@ -306,7 +306,7 @@
set_ready_state(0) set_ready_state(0)
if(do_after_cooldown(target)) if(do_after_cooldown(target))
if(disabled) return if(disabled) return
target:ReplaceWithPlating() target:ChangeTurf(/turf/simulated/floor/plating)
playsound(target, 'sound/items/Deconstruct.ogg', 50, 1) playsound(target, 'sound/items/Deconstruct.ogg', 50, 1)
chassis.spark_system.start() chassis.spark_system.start()
chassis.use_power(energy_drain*2) chassis.use_power(energy_drain*2)
@@ -315,7 +315,7 @@
set_ready_state(0) set_ready_state(0)
if(do_after_cooldown(target)) if(do_after_cooldown(target))
if(disabled) return if(disabled) return
target:ReplaceWithWall() target:ChangeTurf(/turf/simulated/wall)
playsound(target, 'sound/items/Deconstruct.ogg', 50, 1) playsound(target, 'sound/items/Deconstruct.ogg', 50, 1)
chassis.spark_system.start() chassis.spark_system.start()
chassis.use_power(energy_drain*2) chassis.use_power(energy_drain*2)

View File

@@ -36,7 +36,7 @@
*/ */
/obj/item/stack/tile/plasteel/proc/build(turf/S as turf) /obj/item/stack/tile/plasteel/proc/build(turf/S as turf)
S.ReplaceWithPlating() S.ChangeTurf(/turf/simulated/floor/plating)
// var/turf/simulated/floor/W = S.ReplaceWithFloor() // var/turf/simulated/floor/W = S.ReplaceWithFloor()
// W.make_plating() // W.make_plating()
return return

View File

@@ -92,7 +92,7 @@ RCD
if(useResource(1, user)) if(useResource(1, user))
user << "Building Floor..." user << "Building Floor..."
activate() activate()
A:ReplaceWithPlating() A:ChangeTurf(/turf/simulated/floor/plating)
return 1 return 1
return 0 return 0
@@ -103,7 +103,7 @@ RCD
if(do_after(user, 20)) if(do_after(user, 20))
if(!useResource(3, user)) return 0 if(!useResource(3, user)) return 0
activate() activate()
A:ReplaceWithWall() A:ChangeTurf(/turf/simulated/wall)
return 1 return 1
return 0 return 0
@@ -131,7 +131,7 @@ RCD
if(do_after(user, 40)) if(do_after(user, 40))
if(!useResource(5, user)) return 0 if(!useResource(5, user)) return 0
activate() activate()
A:ReplaceWithPlating() A:ChangeTurf(/turf/simulated/floor/plating)
return 1 return 1
return 0 return 0
@@ -142,7 +142,7 @@ RCD
if(do_after(user, 50)) if(do_after(user, 50))
if(!useResource(5, user)) return 0 if(!useResource(5, user)) return 0
activate() activate()
A:ReplaceWithSpace() A:ChangeTurf(/turf/space)
return 1 return 1
return 0 return 0

View File

@@ -144,7 +144,7 @@
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
user.visible_message("[user] tightens some bolts on the wall.", "You tighten the bolts on the wall.") user.visible_message("[user] tightens some bolts on the wall.", "You tighten the bolts on the wall.")
if(!mineral || mineral == "metal") if(!mineral || mineral == "metal")
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
else else
T.ReplaceWithMineralWall(mineral) T.ReplaceWithMineralWall(mineral)
del(src) del(src)
@@ -154,7 +154,7 @@
if( WT:welding ) if( WT:welding )
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(!mineral) if(!mineral)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
else else
T.ReplaceWithMineralWall(mineral) T.ReplaceWithMineralWall(mineral)
if(mineral != "plasma")//Stupid shit keeps me from pushing the attackby() to plasma walls -Sieve if(mineral != "plasma")//Stupid shit keeps me from pushing the attackby() to plasma walls -Sieve
@@ -167,7 +167,7 @@
if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) ) if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) )
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(!mineral) if(!mineral)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
else else
T.ReplaceWithMineralWall(mineral) T.ReplaceWithMineralWall(mineral)
if(mineral != "plasma") if(mineral != "plasma")
@@ -179,7 +179,7 @@
else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill)) else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill))
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(!mineral) if(!mineral)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
else else
T.ReplaceWithMineralWall(mineral) T.ReplaceWithMineralWall(mineral)
T = get_turf(src) T = get_turf(src)
@@ -189,7 +189,7 @@
else if( istype(W, /obj/item/weapon/melee/energy/blade) ) else if( istype(W, /obj/item/weapon/melee/energy/blade) )
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
if(!mineral) if(!mineral)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
else else
T.ReplaceWithMineralWall(mineral) T.ReplaceWithMineralWall(mineral)
if(mineral != "plasma") if(mineral != "plasma")
@@ -268,21 +268,21 @@
if(istype(W, /obj/item/weapon/screwdriver)) if(istype(W, /obj/item/weapon/screwdriver))
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
user.visible_message("[user] tightens some bolts on the r wall.", "You tighten the bolts on the wall.") 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). T.ChangeTurf(/turf/simulated/wall) //Intentionally makes a regular wall instead of an r-wall (no cheap r-walls for you).
del(src) del(src)
if( istype(W, /obj/item/weapon/weldingtool) ) if( istype(W, /obj/item/weapon/weldingtool) )
var/obj/item/weapon/weldingtool/WT = W var/obj/item/weapon/weldingtool/WT = W
if( WT.remove_fuel(0,user) ) if( WT.remove_fuel(0,user) )
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
T = get_turf(src) T = get_turf(src)
T.attackby(W,user) T.attackby(W,user)
del(src) del(src)
else if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) ) else if( istype(W, /obj/item/weapon/pickaxe/plasmacutter) )
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
T = get_turf(src) T = get_turf(src)
T.attackby(W,user) T.attackby(W,user)
del(src) del(src)
@@ -290,14 +290,14 @@
//DRILLING //DRILLING
else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill)) else if (istype(W, /obj/item/weapon/pickaxe/diamonddrill))
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
T = get_turf(src) T = get_turf(src)
T.attackby(W,user) T.attackby(W,user)
del(src) del(src)
else if( istype(W, /obj/item/weapon/melee/energy/blade) ) else if( istype(W, /obj/item/weapon/melee/energy/blade) )
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
T.ReplaceWithWall() T.ChangeTurf(/turf/simulated/wall)
T = get_turf(src) T = get_turf(src)
T.attackby(W,user) T.attackby(W,user)
del(src) del(src)

View File

@@ -82,7 +82,7 @@
S.use(2) S.use(2)
user << "\blue You added the plating!" user << "\blue You added the plating!"
var/turf/Tsrc = get_turf(src) var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithWall() Tsrc.ChangeTurf(/turf/simulated/wall)
for(var/obj/machinery/atmospherics/pipe/P in Tsrc) for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1 P.layer = 1
for(var/turf/simulated/wall/X in Tsrc.loc) for(var/turf/simulated/wall/X in Tsrc.loc)
@@ -106,7 +106,7 @@
S.use(1) S.use(1)
user << "\blue Wall fully reinforced!" user << "\blue Wall fully reinforced!"
var/turf/Tsrc = get_turf(src) var/turf/Tsrc = get_turf(src)
Tsrc.ReplaceWithRWall() Tsrc.ChangeTurf(/turf/simulated/wall)
for(var/obj/machinery/atmospherics/pipe/P in Tsrc) for(var/obj/machinery/atmospherics/pipe/P in Tsrc)
P.layer = 1 P.layer = 1
for(var/turf/simulated/wall/r_wall/X in Tsrc.loc) for(var/turf/simulated/wall/r_wall/X in Tsrc.loc)

View File

@@ -74,7 +74,7 @@
iterations = min_amount iterations = min_amount
for(var/i=0 to iterations) for(var/i=0 to iterations)
new contains(src) new contains(src)
ReplaceWithSpace() ChangeTurf(/turf/space)
/turf/simulated/wall/asteroid/attackby(obj/item/weapon/W as obj, mob/user as mob)//TODO /turf/simulated/wall/asteroid/attackby(obj/item/weapon/W as obj, mob/user as mob)//TODO

View File

@@ -48,14 +48,14 @@ var/list/wood_icons = list("wood","wood-broken")
//set src in oview(1) //set src in oview(1)
switch(severity) switch(severity)
if(1.0) if(1.0)
src.ReplaceWithSpace() src.ChangeTurf(/turf/space)
if(2.0) if(2.0)
switch(pick(1,2;75,3)) switch(pick(1,2;75,3))
if (1) if (1)
src.ReplaceWithLattice() src.ReplaceWithLattice()
if(prob(33)) new /obj/item/stack/sheet/metal(src) if(prob(33)) new /obj/item/stack/sheet/metal(src)
if(2) if(2)
src.ReplaceWithSpace() src.ChangeTurf(/turf/space)
if(3) if(3)
if(prob(80)) if(prob(80))
src.break_tile_to_plating() src.break_tile_to_plating()
@@ -247,7 +247,7 @@ turf/simulated/floor/proc/update_icon()
/turf/simulated/floor/proc/break_tile() /turf/simulated/floor/proc/break_tile()
if(istype(src,/turf/simulated/floor/engine)) return if(istype(src,/turf/simulated/floor/engine)) return
if(istype(src,/turf/simulated/floor/mech_bay_recharge_floor)) if(istype(src,/turf/simulated/floor/mech_bay_recharge_floor))
src.ReplaceWithPlating() src.ChangeTurf(/turf/simulated/floor/plating)
if(broken) return if(broken) return
if(is_plasteel_floor()) if(is_plasteel_floor())
src.icon_state = "damaged[pick(1,2,3,4,5)]" src.icon_state = "damaged[pick(1,2,3,4,5)]"
@@ -472,7 +472,7 @@ turf/simulated/floor/proc/update_icon()
if (R.amount >= 2) if (R.amount >= 2)
user << "\blue Reinforcing the floor..." user << "\blue Reinforcing the floor..."
if(do_after(user, 30) && R && R.amount >= 2 && is_plating()) if(do_after(user, 30) && R && R.amount >= 2 && is_plating())
ReplaceWithEngineFloor() ChangeTurf(/turf/simulated/floor/engine)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 80, 1) playsound(src.loc, 'sound/items/Deconstruct.ogg', 80, 1)
R.use(2) R.use(2)
return return

View File

@@ -61,7 +61,7 @@
playsound(src.loc, 'sound/items/Ratchet.ogg', 80, 1) playsound(src.loc, 'sound/items/Ratchet.ogg', 80, 1)
if(do_after(user, 30)) if(do_after(user, 30))
new /obj/item/stack/rods(src, 2) new /obj/item/stack/rods(src, 2)
ReplaceWithFloor() ChangeTurf(/turf/simulated/floor)
var/turf/simulated/floor/F = src var/turf/simulated/floor/F = src
F.make_plating() F.make_plating()
return return

View File

@@ -117,7 +117,7 @@
P.roll_and_drop(src) P.roll_and_drop(src)
else else
O.loc = src O.loc = src
ReplaceWithPlating(explode) ChangeTurf(/turf/simulated/floor/plating)
/turf/simulated/wall/examine() /turf/simulated/wall/examine()
set src in oview(1) set src in oview(1)
@@ -129,7 +129,7 @@
switch(severity) switch(severity)
if(1.0) if(1.0)
//SN src = null //SN src = null
src.ReplaceWithSpace() src.ChangeTurf(/turf/space)
return return
if(2.0) if(2.0)
if (prob(50)) if (prob(50))
@@ -338,7 +338,7 @@
O.density = 1 O.density = 1
O.layer = 5 O.layer = 5
var/turf/simulated/floor/F = ReplaceWithPlating() var/turf/simulated/floor/F = ChangeTurf(/turf/simulated/floor/plating)
F.burn_tile() F.burn_tile()
F.icon_state = "wall_thermite" F.icon_state = "wall_thermite"
user << "<span class='warning'>The thermite melts through the wall.</span>" user << "<span class='warning'>The thermite melts through the wall.</span>"
@@ -352,7 +352,7 @@
if (prob(15)) if (prob(15))
dismantle_wall() dismantle_wall()
else if(prob(70)) else if(prob(70))
ReplaceWithPlating() ChangeTurf(/turf/simulated/floor/plating)
else else
ReplaceWithLattice() ReplaceWithLattice()
return 0 return 0

View File

@@ -92,7 +92,7 @@
/turf/simulated/wall/mineral/proc/PlasmaBurn(temperature) /turf/simulated/wall/mineral/proc/PlasmaBurn(temperature)
spawn(2) spawn(2)
new /obj/structure/girder(src) new /obj/structure/girder(src)
src.ReplaceWithFloor() src.ChangeTurf(/turf/simulated/floor)
for(var/turf/simulated/floor/target_tile in range(0,src)) for(var/turf/simulated/floor/target_tile in range(0,src))
if(target_tile.parent && target_tile.parent.group_processing) if(target_tile.parent && target_tile.parent.group_processing)
target_tile.parent.suspend_group_processing() target_tile.parent.suspend_group_processing()

View File

@@ -210,9 +210,41 @@
if(L) if(L)
del L del L
/turf/proc/ReplaceWithFloor(explode=0) //Creates a new turf
var/prior_icon = icon_old /turf/proc/ChangeTurf(var/turf/N)
var/old_dir = dir if (!N)
return
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
if(N in typesof(/turf/simulated))
var/turf/simulated/W = new N( locate(src.x, src.y, src.z) )
W.Assimilate_Air()
W.lighting_lumcount += old_lumcount
if(old_lumcount != W.lighting_lumcount)
W.lighting_changed = 1
lighting_controller.changed_turfs += W
if (istype(W,/turf/simulated/floor))
W.RemoveLattice()
W.levelupdate()
return W
else
var/turf/W = new N( locate(src.x, src.y, src.z) )
W.lighting_lumcount += old_lumcount
if(old_lumcount != W.lighting_lumcount)
W.lighting_changed = 1
lighting_controller.changed_turfs += W
W.levelupdate()
return W
//////Assimilate Air//////
/turf/simulated/proc/Assimilate_Air()
var/aoxy = 0//Holders to assimilate air from nearby turfs var/aoxy = 0//Holders to assimilate air from nearby turfs
var/anitro = 0 var/anitro = 0
var/aco = 0 var/aco = 0
@@ -220,14 +252,6 @@
var/atemp = 0 var/atemp = 0
var/turf_count = 0 var/turf_count = 0
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/simulated/floor/W = new /turf/simulated/floor( locate(src.x, src.y, src.z) )
W.lighting_lumcount += old_lumcount
if(old_lumcount != W.lighting_lumcount)
W.lighting_changed = 1
lighting_controller.changed_turfs += W
//////Assimilate Air//////
for(var/direction in cardinal)//Only use cardinals to cut down on lag for(var/direction in cardinal)//Only use cardinals to cut down on lag
var/turf/T = get_step(src,direction) var/turf/T = get_step(src,direction)
if(istype(T,/turf/space))//Counted as no air if(istype(T,/turf/space))//Counted as no air
@@ -242,138 +266,18 @@
atox += S.air.toxins atox += S.air.toxins
atemp += S.air.temperature atemp += S.air.temperature
turf_count ++ turf_count ++
W.air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like
W.air.nitrogen = (anitro/max(turf_count,1)) air.nitrogen = (anitro/max(turf_count,1))
W.air.carbon_dioxide = (aco/max(turf_count,1)) air.carbon_dioxide = (aco/max(turf_count,1))
W.air.toxins = (atox/max(turf_count,1)) air.toxins = (atox/max(turf_count,1))
W.air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant
W.RemoveLattice() /turf/proc/ReplaceWithFloor()
W.dir = old_dir return
if(prior_icon) W.icon_state = prior_icon
else W.icon_state = "floor"
W.levelupdate()
return W
/turf/proc/ReplaceWithPlating()
var/prior_icon = icon_old
var/old_dir = dir
var/aoxy = 0//Holders to assimilate air from nearby turfs
var/anitro = 0
var/aco = 0
var/atox = 0
var/atemp = 0
var/turf_count = 0
//////Assimilate Air//////
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/simulated/floor/plating/W = new /turf/simulated/floor/plating( locate(src.x, src.y, src.z) )
W.lighting_lumcount += old_lumcount
if(old_lumcount != W.lighting_lumcount)
W.lighting_changed = 1
lighting_controller.changed_turfs += W
for(var/direction in cardinal)
var/turf/T = get_step(src,direction)
if(istype(T,/turf/space))
turf_count++
continue
else if(istype(T,/turf/simulated/floor))
var/turf/simulated/S = T
if(S.air)
aoxy += S.air.oxygen
anitro += S.air.nitrogen
aco += S.air.carbon_dioxide
atox += S.air.toxins
atemp += S.air.temperature
turf_count++
W.air.oxygen = (aoxy/max(turf_count,1))
W.air.nitrogen = (anitro/max(turf_count,1))
W.air.carbon_dioxide = (aco/max(turf_count,1))
W.air.toxins = (atox/max(turf_count,1))
W.air.temperature = (atemp/max(turf_count,1))
W.RemoveLattice()
W.dir = old_dir
if(prior_icon) W.icon_state = prior_icon
else W.icon_state = "plating"
W.levelupdate()
return W
/turf/proc/ReplaceWithEngineFloor()
var/old_dir = dir
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/simulated/floor/engine/E = new /turf/simulated/floor/engine( locate(src.x, src.y, src.z) )
E.lighting_lumcount += old_lumcount
if(old_lumcount != E.lighting_lumcount)
E.lighting_changed = 1
lighting_controller.changed_turfs += E
E.dir = old_dir
E.icon_state = "engine"
E.levelupdate()
/turf/proc/ReplaceWithSpace()
var/old_dir = dir
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) )
S.lighting_lumcount += old_lumcount
if(old_lumcount != S.lighting_lumcount)
S.lighting_changed = 1
lighting_controller.changed_turfs += S
S.dir = old_dir
S.levelupdate()
return S
/turf/proc/ReplaceWithLattice() /turf/proc/ReplaceWithLattice()
var/old_dir = dir src.ChangeTurf(/turf/space)
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) )
S.lighting_lumcount += old_lumcount
if(old_lumcount != S.lighting_lumcount)
S.lighting_changed = 1
lighting_controller.changed_turfs += S
S.dir = old_dir
new /obj/structure/lattice( locate(src.x, src.y, src.z) ) new /obj/structure/lattice( locate(src.x, src.y, src.z) )
S.levelupdate()
return S
/turf/proc/ReplaceWithWall()
var/old_icon = icon_state
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/simulated/wall/S = new /turf/simulated/wall( locate(src.x, src.y, src.z) )
S.lighting_lumcount += old_lumcount
if(old_lumcount != S.lighting_lumcount)
S.lighting_changed = 1
lighting_controller.changed_turfs += S
S.icon_old = old_icon
S.levelupdate()
return S
/turf/proc/ReplaceWithRWall()
var/old_icon = icon_state
var/old_lumcount = lighting_lumcount - initial(lighting_lumcount)
var/turf/simulated/wall/r_wall/S = new /turf/simulated/wall/r_wall( locate(src.x, src.y, src.z) )
S.lighting_lumcount += old_lumcount
if(old_lumcount != S.lighting_lumcount)
S.lighting_changed = 1
lighting_controller.changed_turfs += S
S.icon_old = old_icon
S.levelupdate()
return S
/turf/proc/ReplaceWithMineralWall(var/ore) /turf/proc/ReplaceWithMineralWall(var/ore)
var/old_icon = icon_state var/old_icon = icon_state

View File

@@ -137,7 +137,7 @@
if(istype(target,/turf/simulated/wall)) if(istype(target,/turf/simulated/wall))
if((!istype(target,/turf/simulated/wall/r_wall) && eatingDuration >= 100) || eatingDuration >= 200) //need 20 ticks to eat an rwall, 10 for a regular one if((!istype(target,/turf/simulated/wall/r_wall) && eatingDuration >= 100) || eatingDuration >= 200) //need 20 ticks to eat an rwall, 10 for a regular one
var/turf/simulated/wall/wall = target var/turf/simulated/wall/wall = target
wall.ReplaceWithFloor() wall.ChangeTurf(/turf/simulated/floor)
new /obj/item/stack/sheet/metal(src, flatPlasmaValue) new /obj/item/stack/sheet/metal(src, flatPlasmaValue)
return 1 return 1
else if(istype(target,/atom/movable)) else if(istype(target,/atom/movable))

View File

@@ -21,12 +21,12 @@
/turf/simulated/floor/engine/ex_act(severity) /turf/simulated/floor/engine/ex_act(severity)
switch(severity) switch(severity)
if(1.0) if(1.0)
ReplaceWithSpace() ChangeTurf(/turf/space)
del(src) del(src)
return return
if(2.0) if(2.0)
if (prob(50)) if (prob(50))
ReplaceWithSpace() ChangeTurf(/turf/space)
del(src) del(src)
return return
else else
@@ -34,7 +34,7 @@
/turf/simulated/floor/engine/blob_act() /turf/simulated/floor/engine/blob_act()
if (prob(25)) if (prob(25))
ReplaceWithSpace() ChangeTurf(/turf/space)
del(src) del(src)
return return
return return

View File

@@ -289,7 +289,7 @@ var/global/list/uneatable = list(
continue continue
if(O.invisibility == 101) if(O.invisibility == 101)
src.consume(O) src.consume(O)
T.ReplaceWithSpace() T.ChangeTurf(/turf/space)
gain = 2 gain = 2
src.energy += gain src.energy += gain
return return
@@ -505,7 +505,7 @@ var/global/list/uneatable = list(
continue continue
if(O.invisibility == 101) if(O.invisibility == 101)
src.consume(O) src.consume(O)
A:ReplaceWithSpace() A:ChangeTurf(/turf/space)
return return
/obj/machinery/singularity/narsie/ex_act() //No throwing bombs at it either. --NEO /obj/machinery/singularity/narsie/ex_act() //No throwing bombs at it either. --NEO

View File

@@ -118,7 +118,7 @@
var/turf/Newloc = locate(_x, _y, _z) var/turf/Newloc = locate(_x, _y, _z)
//new T(Newloc) //new T(Newloc)
new T.type(Newloc) new T.type(Newloc)
T.ReplaceWithSpace() T.ChangeTurf(/turf/space)
if(Newloc) if(Newloc)
Newloc.assume_air(T.return_air()) Newloc.assume_air(T.return_air())