Skip to content

Commit

Permalink
feat: add exploding decompressions (#970)
Browse files Browse the repository at this point in the history
## Что этот PR делает

Добавляем взрывные разгермы от нашего друга @AddRaiser

## Почему это хорошо для игры

Возможно меньше нагрузки на атмос

## Тестирование
Сломал окно граничащее с космосом

## Changelog

:cl:
add: Взрывные разгермы
/:cl:

---------

Co-authored-by: Volodymir Ohorodnytskyi <[email protected]>
Co-authored-by: Aylong <[email protected]>
  • Loading branch information
3 people authored Feb 4, 2024
1 parent d87f341 commit 30dfa87
Showing 1 changed file with 54 additions and 8 deletions.
62 changes: 54 additions & 8 deletions code/modules/atmospherics/environmental/LINDA_turf_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,23 @@

else
if(!air.check_turf(enemy_tile, adjacent_turfs_length))
var/difference = air.mimic(enemy_tile, adjacent_turfs_length)
if(difference)
if(difference > 0)
consider_pressure_difference(enemy_tile, difference)
else
enemy_tile.consider_pressure_difference(src, difference)
// SS220 EDIT - START
var/current_moles = air.total_moles()
if(is_station_level(loc.z) && current_moles > 5 && isspaceturf(enemy_tile))
handle_space(enemy_tile)
var/pressure_direction = get_dir(src, enemy_tile)
for(var/atom/movable/movable in enemy_tile)
if(!movable.anchored && !movable.pulledby)
movable.experience_pressure_difference(current_moles, pressure_direction)
else
var/difference = air.mimic(enemy_tile, adjacent_turfs_length)
if(difference)
if(difference > 0)
consider_pressure_difference(enemy_tile, difference)
else
enemy_tile.consider_pressure_difference(src, difference)
// SS220 EDIT - END

remove = 0
if(our_excited_group)
last_share_check()
Expand Down Expand Up @@ -260,6 +271,41 @@
if(!our_excited_group && remove == 1)
SSair.remove_from_active(src)

// SS220 EDIT - START
/turf/simulated/proc/handle_space(turf/space/space_turf)
var/list/unchecked_turfs = GetAtmosAdjacentTurfs()
var/list/checked_turfs = list()
while(unchecked_turfs.len)
var/turf/current_turf = unchecked_turfs[1]
var/list/connected_turfs = current_turf.GetAtmosAdjacentTurfs()
if(checked_turfs.len < 30)
for(var/turf/simulated/turf in connected_turfs)
if(!unchecked_turfs.Find(turf) && !checked_turfs.Find(turf))
unchecked_turfs.Add(connected_turfs)
checked_turfs.Add(current_turf)
unchecked_turfs.Remove(current_turf)
decompression(checked_turfs, space_turf)

/turf/simulated/proc/decompression(list/turfs, turf/space/space_turf, turn = 0)
for(var/turf/simulated/turf in turfs)
var/difference = turf.air.total_moles() / 2

turf.air.oxygen /= 2
turf.air.carbon_dioxide /= 2
turf.air.nitrogen /= 2
turf.air.toxins /= 2
turf.air.sleeping_agent /= 2
turf.air.agent_b /= 2
turf.air.temperature /= 2
turf.archive()

if(difference)
var/decompression_direction = get_dir(turf, get_step_towards(turf, space_turf))
if(!decompression_direction)
decompression_direction = get_dir(turf, space_turf)
turf.consider_pressure_difference(src, difference, decompression_direction)
// SS220 EDIT - END


/turf/simulated/proc/archive()
if(air) //For open space like floors
Expand Down Expand Up @@ -310,10 +356,10 @@
T.consider_pressure_difference(src, difference)
last_share_check()

/turf/proc/consider_pressure_difference(turf/simulated/T, difference)
/turf/proc/consider_pressure_difference(turf/simulated/T, difference, direction = get_dir(src, T)) // SS220 - EDIT
SSair.high_pressure_delta |= src
if(difference > pressure_difference)
pressure_direction = get_dir(src, T)
pressure_direction = direction // SS220 - EDIT
pressure_difference = difference

/turf/simulated/proc/last_share_check()
Expand Down

0 comments on commit 30dfa87

Please sign in to comment.