Commit 1690e86b authored by ririchiyo's avatar ririchiyo
Browse files

Merge pull request #1 from d3athrow/Bleeding-Edge

Bleeding edge
parents 15f6de40 d3cdc40c
......@@ -377,7 +377,8 @@ proc/airborne_can_reach(turf/source, turf/target)
name = "Telepathy Syndrome"
stage = 3
activate(var/mob/living/carbon/mob,var/multiplier)
mob.mutations |= 512
mob.mutations |= 104
mob:verbs += /mob/living/carbon/human/proc/remotesay
/*/datum/disease2/effect/greater/noface
name = "Identity Loss syndrome"
......@@ -430,7 +431,7 @@ proc/airborne_can_reach(turf/source, turf/target)
stage = 3
activate(var/mob/living/carbon/mob,var/multiplier)
mob.setBrainLoss(50)
/* stupid disease really
/datum/disease2/effect/greater/suicide
name = "Suicidal syndrome"
stage = 4
......@@ -442,7 +443,7 @@ proc/airborne_can_reach(turf/source, turf/target)
mob.updatehealth()
spawn(200) //in case they get revived by cryo chamber or something stupid like that, let them suicide again in 20 seconds
mob.suiciding = 0
*/
// lesser syndromes, partly just copypastes
/datum/disease2/effect/lesser/mind
name = "Lazy mind syndrome"
......
This diff is collapsed.
......@@ -3,16 +3,16 @@ client/proc/Zone_Info(turf/T as null|turf)
set category = "Debug"
if(T)
if(T.zone)
T.zone.DebugDisplay(mob)
T.zone.DebugDisplay(src)
else
mob << "No zone here."
else
for(T in world)
T.overlays -= 'debug_space.dmi'
T.overlays -= 'debug_group.dmi'
T.overlays -= 'debug_connect.dmi'
if(zone_debug_images)
for(var/zone in zone_debug_images)
images -= zone_debug_images[zone]
zone_debug_images = null
client/var/list/zone_debug_images
client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf)
set category = "Debug"
......@@ -24,12 +24,12 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf)
"South" = SOUTH,\
"East" = EAST,\
"West" = WEST,\
"None" = null)
"N/A" = null)
var/direction = input("What direction do you wish to test?","Set direction") as null|anything in direction_list
if(!direction)
return
if(direction == "None")
if(direction == "N/A")
if(T.CanPass(null, T, 0,0))
mob << "The turf can pass air! :D"
else
......@@ -56,51 +56,67 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf)
mob << "Both turfs can connect! :)"
zone/proc
DebugDisplay(mob/M)
if(!dbg_output)
dbg_output = 1 //Don't want to be spammed when someone investigates a zone...
for(var/turf/T in contents)
T.overlays += 'debug_group.dmi'
for(var/turf/space/S in unsimulated_tiles)
S.overlays += 'debug_space.dmi'
M << "<u>Zone Air Contents</u>"
M << "Oxygen: [air.oxygen]"
M << "Nitrogen: [air.nitrogen]"
M << "Plasma: [air.toxins]"
M << "Carbon Dioxide: [air.carbon_dioxide]"
M << "Temperature: [air.temperature]"
M << "Heat Energy: [air.temperature * air.heat_capacity()]"
M << "Pressure: [air.return_pressure()]"
M << ""
M << "Space Tiles: [length(unsimulated_tiles)]"
M << "Movable Objects: [length(movables())]"
M << "<u>Connections: [length(connections)]</u>"
for(var/connection/C in connections)
M << "[C.A] --> [C.B] [(C.indirect?"Open":"Closed")]"
C.A.overlays += 'debug_connect.dmi'
C.B.overlays += 'debug_connect.dmi'
for(var/C in connections)
if(!istype(C,/connection))
M << "[C] (Not Connection!)"
zone/proc/DebugDisplay(client/client)
if(!istype(client))
return
if(!dbg_output)
dbg_output = 1 //Don't want to be spammed when someone investigates a zone...
else
dbg_output = 0
if(!client.zone_debug_images)
client.zone_debug_images = list()
var/list/current_zone_images = list()
for(var/turf/T in contents)
current_zone_images += image('debug_group.dmi', T, null, TURF_LAYER)
for(var/turf/space/S in unsimulated_tiles)
current_zone_images += image('debug_space.dmi', S, null, TURF_LAYER)
client << "<u>Zone Air Contents</u>"
client << "Oxygen: [air.oxygen]"
client << "Nitrogen: [air.nitrogen]"
client << "Plasma: [air.toxins]"
client << "Carbon Dioxide: [air.carbon_dioxide]"
client << "Temperature: [air.temperature] K"
client << "Heat Energy: [air.temperature * air.heat_capacity()] J"
client << "Pressure: [air.return_pressure()] KPa"
client << ""
client << "Space Tiles: [length(unsimulated_tiles)]"
client << "Movable Objects: [length(movables())]"
client << "<u>Connections: [length(connections)]</u>"
for(var/turf/T in contents)
T.overlays -= 'debug_group.dmi'
for(var/connection/C in connections)
client << "\ref[C] [C.A] --> [C.B] [(C.indirect?"Open":"Closed")]"
current_zone_images += image('debug_connect.dmi', C.A, null, TURF_LAYER)
current_zone_images += image('debug_connect.dmi', C.B, null, TURF_LAYER)
client << "Connected Zones:"
for(var/zone/zone in connected_zones)
client << "\ref[zone] [zone] - [connected_zones[zone]] (Connected)"
for(var/zone/zone in closed_connection_zones)
client << "\ref[zone] [zone] - [closed_connection_zones[zone]] (Unconnected)"
for(var/C in connections)
if(!istype(C,/connection))
client << "[C] (Not Connection!)"
if(!client.zone_debug_images)
client.zone_debug_images = list()
client.zone_debug_images[src] = current_zone_images
client.images += client.zone_debug_images[src]
else
dbg_output = 0
for(var/turf/space/S in unsimulated_tiles)
S.overlays -= 'debug_space.dmi'
client.images -= client.zone_debug_images[src]
client.zone_debug_images.Remove(src)
for(var/connection/C in connections)
C.A.overlays -= 'debug_connect.dmi'
C.B.overlays -= 'debug_connect.dmi'
for(var/zone/Z in zones)
if(Z.air == air && Z != src)
var/turf/zloc = pick(Z.contents)
M << "\red Illegal air datum shared by: [zloc.loc.name]"
for(var/zone/Z in zones)
if(Z.air == air && Z != src)
var/turf/zloc = pick(Z.contents)
client << "\red Illegal air datum shared by: [zloc.loc.name]"
......@@ -64,49 +64,46 @@ atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
return (!density || !height || air_group)
turf
CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0)
if(!target) return 0
/turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0)
if(!target) return 0
if(istype(mover)) // turf/Enter(...) will perform more advanced checks
return !density
if(istype(mover)) // turf/Enter(...) will perform more advanced checks
return !density
else // Now, doing more detailed checks for air movement and air group formation
if(target.blocks_air||blocks_air)
return 0
else // Now, doing more detailed checks for air movement and air group formation
if(target.blocks_air||blocks_air)
return 0
for(var/obj/obstacle in src)
if(!obstacle.CanPass(mover, target, height, air_group))
for(var/obj/obstacle in src)
if(!obstacle.CanPass(mover, target, height, air_group))
return 0
if(target != src)
for(var/obj/obstacle in target)
if(!obstacle.CanPass(mover, src, height, air_group))
return 0
if(target != src)
for(var/obj/obstacle in target)
if(!obstacle.CanPass(mover, src, height, air_group))
return 0
return 1
return 1
var/global/datum/controller/air_system/air_master
var/datum/controller/air_system/air_master
datum
controller
air_system
//Geoemetry lists
var/list/turfs_with_connections = list()
var/list/active_hotspots = list()
/datum/controller/air_system/
//Geoemetry lists
var/list/turfs_with_connections = list()
var/list/active_hotspots = list()
//Special functions lists
var/list/tiles_to_reconsider_zones = list()
//Special functions lists
var/list/tiles_to_reconsider_zones = list()
//Geometry updates lists
var/list/tiles_to_update = list()
var/list/connections_to_check = list()
//Geometry updates lists
var/list/tiles_to_update = list()
var/list/connections_to_check = list()
var/current_cycle = 0
var/update_delay = 5 //How long between check should it try to process atmos again.
var/failed_ticks = 0 //How many ticks have runtimed?
var/current_cycle = 0
var/update_delay = 5 //How long between check should it try to process atmos again.
var/failed_ticks = 0 //How many ticks have runtimed?
var/tick_progress = 0
var/tick_progress = 0
/* process()
......@@ -122,97 +119,103 @@ datum
*/
proc/setup()
//Purpose: Call this at the start to setup air groups geometry
// (Warning: Very processor intensive but only must be done once per round)
//Called by: Gameticker/Master controller
//Inputs: None.
//Outputs: None.
set background = 1
world << "\red \b Processing Geometry..."
sleep(-1)
var/start_time = world.timeofday
var/simulated_turf_count = 0
for(var/turf/simulated/S in world)
simulated_turf_count++
if(!S.zone && !S.blocks_air)
if(S.CanPass(null, S, 0, 0))
new/zone(S)
for(var/turf/simulated/S in world)
S.update_air_properties()
world << {"<font color='red'><b>Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</b>
Total Simulated Turfs: [simulated_turf_count]
Total Zones: [zones.len]
Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]</font>"}
/*
spawn start()
proc/start()
//Purpose: This is kicked off by the master controller, and controls the processing of all atmosphere.
//Called by: Master controller
//Inputs: None.
//Outputs: None.
set background = 1
while(1)
if(!kill_air)
current_cycle++
var/success = tick() //Changed so that a runtime does not crash the ticker.
if(!success) //Runtimed.
failed_ticks++
if(failed_ticks > 20)
world << "<font color='red'><b>ERROR IN ATMOS TICKER. Killing air simulation!</font></b>"
kill_air = 1
sleep(max(5,update_delay*tick_multiplier))
*/
proc/tick()
. = 1 //Set the default return value, for runtime detection.
tick_progress = "update_air_properties"
if(tiles_to_update.len) //If there are tiles to update, do so.
for(var/turf/simulated/T in tiles_to_update)
if(. && T && !T.update_air_properties())
. = 0 //If a runtime occured, make sure we can sense it.
//message_admins("ZASALERT: Unable run turf/simualted/update_air_properties()")
tiles_to_update = list()
//Check sanity on connection objects.
tick_progress = "connections_to_check"
if(connections_to_check.len)
for(var/connection/C in connections_to_check)
C.CheckPassSanity()
connections_to_check = list()
//Ensure tiles still have zones.
tick_progress = "tiles_to_reconsider_zones"
if(tiles_to_reconsider_zones.len)
for(var/turf/simulated/T in tiles_to_reconsider_zones)
if(!T.zone)
new /zone(T)
tiles_to_reconsider_zones = list()
//Process zones.
tick_progress = "zone/process()"
for(var/zone/Z in zones)
if(Z.last_update < current_cycle)
var/output = Z.process()
if(Z)
Z.last_update = current_cycle
if(. && Z && !output)
. = 0
//Process fires.
tick_progress = "active_hotspots (fire)"
for(var/obj/fire/F in active_hotspots)
if(. && F && !F.process())
. = 0
tick_progress = "success"
\ No newline at end of file
/datum/controller/air_system/proc/setup()
//Purpose: Call this at the start to setup air groups geometry
// (Warning: Very processor intensive but only must be done once per round)
//Called by: Gameticker/Master controller
//Inputs: None.
//Outputs: None.
set background = 1
world << "\red \b Processing Geometry..."
sleep(-1)
var/start_time = world.timeofday
var/simulated_turf_count = 0
for(var/turf/simulated/S in world)
simulated_turf_count++
if(!S.zone && !S.blocks_air)
if(S.CanPass(null, S, 0, 0))
new/zone(S)
for(var/turf/simulated/S in world)
S.update_air_properties()
world << {"<font color='red'><b>Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</b>
Total Simulated Turfs: [simulated_turf_count]
Total Zones: [zones.len]
Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]</font>"}
/*
spawn start()
/datum/controller/air_system/proc/start()
//Purpose: This is kicked off by the master controller, and controls the processing of all atmosphere.
//Called by: Master controller
//Inputs: None.
//Outputs: None.
set background = 1
while(1)
if(!kill_air)
current_cycle++
var/success = tick() //Changed so that a runtime does not crash the ticker.
if(!success) //Runtimed.
failed_ticks++
if(failed_ticks > 20)
world << "<font color='red'><b>ERROR IN ATMOS TICKER. Killing air simulation!</font></b>"
kill_air = 1
sleep(max(5,update_delay*tick_multiplier))
*/
/datum/controller/air_system/proc/tick()
. = 1 //Set the default return value, for runtime detection.
tick_progress = "update_air_properties"
if(tiles_to_update.len) //If there are tiles to update, do so.
for(var/turf/simulated/T in tiles_to_update)
if(. && T && !T.update_air_properties())
. = 0 //If a runtime occured, make sure we can sense it.
//message_admins("ZASALERT: Unable run turf/simualted/update_air_properties()")
if(.)
tiles_to_update = list()
//Check sanity on connection objects.
if(.)
tick_progress = "connections_to_check"
if(connections_to_check.len)
for(var/connection/C in connections_to_check)
C.CheckPassSanity()
connections_to_check = list()
//Ensure tiles still have zones.
if(.)
tick_progress = "tiles_to_reconsider_zones"
if(tiles_to_reconsider_zones.len)
for(var/turf/simulated/T in tiles_to_reconsider_zones)
if(!T.zone)
new /zone(T)
tiles_to_reconsider_zones = list()
//Process zones.
if(.)
tick_progress = "zone/process()"
for(var/zone/Z in zones)
if(Z.last_update < current_cycle)
var/output = Z.process()
if(Z)
Z.last_update = current_cycle
if(. && Z && !output)
. = 0
//Process fires.
if(.)
tick_progress = "active_hotspots (fire)"
for(var/obj/fire/F in active_hotspots)
if(. && F && !F.process())
. = 0
if(.)
tick_progress = "success"
\ No newline at end of file
......@@ -237,11 +237,11 @@ datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid,force
carbon_dioxide += max(2 * total_fuel, 0)
if(fuel)
fuel.moles -= fuel.moles * used_fuel_ratio * used_reactants_ratio
fuel.moles -= (fuel.moles * used_fuel_ratio * used_reactants_ratio) * 5 //Fuel burns 5 times as quick
if(fuel.moles <= 0) del fuel
if(liquid)
liquid.amount -= liquid.amount * used_fuel_ratio * used_reactants_ratio
liquid.amount -= (liquid.amount * used_fuel_ratio * used_reactants_ratio) * 5 // liquid fuel burns 5 times as quick
if(liquid.amount <= 0) del liquid
//calculate the energy produced by the reaction and then set the new temperature of the mix
......@@ -258,7 +258,13 @@ datum/gas_mixture/proc/check_combustability(obj/effect/decal/cleanable/liquid_fu
var/value = 0
if(oxygen && (toxins || fuel || liquid))
value = 1
if(toxins && toxins < MOLES_PLASMA_VISIBLE)
value = 0
if(fuel)
if(fuel.moles < (MOLES_PLASMA_VISIBLE / 2))
value = 0
else
value = 1
return value
......
......@@ -62,6 +62,13 @@ vs_control/var
airflow_mob_slowdown_NAME = "Airflow Slowdown"
airflow_mob_slowdown_DESC = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow."
var/connection_insulation = 0.4
var/connection_insulation_NAME = "Connections - Insulation"
var/connection_insulation_DESC = "How insulative a connection is, in terms of heat transfer. 1 is perfectly insulative, and 0 is perfectly conductive."
var/connection_temperature_delta = 10
var/connection_temperature_delta_NAME = "Connections - Temperature Difference"
var/connection_temperature_delta_DESC = "The smallest temperature difference which will cause heat to travel through doors."
vs_control
var
......
......@@ -2,129 +2,126 @@ var/list/zones = list()
var/list/DoorDirections = list(NORTH,WEST) //Which directions doors turfs can connect to zones
var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs can connect to zones
zone
var
dbg_output = 0 //Enables debug output.
rebuild = 0 //If 1, zone will be rebuilt on next process. Not sure if used.
datum/gas_mixture/air //The air contents of the zone.
list/contents //All the tiles that are contained in this zone.
list/connections // /connection objects which refer to connections with other zones, e.g. through a door.
list/connected_zones //Parallels connections, but lists zones to which this one is connected and the number
/zone
var/dbg_output = 0 //Enables debug output.
var/rebuild = 0 //If 1, zone will be rebuilt on next process. Not sure if used.
var/datum/gas_mixture/air //The air contents of the zone.
var/list/contents //All the tiles that are contained in this zone.
var/list/connections // /connection objects which refer to connections with other zones, e.g. through a door.
var/list/connected_zones //Parallels connections, but lists zones to which this one is connected and the number
//of points they're connected at.
list/closed_connection_zones //Same as connected_zones, but for zones where the door or whatever is closed.
list/unsimulated_tiles // Any space tiles in this list will cause air to flow out.
last_update = 0
progress = "nothing"
// To make sure you're not spammed to death by airflow sound effects
tmp/playsound_cooldown = 0
var/list/closed_connection_zones //Same as connected_zones, but for zones where the door or whatever is closed.
var/list/unsimulated_tiles // Any space tiles in this list will cause air to flow out.
var/last_update = 0
var/progress = "nothing"
//CREATION AND DELETION
New(turf/start)
. = ..()
//Get the turfs that are part of the zone using a floodfill method
if(istype(start,/list))
contents = start
else
contents = FloodFill(start)
//Change all the zone vars of the turfs, check for space to be added to unsimulated_tiles.
for(var/turf/T in contents)
if(T.zone && T.zone != src)
T.zone.RemoveTurf(T)
T.zone = src
if(!istype(T,/turf/simulated))
AddTurf(T)
/zone/New(turf/start)
. = ..()
//Get the turfs that are part of the zone using a floodfill method
if(istype(start,/list))
contents = start
else
contents = FloodFill(start)
//Change all the zone vars of the turfs, check for space to be added to unsimulated_tiles.
for(var/turf/T in contents)
if(T.zone && T.zone != src)
T.zone.RemoveTurf(T)
T.zone = src
if(!istype(T,/turf/simulated))
AddTurf(T)
//Generate the gas_mixture for use in txhis zone by using the average of the gases
//defined at startup.
air = new
var/members = contents.len
for(var/turf/simulated/T in contents)
air.oxygen += T.oxygen / members
air.nitrogen += T.nitrogen / members
air.carbon_dioxide += T.carbon_dioxide / members
air.toxins += T.toxins / members
air.temperature += T.temperature / members
air.group_multiplier = contents.len
air.update_values()
//Generate the gas_mixture for use in txhis zone by using the average of the gases
//defined at startup.
air = new
air.group_multiplier = contents.len
for(var/turf/simulated/T in contents)
air.oxygen += T.oxygen / air.group_multiplier
air.nitrogen += T.nitrogen / air.group_multiplier
air.carbon_dioxide += T.carbon_dioxide / air.group_multiplier
air.toxins += T.toxins / air.group_multiplier
air.temperature += T.temperature / air.group_multiplier
air.update_values()
//Add this zone to the global list.
zones.Add(src)
//Add this zone to the global list.
zones.Add(src)
//LEGACY, DO NOT USE. Use the SoftDelete proc.
Del()
//Ensuring the zone list doesn't get clogged with null values.
for(var/turf/simulated/T in contents)
RemoveTurf(T)
air_master.tiles_to_reconsider_zones += T
for(var/zone/Z in connected_zones)
if(src in Z.connected_zones)
Z.connected_zones.Remove(src)
for(var/connection/C in connections)
air_master.connections_to_check += C
zones.Remove(src)
air = null
. = ..()
/zone/Del()
//Ensuring the zone list doesn't get clogged with null values.
for(var/turf/simulated/T in contents)
RemoveTurf(T)
air_master.tiles_to_reconsider_zones += T
for(var/zone/Z in connected_zones)
if(src in Z.connected_zones)
Z.connected_zones.Remove(src)
for(var/connection/C in connections)
air_master.connections_to_check += C
zones.Remove(src)
air = null
. = ..()
//Handles deletion via garbage collection.
proc/SoftDelete()
zones.Remove(src)
air = null
/zone/proc/SoftDelete()
zones.Remove(src)
air = null
//Ensuring the zone list doesn't get clogged with null values.
for(var/turf/simulated/T in contents)
RemoveTurf(T)
air_master.tiles_to_reconsider_zones += T
//Ensuring the zone list doesn't get clogged with null values.
for(var/turf/simulated/T in contents)
RemoveTurf(T)
air_master.tiles_to_reconsider_zones += T
//Removing zone connections and scheduling connection cleanup
for(var/zone/Z in connected_zones)
if(src in Z.connected_zones)
Z.connected_zones.Remove(src)
for(var/connection/C in connections)
air_master.connections_to_check += C
//Removing zone connections and scheduling connection cleanup
for(var/zone/Z in connected_zones)
if(src in Z.connected_zones)
Z.connected_zones.Remove(src)
connected_zones = null
for(var/connection/C in connections)