mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
24
gamemodes/darkrp/plugins/wn7_gestures/cl_plugin.lua
Normal file
24
gamemodes/darkrp/plugins/wn7_gestures/cl_plugin.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
net.Receive("ixGestureAnimation", function()
|
||||
local client = net.ReadEntity()
|
||||
if (!IsValid(client)) then return end
|
||||
|
||||
local sequence = net.ReadString()
|
||||
|
||||
client:AddVCDSequenceToGestureSlot(GESTURE_SLOT_VCD, sequence, 0, true)
|
||||
end)
|
||||
|
||||
net.Receive("ixOpenHandSignalMenu", function()
|
||||
if IsValid(ix.gui.handsignalMenu) then ix.gui.handsignalMenu:Remove() end
|
||||
vgui.Create("ixGestureWheel")
|
||||
end)
|
||||
@@ -0,0 +1,89 @@
|
||||
--[[
|
||||
| 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 PANEL = {}
|
||||
local function FramePaint( s, w, h )
|
||||
surface.SetDrawColor(Color(0, 0, 0, 50))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
surface.SetDrawColor(Color(100, 100, 100, 150))
|
||||
surface.DrawOutlinedRect(0, 0, w, h)
|
||||
end
|
||||
local function PointOnCircle( ang, radius, offX, offY )
|
||||
ang = math.rad( ang )
|
||||
local x = math.cos( ang ) * radius + offX
|
||||
local y = math.sin( ang ) * radius + offY
|
||||
return x, y
|
||||
end
|
||||
function PANEL:Init()
|
||||
ix.gui.handsignalMenu = self
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self.gestButtons = {}
|
||||
local gestures = ix.handsignal:GetAnimClassGestures(ix.anim.GetModelClass(LocalPlayer():GetModel()))
|
||||
local numSquares = #gestures
|
||||
local interval = 360 / numSquares
|
||||
local centerX, centerY = self:GetWide()*0.485, self:GetTall()*0.45
|
||||
local radius = 240
|
||||
for degrees = 1, 360, interval do --Start at 1, go to 360, and skip forward at even intervals.
|
||||
|
||||
local x, y = PointOnCircle( degrees, radius, centerX, centerY )
|
||||
|
||||
local gestButton = self:Add("DButton")
|
||||
gestButton:SetFont("MenuFontNoClamp")
|
||||
gestButton:SetText( "..." )
|
||||
gestButton:SetPos(x, y)
|
||||
self.gestButtons[#self.gestButtons + 1] = gestButton
|
||||
|
||||
gestButton.Paint = function( s, w, h ) FramePaint(s, w, h) end
|
||||
|
||||
gestButton.DoClick = function ( btn )
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
end
|
||||
for k, v in ipairs(gestures) do
|
||||
local btn = self.gestButtons[k]
|
||||
btn:SetText(v.name)
|
||||
btn.DoClick = function()
|
||||
net.Start("ixAskForGestureAnimation")
|
||||
net.WriteString(v.gesturePath)
|
||||
net.SendToServer()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self:Remove()
|
||||
end
|
||||
btn:SetWide(ScreenScale(128 / 3))
|
||||
btn:SetHeight(ScreenScale(64 / 3))
|
||||
end
|
||||
|
||||
self.closeButton = self:Add("DButton")
|
||||
self.closeButton:Dock(BOTTOM)
|
||||
self.closeButton:SetFont("MenuFontNoClamp")
|
||||
self.closeButton:SetText( "Fermer" )
|
||||
self.closeButton:SetHeight(ScreenScale(64 / 3))
|
||||
|
||||
self.closeButton.Paint = function( s, w, h ) FramePaint(s, w, h) end
|
||||
|
||||
self.closeButton.DoClick = function ( btn )
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self:MakePopup()
|
||||
self:SetKeyboardInputEnabled(false)
|
||||
end
|
||||
|
||||
function PANEL:Paint(width, height)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 100))
|
||||
surface.DrawRect(0, 0, width, height)
|
||||
|
||||
Derma_DrawBackgroundBlur( self, 0 )
|
||||
end
|
||||
|
||||
vgui.Register("ixGestureWheel", PANEL)
|
||||
@@ -0,0 +1,15 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
LANGUAGE = {
|
||||
optEnableGestureAnims = "Activer les animations gestuelles",
|
||||
optdEnableGestureAnims = "Si votre personnage devrait faire un geste aléatoire en parlant."
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
LANGUAGE = {
|
||||
optEnableGestureAnims = "Activer les animations gestuelles",
|
||||
optdEnableGestureAnims = "Si votre personnage devrait faire un geste aléatoire en parlant."
|
||||
}
|
||||
173
gamemodes/darkrp/plugins/wn7_gestures/libs/sh_hand_signals.lua
Normal file
173
gamemodes/darkrp/plugins/wn7_gestures/libs/sh_hand_signals.lua
Normal file
@@ -0,0 +1,173 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
ix.handsignal = ix.handsignal or {}
|
||||
ix.handsignal.stored = ix.handsignal.stored or {}
|
||||
|
||||
function ix.handsignal:Register(data)
|
||||
if ix.handsignal.stored[data.id] then return "already exists" end
|
||||
ix.handsignal.stored[data.id] = data
|
||||
end
|
||||
function ix.handsignal:GetAnimClassGestures(animClass)
|
||||
local tbl = {}
|
||||
for k, v in pairs(ix.handsignal.stored) do
|
||||
if v.animClass == animClass then tbl[#tbl + 1] = v end
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
-- female
|
||||
ix.handsignal:Register({
|
||||
id = "wave",
|
||||
name = "Vient !",
|
||||
animClass = "citizen_female",
|
||||
gesturePath = "g_wave"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "display_r",
|
||||
name = "A droite",
|
||||
animClass = "citizen_female",
|
||||
gesturePath = "g_right_openhand"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "headshake",
|
||||
name = "Hochement de tête",
|
||||
animClass = "citizen_female",
|
||||
gesturePath = "hg_headshake"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "display_l",
|
||||
name = "A gauche",
|
||||
animClass = "citizen_female",
|
||||
gesturePath = "g_display_left"
|
||||
})
|
||||
-- male
|
||||
ix.handsignal:Register({
|
||||
id = "clap",
|
||||
name = "Clap",
|
||||
animClass = "citizen_male",
|
||||
gesturePath = "g_clap"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "clap_m",
|
||||
name = "Clap",
|
||||
animClass = "metrocop",
|
||||
gesturePath = "g_clap"
|
||||
})
|
||||
|
||||
ix.handsignal:Register({
|
||||
id = "point",
|
||||
name = "Pointer",
|
||||
animClass = "citizen_male",
|
||||
gesturePath = "g_point_l"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "point_m",
|
||||
name = "Pointer",
|
||||
animClass = "metrocop",
|
||||
gesturePath = "g_point_l"
|
||||
})
|
||||
|
||||
ix.handsignal:Register({
|
||||
id = "point_left",
|
||||
name = "Pointer à gauche",
|
||||
animClass = "citizen_male",
|
||||
gesturePath = "g_pointleft_l"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "point_left_m",
|
||||
name = "Pointer à gauche",
|
||||
animClass = "metrocop",
|
||||
gesturePath = "g_pointleft_l"
|
||||
})
|
||||
|
||||
ix.handsignal:Register({
|
||||
id = "point_right",
|
||||
name = "Pointer à droite",
|
||||
animClass = "citizen_male",
|
||||
gesturePath = "g_pointright_l"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "point_right_m",
|
||||
name = "Pointer à droite",
|
||||
animClass = "metrocop",
|
||||
gesturePath = "g_pointright_l"
|
||||
})
|
||||
|
||||
ix.handsignal:Register({
|
||||
id = "wave_male",
|
||||
name = "Vient !",
|
||||
animClass = "citizen_male",
|
||||
gesturePath = "g_wave"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "wave_metro",
|
||||
name = "Vient !",
|
||||
animClass = "metrocop",
|
||||
gesturePath = "g_wave"
|
||||
})
|
||||
|
||||
ix.handsignal:Register({
|
||||
id = "wave_low",
|
||||
name = "Vient ! (Doucement)",
|
||||
animClass = "citizen_male",
|
||||
gesturePath = "g_lookatthis"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "wave_low_m",
|
||||
name = "Vient ! (Doucement)",
|
||||
animClass = "metrocop",
|
||||
gesturePath = "g_lookatthis"
|
||||
})
|
||||
|
||||
-- OTA
|
||||
|
||||
ix.handsignal:Register({
|
||||
id = "advance",
|
||||
name = "Avancer",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_advance"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "forward",
|
||||
name = "Pointer",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_forward"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "group",
|
||||
name = "Grouper",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_group"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "halt",
|
||||
name = "Halt",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_halt"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "ota_point_r",
|
||||
name = "Pointer à droite",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_right"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "ota_point_l",
|
||||
name = "Pointer à gauche",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_left"
|
||||
})
|
||||
ix.handsignal:Register({
|
||||
id = "takecover",
|
||||
name = "Prenez une couverture",
|
||||
animClass = "overwatch",
|
||||
gesturePath = "signal_takecover"
|
||||
})
|
||||
27
gamemodes/darkrp/plugins/wn7_gestures/meta/sv_player.lua
Normal file
27
gamemodes/darkrp/plugins/wn7_gestures/meta/sv_player.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
--[[
|
||||
| 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 playerMeta = FindMetaTable("Player")
|
||||
|
||||
function playerMeta:PlayGestureAnimation(animation)
|
||||
net.Start("ixGestureAnimation")
|
||||
net.WriteEntity(self)
|
||||
net.WriteString(animation)
|
||||
net.SendPVS( self:GetPos() )
|
||||
end
|
||||
|
||||
net.Receive("ixAskForGestureAnimation", function(len, client)
|
||||
local gest = net.ReadString()
|
||||
|
||||
if not client:IsPlayer() or (client.ixGestDelay and client.ixGestDelay > CurTime()) then return end
|
||||
client:PlayGestureAnimation(client:LookupSequence(gest))
|
||||
client.ixGestDelay = CurTime() + 1
|
||||
end)
|
||||
15
gamemodes/darkrp/plugins/wn7_gestures/sh_options.lua
Normal file
15
gamemodes/darkrp/plugins/wn7_gestures/sh_options.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ix.option.Add("enableGestureAnims", ix.type.bool, true, {
|
||||
category = "Apparence",
|
||||
bNetworked = true
|
||||
})
|
||||
36
gamemodes/darkrp/plugins/wn7_gestures/sh_plugin.lua
Normal file
36
gamemodes/darkrp/plugins/wn7_gestures/sh_plugin.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
PLUGIN.name = "Dialogue Gestures & Hand Signals"
|
||||
PLUGIN.author = "Naast & Aspect™"
|
||||
PLUGIN.description = "Adds dialogue gestures & hand signals."
|
||||
|
||||
ix.util.Include("meta/sv_player.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
ix.util.Include("sh_options.lua")
|
||||
ix.util.Include("sv_hooks.lua")
|
||||
|
||||
PLUGIN.availableAnimClasses = {
|
||||
["metrocop"] = true,
|
||||
["citizen_male"] = true,
|
||||
["citizen_female"] = true,
|
||||
["overwatch"] = true
|
||||
}
|
||||
|
||||
ix.command.Add("Handsignals", {
|
||||
description = "Ouvrir le menu des signaux !",
|
||||
OnRun = function(self, client)
|
||||
if not PLUGIN.availableAnimClasses[ix.anim.GetModelClass(client:GetModel())] then return client:NotifyLocalized("Votre model n'est pas pris en charge") end
|
||||
net.Start("ixOpenHandSignalMenu")
|
||||
net.Send(client)
|
||||
end
|
||||
})
|
||||
98
gamemodes/darkrp/plugins/wn7_gestures/sv_hooks.lua
Normal file
98
gamemodes/darkrp/plugins/wn7_gestures/sv_hooks.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
util.AddNetworkString("ixOpenHandSignalMenu")
|
||||
util.AddNetworkString("ixGestureAnimation")
|
||||
util.AddNetworkString("ixAskForGestureAnimation")
|
||||
|
||||
local animationLookup = {
|
||||
male = {
|
||||
"bg_accent_left",
|
||||
"bg_accentfwd",
|
||||
"bg_accentup",
|
||||
"bg_down",
|
||||
"bg_left",
|
||||
"bg_right",
|
||||
"bg_up_l",
|
||||
"bg_up_r",
|
||||
"g_antman_punctuate",
|
||||
"g_armsout",
|
||||
"g_chestup",
|
||||
"g_fist_l",
|
||||
"g_fist_r",
|
||||
"g_first_swing_accross",
|
||||
"g_lefthandmotion",
|
||||
"g_lhandease",
|
||||
"g_look",
|
||||
"g_look_small",
|
||||
"g_medpuct_mid",
|
||||
"g_noway_small",
|
||||
"g_openarms",
|
||||
"g_openarms_right",
|
||||
"g_palm_out_high_l",
|
||||
"g_palm_out_high_r",
|
||||
"g_palm_out_r",
|
||||
"g_palm_out_l",
|
||||
"g_palm_up_high_l",
|
||||
"g_palm_up_l",
|
||||
"g_puncuate",
|
||||
"g_righthandheavy",
|
||||
"g_righthandroll",
|
||||
"g_shrug",
|
||||
"g_what",
|
||||
"hg_chest_twistl",
|
||||
"hg_headshake",
|
||||
"hg_nod_yes",
|
||||
"hg_puncuate_down",
|
||||
"hg_turn_l",
|
||||
"hg_turn_r",
|
||||
"hg_turnl",
|
||||
"hg_turnr"
|
||||
},
|
||||
female = {
|
||||
"hg_headshake",
|
||||
"hg_nodleft",
|
||||
"hg_nodright",
|
||||
"hg_puncuate_down",
|
||||
"g_display_left",
|
||||
"g_left_openhand",
|
||||
"g_puncuate",
|
||||
"g_right_openhand",
|
||||
"b_accent_back",
|
||||
"b_accent_fwd",
|
||||
"b_head_back",
|
||||
"b_head_forward",
|
||||
"b_overhere_left",
|
||||
"b_overhere_right",
|
||||
}
|
||||
}
|
||||
|
||||
local allowedChatTypes = {
|
||||
["ic"] = true,
|
||||
["w"] = true,
|
||||
["wd"] = true,
|
||||
["y"] = true,
|
||||
["sv"] = true
|
||||
}
|
||||
function PLUGIN:PostPlayerSay(client, chatType)
|
||||
if (!ix.option.Get(client, "enableGestureAnims", true)) then return end
|
||||
if (!allowedChatTypes[chatType] or !client:Alive()) then return end
|
||||
if (!client:Alive()) then return end
|
||||
--local modelClass = ix.anim.GetModelClass(client:GetModel())
|
||||
--if (modelClass != "citizen_male" and modelClass != "citizen_female") then return end
|
||||
|
||||
local activeWeapon = client:GetActiveWeapon()
|
||||
if (!IsValid(activeWeapon)) then return end
|
||||
if (activeWeapon and activeWeapon:GetClass() != "ix_hands") then return end
|
||||
|
||||
if (math.random(1, 2) == 2) then return end -- Don't want it to always gesture
|
||||
|
||||
client:PlayGestureAnimation(client:LookupSequence(client:IsFemale() and animationLookup.female[math.random(#animationLookup.female)] or animationLookup.male[math.random(#animationLookup.male)]))
|
||||
end
|
||||
Reference in New Issue
Block a user