-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmoods.lua
More file actions
100 lines (84 loc) · 2.54 KB
/
moods.lua
File metadata and controls
100 lines (84 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
local GAMEMODE = GAMEMODE || GM
PLUGIN.name = 'Emote Moods'
PLUGIN.author = 'DrodA (Ported from NS)'
PLUGIN.description = 'With this plugin, characters can set their mood.'
do
MOOD_NONE = 0
MOOD_RELAXED = 1
MOOD_FRUSTRATED = 3
MOOD_MODEST = 4
PLUGIN.MoodTextTable = {
[MOOD_NONE] = 'Default',
[MOOD_RELAXED] = 'Relaxed',
[MOOD_FRUSTRATED] = 'Frustrated',
[MOOD_MODEST] = 'Modest'
}
PLUGIN.MoodBadMovetypes = {
[MOVETYPE_FLY] = true,
[MOVETYPE_LADDER] = true,
[MOVETYPE_NOCLIP] = true
}
PLUGIN.MoodAnimTable = {
[MOOD_RELAXED] = {
[0] = 'LineIdle01',
[1] = 'walk_all_Moderate'
},
[MOOD_FRUSTRATED] = {
[0] = 'LineIdle02',
[1] = 'pace_all'
},
[MOOD_MODEST] = {
[0] = 'LineIdle04',
[1] = 'plaza_walk_all'
}
}
end
do
local meta = FindMetaTable('Player')
function meta:GetMood()
return self:GetNetVar('mood') or MOOD_NONE
end
if SERVER then
function meta:SetMood(int)
int = int or 0
self:SetNetVar('mood', int)
end
end
end
do
local COMMAND = {}
COMMAND.description = 'Set your own mood'
COMMAND.arguments = {
ix.type.number
}
function COMMAND:OnRun(client, mood)
mood = math.Clamp(mood, 0, MOOD_MODEST)
client:SetMood(mood)
end
ix.command.Add('Mood', COMMAND)
local tblWorkaround = {['ix_keys'] = true, ['ix_hands'] = true}
function PLUGIN:CalcMainActivity(client, velocity)
local length = velocity:Length2DSqr()
local clientInfo = client:GetTable()
local mood = client:GetMood()
local pkpill = NULL
if pk_pills then
pkpill = pk_pills.getMappedEnt(client)
end
if IsValid(pkpill) then return end
if (client && IsValid(client) && client:IsPlayer()) then
if (!client:IsWepRaised() && !client:Crouching() && IsValid(client:GetActiveWeapon()) && tblWorkaround[client:GetActiveWeapon():GetClass()] && !client:InVehicle() and mood > 0 and !self.MoodBadMovetypes[client:GetMoveType()] and !client.m_bJumping and client:IsOnGround()) then
if length < 0.25 then
clientInfo.CalcSeqOverride = self.MoodAnimTable[mood][0] && client:LookupSequence(self.MoodAnimTable[mood][0]) || clientInfo.CalcSeqOverride
elseif length > 0.25 && length < 22500 then
clientInfo.CalcSeqOverride = self.MoodAnimTable[mood][1] && client:LookupSequence(self.MoodAnimTable[mood][1]) || clientInfo.CalcSeqOverride
end
end
end
end
end
if SERVER then
function PLUGIN:PlayerLoadedCharacter(client, character)
client:SetMood(MOOD_NONE)
end
end