why am i doing this

This commit is contained in:
silicons
2020-08-03 13:37:37 -07:00
parent 3d741218c1
commit 42db990836
21 changed files with 119 additions and 102 deletions

View File

@@ -47,8 +47,8 @@
#define COMBAT_FLAG_RESISTING_REST (1<<4)
/// Intentionally resting
#define COMBAT_FLAG_INTENTIONALLY_RESTING (1<<5)
/// Currently stamcritted but not as violently
#define COMBAT_FLAG_SOFT_STAMCRIT (1<<6)
/// This mob requires stamina buffer to do things that require stamina buffer. Not having this exempts the mob from stamina combat.
#define COMBAT_FLAG_STAMINA_BUFFER (1<<6)
/// Force sprint mode on at all times, overrides everything including sprint disable traits.
#define COMBAT_FLAG_SPRINT_FORCED (1<<7)
/// This mob is capable of using the active parrying system.
@@ -64,26 +64,15 @@
// Helpers for getting someone's stamcrit state. Cast to living.
#define NOT_STAMCRIT 0
#define SOFT_STAMCRIT 1
#define HARD_STAMCRIT 2
#define HARD_STAMCRIT 1
// Stamcrit check helpers
#define IS_STAMCRIT(mob) (CHECK_STAMCRIT(mob) != NOT_STAMCRIT)
#define CHECK_STAMCRIT(mob) ((mob.combat_flags & COMBAT_FLAG_HARD_STAMCRIT)? HARD_STAMCRIT : ((mob.combat_flags & COMBAT_FLAG_SOFT_STAMCRIT)? SOFT_STAMCRIT : NOT_STAMCRIT))
#define CHECK_STAMCRIT(mob) (mob.combat_flags & COMBAT_FLAG_HARD_STAMCRIT)
//stamina stuff
///Threshold over which attacks start being hindered.
#define STAMINA_NEAR_SOFTCRIT 90
///softcrit for stamina damage. prevents standing up, some actions that cost stamina, etc, but doesn't force a rest or stop movement
#define STAMINA_SOFTCRIT 100
///sanity cap to prevent stamina actions (that are still performable) from sending you into crit.
#define STAMINA_NEAR_CRIT 130
///crit for stamina damage. forces a rest, and stops movement until stamina goes back to stamina softcrit
#define STAMINA_CRIT 140
///same as STAMINA_SOFTCRIT except for the more traditional health calculations
#define STAMINA_SOFTCRIT_TRADITIONAL 0
///ditto, but for STAMINA_CRIT
#define STAMINA_CRIT_TRADITIONAL -40
#define CRAWLUNDER_DELAY 30 //Delay for crawling under a standing mob

View File

@@ -0,0 +1,12 @@
/// Stamina buffer amount
#define STAMINA_BUFFER_CAPACITY 50

View File

@@ -130,7 +130,7 @@
playsound(get_turf(A), pick('sound/weapons/bulletflyby.ogg', 'sound/weapons/bulletflyby2.ogg', 'sound/weapons/bulletflyby3.ogg'), 75, TRUE)
P.firer = A
P.setAngle(rand(0, 360))//SHING
A.adjustStaminaLossBuffered (3) //Citadel change to stop infinite bullet sponging as you run away, but it is buffered!
A.adjustStaminaLoss(3)
return BULLET_ACT_FORCE_PIERCE
return BULLET_ACT_HIT

View File

@@ -95,8 +95,8 @@
if(is_ash_immune(L))
return
if(is_species(L, /datum/species/lizard/ashwalker))
if(!IS_STAMCRIT(L))
L.adjustStaminaLossBuffered(4)
if(L.getStaminaLoss() < (STAMINA_CRIT - 40))
L.adjustStaminaLos(4)
return
L.adjustFireLoss(4)

View File

@@ -21,12 +21,11 @@
var/can_block_projectiles = FALSE //can't block guns
var/lethal_cost = 400 //10000/400*20 = 500. decent enough?
var/lethal_damage = 20
var/lethal_stam_cost = 4
var/stun_cost = 333 //10000/333*25 = 750. stunbatons are at time of writing 10000/1000*49 = 490.
var/stun_status_effect = STATUS_EFFECT_ELECTROSTAFF //a small slowdown effect
var/stun_stamdmg = 40
var/stun_status_duration = 25
var/stun_stam_cost = 3.5
var/stam_cost = 3.5
var/wielded = FALSE // track wielded status on item
// haha security desword time /s
@@ -171,7 +170,7 @@
turn_off()
/obj/item/electrostaff/attack(mob/living/target, mob/living/user)
if(IS_STAMCRIT(user))//CIT CHANGE - makes it impossible to baton in stamina softcrit
if(IS_STAMCRIT(user) || !UseStaminaBuffer(stam_cost))//CIT CHANGE - makes it impossible to baton in stamina softcrit
to_chat(user, "<span class='danger'>You're too exhausted to use [src] properly.</span>")//CIT CHANGE - ditto
return //CIT CHANGE - ditto
if(on && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
@@ -186,13 +185,11 @@
if(user.a_intent != INTENT_HARM)
if(stun_act(target, user, null, return_list))
user.do_attack_animation(target)
user.adjustStaminaLossBuffered(stun_stam_cost)
return
else if(!harm_act(target, user, null, return_list))
return ..() //if you can't fry them just beat them with it
else //we did harm act them
user.do_attack_animation(target)
user.adjustStaminaLossBuffered(lethal_stam_cost)
/obj/item/electrostaff/proc/stun_act(mob/living/target, mob/living/user, no_charge_and_force = FALSE, list/block_return = list())
var/stunforce = block_calculate_resultant_damage(stun_stamdmg, block_return)

View File

@@ -76,6 +76,9 @@
if(!tank)
to_chat(user, "<span class='warning'>\The [src] can't operate without a source of gas!</span>")
return FALSE
var/weight = getweight(user, STAM_COST_ATTACK_MOB_MULT)
if(!UseStaminaBuffer(weight, warn = TRUE))
return FALSE
var/datum/gas_mixture/gasused = tank.air_contents.remove(gasperfist * fisto_setting)
var/turf/T = get_turf(src)
if(!T)
@@ -108,8 +111,4 @@
target.throw_at(throw_target, 5 * fisto_setting, 0.5 + (fisto_setting / 2))
log_combat(user, target, "power fisted", src)
var/weight = getweight(user, STAM_COST_ATTACK_MOB_MULT)
if(weight)
user.adjustStaminaLossBuffered(weight)
return TRUE

View File

@@ -136,15 +136,17 @@
if(!(shield_flags & SHIELD_BASH_GROUND_SLAM))
to_chat(user, "<span class='warning'>You can't ground slam with [src]!</span>")
return FALSE
if(!user.UseStaminaBuffer(shieldbash_stamcost, warn = TRUE))
return FALSE
bash_target(user, target, NONE, harmful)
user.do_attack_animation(target, used_item = src)
playsound(src, harmful? "swing_hit" : 'sound/weapons/thudswoosh.ogg', 75, 1)
last_shieldbash = world.time
user.adjustStaminaLossBuffered(shieldbash_stamcost)
return TRUE
// Directional sweep!
last_shieldbash = world.time
user.adjustStaminaLossBuffered(shieldbash_stamcost)
if(!user.UseStaminaBuffer(shieldbash_stamcost, warn = TRUE))
return FLASE
// Since we are in combat mode, we can probably safely use the user's dir instead of getting their mouse pointing cardinal dir.
var/bashdir = user.dir
do_shieldbash_effect(user, bashdir, harmful)

View File

@@ -602,14 +602,27 @@
remove_movespeed_modifier(/datum/movespeed_modifier/carbon_softcrit)
/mob/living/carbon/update_stamina()
var/stam = getStaminaLoss()
if(stam > DAMAGE_PRECISION)
var/total_health = (maxHealth - stam)
if(total_health <= crit_threshold && !stat)
if(CHECK_MOBILITY(src, MOBILITY_STAND))
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
KnockToFloor(TRUE)
update_health_hud()
var/total_health = getStaminaLoss()
if(total_health >= STAMINA_SOFTCRIT)
if(!(combat_flags & COMBAT_FLAG_SOFT_STAMCRIT))
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_SOFT_STAMCRIT)
else
if(combat_flags & COMBAT_FLAG_SOFT_STAMCRIT)
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_SOFT_STAMCRIT)
if(total_health)
if(!(combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && total_health >= STAMINA_CRIT && !stat)
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
set_resting(TRUE, FALSE, FALSE)
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT)
filters += CIT_FILTER_STAMINACRIT
update_mobility()
if((combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && total_health <= STAMINA_SOFTCRIT)
to_chat(src, "<span class='notice'>You don't feel nearly as exhausted anymore.</span>")
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT | COMBAT_FLAG_SOFT_STAMCRIT)
filters -= CIT_FILTER_STAMINACRIT
update_mobility()
update_health_hud()
/mob/living/carbon/update_sight()
if(!client)

View File

@@ -1462,9 +1462,10 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if(!(attackchain_flags & ATTACK_IS_PARRY_COUNTERATTACK))
if(HAS_TRAIT(user, TRAIT_PUGILIST))//CITADEL CHANGE - makes punching cause staminaloss but funny martial artist types get a discount
user.adjustStaminaLossBuffered(1.5)
else
user.adjustStaminaLossBuffered(3.5)
if(!user.UseStaminaBuffer(1.5, warn = TRUE))
return
else if(!user.UseStaminaBuffer(3.5, warn = TRUE))
return
if(attacker_style && attacker_style.harm_act(user,target))
return TRUE
@@ -1592,6 +1593,8 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
return FALSE
else if(aim_for_mouth && ( target_on_help || target_restrained || target_aiming_for_mouth))
if(!UseStaminaBuffer(3, warn = TRUE))
return
playsound(target.loc, 'sound/weapons/slap.ogg', 50, 1, -1)
target.visible_message(\
@@ -1599,7 +1602,6 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
"<span class='notice'>[user] slaps you in the face! </span>",\
"You hear a slap.", target = user, target_message = "<span class='notice'>You slap [user == target ? "yourself" : "\the [target]"] in the face! </span>")
user.do_attack_animation(target, ATTACK_EFFECT_FACE_SLAP)
user.adjustStaminaLossBuffered(3)
if (!HAS_TRAIT(target, TRAIT_PERMABONER))
stop_wagging_tail(target)
return FALSE
@@ -1607,8 +1609,9 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if(target.client?.prefs.cit_toggles & NO_ASS_SLAP)
to_chat(user,"A force stays your hand, preventing you from slapping \the [target]'s ass!")
return FALSE
if(!user.UseStaminaBuffer(3, warn = TRUE))
return FALSE
user.do_attack_animation(target, ATTACK_EFFECT_ASS_SLAP)
user.adjustStaminaLossBuffered(3)
target.adjust_arousal(20,maso = TRUE)
if (ishuman(target) && HAS_TRAIT(target, TRAIT_MASO) && target.has_dna() && prob(10))
target.mob_climax(forced_climax=TRUE)
@@ -1626,9 +1629,11 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
user.do_attack_animation(target, ATTACK_EFFECT_DISARM)
if(HAS_TRAIT(user, TRAIT_PUGILIST))//CITADEL CHANGE - makes disarmspam cause staminaloss, pugilists can do it almost effortlessly
user.adjustStaminaLossBuffered(1)
if(!user.UseStaminaBuffer(1, warn = TRUE))
return
else
user.adjustStaminaLossBuffered(3)
if(!user.UseStaminaBuffer(1, warn = TRUE))
return
if(attacker_style && attacker_style.disarm_act(user,target))
return TRUE
@@ -1890,8 +1895,9 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
else
if(user == target)
return
if(!user.UseStaminaBuffer(4, warn = TRUE))
return
user.do_attack_animation(target, ATTACK_EFFECT_DISARM)
user.adjustStaminaLossBuffered(4)
playsound(target, 'sound/weapons/thudswoosh.ogg', 50, TRUE, -1)
if(target.w_uniform)

View File

@@ -1241,7 +1241,7 @@
SetUnconscious(clamp_unconscious_to)
HealAllImmobilityUpTo(clamp_immobility_to)
adjustStaminaLoss(min(0, -stamina_boost))
adjustStaminaLossBuffered(min(0, -stamina_buffer_boost))
RechargeStaminaBuffer(stamina_buffer_boost)
if(scale_stamina_loss_recovery)
adjustStaminaLoss(min(-((getStaminaLoss() - stamina_loss_recovery_bypass) * scale_stamina_loss_recovery), 0))
if(put_on_feet)

View File

@@ -186,7 +186,7 @@
var/held_index = C.get_held_index_of_item(src)
var/obj/item/bodypart/BP = C.hand_bodyparts[held_index]
if(!BP?.body_zone)
return C.adjustStaminaLossBuffered(stamina_amount) //nah
return C.adjustStaminaLoss(stamina_amount) //nah
var/zone = BP.body_zone
var/stamina_to_zone = data.block_stamina_limb_ratio * stamina_amount
var/stamina_to_chest = stamina_amount - stamina_to_zone
@@ -194,9 +194,9 @@
stamina_to_chest -= stamina_buffered
C.apply_damage(stamina_to_zone, STAMINA, zone)
C.apply_damage(stamina_to_chest, STAMINA, BODY_ZONE_CHEST)
C.adjustStaminaLossBuffered(stamina_buffered)
C.adjustStaminaLoss(stamina_buffered)
else
owner.adjustStaminaLossBuffered(stamina_amount)
owner.adjustStaminaLoss(stamina_amount)
/obj/item/proc/on_active_block(mob/living/owner, atom/object, damage, damage_blocked, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return, override_direction)
return

View File

@@ -53,6 +53,7 @@
var/hallucination = 0 //Directly affects how long a mob will hallucinate for
var/last_special = 0 //Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.
var/timeofdeath = 0
//Allows mobs to move through dense areas without restriction. For instance, in space or out of holder objects.
@@ -148,9 +149,6 @@
var/combatmessagecooldown = 0
var/incomingstammult = 1
var/bufferedstam = 0
var/stambuffer = 20
var/stambufferregentime
//Sprint buffer---
var/sprint_buffer = 42 //Tiles
@@ -159,3 +157,17 @@
var/sprint_buffer_regen_last = 0 //last world.time this was regen'd for math.
var/sprint_stamina_cost = 0.70 //stamina loss per tile while insufficient sprint buffer.
//---End
// Stamina Buffer---
/// Our maximum stamina buffer
var/stamina_buffer_max = STAMINA_BUFFER_CAPACITY
/// Our stamina buffer
var/stamina_buffer = STAMINA_BUFFER_CAPACITY
/// Stamina buffer regen modifier
var/stamina_buffer_regen_mod = 1
/// Standard stamina buffer regen per second
var/stamina_buffer_regen = STAMINA_BUFFER_REGEN_PER_SECOND
/// Standard stamina buffer regen per second with combat mode
var/stamina_buffer_regen_combat = STAMINA_BUFFER_REGEN_PER_SECOND_COMBAT
/// Last time stamina buffer regen was done
var/stamina_buffer_regen_last = 0

View File

@@ -1114,10 +1114,6 @@
bellyup = 1
update_icons()
/mob/living/silicon/robot/adjustStaminaLossBuffered(amount, updating_health = 1)
if(istype(cell))
cell.charge -= amount*5
/mob/living/silicon/robot/verb/viewmanifest()
set category = "Robot Commands"
set name = "View Crew Manifest"

View File

@@ -0,0 +1,2 @@

View File

@@ -0,0 +1,26 @@
/**
* Attempts to use an amount of stamina from our stamina buffer.
* Does not use anything if we don't have enough.
*
* Returns TRUE or FALSE based on if we have it.
*/
/mob/living/proc/UseStaminaBuffer(amount, warn = FALSE)
if(!(combat_flags & COMBAT_FLAG_STAMINA_BUFFER))
return TRUE
if(stamina_buffer < amount)
if(warn)
to_chat(src, "<span class='warning'>You do not have enough action stamina to do that!</span>")
return
return FALSE
stamina_buffer -= amount
return TRUE
/**
* Updates our stamina buffer amount.
*/
/mob/living/proc/UpdateStaminaBuffer(updating_hud = TRUE)
var/time = world.time - stamina_buffer_regen_last
if(time <= 0)
return
stamina_buffer_regen_last = time
var/penalized

View File

@@ -153,8 +153,8 @@
shake_camera(user, recoil + 1, recoil)
if(stam_cost) //CIT CHANGE - makes gun recoil cause staminaloss
var/safe_cost = clamp(stam_cost, 0, STAMINA_NEAR_CRIT - user.getStaminaLoss())*(firing && burst_size >= 2 ? 1/burst_size : 1)
user.adjustStaminaLossBuffered(safe_cost) //CIT CHANGE - ditto
var/safe_cost = clamp(stam_cost, 0, user.stamina_buffer)*(firing && burst_size >= 2 ? 1/burst_size : 1)
user.UseStaminaBuffer(safe_cost)
if(suppressed)
playsound(user, fire_sound, 10, 1)

View File

@@ -44,10 +44,9 @@
if(HAS_TRAIT(user, TRAIT_FAST_PUMP))
recentpump = world.time + 2
else
if(!user.UseStaminaBuffer(2, warn = TRUE))
return
recentpump = world.time + 10
if(istype(user))//CIT CHANGE - makes pumping shotguns cost a lil bit of stamina.
user.adjustStaminaLossBuffered(2) //CIT CHANGE - DITTO. make this scale inversely to the strength stat when stats/skills are added
return
/obj/item/gun/ballistic/shotgun/blow_up(mob/user)
. = 0

View File

@@ -1,16 +1,3 @@
/mob/living/carbon/adjustStaminaLossBuffered(amount, updating_health = 1)
if(status_flags & GODMODE)
return 0
if(CONFIG_GET(flag/disable_stambuffer))
return
var/directstamloss = (bufferedstam + amount) - stambuffer
if(directstamloss > 0)
adjustStaminaLoss(directstamloss)
bufferedstam = clamp(bufferedstam + amount, 0, stambuffer)
stambufferregentime = world.time + 10
if(updating_health)
update_health_hud()
/mob/living/carbon/adjustStaminaLoss(amount, updating_health = TRUE, forced = FALSE, affected_zone = BODY_ZONE_CHEST)
if(!forced && (status_flags & GODMODE))
return FALSE

View File

@@ -1,2 +0,0 @@
/mob/living/proc/adjustStaminaLossBuffered(amount, updating_health = TRUE, forced = FALSE)
return

View File

@@ -1,5 +1,3 @@
/mob/living
/atom
var/pseudo_z_axis
@@ -24,26 +22,3 @@
if(.)
pseudo_z_axis = newloc.get_fake_z()
pixel_z = pseudo_z_axis
/mob/living/carbon/update_stamina()
var/total_health = getStaminaLoss()
if(total_health >= STAMINA_SOFTCRIT)
if(!(combat_flags & COMBAT_FLAG_SOFT_STAMCRIT))
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_SOFT_STAMCRIT)
else
if(combat_flags & COMBAT_FLAG_SOFT_STAMCRIT)
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_SOFT_STAMCRIT)
if(total_health)
if(!(combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && total_health >= STAMINA_CRIT && !stat)
to_chat(src, "<span class='notice'>You're too exhausted to keep going...</span>")
set_resting(TRUE, FALSE, FALSE)
SEND_SIGNAL(src, COMSIG_DISABLE_COMBAT_MODE)
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT)
filters += CIT_FILTER_STAMINACRIT
update_mobility()
if((combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && total_health <= STAMINA_SOFTCRIT)
to_chat(src, "<span class='notice'>You don't feel nearly as exhausted anymore.</span>")
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT | COMBAT_FLAG_SOFT_STAMCRIT)
filters -= CIT_FILTER_STAMINACRIT
update_mobility()
update_health_hud()

View File

@@ -128,9 +128,11 @@
#include "code\__DEFINES\_flags\shields.dm"
#include "code\__DEFINES\admin\keybindings.dm"
#include "code\__DEFINES\chemistry\reactions.dm"
#include "code\__DEFINES\combat\aim_instability.dm"
#include "code\__DEFINES\combat\attack_types.dm"
#include "code\__DEFINES\combat\block.dm"
#include "code\__DEFINES\combat\block_parry.dm"
#include "code\__DEFINES\combat\stamina_combat.dm"
#include "code\__DEFINES\dcs\flags.dm"
#include "code\__DEFINES\dcs\helpers.dm"
#include "code\__DEFINES\dcs\signals.dm"
@@ -2382,6 +2384,7 @@
#include "code\modules\mob\dead\observer\observer_movement.dm"
#include "code\modules\mob\dead\observer\orbit.dm"
#include "code\modules\mob\dead\observer\say.dm"
#include "code\modules\mob\living\aim_instability.dm"
#include "code\modules\mob\living\blood.dm"
#include "code\modules\mob\living\bloodcrawl.dm"
#include "code\modules\mob\living\clickdelay.dm"
@@ -2402,6 +2405,7 @@
#include "code\modules\mob\living\login.dm"
#include "code\modules\mob\living\logout.dm"
#include "code\modules\mob\living\say.dm"
#include "code\modules\mob\living\stamina_buffer.dm"
#include "code\modules\mob\living\status_procs.dm"
#include "code\modules\mob\living\taste.dm"
#include "code\modules\mob\living\update_icons.dm"
@@ -2527,6 +2531,7 @@
#include "code\modules\mob\living\silicon\silicon.dm"
#include "code\modules\mob\living\silicon\silicon_defense.dm"
#include "code\modules\mob\living\silicon\silicon_movement.dm"
#include "code\modules\mob\living\silicon\stamina_buffer.dm"
#include "code\modules\mob\living\silicon\ai\ai.dm"
#include "code\modules\mob\living\silicon\ai\ai_defense.dm"
#include "code\modules\mob\living\silicon\ai\death.dm"
@@ -3491,7 +3496,6 @@
#include "modular_citadel\code\modules\mentor\mentorpm.dm"
#include "modular_citadel\code\modules\mentor\mentorsay.dm"
#include "modular_citadel\code\modules\mob\cit_emotes.dm"
#include "modular_citadel\code\modules\mob\living\damage_procs.dm"
#include "modular_citadel\code\modules\mob\living\living.dm"
#include "modular_citadel\code\modules\mob\living\carbon\carbon.dm"
#include "modular_citadel\code\modules\mob\living\carbon\damage_procs.dm"