Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heretic QoL pass #9880

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/antagonists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
/// A define used in ritual priority for heretics.
#define MAX_KNOWLEDGE_PRIORITY 100

/// The maximum (and optimal) number of sacrifice targets a heretic should roll.
#define HERETIC_MAX_SAC_TARGETS 4


/// How much does it cost to reroll strains?
#define BLOB_REROLL_COST 40
Expand Down
16 changes: 16 additions & 0 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,22 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
. = orange(distance,center)
return

/**
* Gets the mind from a variable, whether it be a mob, or a mind itself.
* If [include_last] is true, then it will also return last_mind for carbons if there isn't a current mind.
*/
/proc/get_mind(target, include_last = FALSE)
if(istype(target, /datum/mind))
return target
if(ismob(target))
var/mob/mob_target = target
if(!QDELETED(mob_target.mind))
return mob_target.mind
if(include_last && iscarbon(mob_target))
var/mob/living/carbon/carbon_target = mob_target
if(!QDELETED(carbon_target.last_mind))
return carbon_target.last_mind

#undef FACING_SAME_DIR
#undef FACING_EACHOTHER
#undef FACING_INIT_FACING_TARGET_TARGET_FACING_PERPENDICULAR
23 changes: 23 additions & 0 deletions code/__HELPERS/turfs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,26 @@ Turf and target are separate in case you want to teleport some distance from a t
if(rail.dir == test_dir || is_fulltile)
return FALSE
return TRUE

/proc/is_turf_safe(turf/open/floor/floor)
// It's probably not safe if it's not a floor.
if(!istype(floor))
return FALSE
var/datum/gas_mixture/air = floor.air
// Certainly unsafe if it completely lacks air.
if(QDELETED(air))
return FALSE
// Can most things breathe?
for(var/id in air.get_gases())
if(id in GLOB.hardcoded_gases)
continue
return FALSE
if(air.get_moles(GAS_O2) < 16 || air.get_moles(GAS_PLASMA) || air.get_moles(GAS_CO2) >= 10)
return FALSE
var/temperature = air.return_temperature()
if(temperature <= 270 || temperature >= 360)
return FALSE
var/pressure = air.return_pressure()
if(pressure <= 20 || pressure >= 550)
return FALSE
return TRUE
27 changes: 1 addition & 26 deletions code/datums/helper_datums/teleport.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,32 +137,7 @@
if(!isfloorturf(random_location))
continue
var/turf/open/floor/F = random_location
if(!F.air)
continue

var/datum/gas_mixture/A = F.air
var/trace_gases
for(var/id in A.get_gases())
if(id in GLOB.hardcoded_gases)
continue
trace_gases = TRUE
break

// Can most things breathe?
if(trace_gases)
continue
if(A.get_moles(GAS_O2) < 16)
continue
if(A.get_moles(GAS_PLASMA))
continue
if(A.get_moles(GAS_CO2) >= 10)
continue

// Aim for goldilocks temperatures and pressure
if((A.return_temperature() <= 270) || (A.return_temperature() >= 360))
continue
var/pressure = A.return_pressure()
if((pressure <= 20) || (pressure >= 550))
if(!is_turf_safe(F))
continue

if(extended_safety_checks)
Expand Down
Loading