mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge branch 'master' of https://github.com/Baystation12/Baystation12 into bs12_with_tgport. May have overwritten some tweaks from Sky here.
Conflicts: code/WorkInProgress/Cael_Aislinn/Supermatter/SuperMatter.dm code/ZAS/Fire.dm code/game/machinery/alarm.dm code/modules/mob/living/carbon/human/life.dm code/setup.dm Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
@@ -92,15 +92,16 @@ datum
|
||||
controller
|
||||
air_system
|
||||
//Geoemetry lists
|
||||
var/list/turf/simulated/turfs_with_connections = list()
|
||||
var/list/obj/fire/active_hotspots = list()
|
||||
var/list/turfs_with_connections = list()
|
||||
var/list/active_hotspots = list()
|
||||
|
||||
//Special functions lists
|
||||
var/list/turf/simulated/tiles_to_reconsider_zones = list()
|
||||
var/list/tiles_to_reconsider_zones = list()
|
||||
|
||||
//Geometry updates lists
|
||||
var/list/turf/simulated/tiles_to_update = list()
|
||||
var/list/connection/connections_to_check = list()
|
||||
var/list/tiles_to_update = list()
|
||||
var/list/connections_to_check = list()
|
||||
var/list/rebuilds_to_consider = list()
|
||||
|
||||
var/current_cycle = 0
|
||||
var/update_delay = 5 //How long between check should it try to process atmos again.
|
||||
@@ -184,9 +185,30 @@ datum
|
||||
var/output = T.update_air_properties()
|
||||
if(. && T && !output)
|
||||
. = 0 //If a runtime occured, make sure we can sense it.
|
||||
log_admin("ZASALERT: Unable run turf/simualted/update_air_properties()")
|
||||
//message_admins("ZASALERT: Unable run turf/simualted/update_air_properties()")
|
||||
tiles_to_update = list()
|
||||
|
||||
tick_progress = "reconsider_zones"
|
||||
if(rebuilds_to_consider.len)
|
||||
for(var/turf/T in rebuilds_to_consider)
|
||||
if(istype(T, /turf/simulated) && T.zone && !T.zone.rebuild)
|
||||
var/turf/simulated/other_turf = rebuilds_to_consider[T]
|
||||
if(istype(other_turf))
|
||||
ConsiderRebuild(T,other_turf)
|
||||
else if(istype(other_turf, /list))
|
||||
var/list/temp_turfs = other_turf
|
||||
for(var/turf/NT in temp_turfs)
|
||||
ConsiderRebuild(T,NT)
|
||||
else if (istype(T))
|
||||
var/turf/simulated/other_turf = rebuilds_to_consider[T]
|
||||
if(istype(other_turf))
|
||||
ConsiderRebuild(other_turf,T)
|
||||
else if(istype(other_turf, /list))
|
||||
var/list/temp_turfs = other_turf
|
||||
for(var/turf/simulated/NT in temp_turfs)
|
||||
ConsiderRebuild(NT,T)
|
||||
rebuilds_to_consider = list()
|
||||
|
||||
tick_progress = "connections_to_check"
|
||||
if(connections_to_check.len)
|
||||
for(var/connection/C in connections_to_check)
|
||||
@@ -215,6 +237,137 @@ datum
|
||||
var/output = F.process()
|
||||
if(. && F && !output)
|
||||
. = 0
|
||||
log_admin("ZASALERT: Unable run obj/fire/process()")
|
||||
//message_admins("ZASALERT: Unable run obj/fire/process()")
|
||||
|
||||
tick_progress = "success"
|
||||
tick_progress = "success"
|
||||
|
||||
proc/AddToConsiderRebuild(var/turf/simulated/T, var/turf/NT)
|
||||
var/turf/existing_test = rebuilds_to_consider[T]
|
||||
var/turf/existing_test_alternate = rebuilds_to_consider[NT]
|
||||
|
||||
if(existing_test)
|
||||
if(NT == existing_test)
|
||||
return
|
||||
else if(islist(existing_test) && existing_test[NT])
|
||||
return
|
||||
|
||||
else if(existing_test_alternate)
|
||||
if(T == existing_test_alternate)
|
||||
return
|
||||
else if(islist(existing_test_alternate) && existing_test_alternate[T])
|
||||
return
|
||||
|
||||
if(istype(T))
|
||||
if(istype(existing_test))
|
||||
var/list/temp_list = list(NT = 1, existing_test = 1)
|
||||
rebuilds_to_consider[T] = temp_list
|
||||
else if(istype(existing_test, /list))
|
||||
existing_test[NT] = 1
|
||||
else
|
||||
rebuilds_to_consider[T] = NT
|
||||
|
||||
else if(istype(NT, /turf/simulated))
|
||||
if(istype(existing_test_alternate))
|
||||
var/list/temp_list = list(T = 1, existing_test_alternate = 1)
|
||||
rebuilds_to_consider[NT] = temp_list
|
||||
else if(istype(existing_test_alternate, /list))
|
||||
existing_test_alternate[T] = 1
|
||||
else
|
||||
rebuilds_to_consider[NT] = T
|
||||
|
||||
proc/ConsiderRebuild(var/turf/simulated/T, var/turf/NT)
|
||||
|
||||
if(istype(NT, /turf/simulated) && NT.zone != T.zone)
|
||||
T.zone.RemoveTurf(NT)
|
||||
if(NT.zone)
|
||||
NT.zone.RemoveTurf(T)
|
||||
return
|
||||
if(T.zone.rebuild)
|
||||
return
|
||||
|
||||
var/zone/zone = T.zone
|
||||
|
||||
var/target_dir = get_dir(T, NT)
|
||||
if(target_dir in list(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST))
|
||||
T.zone.rebuild = 1
|
||||
return
|
||||
var/test_dir = turn(target_dir, 90)
|
||||
|
||||
var/turf/simulated/current = T
|
||||
var/turf/simulated/next
|
||||
var/stepped_back = 0
|
||||
|
||||
if( !(T.air_check_directions&test_dir || T.air_check_directions&turn(target_dir, 270)) )
|
||||
//Step back, then try to connect.
|
||||
if(!(T.air_check_directions&get_dir(NT, T)))
|
||||
zone.rebuild = 1
|
||||
return
|
||||
current = get_step(T, get_dir(NT, T))
|
||||
if(!istype(current) || !(current.air_check_directions&test_dir || current.air_check_directions&turn(target_dir, 270)) )
|
||||
zone.rebuild = 1
|
||||
return
|
||||
stepped_back = 1
|
||||
|
||||
if ( !(current.air_check_directions&test_dir) && current.air_check_directions&turn(target_dir, 270) )
|
||||
//Try to connect to the right hand side.
|
||||
var/flipped = 0
|
||||
test_dir = turn(target_dir, 270)
|
||||
|
||||
for(var/i = 1, i <= 10, i++)
|
||||
if(get_dir(current, NT) in cardinal)
|
||||
target_dir = get_dir(current, NT)
|
||||
|
||||
if(!istype(current) || !(current.air_check_directions&target_dir || current.air_check_directions&test_dir))
|
||||
if(flipped)
|
||||
zone.rebuild = 1
|
||||
return
|
||||
current = T
|
||||
test_dir = turn(target_dir, 180)
|
||||
i = 0
|
||||
target_dir = get_dir(current, NT)
|
||||
flipped = 1
|
||||
continue
|
||||
|
||||
if(current.air_check_directions&target_dir && !stepped_back)
|
||||
next = get_step(current, target_dir)
|
||||
if(!next.HasDoor())
|
||||
current = next
|
||||
|
||||
if(current.air_check_directions&test_dir && current != next)
|
||||
next = get_step(current, test_dir)
|
||||
if(!next.HasDoor())
|
||||
current = next
|
||||
|
||||
if(current == NT)
|
||||
return //We made it, yaaay~
|
||||
stepped_back = 0
|
||||
zone.rebuild = 1
|
||||
|
||||
else if ( current.air_check_directions&test_dir )
|
||||
//Try to connect to the left hand side.
|
||||
for(var/i = 1, i <= 10, i++)
|
||||
if(get_dir(current, NT) in cardinal)
|
||||
target_dir = get_dir(current, NT)
|
||||
|
||||
if(!istype(current) || !(current.air_check_directions&target_dir || current.air_check_directions&test_dir))
|
||||
zone.rebuild = 1
|
||||
return
|
||||
|
||||
if(current.air_check_directions&target_dir && !stepped_back)
|
||||
next = get_step(current, target_dir)
|
||||
if(!next.HasDoor())
|
||||
current = next
|
||||
|
||||
if(current.air_check_directions&test_dir && current != next)
|
||||
next = get_step(current, test_dir)
|
||||
if(!next.HasDoor())
|
||||
current = next
|
||||
|
||||
if(current == NT)
|
||||
return //We made it, yaaay~
|
||||
stepped_back = 0
|
||||
zone.rebuild = 1
|
||||
|
||||
else
|
||||
//FUCK IT
|
||||
zone.rebuild = 1
|
||||
@@ -92,10 +92,14 @@ obj
|
||||
//Also get liquid fuels on the ground.
|
||||
obj/liquid_fuel/liquid = locate() in S
|
||||
|
||||
var/datum/gas_mixture/flow = air_contents.remove_ratio(0.25)
|
||||
//The reason we're taking a part of the air instead of all of it is so that it doesn't jump to
|
||||
//the fire's max temperature instantaneously.
|
||||
|
||||
firelevel = air_contents.calculate_firelevel(liquid)
|
||||
|
||||
//Ensure that there is an appropriate amount of fuel and O2 here.
|
||||
if(firelevel > 0.25 && (air_contents.toxins || fuel || liquid))
|
||||
if(firelevel > 0.25 && flow.oxygen > 0.3 && (air_contents.toxins || fuel || liquid))
|
||||
|
||||
for(var/direction in cardinal)
|
||||
if(S.air_check_directions&direction) //Grab all valid bordering tiles
|
||||
@@ -114,10 +118,6 @@ obj
|
||||
if( prob( firelevel*10 ) )
|
||||
new/obj/fire(enemy_tile,firelevel)
|
||||
|
||||
var/datum/gas_mixture/flow = air_contents.remove_ratio(0.25)
|
||||
//The reason we're taking a part of the air instead of all of it is so that it doesn't jump to
|
||||
//the fire's max temperature instantaneously.
|
||||
|
||||
if(flow)
|
||||
|
||||
//Ensure adequate oxygen and fuel.
|
||||
@@ -126,16 +126,10 @@ obj
|
||||
//Change icon depending on the fuel, and thus temperature.
|
||||
if(firelevel > 6)
|
||||
icon_state = "3"
|
||||
if(LuminosityRed != 11)
|
||||
sd_SetLuminosity(11,9,0)
|
||||
else if(firelevel > 2.5)
|
||||
icon_state = "2"
|
||||
if(LuminosityRed != 8)
|
||||
sd_SetLuminosity(8,7,0)
|
||||
else
|
||||
icon_state = "1"
|
||||
if(LuminosityRed != 5)
|
||||
sd_SetLuminosity(5,4,0)
|
||||
|
||||
//Ensure flow temperature is higher than minimum fire temperatures.
|
||||
flow.temperature = max(PLASMA_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature)
|
||||
@@ -163,8 +157,12 @@ obj
|
||||
|
||||
New(newLoc,fl)
|
||||
..()
|
||||
|
||||
if(!istype(loc, /turf) || !loc.CanPass(null, loc, 0, 0))
|
||||
del src
|
||||
|
||||
dir = pick(cardinal)
|
||||
sd_SetLuminosity(3,2,0)
|
||||
ul_SetLuminosity(3,2,0)
|
||||
firelevel = fl
|
||||
for(var/mob/living/carbon/human/M in loc)
|
||||
M.FireBurn(min(max(0.1,firelevel / 20),10)) //Burn the humans!
|
||||
@@ -172,7 +170,7 @@ obj
|
||||
|
||||
Del()
|
||||
if (istype(loc, /turf/simulated))
|
||||
sd_SetLuminosity(0)
|
||||
ul_SetLuminosity(0)
|
||||
|
||||
loc = null
|
||||
air_master.active_hotspots.Remove(src)
|
||||
@@ -322,8 +320,7 @@ datum/gas_mixture/proc/calculate_firelevel(obj/liquid_fuel/liquid)
|
||||
arms_exposure = 1
|
||||
|
||||
//Get heat transfer coefficients for clothing.
|
||||
//skytodo: this is handled different in tg
|
||||
/*for(var/obj/item/clothing/C in src)
|
||||
for(var/obj/item/clothing/C in src)
|
||||
if(l_hand == C || r_hand == C) continue
|
||||
if(C.body_parts_covered & HEAD)
|
||||
head_exposure *= C.heat_transfer_coefficient
|
||||
@@ -334,7 +331,7 @@ datum/gas_mixture/proc/calculate_firelevel(obj/liquid_fuel/liquid)
|
||||
if(C.body_parts_covered & LEGS)
|
||||
legs_exposure *= C.heat_transfer_coefficient
|
||||
if(C.body_parts_covered & ARMS)
|
||||
arms_exposure *= C.heat_transfer_coefficient*/
|
||||
arms_exposure *= C.heat_transfer_coefficient
|
||||
|
||||
//Always check these damage procs first if fire damage isn't working. They're probably what's wrong.
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ turf
|
||||
|
||||
proc/update_air_properties()
|
||||
. = 1
|
||||
var/air_directions_archived = air_check_directions
|
||||
air_check_directions = 0
|
||||
|
||||
for(var/direction in cardinal)
|
||||
@@ -169,28 +170,69 @@ turf
|
||||
if(!(C in air_master.connections_to_check))
|
||||
air_master.connections_to_check += C
|
||||
|
||||
for(var/direction in cardinal)
|
||||
var/turf/T = get_step(src,direction)
|
||||
if(!istype(T))
|
||||
continue
|
||||
// var/list/zone/adjacent_zones = list()
|
||||
if(zone && !zone.rebuild)
|
||||
for(var/direction in cardinal)
|
||||
if(zone.rebuild)
|
||||
break
|
||||
|
||||
if(air_check_directions&direction) //I can connect air in this direction
|
||||
if(!CanPass(null, T, 0, 0)) //If either block air, we must look to see if the adjacent turfs need rebuilt.
|
||||
if(T.zone && !T.zone.rebuild)
|
||||
var/turf/simulated/NT = get_step(src, reverse_direction(direction))
|
||||
if(istype(NT) && NT.zone && NT.zone == T.zone)
|
||||
T.zone.rebuild = 1
|
||||
var/turf/T = get_step(src,direction)
|
||||
if(!istype(T))
|
||||
continue
|
||||
// var/list/zone/adjacent_zones = list()
|
||||
|
||||
else
|
||||
ZConnect(src,T)
|
||||
if(air_check_directions&direction) //I can connect air in this direction
|
||||
if(!CanPass(null, T, 0, 0)) //If either block air, we must look to see if the adjacent turfs need rebuilt.
|
||||
if(!T.CanPass(null, T, 0, 0)) //Target blocks air
|
||||
var/turf/NT = get_step(T, direction)
|
||||
if(istype(NT,/turf/simulated) && NT in zone.contents)
|
||||
air_master.AddToConsiderRebuild(src,NT)
|
||||
else if(istype(NT) && NT in zone.unsimulated_tiles)
|
||||
var/consider_rebuild = 0
|
||||
for(var/d in cardinal)
|
||||
var/turf/UT = get_step(NT,d)
|
||||
if(istype(UT, /turf/simulated) && UT.zone == zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild
|
||||
consider_rebuild = 1
|
||||
break
|
||||
if(consider_rebuild)
|
||||
air_master.AddToConsiderRebuild(src,NT) //Gotta check if we need to rebuild, dammit
|
||||
else
|
||||
zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~
|
||||
|
||||
//If I cannot connect to air or whatever, and there is a zone there, I am probably not able to pass air. Consider zone rebuilding
|
||||
// else if(T.zone && !T.zone.rebuild)
|
||||
// if(T.zone in adjacent_zones) //Found it more than 1 direction, rebuild
|
||||
// T.zone.rebuild = 1
|
||||
// else //Add it for later checks.
|
||||
// adjacent_zones += T.zone
|
||||
if(T.zone && !T.zone.rebuild) //I block air.
|
||||
var/turf/NT = get_step(src, reverse_direction(direction))
|
||||
if(istype(NT,/turf/simulated) && (NT in T.zone.contents || (NT.zone && T in NT.zone.contents)))
|
||||
air_master.AddToConsiderRebuild(T,NT)
|
||||
else if(istype(NT) && NT in T.zone.unsimulated_tiles)
|
||||
var/consider_rebuild = 0
|
||||
for(var/d in cardinal)
|
||||
var/turf/UT = get_step(NT,d)
|
||||
if(istype(UT, /turf/simulated) && UT.zone == T.zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild
|
||||
consider_rebuild = 1
|
||||
break
|
||||
if(consider_rebuild)
|
||||
air_master.AddToConsiderRebuild(T,NT) //Gotta check if we need to rebuild, dammit
|
||||
else
|
||||
T.zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~
|
||||
|
||||
else
|
||||
ZConnect(src,T)
|
||||
|
||||
else if(air_directions_archived&direction) //Something like a wall was built, changing the geometry.
|
||||
var/turf/NT = get_step(T, direction)
|
||||
if(istype(NT,/turf/simulated) && NT in zone.contents)
|
||||
air_master.AddToConsiderRebuild(src,NT)
|
||||
|
||||
else if(istype(NT) && NT in zone.unsimulated_tiles) //Parse if we need to remove the tile, or rebuild the zone.
|
||||
var/consider_rebuild = 0
|
||||
for(var/d in cardinal)
|
||||
var/turf/UT = get_step(NT,d)
|
||||
if(istype(UT, /turf/simulated) && UT.zone == zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild
|
||||
consider_rebuild = 1
|
||||
break
|
||||
if(consider_rebuild)
|
||||
air_master.AddToConsiderRebuild(src,NT) //Gotta check if we need to rebuild, dammit
|
||||
else
|
||||
zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~
|
||||
|
||||
if(air_check_directions)
|
||||
processing = 1
|
||||
@@ -198,6 +240,9 @@ turf
|
||||
processing = 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/turf/proc/HasDoor(turf/O)
|
||||
//Checks for the presence of doors, used for zone spreading and connection.
|
||||
//A positive numerical argument checks only for closed doors.
|
||||
|
||||
@@ -167,7 +167,8 @@ zone/proc/process()
|
||||
progress = "problem with: air.react()"
|
||||
|
||||
//React the air here.
|
||||
air.react(null,0)
|
||||
//Handled by fire, no need for this.
|
||||
// air.react(null,0)
|
||||
|
||||
//Check the graphic.
|
||||
|
||||
@@ -454,7 +455,7 @@ zone/proc/Rebuild()
|
||||
continue
|
||||
for(var/direction in cardinal)
|
||||
var/turf/simulated/T = get_step(S,direction)
|
||||
if(istype(T) && T.zone)
|
||||
if(istype(T) && T.zone && S.CanPass(null, T, 0, 0))
|
||||
T.zone.AddTurf(S)
|
||||
|
||||
//UNUSED
|
||||
|
||||
Reference in New Issue
Block a user