Skip to content

Commit

Permalink
fix: reset walk style to old if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Andyyy7666 committed Feb 27, 2024
1 parent aadd2df commit f25e8a6
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 11 deletions.
30 changes: 19 additions & 11 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local data_bone_settings = require("data.bone_settings")
local data_bones = require("data.bones")
local data_knockout = require("data.knockout")
local data_death = require("data.death")
local data_walks = require("data.walks")

local respawnKeybindLetter = ""
local randomDeathAnim = nil
Expand All @@ -14,6 +15,7 @@ local bleedOutTimer = nil
local knockedOut = false
local bleeding = 0
local bodyBonesDamage = lib.table.deepclone(data_bone_settings)
local oldMovement = nil

function BlockActions(status)
LocalPlayer.state.blockHandsUp = status
Expand Down Expand Up @@ -81,8 +83,20 @@ local function getNearestRespawnPoint()
return nearestCoords
end

local function resetWalk()
local ped = cache.ped
if GetPedMovementClipset(ped) ~= `move_m@injured` then return end

SetPedMoveRateOverride(ped, 1.0)

local movement = data_walks[oldMovement]
return movement and SetPedMovementClipset(ped, movement, true) or ResetPedMovementClipset(ped, 0)
end

-- injured walking style set depending on body part injury.
local function hurtWalk()
oldMovement = GetPedMovementClipset(cache.ped)

for _, info in pairs(bodyBonesDamage) do
if info.causeLimp and info.severity > 1.0 then
lib.requestAnimSet("move_m@injured")
Expand All @@ -92,10 +106,8 @@ local function hurtWalk()
return true
end
end
if GetPedMovementClipset(cache.ped) == `move_m@injured` then
SetPedMoveRateOverride(cache.ped, 1.0)
ResetPedMovementClipset(cache.ped, 0)
end

resetWalk()
end

-- get body damage based on body parts.
Expand Down Expand Up @@ -307,17 +319,13 @@ RegisterNetEvent("ND:revivePlayer", function()
LocalPlayer.state.dead = false
LocalPlayer.state.onStretcher = false

BlockActions(false)

if knockedOut then
state:set("knockedout", false, true)
knockedOut = false
end

if GetPedMovementClipset(cache.ped) == `move_m@injured` then
SetPedMoveRateOverride(cache.ped, 1.0)
ResetPedMovementClipset(cache.ped, 0)
end

BlockActions(false)
resetWalk()
end)

RegisterNetEvent("ND:characterLoaded", function(player)
Expand Down
133 changes: 133 additions & 0 deletions data/walks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
return { -- don't touch anything here if you don't know what you're doing. This is used for resetting the walk style to the previous one after player stops the injured walk.
[`move_m@alien`] = "move_m@alien",
[`anim_group_move_ballistic`] = "anim_group_move_ballistic",
[`move_f@arrogant@a`] = "move_f@arrogant@a",
[`move_m@brave`] = "move_m@brave",
[`move_m@brave@a`] = "move_m@brave@a",
[`move_m@brave@b`] = "move_m@brave@b",
[`move_m@hurry_butch@a`] = "move_m@hurry_butch@a",
[`move_m@hurry_butch@b`] = "move_m@hurry_butch@b",
[`move_m@hurry_butch@c`] = "move_m@hurry_butch@c",
[`move_m@buzzed`] = "move_m@buzzed",
[`move_casey`] = "move_casey",
[`move_m@casual@a`] = "move_m@casual@a",
[`move_m@casual@b`] = "move_m@casual@b",
[`move_m@casual@c`] = "move_m@casual@c",
[`move_m@casual@d`] = "move_m@casual@d",
[`move_m@casual@e`] = "move_m@casual@e",
[`move_m@casual@f`] = "move_m@casual@f",
[`move_f@chichi`] = "move_f@chichi",
[`move_f@chubby@a`] = "move_f@chubby@a",
[`move_chubby`] = "move_chubby",
[`move_m@confident`] = "move_m@confident",
[`move_m@business@a`] = "move_m@business@a",
[`move_m@business@b`] = "move_m@business@b",
[`move_m@business@c`] = "move_m@business@c",
[`move_m@intimidation@cop@unarmed`] = "move_m@intimidation@cop@unarmed",
[`move_m@coward`] = "move_m@coward",
[`move_characters@dave_n`] = "move_characters@dave_n",
[`move_f@multiplayer`] = "move_f@multiplayer",
[`move_m@multiplayer`] = "move_m@multiplayer",
[`move_m@depressed@a`] = "move_m@depressed@a",
[`move_m@depressed@b`] = "move_m@depressed@b",
[`move_f@depressed@a`] = "move_f@depressed@a",
[`move_f@depressed@c`] = "move_f@depressed@c",
[`move_dreyfuss`] = "move_dreyfuss",
[`move_m@drunk@a`] = "move_m@drunk@a",
[`move_m@drunk@slightlydrunk`] = "move_m@drunk@slightlydrunk",
[`move_m@drunk@verydrunk`] = "move_m@drunk@verydrunk",
[`move_m@drunk@moderatedrunk`] = "move_m@drunk@moderatedrunk",
[`move_f@fat@a`] = "move_f@fat@a",
[`move_m@fat@a`] = "move_m@fat@a",
[`move_m@fat@bulky`] = "move_m@fat@bulky",
[`move_f@femme@`] = "move_f@femme@",
[`move_characters@franklin@fire`] = "move_characters@franklin@fire",
[`move_characters@michael@fire`] = "move_characters@michael@fire",
[`move_m@fire`] = "move_m@fire",
[`move_f@flee@a`] = "move_f@flee@a",
[`move_f@flee@c`] = "move_f@flee@c",
[`move_m@flee@a`] = "move_m@flee@a",
[`move_m@flee@b`] = "move_m@flee@b",
[`move_m@flee@c`] = "move_m@flee@c",
[`move_characters@floyd`] = "move_characters@floyd",
[`move_p_m_one`] = "move_p_m_one",
[`move_m@gangster@generic`] = "move_m@gangster@generic",
[`move_gangster`] = "move_gangster",
[`move_m@gangster@ng`] = "move_m@gangster@ng",
[`move_m@gangster@var_a`] = "move_m@gangster@var_a",
[`move_m@gangster@var_b`] = "move_m@gangster@var_b",
[`move_m@gangster@var_c`] = "move_m@gangster@var_c",
[`move_m@gangster@var_d`] = "move_m@gangster@var_d",
[`move_m@gangster@var_e`] = "move_m@gangster@var_e",
[`move_m@gangster@var_f`] = "move_m@gangster@var_f",
[`move_m@gangster@var_g`] = "move_m@gangster@var_g",
[`move_m@gangster@var_h`] = "move_m@gangster@var_h",
[`move_m@gangster@var_i`] = "move_m@gangster@var_i",
[`move_m@gangster@var_j`] = "move_m@gangster@var_j",
[`move_m@gangster@var_k`] = "move_m@gangster@var_k",
[`move_m@generic`] = "move_m@generic",
[`move_f@generic`] = "move_f@generic",
[`anim@move_m@grooving@`] = "anim@move_m@grooving@",
[`anim@move_f@grooving@`] = "anim@move_f@grooving@",
[`move_m@prison_gaurd`] = "move_m@prison_gaurd",
[`move_m@prisoner_cuffed`] = "move_m@prisoner_cuffed",
[`move_f@heels@c`] = "move_f@heels@c",
[`move_f@heels@d`] = "move_f@heels@d",
[`move_m@hiking`] = "move_m@hiking",
[`move_f@hiking`] = "move_f@hiking",
[`move_m@hipster@a`] = "move_m@hipster@a",
[`move_m@hobo@a`] = "move_m@hobo@a",
[`move_m@hobo@b`] = "move_m@hobo@b",
[`move_f@hurry@a`] = "move_f@hurry@a",
[`move_m@hurry@a`] = "move_m@hurry@a",
[`move_m@hurry@c`] = "move_m@hurry@c",
[`move_f@hurry@b`] = "move_f@hurry@b",
[`move_m@injured`] = "move_m@injured",
[`move_f@injured`] = "move_f@injured",
[`move_m@intimidation@1h`] = "move_m@intimidation@1h",
[`move_m@intimidation@unarmed`] = "move_m@intimidation@unarmed",
[`move_p_m_zero_janitor`] = "move_p_m_zero_janitor",
[`move_p_m_zero_slow`] = "move_p_m_zero_slow",
[`move_characters@jimmy`] = "move_characters@jimmy",
[`move_m@jog@`] = "move_m@jog@",
[`anim_group_move_lemar_alley`] = "anim_group_move_lemar_alley",
[`move_characters@lamar`] = "move_characters@lamar",
[`move_heist_lester`] = "move_heist_lester",
[`move_lester_caneup`] = "move_lester_caneup",
[`move_f@maneater`] = "move_f@maneater",
[`move_ped_bucket`] = "move_ped_bucket",
[`move_m@money`] = "move_m@money",
[`move_m@muscle@a`] = "move_m@muscle@a",
[`move_characters@jimmy@nervous@`] = "move_characters@jimmy@nervous@",
[`move_characters@patricia`] = "move_characters@patricia",
[`move_paramedic`] = "move_paramedic",
[`move_m@posh@`] = "move_m@posh@",
[`move_f@posh@`] = "move_f@posh@",
[`move_m@quick`] = "move_m@quick",
[`move_characters@ron`] = "move_characters@ron",
[`female_fast_runner`] = "female_fast_runner",
[`move_m@sad@a`] = "move_m@sad@a",
[`move_m@sad@b`] = "move_m@sad@b",
[`move_m@sad@c`] = "move_m@sad@c",
[`move_f@sad@a`] = "move_f@sad@a",
[`move_f@sad@b`] = "move_f@sad@b",
[`move_m@sassy`] = "move_m@sassy",
[`move_f@sassy`] = "move_f@sassy",
[`move_f@scared`] = "move_f@scared",
[`move_f@sexy@a`] = "move_f@sexy@a",
[`move_m@shadyped@a`] = "move_m@shadyped@a",
[`move_characters@jimmy@slow@`] = "move_characters@jimmy@slow@",
[`move_f@stripper@a`] = "move_f@stripper@a",
[`move_m@swagger`] = "move",
[`_m@swagger@b`] = "move_m@swagger@b",
[`move_m@tough_guy@`] = "move_m@tough_guy@",
[`move_f@tough_guy@`] = "move_f@tough_guy@",
[`move_m@tool_belt@a`] = "move_m@tool_belt@a",
[`move_f@tool_belt@a`] = "move_f@tool_belt@a",
[`move_characters@tracey`] = "move_characters@tracey",
[`clipset@move@trash_fast_turn`] = "clipset@move@trash_fast_turn",
[`missfbi4prepp1_garbageman`] = "missfbi4prepp1_garbageman",
[`move_p_m_two`] = "move_p_m_two",
[`move_m@leaf_blower`] = "move_m@leaf_blower",
[`move_m@bag`] = "move_m@bag",
}

0 comments on commit f25e8a6

Please sign in to comment.