mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
46
gamemodes/darkrp/plugins/ln_emotemoods/sh_commands.lua
Normal file
46
gamemodes/darkrp/plugins/ln_emotemoods/sh_commands.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
local COMMAND = {}
|
||||
|
||||
COMMAND.description = "Définissez l'humeur de votre personnage."
|
||||
COMMAND.arguments = {
|
||||
ix.type.string
|
||||
}
|
||||
COMMAND.argumentNames = {
|
||||
"Humeur [DEFAUT | DETENDU | TETU | EFFRAYE | FRUSTRE]"
|
||||
}
|
||||
|
||||
function COMMAND:OnRun(client, mood)
|
||||
if (string.lower(mood) == "default") then
|
||||
client:SetNetVar("characterMood", nil)
|
||||
|
||||
return "Yous avez réglé l'humeur de votre personnage sur 'Par défaut'."
|
||||
end
|
||||
|
||||
if (!PLUGIN.personaTypes[string.upper(mood)]) then
|
||||
return "Vous devez spécifier une humeur valide !"
|
||||
end
|
||||
|
||||
if (client:IsFemale()) then
|
||||
client:SetNetVar("characterMood", string.upper(mood) .. "F")
|
||||
else
|
||||
client:SetNetVar("characterMood", string.upper(mood))
|
||||
end
|
||||
|
||||
local formattedString = string.upper(string.sub(mood, 1, 1)) .. string.lower(string.sub(mood, 2))
|
||||
|
||||
return "Vous avez défini l'humeur de votre personnage sur '" .. formattedString .. "'."
|
||||
end
|
||||
|
||||
ix.command.Add("SetMood", COMMAND)
|
||||
120
gamemodes/darkrp/plugins/ln_emotemoods/sh_plugin.lua
Normal file
120
gamemodes/darkrp/plugins/ln_emotemoods/sh_plugin.lua
Normal file
@@ -0,0 +1,120 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
PLUGIN.name = "LN | Emote Moods"
|
||||
PLUGIN.author = "Aspect™ & Scotnay"
|
||||
PLUGIN.description = "Donne la possibilité aux joueurs de changer leur humeur et à leur tour certaines de leurs animations."
|
||||
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
ix.util.Include("sh_commands.lua")
|
||||
|
||||
PLUGIN.personaTypes = {
|
||||
["DEFAUT"] = true,
|
||||
["DETENDU"] = true,
|
||||
["TETU"] = true,
|
||||
["EFFRAYE"] = true,
|
||||
["FRUSTRE"] = true,
|
||||
["OTAR"] = true
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable = {}
|
||||
|
||||
PLUGIN.lookupTable["DETENDU"] = {
|
||||
["idle"] = "LineIdle01",
|
||||
["walk"] = "walk_all_Moderate",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["DETENDUF"] = {
|
||||
["idle"] = "LineIdle01",
|
||||
["walk"] = "walk_all_Moderate",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["TETU"] = {
|
||||
["idle"] = "idle_subtle",
|
||||
["run"] = "run_all_panicked",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["TETUF"] = {
|
||||
["idle"] = "idle_subtle",
|
||||
["run"] = "run_panicked_2_all",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["EFFRAYE"] = {
|
||||
["idle"] = "scaredidle",
|
||||
["run"] = "run_protected_all",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["EFFRAYEF"] = {
|
||||
["run"] = "run_protected_all",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["FRUSTRE"] = {
|
||||
["idle"] = "LineIdle02",
|
||||
["walk"] = "pace_all",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["FRUSTREF"] = {
|
||||
["idle"] = "willard_female_stand04",
|
||||
}
|
||||
|
||||
PLUGIN.lookupTable["OTAR"] = {
|
||||
["idle"] = "Idle01",
|
||||
["walk"] = "walkeasy_all",
|
||||
}
|
||||
|
||||
local vectorAngle = FindMetaTable("Vector").Angle
|
||||
local normalAngle = math.NormalizeAngle
|
||||
|
||||
function PLUGIN:CalcMainActivity(client, velocity)
|
||||
if (client:GetNetVar("characterMood") and !client:GetNetVar("forcedSequence")) then
|
||||
local eyeAngle = client:EyeAngles()
|
||||
local yaw = vectorAngle(velocity)[2]
|
||||
local normal = normalAngle(yaw - eyeAngle[2])
|
||||
|
||||
client:SetPoseParameter("move_yaw", normal)
|
||||
|
||||
if (client:GetActiveWeapon() == NULL) then
|
||||
return
|
||||
end
|
||||
|
||||
local mood = client:GetNetVar("characterMood")
|
||||
local moodTab = self.lookupTable[mood]
|
||||
|
||||
if (!moodTab) then
|
||||
return
|
||||
end
|
||||
|
||||
client.calcIdeal = ACT_IDLE
|
||||
client.calcSeqOverride = -1
|
||||
|
||||
local baseClass = GAMEMODE.BaseClass
|
||||
|
||||
if (!baseClass:HandlePlayerDriving(client) and !baseClass:HandlePlayerDucking(client, velocity) and!baseClass:HandlePlayerJumping(client, velocity) and !baseClass:HandlePlayerSwimming(client)) then
|
||||
if (velocity:Length2D() < 0.5 and client:GetActiveWeapon():GetClass() == "ix_hands") then
|
||||
client.calcSeqOverride = moodTab["idle"]
|
||||
elseif (velocity:Length2D() >= 0.5 and !client:IsRunning() and client:GetActiveWeapon():GetClass() == "ix_hands") then
|
||||
if (!client:IsOnGround()) then
|
||||
return
|
||||
end
|
||||
|
||||
client.calcSeqOverride = moodTab["walk"]
|
||||
elseif (client:IsRunning()) then
|
||||
client.calcSeqOverride = moodTab["run"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (client.calcSeqOverride != -1 and isstring(client.calcSeqOverride)) then
|
||||
client.calcSeqOverride = client:LookupSequence(client.calcSeqOverride)
|
||||
|
||||
return client.calcIdeal, client.calcSeqOverride
|
||||
end
|
||||
end
|
||||
20
gamemodes/darkrp/plugins/ln_emotemoods/sv_hooks.lua
Normal file
20
gamemodes/darkrp/plugins/ln_emotemoods/sv_hooks.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
-- Called after a player has loaded a character.
|
||||
function PLUGIN:PlayerLoadedCharacter(client, character, currentChar)
|
||||
client:SetNetVar("characterMood", nil)
|
||||
end
|
||||
|
||||
-- Called after the player's model has changed.
|
||||
function PLUGIN:PlayerModelChanged(client, model)
|
||||
client:SetNetVar("characterMood", nil)
|
||||
end
|
||||
Reference in New Issue
Block a user