😎 Feat: Add Exit Emotes (#101) 😎

* Feat: Add Exit Emotes

This would add the option to add "exit emotes" for any emote.

The point of adding this would be to allow for more "smooth" or "dynamic" animations to be set up, hopefully improving the "natural flow" when using emotes. Further down the line entry emotes could also be added to build on top of this.

This PR only includes getting up (getup) as an example on how it could be used, more emotes could be added as time goes by.

I don't think I've seen any other menu with this, so it certainly should be a step ahead of other menus.

Here is a video showing it in action: https://youtu.be/uEWAz-xgHlg (sorry for the "low" fps, my pc suddenly decided to not cooperate)

* Made Requested Changes

Add checks to confirm that both the exit type and emote exists. ExitEmoteType also defaults to "Emotes" if not specified.

ExitEmote config have been changed to match the style of other configs. It is now split up into ExitEmote and ExitEmoteType.

Added new array in the RP table called "Exits" to allow adding exit emotes without having them appear in the menu, they are still available trough commands.
This commit is contained in:
Mads
2023-01-14 17:25:00 +01:00
committed by GitHub
parent 1aea3c70ab
commit 63d58cc8e8
3 changed files with 84 additions and 17 deletions

View File

@@ -4991,6 +4991,20 @@ RP.AnimalEmotes = {
}
--- EXIT EMOTES ---
RP.Exits = {
["getup"] = {
"get_up@sat_on_floor@to_stand",
"getup_0",
"Get Up",
AnimationOptions = {
EmoteDuration = 2000
}
}
}
--- EMOTES NO PROPS ---
RP.Emotes = {
@@ -6218,7 +6232,9 @@ RP.Emotes = {
"sit_phone_phoneputdown_idle_nowork",
"Sit",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit2"] = {
@@ -6226,7 +6242,9 @@ RP.Emotes = {
"barry_3_sit_loop",
"Sit 2",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit3"] = {
@@ -6234,7 +6252,9 @@ RP.Emotes = {
"idle_a",
"Sit 3",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit4"] = {
@@ -6242,7 +6262,9 @@ RP.Emotes = {
"idle_a",
"Sit 4",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit5"] = {
@@ -6250,7 +6272,9 @@ RP.Emotes = {
"owner_idle",
"Sit 5",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit6"] = {
@@ -6258,7 +6282,9 @@ RP.Emotes = {
"idle_a_jimmy",
"Sit 6",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit7"] = {
@@ -6266,7 +6292,9 @@ RP.Emotes = {
"lowalone_base_laz",
"Sit 7",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit8"] = {
@@ -6274,7 +6302,9 @@ RP.Emotes = {
"mics3_15_base_jimmy",
"Sit 8",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sit9"] = {
@@ -6282,7 +6312,9 @@ RP.Emotes = {
"idle_a",
"Sit 9",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sitlow"] = {
@@ -6306,7 +6338,9 @@ RP.Emotes = {
"sit_phone_phoneputdown_sleeping-noworkfemale",
"Sit Sad",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sitscared"] = {
@@ -6314,7 +6348,9 @@ RP.Emotes = {
"hit_loop_ped_b",
"Sit Scared",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sitscared2"] = {
@@ -6322,7 +6358,9 @@ RP.Emotes = {
"flinch_loop",
"Sit Scared 2",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sitscared3"] = {
@@ -6330,7 +6368,9 @@ RP.Emotes = {
"flinch_loop",
"Sit Scared 3",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sitdrunk"] = {
@@ -6338,7 +6378,9 @@ RP.Emotes = {
"base",
"Sit Drunk",
AnimationOptions = {
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["sitchair2"] = {
@@ -16670,7 +16712,9 @@ RP.PropEmotes = {
88.6103,
-1.4385
},
EmoteLoop = true
EmoteLoop = true,
ExitEmote = "getup",
ExitEmoteType = "Exits"
}
},
["crackhead"] = {

View File

@@ -9,6 +9,7 @@ CustomDP.Walks = {}
CustomDP.Shared = {}
CustomDP.Dances = {}
CustomDP.AnimalEmotes = {}
CustomDP.Exits = {}
CustomDP.Emotes = {}
CustomDP.PropEmotes = {}

View File

@@ -2,6 +2,7 @@
local AnimationDuration = -1
local ChosenAnimation = ""
local ChosenDict = ""
local ChosenAnimOptions = false
local IsInAnimation = false
local MostRecentChosenAnimation = ""
local MostRecentChosenDict = ""
@@ -248,11 +249,28 @@ function EmoteCancel(force)
if LocalPlayer.state.ptfx then
PtfxStop()
end
ClearPedTasks(ply)
DetachEntity(ply, true, false)
CancelSharedEmote(ply)
DestroyAllProps()
IsInAnimation = false
if ChosenAnimOptions and ChosenAnimOptions.ExitEmote then
-- If the emote exit type is not spesifed it defaults to Emotes
local ExitEmoteType = ChosenAnimOptions.ExitEmoteType or "Emotes"
-- Checks that the exit emote actually exists
if not RP[ExitEmoteType] or not RP[ExitEmoteType][ChosenAnimOptions.ExitEmote] then
DebugPrint("Exit emote was invalid")
ClearPedTasks(ply)
IsInAnimation = false
return
end
OnEmotePlay(RP[ExitEmoteType][ChosenAnimOptions.ExitEmote])
DebugPrint("Playing exit animation")
else
ClearPedTasks(ply)
IsInAnimation = false
end
end
AnimationThreadStatus = false
end
@@ -420,6 +438,9 @@ function EmoteCommandStart(source, args, raw)
elseif RP.AnimalEmotes[name] ~= nil then
OnEmotePlay(RP.AnimalEmotes[name])
return
elseif RP.Exits[name] ~= nil then
OnEmotePlay(RP.Exits[name])
return
elseif RP.PropEmotes[name] ~= nil then
if RP.PropEmotes[name].AnimationOptions.PropTextureVariations then
if #args > 1 then
@@ -531,6 +552,7 @@ function OnEmotePlay(EmoteName, textureVariation)
end
ChosenDict, ChosenAnimation, ename = table.unpack(EmoteName)
ChosenAnimOptions = EmoteName.AnimationOptions
AnimationDuration = -1
if ChosenDict == "Expression" then