Remove Movement Toggle & Add Moods chat command (#148)

* Revert most Movement On/Off Code (#146)

* Revert Native UI

* Revert Emote.lua

* Revert AnimationList.lua

* fix: returns wrong movement flag

* fix: MovementType issues

* feat: add persistent expression (#145)

* Add 2 new moods/expression

* feat: add persistent expression

Add persistent expression, get's loaded just like the walks.

As a sidenote: maybe this should be in it's own file? But the again it's pretty small, so there would't be a "need" for it.

* dev: remove comment

* Delete stream/[Custom Emotes]/Prue颜 directory

* refactor: mood commands (#147)

* refactor: mood commands

* fix: mood menu names

---------

Co-authored-by: Mads <madsleander@outlook.com>
This commit is contained in:
TayMcKenzieNZ
2023-02-02 12:30:57 +13:00
committed by GitHub
parent e04ef958b6
commit 41bd1f3f5e
7 changed files with 1420 additions and 646 deletions

View File

@@ -2423,9 +2423,6 @@ function UIMenu.New(Title, Subtitle, X, Y, TxtDictionary, TxtName)
},
Down = {
Enabled = true,
},
Switch = {
Enabled = true,
}
},
ParentMenu = nil,
@@ -2885,10 +2882,6 @@ function UIMenu:ProcessControl()
self:GoBack()
end
if self.Controls.Switch.Enabled and (IsDisabledControlJustReleased(0, 37) or IsDisabledControlJustReleased(1, 37) or IsDisabledControlJustReleased(2, 37)) then
self:SwitchMove()
end
if #self.Items == 0 then
return
end
@@ -3177,12 +3170,6 @@ function UIMenu:GoBack()
self.OnMenuClosed(self)
end
function UIMenu:SwitchMove()
PlaySoundFrontend(-1, self.Settings.Audio.Back, self.Settings.Audio.Library, true)
ToggleEmoteMovement = not ToggleEmoteMovement
self:Visible(true)
end
function UIMenu:BindMenuToItem(Menu, Item)
if Menu() == "UIMenu" and Item() == "UIMenuItem" then
Menu.ParentMenu = self
@@ -3597,24 +3584,15 @@ function UIMenu:UpdateScaleform()
PopScaleformMovieFunction()
end
if self.Controls.Switch.Enabled then
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(2)
PushScaleformMovieFunctionParameterString(GetControlInstructionalButton(2, 37, 0))
PushScaleformMovieFunctionParameterString(Config.Languages[lang]['btn_switch']..(ToggleEmoteMovement and ": <C>ON </C>" or ": <C>OFF</C>"))
PopScaleformMovieFunction()
end
local count = 2
for i = 1, #self.InstructionalButtons do
if self.InstructionalButtons[i] then
if #self.InstructionalButtons[i] == 3 then
if #self.InstructionalButtons[i] == 2 then
PushScaleformMovieFunction(self.InstructionalScaleform, "SET_DATA_SLOT")
PushScaleformMovieFunctionParameterInt(count)
PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][1])
PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][2])
PushScaleformMovieFunctionParameterString(self.InstructionalButtons[i][3])
PopScaleformMovieFunction()
count = count + 1
end

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,6 @@ local AnimationThreadStatus = false
local CanCancel = true
local InExitEmote = false
IsInAnimation = false
ToggleEmoteMovement = true
-- Remove emotes if needed
@@ -358,7 +357,7 @@ function EmoteMenuStart(args, hard, textureVariation)
end
elseif etype == "expression" then
if RP.Expressions[name] ~= nil then
OnEmotePlay(RP.Expressions[name])
SetPlayerPedExpression(RP.Expressions[name][1], true)
end
end
end
@@ -494,8 +493,6 @@ end
-----------------------------------------------------------------------------------------------------
function OnEmotePlay(EmoteName, textureVariation)
local animOption = EmoteName.AnimationOptions
InVehicle = IsPedInAnyVehicle(PlayerPedId(), true)
Pointing = false
@@ -512,6 +509,7 @@ function OnEmotePlay(EmoteName, textureVariation)
return false
end
local animOption = EmoteName.AnimationOptions
if animOption and animOption.NotInVehicle and InVehicle then
return EmoteChatMessage("You can't play this animation while in vehicle.")
end
@@ -531,11 +529,6 @@ function OnEmotePlay(EmoteName, textureVariation)
ChosenAnimOptions = animOption
AnimationDuration = -1
if ChosenDict == "Expression" then
SetFacialIdleAnimOverride(PlayerPedId(), ChosenAnimation, 0)
return
end
if Config.DisarmPlayer then
if IsPedArmed(PlayerPedId(), 7) then
SetCurrentPedWeapon(PlayerPedId(), joaat('WEAPON_UNARMED'), true)
@@ -588,18 +581,18 @@ function OnEmotePlay(EmoteName, textureVariation)
return
end
MovementType = 0 -- Default movement type
if InVehicle == 1 then
MovementType = 51
elseif animOption then
if animOption.EmoteLoop then
MovementType = (ToggleEmoteMovement and 51 or 1)
if animOption.EmoteMoving then
MovementType = 51
elseif animOption.EmoteLoop then
MovementType = 1
elseif animOption.EmoteStuck then
MovementType = (ToggleEmoteMovement and 50 or 1) -- 110010
else
MovementType = (ToggleEmoteMovement and 51 or 1)
MovementType = 50
end
else
MovementType = (ToggleEmoteMovement and 51 or 0)
end
if animOption then
@@ -651,7 +644,7 @@ function OnEmotePlay(EmoteName, textureVariation)
if animOption.SecondProp then
SecondPropName = animOption.SecondProp
SecondPropBone = animOption.SecondPropBone
SecondPropPl1, SecondPropPl2, SecondPropPl3, SecondPropPl4, SecondPropPl5, SecondPropPl6 = table.unpack(EmoteName.AnimationOptions.SecondPropPlacement)
SecondPropPl1, SecondPropPl2, SecondPropPl3, SecondPropPl4, SecondPropPl5, SecondPropPl6 = table.unpack(animOption.SecondPropPlacement)
SecondPropEmote = true
else
SecondPropEmote = false
@@ -672,6 +665,7 @@ function OnEmotePlay(EmoteName, textureVariation)
end
end
-----------------------------------------------------------------------------------------------------
------ Some exports to make the script more standalone! (by Clem76) ---------------------------------
-----------------------------------------------------------------------------------------------------

View File

@@ -449,15 +449,14 @@ end
function AddFaceMenu(menu)
local submenu = _menuPool:AddSubMenu(menu, Config.Languages[lang]['moods'], "", "", Menuthing, Menuthing)
facereset = NativeUI.CreateItem(Config.Languages[lang]['normalreset'], Config.Languages[lang]['resetdef'])
local facereset = NativeUI.CreateItem(Config.Languages[lang]['normalreset'], Config.Languages[lang]['resetdef'])
submenu:AddItem(facereset)
table.insert(FaceTable, "")
for a, b in pairsByKeys(RP.Expressions) do
x, y, z = table.unpack(b)
faceitem = NativeUI.CreateItem(a, "")
for name, data in pairsByKeys(RP.Expressions) do
local faceitem = NativeUI.CreateItem(data[2] or name, "")
submenu:AddItem(faceitem)
table.insert(FaceTable, a)
table.insert(FaceTable, name)
end
submenu.OnItemSelect = function(sender, item, index)

44
client/Expressions.lua Normal file
View File

@@ -0,0 +1,44 @@
function SetPlayerPedExpression(expression, saveToKvp)
SetFacialIdleAnimOverride(PlayerPedId(), expression, 0)
if Config.PersistentExpression and saveToKvp then SetResourceKvp("expression", expression) end
end
local function DisplayExpressions()
local moodsString = ""
for name, _ in pairs(RP.Expressions) do
moodsString = moodsString..string.lower(name)..", "
end
EmoteChatMessage(moodsString)
EmoteChatMessage("To reset do /mood reset")
end
if Config.ExpressionsEnabled then
RegisterCommand('mood', function(_source, args, _raw)
local expression = firstToUpper(string.lower(args[1]))
if RP.Expressions[expression] ~= nil then
SetPlayerPedExpression(RP.Expressions[expression][1], true)
else
EmoteChatMessage("'"..expression.."' is not a valid mood, do /moods to see all moods.")
end
end, false)
RegisterCommand('moods', function()
DisplayExpressions()
end, false)
-- Chat Suggestions
TriggerEvent('chat:addSuggestion', '/mood', 'Set your current mood/expression.', { { name = "expression", help = "/moods for a list of valid moods" } })
TriggerEvent('chat:addSuggestion', '/moods', 'List available walking moods/expressions.')
-- Persistent Expressions
if Config.PersistentExpression then
AddEventHandler('playerSpawned', function()
local expression = GetResourceKvpString("expression")
if expression ~= nil then
Wait(2500) -- Delay, to ensure the player ped has loaded in
SetPlayerPedExpression(expression, false)
end
end)
end
end

View File

@@ -39,6 +39,8 @@ Config = {
RagdollAsToggle = true,
-- You can disable the Facial Expressions menu here.
ExpressionsEnabled = true,
-- Saves expression style to client and applies them on joining
PersistentExpression = true,
-- You can disable the Walking Styles menu here.
WalkingStylesEnabled = true,
-- Saves walk styles to client and applies them periodically

View File

@@ -39,6 +39,7 @@ client_scripts {
'client/Crouch.lua',
'client/Emote.lua',
'client/EmoteMenu.lua',
'client/Expressions.lua',
'client/Keybinds.lua',
'client/Pointing.lua',
'client/Ragdoll.lua',