relatively small 71 file 700 lines changed refactor/rework to combat mode/sprint and some miscellaneous things that totally aren't important (#11376)

* combat refactoring

* i hate this

* mobility flags part 2 time xd

* whew

* stuff

* a

* ok

* changes

* Wew

* k

* add flags

* FUCKYOUVORE

* fixes

* typo

* no using this in hard stamcrit

* update icon

* woopsy

* . = ..()

* sigh

* Update living_combat.dm

* wew

* wups

* fix

* i hate you

* wrong button

* k

* ok

* bet

* k

* Update code/modules/mob/living/living_combat.dm

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

* Update code/modules/mob/living/living_combat.dm

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

* Update code/modules/mob/living/living_combat.dm

Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com>

* early returns

* skreee

* agony

* k

* k

* k

* k

* wack

* compile

* wack

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
kevinz000
2020-03-21 08:04:26 -07:00
committed by GitHub
parent 84a44e226c
commit 0e3193e929
79 changed files with 788 additions and 486 deletions
@@ -16,14 +16,16 @@
/obj/screen/combattoggle/Click()
if(iscarbon(usr))
var/mob/living/carbon/C = usr
C.toggle_combat_mode()
C.user_toggle_intentional_combat_mode()
/obj/screen/combattoggle/update_icon_state()
var/mob/living/carbon/user = hud?.mymob
if(!istype(user))
return
if(user.combatmode)
if((user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
icon_state = "combat"
else if(HAS_TRAIT(user, TRAIT_COMBAT_MODE_LOCKED))
icon_state = "combat_locked"
else
icon_state = "combat_off"
@@ -41,7 +43,7 @@
var/mob/living/carbon/user = hud?.mymob
if(!istype(user))
return
if(user.voremode && !user.combatmode)
if(user.voremode && !(user.combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
icon_state = "nom"
else
icon_state = "nom_off"
+4 -2
View File
@@ -10,14 +10,16 @@
/obj/screen/sprintbutton/Click()
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
H.togglesprint()
H.default_toggle_sprint()
/obj/screen/sprintbutton/update_icon_state()
var/mob/living/user = hud?.mymob
if(!istype(user))
return
if(user.sprinting)
if(user.combat_flags & COMBAT_FLAG_SPRINT_ACTIVE)
icon_state = "act_sprint_on"
else if(HAS_TRAIT(user, TRAIT_SPRINT_LOCKED))
icon_state = "act_sprint_locked"
else
icon_state = "act_sprint"
+2 -2
View File
@@ -17,7 +17,7 @@
var/mob/living/carbon/user = hud?.mymob
if(!user)
return
if(user.stat == DEAD || user.recoveringstam || (user.hal_screwyhud in 1 to 2))
if(user.stat == DEAD || (user.combat_flags & COMBAT_FLAG_HARD_STAMCRIT) || (user.hal_screwyhud in 1 to 2))
icon_state = "staminacrit"
else if(user.hal_screwyhud == 5)
icon_state = "stamina0"
@@ -37,7 +37,7 @@
var/mob/living/carbon/user = hud?.mymob
if(!user)
return
if(user.stat == DEAD || user.recoveringstam || (user.hal_screwyhud in 1 to 2))
if(user.stat == DEAD || (user.combat_flags & COMBAT_FLAG_HARD_STAMCRIT) || (user.hal_screwyhud in 1 to 2))
icon_state = "stambuffer7"
else if(user.hal_screwyhud == 5)
icon_state = "stambuffer0"
@@ -29,6 +29,7 @@
to_chat(owner, "<span class='warning'>Lucidity shoots to your previously blank mind as your mind suddenly finishes the cloning process. You marvel for a moment at yourself, as your mind subconciously recollects all your memories up until the point when you cloned yourself. Curiously, you find that you memories are blank after you ingested the synthetic serum, leaving you to wonder where the other you is.</span>")
to_chat(M, "<span class='warning'>Lucidity shoots to your previously blank mind as your mind suddenly finishes the cloning process. You marvel for a moment at yourself, as your mind subconciously recollects all your memories up until the point when you cloned yourself. Curiously, you find that you memories are blank after you ingested the synthetic serum, leaving you to wonder where the other you is.</span>")
fermi_Clone = null
return ..()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -95,6 +96,7 @@
to_chat(owner, "<span class='notice'>Your expansive chest has become a more managable size, liberating your movements.</b></span>")
owner.remove_movespeed_modifier(BREAST_MOVEMENT_SPEED)
sizeMoveMod(1)
return ..()
/datum/status_effect/chem/breast_enlarger/proc/sizeMoveMod(var/value)
if(cachedmoveCalc == value)
@@ -164,6 +166,7 @@
log_game("FERMICHEM: [owner]'s dick has reduced to an acceptable size. ID: [owner.key]")
owner.remove_movespeed_modifier(DICK_MOVEMENT_SPEED)
owner.ResetBloodVol()
return ..()
///////////////////////////////////////////////
// Astral INSURANCE
@@ -192,15 +195,14 @@
/datum/status_effect/chem/astral_insurance/on_remove(mob/living/carbon/M) //God damnit get them home!
if(owner.mind == originalmind) //If they're home, HOORAY
return
return ..()
if(owner.mind)
var/mob/living/simple_animal/astral/G = new(get_turf(M.loc))
owner.mind.transfer_to(G)//Just in case someone else is inside of you, it makes them a ghost and should hopefully bring them home at the end.
to_chat(G, "<span class='warning'>[M]'s conciousness snaps back to them as their astrogen runs out, kicking your projected mind out!'</b></span>")
log_game("FERMICHEM: [M]'s possesser has been booted out into a astral ghost!")
originalmind.transfer_to(original)
return ..()
/*//////////////////////////////////////////
Mind control functions!
@@ -603,7 +605,7 @@
REMOVE_TRAIT(owner, TRAIT_PACIFISM, "MKUltra")
to_chat(owner, "<span class='big redtext'><i>You're now free of [master]'s influence, and fully independent!'</i></span>")
UnregisterSignal(owner, COMSIG_GLOB_LIVING_SAY_SPECIAL)
return ..()
/datum/status_effect/chem/enthrall/proc/owner_hear(datum/source, list/hearing_args)
if(lewd == FALSE)
@@ -2,4 +2,4 @@
name = "soul death"
icon = 'modular_citadel/icons/effects/souldeath.dmi'
icon_state = "souldeath"
duration = 30
duration = 30
@@ -1,73 +1,29 @@
/mob/living/carbon
var/combatmode = FALSE //literally lifeweb
var/lastmousedir
var/wrongdirmovedelay
var/lastdirchange
var/combatmessagecooldown
//oh no vore time
var/voremode = FALSE
/mob/living/carbon/proc/toggle_combat_mode(forced, silent)
if(!forced)
if(recoveringstam || stat != CONSCIOUS)
return TRUE
for(var/i in status_effects)
var/datum/status_effect/S = i
if(S.blocks_combatmode)
return TRUE
combatmode = !combatmode
if(voremode)
toggle_vore_mode()
if(!silent)
if(combatmode)
if(world.time >= combatmessagecooldown)
if(a_intent != INTENT_HELP)
visible_message("<span class='warning'>[src] [resting ? "tenses up" : (prob(95)? "drops into a combative stance" : (prob(95)? "poses aggressively" : "asserts dominance with their pose"))].</span>")
else
visible_message("<span class='notice'>[src] [pick("looks","seems","goes")] [pick("alert","attentive","vigilant")].</span>")
playsound_local(src, 'sound/misc/ui_toggle.ogg', 50, FALSE, pressure_affected = FALSE) //Sound from interbay!
else
playsound_local(src, 'sound/misc/ui_toggleoff.ogg', 50, FALSE, pressure_affected = FALSE) //Slightly modified version of the above!
if(client)
client.show_popup_menus = !combatmode // So we can right-click for alternate actions and all that other good shit. Also moves examine to shift+rightclick to make it possible to attack while sprinting
var/obj/screen/combattoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state()
combatmessagecooldown = 10 SECONDS + world.time //This is set 100% of the time to make sure squeezing regen out of process cycles doesn't result in the combat mode message getting spammed
SEND_SIGNAL(src, COMSIG_COMBAT_TOGGLED, src, combatmode)
return TRUE
mob/living/carbon/proc/toggle_vore_mode()
/mob/living/carbon/proc/toggle_vore_mode()
voremode = !voremode
var/obj/screen/voretoggle/T = locate() in hud_used?.static_inventory
T?.update_icon_state()
if(combatmode)
if(combat_flags & COMBAT_FLAG_COMBAT_TOGGLED)
return FALSE //let's not override the main draw of the game these days
SEND_SIGNAL(src, COMSIG_VORE_TOGGLED, src, voremode)
return TRUE
/mob/living/carbon/Move(atom/newloc, direct = 0)
var/currentdirection = dir
. = ..()
wrongdirmovedelay = FALSE
if(combatmode && client && lastmousedir)
if((combat_flags & COMBAT_FLAG_COMBAT_ACTIVE) && client && lastmousedir)
if(lastmousedir != dir)
wrongdirmovedelay = TRUE
setDir(lastmousedir, ismousemovement = TRUE)
if(currentdirection != dir)
lastdirchange = world.time
/mob/living/carbon/onMouseMove(object, location, control, params)
if(!combatmode)
if(!(combat_flags & COMBAT_FLAG_COMBAT_ACTIVE))
return
mouse_face_atom(object)
lastmousedir = dir
/mob/living/carbon/setDir(newdir, ismousemovement = FALSE)
if(!combatmode || ismousemovement)
if(dir != newdir)
lastdirchange = world.time
. = ..()
else
return
@@ -15,24 +15,6 @@
if(!forced && (status_flags & GODMODE))
return FALSE
apply_damage(amount > 0 ? amount*incomingstammult : amount, STAMINA, affected_zone)
if(recoveringstam && amount > 20)
if((combat_flags & COMBAT_FLAG_HARD_STAMCRIT) && amount > 20)
incomingstammult = max(0.01, incomingstammult/(amount*0.05))
return amount
/mob/living/carbon/doSprintLossTiles(tiles)
doSprintBufferRegen(FALSE) //first regen.
if(sprint_buffer)
var/use = min(tiles, sprint_buffer)
sprint_buffer -= use
tiles -= use
update_hud_sprint_bar()
if(!tiles) //we had enough, we're done!
return
adjustStaminaLoss(tiles * sprint_stamina_cost) //use stamina to cover deficit.
/mob/living/carbon/proc/doSprintBufferRegen(updating = TRUE)
var/diff = world.time - sprint_buffer_regen_last
sprint_buffer_regen_last = world.time
sprint_buffer = min(sprint_buffer_max, sprint_buffer + sprint_buffer_regen_ds * diff)
if(updating)
update_hud_sprint_bar()
@@ -1,37 +0,0 @@
/mob/living/carbon/human/Move(NewLoc, direct)
var/oldpseudoheight = pseudo_z_axis
. = ..()
if(. && sprinting && !(movement_type & FLYING) && CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_MOVE|MOBILITY_STAND) && m_intent == MOVE_INTENT_RUN && has_gravity(loc) && !pulledby)
if(!HAS_TRAIT(src, TRAIT_FREESPRINT))
doSprintLossTiles(1)
if((oldpseudoheight - pseudo_z_axis) >= 8)
to_chat(src, "<span class='warning'>You trip off of the elevated surface!</span>")
for(var/obj/item/I in held_items)
accident(I)
DefaultCombatKnockdown(80)
/mob/living/carbon/human/movement_delay()
. = 0
if((mobility_flags & MOBILITY_STAND) && m_intent == MOVE_INTENT_RUN && sprinting)
var/static/datum/config_entry/number/movedelay/sprint_speed_increase/SSI
if(!SSI)
SSI = CONFIG_GET_ENTRY(number/movedelay/sprint_speed_increase)
. -= SSI.config_entry_value
if(wrongdirmovedelay)
. += 1
. += ..()
/mob/living/carbon/human/proc/togglesprint() // If you call this proc outside of hotkeys or clicking the HUD button, I'll be disappointed in you.
sprinting = !sprinting
if((m_intent == MOVE_INTENT_RUN) && CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_STAND|MOBILITY_MOVE))
if(sprinting)
playsound_local(src, 'sound/misc/sprintactivate.ogg', 50, FALSE, pressure_affected = FALSE)
else
playsound_local(src, 'sound/misc/sprintdeactivate.ogg', 50, FALSE, pressure_affected = FALSE)
var/obj/screen/sprintbutton/S = locate() in hud_used?.static_inventory
S?.update_icon_state()
return TRUE
/mob/living/carbon/human/proc/sprint_hotkey(targetstatus)
if(targetstatus ? !sprinting : sprinting)
togglesprint()
@@ -1,5 +1,2 @@
/mob/living/proc/adjustStaminaLossBuffered(amount, updating_health = TRUE, forced = FALSE)
return
/mob/living/proc/doSprintLossTiles(amount)
return
@@ -1,32 +1,4 @@
/mob/living
var/sprinting = FALSE
var/recoveringstam = FALSE
var/incomingstammult = 1
var/bufferedstam = 0
var/stambuffer = 20
var/stambufferregentime
var/attemptingstandup = FALSE
var/intentionalresting = FALSE
var/attemptingcrawl = FALSE
//Sprint buffer---
var/sprint_buffer = 42 //Tiles
var/sprint_buffer_max = 42
var/sprint_buffer_regen_ds = 0.3 //Tiles per world.time decisecond
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
/mob/living/update_config_movespeed()
. = ..()
sprint_buffer_max = CONFIG_GET(number/movedelay/sprint_buffer_max)
sprint_buffer_regen_ds = CONFIG_GET(number/movedelay/sprint_buffer_regen_per_ds)
sprint_stamina_cost = CONFIG_GET(number/movedelay/sprint_stamina_cost)
/mob/living/movement_delay(ignorewalk = 0)
. = ..()
if(!CHECK_MOBILITY(src, MOBILITY_STAND))
. += 6
/atom
var/pseudo_z_axis
@@ -55,22 +27,23 @@
/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(!recoveringstam && total_health >= STAMINA_CRIT && !stat)
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)
if(combatmode)
toggle_combat_mode(TRUE)
recoveringstam = TRUE
disable_intentional_combat_mode(TRUE, FALSE)
ENABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT)
filters += CIT_FILTER_STAMINACRIT
update_mobility()
if(recoveringstam && total_health <= STAMINA_SOFTCRIT)
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>")
recoveringstam = FALSE
DISABLE_BITFIELD(combat_flags, COMBAT_FLAG_HARD_STAMCRIT | COMBAT_FLAG_SOFT_STAMCRIT)
filters -= CIT_FILTER_STAMINACRIT
update_mobility()
update_health_hud()
/mob/living/proc/update_hud_sprint_bar()
if(hud_used && hud_used.sprint_buffer)
hud_used.sprint_buffer.update_to_mob(src)
@@ -1,30 +0,0 @@
/mob/living/silicon/robot/Move(NewLoc, direct)
. = ..()
if(. && sprinting && !(movement_type & FLYING) && CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_STAND | MOBILITY_MOVE))
if(!(cell?.use(25)))
togglesprint(TRUE)
/mob/living/silicon/robot/movement_delay()
. = ..()
if(!resting && !sprinting)
. += 1
. += speed
/mob/living/silicon/robot/proc/togglesprint(shutdown = FALSE) //Basically a copypaste of the proc from /mob/living/carbon/human
if(!shutdown && (!cell || cell.charge < 25) || !cansprint)
return FALSE
sprinting = shutdown ? FALSE : !sprinting
if(CHECK_MULTIPLE_BITFIELDS(mobility_flags, MOBILITY_STAND|MOBILITY_MOVE))
if(sprinting)
playsound_local(src, 'sound/misc/sprintactivate.ogg', 50, FALSE, pressure_affected = FALSE)
else
if(shutdown)
playsound_local(src, 'sound/effects/light_flicker.ogg', 50, FALSE, pressure_affected = FALSE)
playsound_local(src, 'sound/misc/sprintdeactivate.ogg', 50, FALSE, pressure_affected = FALSE)
var/obj/screen/sprintbutton/S = locate() in hud_used?.static_inventory
S?.update_icon_state()
return TRUE
/mob/living/silicon/robot/proc/sprint_hotkey(targetstatus)
if(targetstatus ? !sprinting : sprinting)
togglesprint()