mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 04:51:32 +01:00
Lag War Day 4: Under Pressure, High Voltage (#21878)
Replace /datum/gas_mixture/proc/return_pressure with XGM_PRESSURE(xgm) macro. Having such a relatively simple statement contributing proc overhead to procs called millions of times is ridiculous Rename /datum/gas_mixture/proc/zburn to react, deleting the old react which was just an alias for it. Free proc overhead Turn check_combustibility into a macro CHECK_COMBUSTIBLE(is_cmb, xgm). also rewrite it slightly so that it only needs to do one pass. Its a bit nasty so I apologize for that, but speeeeed. Delete most powernet and obj/machinery/power procs for handling power, replacing them with macros. The fact that we were unironically calling a draw_power() on APCs to call draw_power() on their terminals to call draw_power() on their powernet every single process tick was insane. Turn `between` into a macro alias for clamp() since the param order is different turn `Percent` into a macro AS_PCT Rewrite significant chunks of update_canmove so its not quite as horrifying of a proc and hopefully doesn't eat the entire mob subsystem every movement now
This commit is contained in:
@@ -192,7 +192,7 @@
|
||||
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
var/total_moles = environment.total_moles
|
||||
|
||||
to_chat(src, SPAN_NOTICE("<B>Results:</B>"))
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
if(T && !vacuum_proof) //Ghosts can hear even in vacuum.
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/pressure = (environment)? environment.return_pressure() : 0
|
||||
var/pressure = SAFE_XGM_PRESSURE(environment)
|
||||
var/distance_to_speaker = get_dist(speaker, src)
|
||||
if(pressure < SOUND_MINIMUM_PRESSURE && distance_to_speaker > 1)
|
||||
// Yeah, this isn't quite realistic to be able to see if someone is talking through, say, an opaque mask, but for gameplay purposes it should help indicate that you're not bugged.
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
//Handle possble chem smoke effect
|
||||
/mob/living/carbon/proc/handle_chemical_smoke(var/datum/gas_mixture/environment)
|
||||
if(species && environment.return_pressure() < species.breath_pressure/5)
|
||||
if(species && XGM_PRESSURE(environment) < species.breath_pressure/5)
|
||||
return //pressure is too low to even breathe in.
|
||||
if(wear_mask && (wear_mask.item_flags & ITEM_FLAG_BLOCK_GAS_SMOKE_EFFECT))
|
||||
return
|
||||
|
||||
@@ -416,11 +416,6 @@
|
||||
usr.sleeping = 20 // Short nap.
|
||||
usr.eye_blurry = 20
|
||||
|
||||
/mob/living/carbon/sleeps_horizontal()
|
||||
if(species && species.sleeps_upright)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/verb/toggle_indefinite_sleep()
|
||||
set name = "Toggle Indefinite Sleep"
|
||||
set category = "IC"
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
qdel(internal)
|
||||
else
|
||||
. += "Internal Atmosphere Info: [internal.name]"
|
||||
. += "Tank Pressure: [internal.air_contents.return_pressure()]"
|
||||
. += "Tank Pressure: [XGM_PRESSURE(internal.air_contents)]"
|
||||
. += "Distribution Pressure: [internal.distribute_pressure]"
|
||||
|
||||
var/obj/item/organ/internal/machine/power_core/IC = internal_organs_by_name[BP_CELL]
|
||||
@@ -1905,15 +1905,15 @@
|
||||
eyeobj.remove_visual(src)
|
||||
|
||||
|
||||
/mob/living/carbon/human/can_stand_overridden()
|
||||
/mob/living/carbon/human/proc/can_stand_overridden()
|
||||
if(wearing_rig && wearing_rig.ai_can_move_suit(check_for_ai = 1))
|
||||
// Actually missing a leg will screw you up. Everything else can be compensated for.
|
||||
for(var/limbcheck in list(BP_L_LEG,BP_R_LEG))
|
||||
var/obj/item/organ/affecting = get_organ(limbcheck)
|
||||
if(!affecting)
|
||||
return 0
|
||||
return 1
|
||||
return 0
|
||||
return FALSE
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/mob/living/carbon/human/proc/can_drink(var/obj/item/I)
|
||||
if(should_have_organ(BP_REACTOR))
|
||||
@@ -2307,7 +2307,7 @@
|
||||
look_up_open_space(get_turf(src))
|
||||
|
||||
/mob/living/proc/look_up_open_space(var/turf/T)
|
||||
if(client && !is_physically_disabled())
|
||||
if(client && !MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
if(z_eye)
|
||||
reset_view(null)
|
||||
QDEL_NULL(z_eye)
|
||||
@@ -2330,7 +2330,7 @@
|
||||
look_down_open_space(get_turf(src))
|
||||
|
||||
/mob/living/proc/look_down_open_space(var/turf/T)
|
||||
if(client && !is_physically_disabled())
|
||||
if(client && !MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
if(z_eye)
|
||||
reset_view(null)
|
||||
QDEL_NULL(z_eye)
|
||||
|
||||
@@ -13,7 +13,7 @@ emp_act
|
||||
if(species_check)
|
||||
return species_check
|
||||
|
||||
if(!is_physically_disabled())
|
||||
if(!MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
var/deflection_chance = check_martial_deflection_chance()
|
||||
if(prob(deflection_chance))
|
||||
visible_message(SPAN_WARNING("\The [src] deftly dodges \the [hitting_projectile]!"), SPAN_NOTICE("You deftly dodge \the [hitting_projectile]!"))
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
I.take_damage(rand(3,5))
|
||||
|
||||
//Moving makes open wounds get infected much faster
|
||||
for(var/datum/wound/W in E.wounds)
|
||||
for(var/datum/wound/W as anything in E.wounds)
|
||||
if (W.infection_check())
|
||||
W.germ_level += 1
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
|
||||
if(breath)
|
||||
//exposure to extreme pressures can rupture lungs
|
||||
var/check_pressure = breath.return_pressure()
|
||||
var/check_pressure = XGM_PRESSURE(breath)
|
||||
if(check_pressure < ONE_ATMOSPHERE / 5 || check_pressure > ONE_ATMOSPHERE * 5)
|
||||
if(!is_lung_ruptured() && prob(5))
|
||||
rupture_lung()
|
||||
@@ -313,7 +313,7 @@
|
||||
species.handle_environment_special(src)
|
||||
|
||||
//Moved pressure calculations here for use in skip-processing check.
|
||||
var/pressure = environment.return_pressure()
|
||||
var/pressure = XGM_PRESSURE(environment)
|
||||
var/adjusted_pressure = calculate_affecting_pressure(pressure)
|
||||
|
||||
if (consume_nutrition_from_air)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
visible_message(SPAN_WARNING("\The [user] is taking a look at \the [src]'s air tank."))
|
||||
if(do_after(user, HUMAN_STRIP_DELAY, src, do_flags = DO_EQUIP))
|
||||
var/obj/item/tank/T = internal
|
||||
to_chat(user, SPAN_NOTICE("\The [T] has [T.air_contents.return_pressure()] kPA left."))
|
||||
to_chat(user, SPAN_NOTICE("\The [T] has [XGM_PRESSURE(T.air_contents)] kPA left."))
|
||||
to_chat(user, SPAN_NOTICE("The [T] is set to release [T.distribute_pressure] kPA."))
|
||||
return TRUE
|
||||
if("pockets")
|
||||
|
||||
@@ -320,7 +320,7 @@ var/list/channel_to_radio_key = new
|
||||
if(!speaking || !(speaking.flags & PRESSUREPROOF))
|
||||
//make sure the air can transmit speech - speaker's side
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/pressure = (environment)? environment.return_pressure() : 0
|
||||
var/pressure = SAFE_XGM_PRESSURE(environment)
|
||||
if(pressure < SOUND_MINIMUM_PRESSURE)
|
||||
message_range = 1
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@
|
||||
|
||||
if(jetpack)
|
||||
. += "Internal Atmosphere Info: [jetpack.name]"
|
||||
. += "Tank Pressure: [jetpack.air_contents.return_pressure()]"
|
||||
. += "Tank Pressure: [XGM_PRESSURE(jetpack.air_contents)]"
|
||||
. += "Lights: [lights_on ? "ON" : "OFF"]"
|
||||
if(module)
|
||||
for(var/datum/matter_synth/ms in module.synths)
|
||||
|
||||
@@ -347,7 +347,7 @@
|
||||
if(istype(loc,/turf))
|
||||
var/turf/T = loc
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
if (environment.return_pressure() <= 80)
|
||||
if (XGM_PRESSURE(environment) <= 80)
|
||||
bearmode = BEARMODE_SPACE
|
||||
|
||||
if (bearmode != former)
|
||||
|
||||
+50
-87
@@ -1,7 +1,3 @@
|
||||
#define UNBUCKLED 0
|
||||
#define PARTIALLY_BUCKLED 1
|
||||
#define FULLY_BUCKLED 2
|
||||
|
||||
/mob/Destroy()//This makes sure that mobs with clients/keys are not just deleted from the game.
|
||||
MOB_STOP_THINKING(src)
|
||||
// Tell any mobs touching us that they're not pulling us anymore.
|
||||
@@ -323,12 +319,6 @@
|
||||
return UNBUCKLED
|
||||
return restrained() ? FULLY_BUCKLED : PARTIALLY_BUCKLED
|
||||
|
||||
/mob/proc/is_physically_disabled()
|
||||
return MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED)
|
||||
|
||||
/mob/proc/cannot_stand()
|
||||
return MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN)
|
||||
|
||||
// Inside this file, you should use MOB_IS_INCAPACITATED for performance reasons
|
||||
/mob/proc/incapacitated(var/incapacitation_flags = INCAPACITATION_DEFAULT)
|
||||
|
||||
@@ -828,9 +818,6 @@
|
||||
/mob/proc/is_active()
|
||||
return (0 >= usr.stat)
|
||||
|
||||
/mob/proc/is_dead()
|
||||
return stat == DEAD
|
||||
|
||||
/mob/proc/is_mechanical()
|
||||
return FALSE
|
||||
|
||||
@@ -861,61 +848,60 @@
|
||||
if(transforming) return 0
|
||||
return 1
|
||||
|
||||
/// Not sure what to call this. Used to check if humans are wearing an AI-controlled exosuit and hence don't need to fall over yet.
|
||||
/mob/proc/can_stand_overridden()
|
||||
return 0
|
||||
|
||||
/// Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it.
|
||||
/mob/proc/update_canmove()
|
||||
if(in_neck_grab())
|
||||
lying = FALSE
|
||||
for(var/obj/item/grab/G in grabbed_by)
|
||||
if(G.force_down)
|
||||
lying = TRUE
|
||||
break
|
||||
else if(!resting && cannot_stand() && can_stand_overridden())
|
||||
lying = FALSE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
else
|
||||
if(istype(buckled_to, /obj/vehicle))
|
||||
var/obj/vehicle/V = buckled_to
|
||||
if(is_physically_disabled())
|
||||
lying = TRUE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = FALSE
|
||||
pixel_y = V.mob_offset_y - 5
|
||||
else
|
||||
if(buckled_to.buckle_lying != -1) lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
pixel_y = V.mob_offset_y
|
||||
else if(buckled_to)
|
||||
anchored = TRUE
|
||||
canmove = FALSE
|
||||
if(isobj(buckled_to))
|
||||
if(buckled_to.buckle_lying != -1)
|
||||
lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
if(buckled_to.buckle_movable)
|
||||
anchored = FALSE
|
||||
canmove = TRUE
|
||||
else if(captured)
|
||||
anchored = TRUE
|
||||
var/found_grab = FALSE
|
||||
for(var/obj/item/grab/G as anything in grabbed_by)
|
||||
if(G.wielded || G.state >= GRAB_AGGRESSIVE)
|
||||
canmove = FALSE
|
||||
lying = G.wielded || (G.state >= GRAB_NECK && G.force_down)
|
||||
found_grab = TRUE
|
||||
break
|
||||
var/mob/living/carbon/human/H = astype(src)
|
||||
if(!found_grab)
|
||||
if(!resting && MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && H?.can_stand_overridden())
|
||||
lying = FALSE
|
||||
else if(m_intent == M_LAY && !incapacitated())
|
||||
lying = TRUE
|
||||
lying_is_intentional = TRUE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
else if(sleeping)
|
||||
lying = resting || is_dead() || (MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && sleeps_horizontal()) // Vaurca, IPCs and Diona sleep standing up, unless they were already lying down
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
else
|
||||
lying = resting || is_dead() || MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !recently_slept
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
if(buckled_to)
|
||||
if(istype(buckled_to, /obj/vehicle))
|
||||
var/obj/vehicle/V = buckled_to
|
||||
if(MOB_IS_INCAPACITATED(INCAPACITATION_DISABLED))
|
||||
lying = TRUE
|
||||
lying_is_intentional = FALSE
|
||||
canmove = FALSE
|
||||
pixel_y = V.mob_offset_y - 5
|
||||
else
|
||||
if(buckled_to.buckle_lying != -1) lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
canmove = TRUE
|
||||
pixel_y = V.mob_offset_y
|
||||
else
|
||||
anchored = TRUE
|
||||
canmove = FALSE
|
||||
if(buckled_to.buckle_lying != -1)
|
||||
lying = buckled_to.buckle_lying
|
||||
lying_is_intentional = FALSE
|
||||
if(buckled_to.buckle_movable)
|
||||
anchored = FALSE
|
||||
canmove = TRUE
|
||||
else if(captured)
|
||||
anchored = TRUE
|
||||
canmove = FALSE
|
||||
lying = FALSE
|
||||
else if(m_intent == M_LAY && !MOB_IS_INCAPACITATED(INCAPACITATION_DEFAULT))
|
||||
lying = TRUE
|
||||
lying_is_intentional = TRUE
|
||||
canmove = TRUE
|
||||
else if(sleeping)
|
||||
lying = resting || (stat == DEAD) || (MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !(H?.species?.sleeps_upright)) // Vaurca, IPCs and Diona sleep standing up, unless they were already lying down
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
else
|
||||
lying = resting || (stat == DEAD) || MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKDOWN) && !recently_slept
|
||||
lying_is_intentional = FALSE
|
||||
canmove = !MOB_IS_INCAPACITATED(INCAPACITATION_KNOCKOUT) && !weakened
|
||||
|
||||
if(lying)
|
||||
ADD_TRAIT(src, TRAIT_UNDENSE, TRAIT_SOURCE_LYING_DOWN)
|
||||
@@ -925,30 +911,11 @@
|
||||
else
|
||||
REMOVE_TRAIT(src, TRAIT_UNDENSE, TRAIT_SOURCE_LYING_DOWN)
|
||||
|
||||
for(var/obj/item/grab/G in grabbed_by)
|
||||
if(G.wielded)
|
||||
canmove = FALSE
|
||||
lying = TRUE
|
||||
break
|
||||
if(G.state >= GRAB_AGGRESSIVE)
|
||||
canmove = 0
|
||||
break
|
||||
|
||||
//Temporarily moved here from the various life() procs
|
||||
//I'm fixing stuff incrementally so this will likely find a better home.
|
||||
//It just makes sense for now. ~Carn
|
||||
if( update_icon ) //forces a full overlay update
|
||||
update_icon = 0
|
||||
regenerate_icons()
|
||||
else if( lying != lying_prev )
|
||||
if( lying != lying_prev )
|
||||
update_icon()
|
||||
|
||||
return canmove
|
||||
|
||||
|
||||
/mob/proc/sleeps_horizontal()
|
||||
return TRUE
|
||||
|
||||
/mob/proc/facedir(var/ndir, var/force_change = FALSE)
|
||||
if(!canface() || (client && client.moving))
|
||||
return 0
|
||||
@@ -1121,7 +1088,7 @@
|
||||
break
|
||||
if(affected)
|
||||
affected.implants -= implant
|
||||
for(var/datum/wound/wound in affected.wounds)
|
||||
for(var/datum/wound/wound as anything in affected.wounds)
|
||||
LAZYREMOVE(wound.embedded_objects, implant)
|
||||
if(!surgical_removal)
|
||||
shock_stage += 20
|
||||
@@ -1592,7 +1559,3 @@
|
||||
var/atom/movable/screen/plane_master/lighting/exterior_lighting = hud_used.plane_masters["[EXTERIOR_LIGHTING_PLANE]"]
|
||||
if (exterior_lighting)
|
||||
exterior_lighting.alpha = min(GLOB.minimum_exterior_lighting_alpha, lighting_alpha)
|
||||
|
||||
#undef UNBUCKLED
|
||||
#undef PARTIALLY_BUCKLED
|
||||
#undef FULLY_BUCKLED
|
||||
|
||||
@@ -1296,6 +1296,8 @@ GLOBAL_LIST_INIT(organ_rel_size, list(
|
||||
M.client.eye = M.client.mob
|
||||
M.client.perspective = MOB_PERSPECTIVE
|
||||
|
||||
|
||||
|
||||
/mob/proc/in_neck_grab()
|
||||
for(var/thing in grabbed_by)
|
||||
var/obj/item/grab/G = thing
|
||||
|
||||
Reference in New Issue
Block a user