add sborka
This commit is contained in:
29
garrysmod/addons/wos/lua/autorun/wiltos_dynabase_loader.lua
Normal file
29
garrysmod/addons/wos/lua/autorun/wiltos_dynabase_loader.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
--[[-------------------------------------------------------------------
|
||||
Dynamic Base:
|
||||
Bringing the power everyone. Developer, server owner, and player.
|
||||
Powered by
|
||||
_ _ _ ___ ____
|
||||
__ _(_) | |_ / _ \/ ___|
|
||||
\ \ /\ / / | | __| | | \___ \
|
||||
\ V V /| | | |_| |_| |___) |
|
||||
\_/\_/ |_|_|\__|\___/|____/
|
||||
|
||||
_____ _ _ _
|
||||
|_ _|__ ___| |__ _ __ ___ | | ___ __ _(_) ___ ___
|
||||
| |/ _ \/ __| '_ \| '_ \ / _ \| |/ _ \ / _` | |/ _ \/ __|
|
||||
| | __/ (__| | | | | | | (_) | | (_) | (_| | | __/\__ \
|
||||
|_|\___|\___|_| |_|_| |_|\___/|_|\___/ \__, |_|\___||___/
|
||||
|___/
|
||||
-------------------------------------------------------------------]]--[[
|
||||
|
||||
Lua Developer: King David
|
||||
Contact: http://steamcommunity.com/groups/wiltostech
|
||||
|
||||
----------------------------------------]]--
|
||||
|
||||
if SERVER then
|
||||
AddCSLuaFile( "wos/dynabase/loader/loader.lua" )
|
||||
end
|
||||
|
||||
include( "wos/dynabase/loader/loader.lua" )
|
||||
816
garrysmod/addons/wos/lua/wos/dynabase/core/cl_config_menu.lua
Normal file
816
garrysmod/addons/wos/lua/wos/dynabase/core/cl_config_menu.lua
Normal file
@@ -0,0 +1,816 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
wOS.DynaBase.WorkshopCache = wOS.DynaBase.WorkshopCache or {}
|
||||
|
||||
local w, h = ScrW(), ScrH()
|
||||
|
||||
local male_mat = "icon16/male.png"
|
||||
local female_mat = "icon16/female.png"
|
||||
local zombie_mat = "icon16/bug.png"
|
||||
local shared_mat = "icon16/group.png"
|
||||
|
||||
local reanim_mat = "icon16/application_edit.png"
|
||||
local extend_mat = "icon16/application_add.png"
|
||||
|
||||
surface.CreateFont( "wOS.DynaBase.TitleFont", {
|
||||
font = "Roboto Cn", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
||||
extended = false,
|
||||
size = 24*(h/1200),
|
||||
weight = 1000,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "wOS.DynaBase.QuestionFont", {
|
||||
font = "Roboto Cn", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
||||
extended = false,
|
||||
size = 108*(h/1200),
|
||||
weight = 1000,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "wOS.DynaBase.DescFont",{
|
||||
font = "Roboto Cn", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
||||
extended = false,
|
||||
size = 18*(h/1200),
|
||||
weight = 500,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = false,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
} )
|
||||
|
||||
surface.CreateFont( "wOS.DynaBase.URLFont",{
|
||||
font = "Roboto Cn", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
|
||||
extended = false,
|
||||
size = 12*(h/1200),
|
||||
weight = 300,
|
||||
blursize = 0,
|
||||
scanlines = 0,
|
||||
antialias = true,
|
||||
underline = true,
|
||||
italic = false,
|
||||
strikeout = false,
|
||||
symbol = false,
|
||||
rotary = false,
|
||||
shadow = false,
|
||||
additive = false,
|
||||
outline = false,
|
||||
} )
|
||||
|
||||
local function GetContainingAddon( mdl )
|
||||
mdl = mdl or "models/m_anm.mdl"
|
||||
for _, addon in pairs( engine.GetAddons() ) do
|
||||
local modelFound = file.Find(mdl, addon.title)
|
||||
if #modelFound != 0 then return addon end
|
||||
end
|
||||
end
|
||||
|
||||
local function GetWorkshopInfo( addon, callback )
|
||||
if not addon or not callback then return end
|
||||
if wOS.DynaBase.WorkshopCache[ addon.wsid ] then
|
||||
callback( wOS.DynaBase.WorkshopCache[ addon.wsid ].Data, wOS.DynaBase.WorkshopCache[ addon.wsid ].Icon )
|
||||
return
|
||||
end
|
||||
|
||||
steamworks.FileInfo( addon.wsid, function( result )
|
||||
if not result then return end
|
||||
wOS.DynaBase.WorkshopCache[ addon.wsid ] = {}
|
||||
wOS.DynaBase.WorkshopCache[ addon.wsid ].Data = result
|
||||
if not result.previewid then return end
|
||||
steamworks.Download( result.previewid, true, function( cache )
|
||||
if not cache then callback( result, nil ) return end
|
||||
local mat = AddonMaterial(cache)
|
||||
|
||||
// Jazztronauts taught me not to trust this little material
|
||||
local baseTex = ( mat and mat:GetTexture("$basetexture") ) or nil
|
||||
if baseTex == nil then
|
||||
mat = AddonMaterial(cache)
|
||||
end
|
||||
wOS.DynaBase.WorkshopCache[ addon.wsid ].Icon = mat
|
||||
callback( result, mat )
|
||||
end )
|
||||
end )
|
||||
end
|
||||
|
||||
function wOS.DynaBase:OpenConfigMenu()
|
||||
|
||||
if self.OverFrame then
|
||||
self.OverFrame:Remove()
|
||||
self.OverFrame = nil
|
||||
gui.EnableScreenClicker( false )
|
||||
return
|
||||
end
|
||||
|
||||
self.OverFrame = vgui.Create( "DFrame" )
|
||||
self.OverFrame:SetSize( w, h )
|
||||
self.OverFrame:Center()
|
||||
self.OverFrame.Paint = function() end
|
||||
self.OverFrame:SetTitle( "" )
|
||||
self.OverFrame:ShowCloseButton( false )
|
||||
self.OverFrame:SetDraggable( false )
|
||||
|
||||
gui.EnableScreenClicker( true )
|
||||
self.AnimMenu = vgui.Create( "DFrame", self.OverFrame )
|
||||
self.AnimMenu:SetSize( w*0.4, h*0.5 )
|
||||
self.AnimMenu:Center()
|
||||
self.AnimMenu:MakePopup()
|
||||
self.AnimMenu:SetTitle( "wiltOS Dynamic Animation Manager" )
|
||||
self.AnimMenu:ShowCloseButton( true )
|
||||
self.AnimMenu:SetDraggable( true )
|
||||
self.AnimMenu.OnClose = function( pan )
|
||||
self:OpenConfigMenu()
|
||||
end
|
||||
|
||||
local aw, ah = self.AnimMenu:GetSize()
|
||||
|
||||
local sheet = vgui.Create( "DPropertySheet", self.AnimMenu )
|
||||
sheet:SetSize(aw*0.9, ah*0.8)
|
||||
sheet:SetPos(aw*0.05, ah*0.05)
|
||||
|
||||
////////////////////////////////////////////////////////////////// Server Menu
|
||||
local scroll = vgui.Create("DScrollPanel", sheet )
|
||||
scroll:SetSize(aw*0.9, ah*0.8)
|
||||
local sw, sh = scroll:GetSize()
|
||||
sheet:AddSheet( "Server Animations", scroll, "icon16/server.png" )
|
||||
|
||||
//placehold
|
||||
local layout2
|
||||
local layout = vgui.Create("DListLayout", scroll)
|
||||
layout:SetSize(sw, sh)
|
||||
layout:SetPaintBackground(true)
|
||||
layout:SetBackgroundColor(Color(100, 100, 100))
|
||||
|
||||
local temp_loaded = {}
|
||||
local temp_count = 0
|
||||
local drop_check = WOS_DYNABASE_ENFORCECONTENT_CVAR:GetInt() >= 2 and WOS_DYNABASE_LOADORDERENFORCE_CVAR:GetBool()
|
||||
if !drop_check then
|
||||
layout:MakeDroppable( "WOS_DYNABASE_DROPPABLE" )
|
||||
layout.OnModified = function( pan, opnl )
|
||||
local opos = pan.DroppedPan.OrderPos
|
||||
local npos = opos
|
||||
local children = pan:GetChildren()
|
||||
for id, child in ipairs( children ) do
|
||||
if child != pan.DroppedPan then continue end
|
||||
npos = id
|
||||
break
|
||||
end
|
||||
|
||||
if WOS_DYNABASE_LOADORDERENFORCE_CVAR:GetBool() and ( npos <= temp_count or opos <= temp_count ) then
|
||||
if IsValid( pan.DroppedPan.PreviousPanel ) and pan.DroppedPan.PreviousPanel != pan.DroppedPan then
|
||||
pan.DroppedPan:MoveToAfter( pan.DroppedPan.PreviousPanel )
|
||||
else
|
||||
pan.DroppedPan:MoveToBefore( pan.DroppedPan.ForwardPanel )
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
for id, child in ipairs( children ) do
|
||||
child.OrderPos = id
|
||||
child.PreviousPanel = children[id - 1]
|
||||
child.ForwardPanel = children[id + 1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local lw, lh = layout:GetSize()
|
||||
local fw, fh = lw, lh*0.2
|
||||
local iw, ih = fh*0.9, fh*0.9
|
||||
|
||||
local add_pad = lw*0.05
|
||||
|
||||
local order_checker = {}
|
||||
local disabled_list = {}
|
||||
if WOS_DYNABASE_LOADORDERENFORCE_CVAR:GetBool() and self.EnforceCount >= 1 and self.EnforcedOrder then
|
||||
for cnt, name in ipairs( self.EnforcedOrder ) do
|
||||
local data = self:GetSource( name )
|
||||
if not data then continue end
|
||||
temp_loaded[ name ] = true
|
||||
temp_count = temp_count + 1
|
||||
table.insert( order_checker, data )
|
||||
end
|
||||
end
|
||||
|
||||
if WOS_DYNABASE_ENFORCECONTENT_CVAR:GetInt() < 2 then
|
||||
|
||||
if self.PlayerOrder and self.PlayerCount > 1 then
|
||||
for _, dt in ipairs( self.PlayerOrder ) do
|
||||
local name = dt.Name
|
||||
local data = self:GetSource( name )
|
||||
if not data then continue end
|
||||
disabled_list[ name ] = dt.Toggled
|
||||
if temp_loaded[ name ] then continue end
|
||||
temp_loaded[ name ] = true
|
||||
table.insert( order_checker, data )
|
||||
end
|
||||
end
|
||||
|
||||
for name, data in pairs( self:GetAllSources() ) do
|
||||
if temp_loaded[ name ] then continue end
|
||||
table.insert( order_checker, data )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for order, data in ipairs( order_checker ) do
|
||||
if WOS_DYNABASE_ENFORCECONTENT_CVAR:GetInt() >= 1 and not data.ServerValid then continue end
|
||||
local name = data.Name
|
||||
local frame = vgui.Create( "DPanel", layout )
|
||||
local prev_child = layout:GetChild( order - 2 )
|
||||
if prev_child then
|
||||
frame.PreviousPanel = prev_child
|
||||
prev_child.ForwardPanel = frame
|
||||
end
|
||||
frame:SetSize( fw, fh )
|
||||
frame.Icon = data.IconOverwrite
|
||||
frame.RegisterName = name
|
||||
frame.PreventSort = order <= temp_count
|
||||
frame.OrderPos = order
|
||||
frame.Toggled = true
|
||||
if disabled_list[ name ] != nil then
|
||||
frame.Toggled = disabled_list[ name ]
|
||||
end
|
||||
|
||||
frame.OnDrop = function( pan )
|
||||
layout.DroppedPan = pan
|
||||
return pan
|
||||
end
|
||||
frame.Paint = function( pan, ww, hh )
|
||||
draw.RoundedBox( 0, 0, 0, ww, hh, Color( 0, 0, 0, 155 ) )
|
||||
draw.RoundedBox( 0, ww*0.005, 0, add_pad, hh, Color( 0, 0, 0, 200 ) )
|
||||
|
||||
surface.SetDrawColor( Color( 255, 255, 255, 100 ) )
|
||||
surface.DrawOutlinedRect( 0, 0, ww, hh )
|
||||
|
||||
|
||||
if !drop_check and not pan.PreventSort then
|
||||
surface.SetDrawColor( color_white )
|
||||
for i=0, 1 do
|
||||
surface.DrawRect( ww*0.005 + add_pad*0.2 + i*(add_pad*0.4), hh*0.32, add_pad*0.2, add_pad*0.2 )
|
||||
end
|
||||
|
||||
for i=0, 1 do
|
||||
surface.DrawRect( ww*0.005 + add_pad*0.2 + i*(add_pad*0.4), hh*0.5, add_pad*0.2, add_pad*0.2 )
|
||||
end
|
||||
|
||||
for i=0, 1 do
|
||||
surface.DrawRect( ww*0.005 + add_pad*0.2 + i*(add_pad*0.4), hh*0.68, add_pad*0.2, add_pad*0.2 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local tx, th = draw.SimpleText( pan.RegisterName, "wOS.DynaBase.TitleFont", hh*0.1 + add_pad + iw + ww*0.01, hh*0.06, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||
tx, th = draw.SimpleText( pan.AddonTitle or "Local File", "wOS.DynaBase.DescFont", hh*0.1 + add_pad + iw + ww*0.01, hh*0.06 + th + hh*0.03, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||
|
||||
|
||||
surface.SetDrawColor( color_white )
|
||||
if not pan.Icon then
|
||||
surface.DrawOutlinedRect( hh*0.05 + add_pad , hh*0.05, iw, ih )
|
||||
draw.SimpleText( "?", "wOS.DynaBase.QuestionFont", hh*0.05 + iw*0.5 + add_pad, hh*0.05 + ih*0.5, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
else
|
||||
surface.SetMaterial( pan.Icon )
|
||||
surface.DrawTexturedRect( hh*0.05 + add_pad, hh*0.05, iw, ih )
|
||||
end
|
||||
if pan.Toggled then return end
|
||||
draw.RoundedBox( 0, hh*0.05 + add_pad, hh*0.05, iw, ih, Color( 0, 0, 0, 215 ) )
|
||||
|
||||
end
|
||||
|
||||
local url = vgui.Create( "DButton", frame )
|
||||
url:SetPos(fh*0.1 + fw*0.01 + iw + add_pad, fh - fh*0.15)
|
||||
url:SetSize(fw*0.43, fh*0.125)
|
||||
url:SetColor( color_white )
|
||||
url:SetFont( "wOS.DynaBase.URLFont" )
|
||||
url:SetText( "" )
|
||||
url.Paint = function( pan, ww, hh )
|
||||
local txt = pan.URL or "No Workshop URL"
|
||||
draw.SimpleText( txt, "wOS.DynaBase.URLFont", 0, hh*0.5, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
url:SetDisabled( true )
|
||||
url.DoClick = function( pan )
|
||||
if not pan.URL then return end
|
||||
gui.OpenURL( pan.URL )
|
||||
end
|
||||
|
||||
local icon = vgui.Create("DImageButton", frame)
|
||||
icon:SetPos(lw*0.01 + add_pad, lw*0.01)
|
||||
icon:SetSize(iw, ih)
|
||||
|
||||
local ix, iy = icon:GetPos()
|
||||
|
||||
local validated = vgui.Create("DImage", icon)
|
||||
validated:SetPos( -8, -8 )
|
||||
validated:SetSize( 16, 16 )
|
||||
validated:NoClipping( true )
|
||||
validated.UpdateCast = function( pan )
|
||||
if !frame.Toggled then
|
||||
pan:SetImage( "icon16/delete.png" )
|
||||
icon:SetTooltip( "This item is currently disabled" )
|
||||
else
|
||||
if data.ServerValid then
|
||||
pan:SetImage( "icon16/accept.png" )
|
||||
icon:SetTooltip( "This item is registered by the server and client" )
|
||||
else
|
||||
pan:SetImage( "icon16/error.png" )
|
||||
icon:SetTooltip( "This item is only registered by the client and may cause unpredictable issues" )
|
||||
end
|
||||
end
|
||||
end
|
||||
validated:UpdateCast()
|
||||
|
||||
local dock_bar = vgui.Create( "DPanel", frame )
|
||||
dock_bar:SetPos(fh*0.1 + fw*0.01 + iw + add_pad , fh - fh*0.42)
|
||||
dock_bar:SetSize(fw*0.7, fh*0.2)
|
||||
dock_bar:SetPaintBackground( false )
|
||||
|
||||
local thetype = vgui.Create("DImageButton", dock_bar)
|
||||
thetype:SetTall( fh*0.2 )
|
||||
thetype:SetWide( fh*0.2 )
|
||||
thetype:Dock( LEFT )
|
||||
|
||||
if data.Type == WOS_DYNABASE.REANIMATION then
|
||||
thetype:SetImage( reanim_mat )
|
||||
thetype:SetTooltip( "This addon replaces existing animations" )
|
||||
else
|
||||
thetype:SetImage( extend_mat )
|
||||
thetype:SetTooltip( "This addon includes new animations" )
|
||||
end
|
||||
|
||||
local div = vgui.Create("DPanel", dock_bar)
|
||||
div:SetWide( fh*0.22 )
|
||||
div:Dock( LEFT )
|
||||
div.Paint = function( pan, ww, hh )
|
||||
surface.SetDrawColor( color_white )
|
||||
surface.DrawRect( ww*0.45, 0, ww*0.1, hh )
|
||||
end
|
||||
|
||||
local shared = vgui.Create("DImageButton", dock_bar)
|
||||
shared:SetTall( fh*0.2 )
|
||||
shared:SetWide( fh*0.2 )
|
||||
shared:SetImage( shared_mat )
|
||||
shared:Dock( LEFT )
|
||||
if data.Shared then
|
||||
shared:SetTooltip( "Common / All Gender Animations" )
|
||||
else
|
||||
shared:SetColor(Color(135, 135, 135, 255))
|
||||
end
|
||||
|
||||
local maled = vgui.Create("DImageButton", dock_bar)
|
||||
maled:SetTall( fh*0.2 )
|
||||
maled:SetWide( fh*0.2 )
|
||||
maled:Dock( LEFT )
|
||||
maled:SetImage( male_mat )
|
||||
if data.Male then
|
||||
maled:SetTooltip( "Male Animations" )
|
||||
else
|
||||
maled:SetColor(Color(125, 125, 125, 125))
|
||||
end
|
||||
|
||||
local femaled = vgui.Create("DImageButton", dock_bar)
|
||||
femaled:SetTall( fh*0.2 )
|
||||
femaled:SetWide( fh*0.2 )
|
||||
femaled:Dock( LEFT )
|
||||
femaled:SetImage( female_mat )
|
||||
if data.Female then
|
||||
femaled:SetTooltip( "Female Animations" )
|
||||
else
|
||||
femaled:SetColor(Color(125, 125, 125, 125))
|
||||
end
|
||||
|
||||
local zombied = vgui.Create("DImageButton", dock_bar)
|
||||
zombied:SetTall( fh*0.2 )
|
||||
zombied:SetWide( fh*0.2 )
|
||||
zombied:Dock( LEFT )
|
||||
zombied:SetImage( zombie_mat )
|
||||
if data.Zombie then
|
||||
zombied:SetTooltip( "Zombie Animations" )
|
||||
else
|
||||
zombied:SetColor(Color(125, 125, 125, 125))
|
||||
end
|
||||
|
||||
local mdl = data.Shared
|
||||
if not mdl then mdl = data.Male end
|
||||
if not mdl then mdl = data.Female end
|
||||
if not mdl then mdl = data.Zombie end
|
||||
|
||||
if mdl then
|
||||
local function UpdateContent( ndat, mat )
|
||||
if ndat and ndat.id then
|
||||
frame.AddonTitle = ndat.title
|
||||
frame.Description = ndat.description
|
||||
frame.ID = ndat.id
|
||||
|
||||
url.URL = "https://steamcommunity.com/sharedfiles/filedetails/?id=" .. ndat.id
|
||||
url:SetDisabled( false )
|
||||
end
|
||||
frame.Icon = mat
|
||||
end
|
||||
local addon = GetContainingAddon( mdl )
|
||||
GetWorkshopInfo( addon, UpdateContent )
|
||||
end
|
||||
|
||||
|
||||
local check1 = data.Type == WOS_DYNABASE.REANIMATION and WOS_DYNABASE_ENFORCEREANIMATE_CVAR:GetBool()
|
||||
local check2 = data.Type == WOS_DYNABASE.EXTENSION and WOS_DYNABASE_ENFORCEEXTENDERS_CVAR:GetBool()
|
||||
if !check1 and !check2 then
|
||||
local div2 = vgui.Create("DPanel", dock_bar)
|
||||
div2:SetWide( fh*0.22 )
|
||||
div2:Dock( LEFT )
|
||||
div2.Paint = function( pan, ww, hh )
|
||||
surface.SetDrawColor( color_white )
|
||||
surface.DrawRect( ww*0.45, 0, ww*0.1, hh )
|
||||
end
|
||||
|
||||
local toggle = vgui.Create("DButton", dock_bar)
|
||||
toggle:SetTall( fh*0.2 )
|
||||
if frame.Toggled then
|
||||
toggle:SetText( "Unmount Addon" )
|
||||
else
|
||||
toggle:SetText( "Mount Addon" )
|
||||
end
|
||||
toggle:SetWide( fw*0.15 )
|
||||
toggle:Dock( LEFT )
|
||||
toggle.DoClick = function( pan )
|
||||
frame.Toggled = !frame.Toggled
|
||||
if frame.Toggled then
|
||||
pan:SetText( "Unmount Addon" )
|
||||
else
|
||||
pan:SetText( "Mount Addon" )
|
||||
end
|
||||
validated:UpdateCast()
|
||||
end
|
||||
end
|
||||
|
||||
layout:Add( frame )
|
||||
end
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////// Local Menu
|
||||
|
||||
-- if WOS_DYNABASE_ENFORCECONTENT_CVAR:GetInt() > 0 then
|
||||
-- local err = vgui.Create( "DPanel", sheet )
|
||||
-- err:Dock( FILL )
|
||||
-- err.Paint = function( pan, ww, hh )
|
||||
-- draw.SimpleText( "SERVER HAS DISABLED LOCAL ANIMATION CONTENT", "wOS.DynaBase.TitleFont", ww/2, hh*0.4, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
-- draw.SimpleText( "USE THE SERVER TAB FOR AVAILABILITY", "wOS.DynaBase.TitleFont", ww/2, hh*0.6, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
-- end
|
||||
-- sheet:AddSheet( "User Animations", err, "icon16/user.png" )
|
||||
-- else
|
||||
|
||||
local core = vgui.Create( "DPanel", sheet )
|
||||
core:SetSize(aw*0.9, ah*0.8)
|
||||
sheet:AddSheet( "User Animations", core, "icon16/user.png" )
|
||||
|
||||
local create_butt = vgui.Create( "DButton", core )
|
||||
create_butt:SetSize( aw*0.9, ah*0.05 )
|
||||
create_butt:Dock( TOP )
|
||||
create_butt:SetText( "Create User Mount" )
|
||||
|
||||
local scroll2 = vgui.Create("DScrollPanel", core )
|
||||
scroll2:SetSize(aw*0.9, ah*0.69)
|
||||
scroll2:Dock( TOP )
|
||||
|
||||
local function PopulateEntries()
|
||||
if layout2 then layout2:Remove() end
|
||||
|
||||
local sw, sh = aw*0.9, ah*0.73
|
||||
layout2 = vgui.Create("DListLayout", scroll2)
|
||||
layout2:SetSize(sw, sh)
|
||||
layout2:SetPaintBackground(true)
|
||||
layout2:SetBackgroundColor(Color(100, 100, 100))
|
||||
layout2:MakeDroppable( "WOS_DYNABASE_DROPPABLE_LOCAL" )
|
||||
|
||||
local local_temp_loaded = {}
|
||||
local lw, lh = layout2:GetSize()
|
||||
local fw, fh = lw, lh*0.13
|
||||
local iw, ih = 0, 0
|
||||
|
||||
local add_pad = lw*0.05
|
||||
|
||||
local local_order_checker = {}
|
||||
|
||||
local read = file.Read( "wos/dynabase/usermounts/preference.txt", "DATA" ) or "{}"
|
||||
local local_order = util.JSONToTable( read )
|
||||
local enabled_check = {}
|
||||
|
||||
if table.Count( local_order ) > 0 then
|
||||
for id, dd in ipairs( local_order ) do
|
||||
local name = dd.Name
|
||||
local data = self:GetUserMount( name )
|
||||
if not data then continue end
|
||||
local_temp_loaded[ name ] = true
|
||||
table.insert( local_order_checker, data )
|
||||
if dd.Toggled then enabled_check[ name ] = true end
|
||||
end
|
||||
end
|
||||
|
||||
for name, data in pairs( self:GetAllUserMounts() ) do
|
||||
if local_temp_loaded[ name ] then continue end
|
||||
table.insert( local_order_checker, data )
|
||||
end
|
||||
|
||||
for order, data in ipairs( local_order_checker ) do
|
||||
local name = data.Name
|
||||
local frame = vgui.Create( "DPanel", layout2 )
|
||||
frame:SetSize( fw, fh )
|
||||
frame.RegisterName = name
|
||||
frame.Toggled = enabled_check[ name ]
|
||||
frame.Paint = function( pan, ww, hh )
|
||||
draw.RoundedBox( 0, 0, 0, ww, hh, Color( 0, 0, 0, 155 ) )
|
||||
draw.RoundedBox( 0, ww*0.005, 0, add_pad, hh, Color( 0, 0, 0, 200 ) )
|
||||
|
||||
surface.SetDrawColor( Color( 255, 255, 255, 100 ) )
|
||||
surface.DrawOutlinedRect( 0, 0, ww, hh )
|
||||
|
||||
surface.SetDrawColor( color_white )
|
||||
for i=0, 1 do
|
||||
surface.DrawRect( ww*0.005 + add_pad*0.2 + i*(add_pad*0.4), hh*0.32, add_pad*0.2, add_pad*0.2 )
|
||||
end
|
||||
|
||||
for i=0, 1 do
|
||||
surface.DrawRect( ww*0.005 + add_pad*0.2 + i*(add_pad*0.4), hh*0.5, add_pad*0.2, add_pad*0.2 )
|
||||
end
|
||||
|
||||
for i=0, 1 do
|
||||
surface.DrawRect( ww*0.005 + add_pad*0.2 + i*(add_pad*0.4), hh*0.68, add_pad*0.2, add_pad*0.2 )
|
||||
end
|
||||
|
||||
local tx, th = draw.SimpleText( pan.RegisterName, "wOS.DynaBase.TitleFont", hh*0.1 + add_pad + iw + ww*0.01, hh*0.06, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP )
|
||||
end
|
||||
|
||||
local dock_bar = vgui.Create( "DPanel", frame )
|
||||
dock_bar:SetPos(fh*0.1 + fw*0.01 + iw + add_pad , fh - fh*0.42)
|
||||
dock_bar:SetSize(fw*0.7, fh*0.35)
|
||||
dock_bar:SetPaintBackground( false )
|
||||
|
||||
local validated = vgui.Create("DImageButton", dock_bar )
|
||||
validated:SetTall( fh*0.35 )
|
||||
validated:SetWide( fh*0.35 )
|
||||
validated:Dock( LEFT )
|
||||
validated.UpdateCast = function( pan )
|
||||
if !frame.Toggled then
|
||||
pan:SetImage( "icon16/delete.png" )
|
||||
pan:SetTooltip( "This item is currently disabled" )
|
||||
else
|
||||
pan:SetImage( "icon16/accept.png" )
|
||||
pan:SetTooltip( "This item is currently enabled" )
|
||||
pan:CheckModelValidity()
|
||||
end
|
||||
end
|
||||
validated.CheckModelValidity = function( pan )
|
||||
for _, mdl in ipairs( pan.Models ) do
|
||||
if file.Exists( mdl, "GAME" ) then continue end
|
||||
pan:SetImage( "icon16/error.png" )
|
||||
pan:SetTooltip( "This item is missing models" )
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local div = vgui.Create("DPanel", dock_bar)
|
||||
div:SetWide( fh*0.22 )
|
||||
div:Dock( LEFT )
|
||||
div.Paint = function( pan, ww, hh )
|
||||
surface.SetDrawColor( color_white )
|
||||
surface.DrawRect( ww*0.45, 0, ww*0.1, hh )
|
||||
end
|
||||
|
||||
local mdls = {}
|
||||
|
||||
local shared = vgui.Create("DImageButton", dock_bar)
|
||||
shared:SetTall( fh*0.35 )
|
||||
shared:SetWide( fh*0.35 )
|
||||
shared:SetImage( shared_mat )
|
||||
shared:Dock( LEFT )
|
||||
if data.Shared then
|
||||
table.insert( mdls, data.Shared )
|
||||
shared:SetTooltip( "Common / All Gender Animations" )
|
||||
else
|
||||
shared:SetColor(Color(135, 135, 135, 255))
|
||||
end
|
||||
|
||||
local maled = vgui.Create("DImageButton", dock_bar)
|
||||
maled:SetTall( fh*0.35 )
|
||||
maled:SetWide( fh*0.35 )
|
||||
maled:Dock( LEFT )
|
||||
maled:SetImage( male_mat )
|
||||
if data.Male then
|
||||
table.insert( mdls, data.Male )
|
||||
maled:SetTooltip( "Male Animations" )
|
||||
else
|
||||
maled:SetColor(Color(125, 125, 125, 125))
|
||||
end
|
||||
|
||||
local femaled = vgui.Create("DImageButton", dock_bar)
|
||||
femaled:SetTall( fh*0.35 )
|
||||
femaled:SetWide( fh*0.35 )
|
||||
femaled:Dock( LEFT )
|
||||
femaled:SetImage( female_mat )
|
||||
if data.Female then
|
||||
table.insert( mdls, data.Female )
|
||||
femaled:SetTooltip( "Female Animations" )
|
||||
else
|
||||
femaled:SetColor(Color(125, 125, 125, 125))
|
||||
end
|
||||
|
||||
local zombied = vgui.Create("DImageButton", dock_bar)
|
||||
zombied:SetTall( fh*0.35 )
|
||||
zombied:SetWide( fh*0.35 )
|
||||
zombied:Dock( LEFT )
|
||||
zombied:SetImage( zombie_mat )
|
||||
if data.Zombie then
|
||||
table.insert( mdls, data.Zombie )
|
||||
zombied:SetTooltip( "Zombie Animations" )
|
||||
else
|
||||
zombied:SetColor(Color(125, 125, 125, 125))
|
||||
end
|
||||
|
||||
validated.Models = mdls
|
||||
validated:UpdateCast()
|
||||
|
||||
local div2 = vgui.Create("DPanel", dock_bar)
|
||||
div2:SetWide( fh*0.22 )
|
||||
div2:Dock( LEFT )
|
||||
div2.Paint = function( pan, ww, hh )
|
||||
surface.SetDrawColor( color_white )
|
||||
surface.DrawRect( ww*0.45, 0, ww*0.1, hh )
|
||||
end
|
||||
|
||||
local toggle = vgui.Create("DButton", dock_bar)
|
||||
toggle:SetTall( fh*0.2 )
|
||||
if frame.Toggled then
|
||||
toggle:SetText( "Unmount" )
|
||||
else
|
||||
toggle:SetText( "Mount" )
|
||||
end
|
||||
toggle:SetWide( fw*0.1 )
|
||||
toggle:Dock( LEFT )
|
||||
toggle.DoClick = function( pan )
|
||||
frame.Toggled = !frame.Toggled
|
||||
if frame.Toggled then
|
||||
pan:SetText( "Unmount" )
|
||||
else
|
||||
pan:SetText( "Mount" )
|
||||
end
|
||||
validated:UpdateCast()
|
||||
end
|
||||
|
||||
local div3 = vgui.Create("DPanel", dock_bar)
|
||||
div3:SetWide( fh*0.22 )
|
||||
div3:Dock( LEFT )
|
||||
div3.Paint = function( pan, ww, hh )
|
||||
surface.SetDrawColor( color_white )
|
||||
surface.DrawRect( ww*0.45, 0, ww*0.1, hh )
|
||||
end
|
||||
|
||||
local edit = vgui.Create("DButton", dock_bar)
|
||||
edit:SetTall( fh*0.2 )
|
||||
edit:SetWide( fw*0.1 )
|
||||
edit:Dock( LEFT )
|
||||
edit:SetText( "Edit" )
|
||||
edit.DoClick = function( pan )
|
||||
if IsValid( pan.OverFrame ) then pan.OverFrame:Remove() pan.OverFrame = nil end
|
||||
pan.OverFrame = vgui.Create( "DPanel" )
|
||||
pan.OverFrame:SetPaintBackground( true )
|
||||
pan.OverFrame:SetBackgroundColor( Color( 0, 0, 0, 185 ) )
|
||||
pan.OverFrame:SetSize( w, h )
|
||||
pan.OverFrame:MakePopup()
|
||||
pan.OverFrame.RefreshList = function()
|
||||
PopulateEntries()
|
||||
end
|
||||
|
||||
self:CreateLocalMenu( pan.OverFrame, data )
|
||||
end
|
||||
|
||||
local div4 = vgui.Create("DPanel", dock_bar)
|
||||
div4:SetWide( fh*0.22 )
|
||||
div4:Dock( LEFT )
|
||||
div4.Paint = function( pan, ww, hh )
|
||||
surface.SetDrawColor( color_white )
|
||||
surface.DrawRect( ww*0.45, 0, ww*0.1, hh )
|
||||
end
|
||||
|
||||
local delete = vgui.Create("DButton", dock_bar)
|
||||
delete:SetTall( fh*0.2 )
|
||||
delete:SetWide( fw*0.1 )
|
||||
delete:Dock( LEFT )
|
||||
delete:SetText( "Delete" )
|
||||
delete.DoClick = function( pan )
|
||||
self:DeleteUserMount( name )
|
||||
PopulateEntries()
|
||||
end
|
||||
|
||||
layout2:Add( frame )
|
||||
end
|
||||
end
|
||||
|
||||
create_butt.DoClick = function(pan)
|
||||
if IsValid( pan.OverFrame ) then pan.OverFrame:Remove() pan.OverFrame = nil end
|
||||
pan.OverFrame = vgui.Create( "DPanel" )
|
||||
pan.OverFrame:SetPaintBackground( true )
|
||||
pan.OverFrame:SetBackgroundColor( Color( 0, 0, 0, 185 ) )
|
||||
pan.OverFrame:SetSize( w, h )
|
||||
pan.OverFrame:MakePopup()
|
||||
pan.OverFrame.RefreshList = function()
|
||||
PopulateEntries()
|
||||
end
|
||||
|
||||
self:CreateLocalMenu( pan.OverFrame )
|
||||
end
|
||||
|
||||
PopulateEntries()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////// Helper Menu
|
||||
local scroll = vgui.Create("DScrollPanel", sheet )
|
||||
scroll:SetSize(aw*0.9, ah*0.8)
|
||||
scroll.ReloadAddons = function() PopulateEntries() end
|
||||
local sw, sh = scroll:GetSize()
|
||||
sheet:AddSheet( "Helper Functions", scroll, "icon16/heart.png" )
|
||||
|
||||
local download_butt = vgui.Create( "DButton", scroll )
|
||||
download_butt:SetSize( aw*0.9, ah*0.05 )
|
||||
download_butt:Dock( TOP )
|
||||
download_butt:SetText( "Convert Server to User Mounts (Will overwrite mounts with the same name!)" )
|
||||
download_butt.DoClick = function(pan)
|
||||
for name, data in pairs( self:GetAllSources() ) do
|
||||
if data.Core then continue end
|
||||
if data.PreventActivities then continue end
|
||||
self:CreateUserMount( data )
|
||||
end
|
||||
PopulateEntries()
|
||||
chat.AddText( color_white, "[", Color( 0, 175, 255 ), "wOS-DynaBase", color_white, "] All registered server mounts have been added to your user mount list!" )
|
||||
end
|
||||
hook.Call( "wOS.DynaBase.PopulateHelperFunctions", nil, scroll )
|
||||
|
||||
|
||||
local savebutt = vgui.Create("DButton", self.AnimMenu )
|
||||
savebutt:SetSize(aw*0.9, ah*0.04)
|
||||
savebutt:SetPos( aw*0.05, ah*0.86 )
|
||||
savebutt:SetText( "Save Animation Settings" )
|
||||
sheet.OnActiveTabChanged = function( pan, old, new )
|
||||
local txt = new:GetText()
|
||||
if txt:find( "User" ) then
|
||||
savebutt:SetText( "Save User Settings" )
|
||||
savebutt:Show()
|
||||
elseif txt:find( "Server" ) then
|
||||
savebutt:SetText( "Save Server Settings" )
|
||||
savebutt:Show()
|
||||
else
|
||||
savebutt:Hide()
|
||||
end
|
||||
end
|
||||
savebutt.DoClick = function( pan )
|
||||
if sheet:GetActiveTab():GetText():find( "User" ) then
|
||||
if not layout2 then return end
|
||||
local order = {}
|
||||
for _, child in ipairs( layout2:GetChildren() ) do
|
||||
table.insert( order, { Name = child.RegisterName, Toggled = child.Toggled } )
|
||||
end
|
||||
local pref = util.TableToJSON( order )
|
||||
file.Write( "wos/dynabase/usermounts/preference.txt", pref )
|
||||
self:ReloadLocalAnimations( order )
|
||||
else
|
||||
self.PlayerOrder = {}
|
||||
self.PlayerCount = 0
|
||||
for _, child in ipairs( layout:GetChildren() ) do
|
||||
table.insert( self.PlayerOrder, { Name = child.RegisterName, Toggled = child.Toggled } )
|
||||
self.PlayerCount = self.PlayerCount + 1
|
||||
end
|
||||
self:ProcessPlayerOrder()
|
||||
end
|
||||
self:ReloadAnimations()
|
||||
end
|
||||
|
||||
local nobutt = vgui.Create("DButton", self.AnimMenu )
|
||||
nobutt:SetSize(aw*0.9, ah*0.04)
|
||||
nobutt:SetPos( aw*0.05, ah*0.91 )
|
||||
nobutt:SetText( "Cancel" )
|
||||
nobutt.DoClick = function() self:OpenConfigMenu() end
|
||||
//toggle:SetText( "Cancel" )
|
||||
end
|
||||
87
garrysmod/addons/wos/lua/wos/dynabase/core/cl_core.lua
Normal file
87
garrysmod/addons/wos/lua/wos/dynabase/core/cl_core.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
wOS.DynaBase.UserMounts = {}
|
||||
|
||||
hook.Add( "RenderScene", "wOS.DynaBase.PreventDataAccess", function()
|
||||
if wOS.DynaBase.ResumeRendering and wOS.DynaBase.ResumeRendering >= CurTime() then return true end
|
||||
if not wOS.DynaBase.ReloadModelBool then return end
|
||||
wOS.DynaBase.DataCachePass = wOS.DynaBase.DataCachePass + 1
|
||||
return true
|
||||
end )
|
||||
|
||||
hook.Add( "PostRender", "wOS.DynaBase.PreventDataAccess", function()
|
||||
if not wOS.DynaBase.ReloadModelBool then return end
|
||||
wOS.DynaBase.ReloadModelBool = false
|
||||
local val = wOS.DynaBase.DataCachePass
|
||||
wOS.DynaBase.DataCachePass = 0
|
||||
if not val or val < WOS_DYNABASE.MAXCACHE then
|
||||
chat.AddText( Color( 255, 0, 0 ), "[wOS-Dynabase] Can not apply animation selection due to conflicting addons. Please let us know on the Workshop Page or Discord!" )
|
||||
return
|
||||
end
|
||||
RunConsoleCommand( "r_flushlod" )
|
||||
hook.Call( "PostLoadAnimations" )
|
||||
wOS.DynaBase.ResumeRendering = CurTime() + 0.3
|
||||
if not wOS.DynaBase.FIRST_TIME_LOADED then wOS.DynaBase.FIRST_TIME_LOADED = true return end
|
||||
chat.AddText( Color( 0, 255, 0 ), "[wOS-Dynabase] Successfully applied animation selection to models!" )
|
||||
end )
|
||||
|
||||
concommand.Add( "wos_dynabase_reloadmodels", function()
|
||||
wOS.DynaBase.LIVE_RELOAD = true
|
||||
wOS.DynaBase:ReloadAnimations()
|
||||
wOS.DynaBase.LIVE_RELOAD = false
|
||||
end )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Credits to Starlight (Oliver) for the code snippet and also giving it to me every time
|
||||
// I asked, for the last 3 years
|
||||
local function FindPotentialBases()
|
||||
|
||||
for _ ,addon in pairs( engine.GetAddons() ) do
|
||||
local modelFound = file.Find("models/m_anm.mdl", addon.title)
|
||||
if #modelFound != 0 then
|
||||
MsgC( Color( 255, 0, 255 ), "\n\tAddon: " .. addon.title .. "\n" )
|
||||
MsgC( Color( 255, 0, 255 ), "\tLink: https://steamcommunity.com/sharedfiles/filedetails/?id=" .. addon.wsid .. "\n" )
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
concommand.Add( "wos_dynabase_help", function( ply, cmd, args )
|
||||
MsgC( Color( 255, 255, 255 ), "------------------ ", Color( 133, 173, 219 ), "wiltOS HELP PRINT", Color( 255, 255, 255 ), " ----------------------\n" )
|
||||
MsgC( Color( 255, 255, 255 ), "Installed Animation Base\n" )
|
||||
timer.Simple( 0.01, function()
|
||||
local found = FindPotentialBases()
|
||||
if not found then
|
||||
MsgC( Color( 255, 0, 255 ), "\n\tNo Animation Bases found! You must get the Dynamic Animation Manager\n" )
|
||||
MsgC( Color( 255, 0, 255 ), "\tWorkshop Link: https://steamcommunity.com/sharedfiles/filedetails/?id=2916561591\n" )
|
||||
end
|
||||
MsgC( color_white, "\nPlease ensure that the only addon above is ", Color( 0, 255, 0 ), "'[wOS] DynaBase - The Dynamic Animation Manager'\n")
|
||||
MsgC( color_white, "If there are more addons, unsubscribe from them and install the Dynamic Animation Manager.\n")
|
||||
print("\n")
|
||||
|
||||
local seq = LocalPlayer():LookupSequence( "_dynamic_wiltos_enabled_" )
|
||||
local resp = ( seq >= 0 and Color( 0, 255, 0 ) ) or Color( 255, 0, 0 )
|
||||
MsgC( color_white, "Sequence Check: ", resp, "\t", seq, "\n" )
|
||||
MsgC( color_white, "If the above sequence check is ", Color( 255, 0, 0 ), -1, color_white, " and the addon above points to the correct location,\nensure your model is a ", Color( 0, 255, 0 ), "PLAYER MODEL", color_white, " and not an ", Color( 255, 0, 0 ), "NPC MODEL\n" )
|
||||
MsgC( color_white, "Run this commmand again as a default GMod player model. If it still prints ", Color( 255, 0, 0 ), -1, color_white, " your Animation Base may be outdated\n" )
|
||||
|
||||
print( "\n" )
|
||||
MsgC( color_white, "Make can find the Dynamic Animation Manager workshop page here: https://steamcommunity.com/sharedfiles/filedetails/?id=2916561591\n")
|
||||
MsgC( Color( 255, 255, 255 ), "-----------------------------------------------------------\n" )
|
||||
end )
|
||||
end )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
concommand.Add( "wos_dynabase_openconfig", function( ply, cmd, args )
|
||||
wOS.DynaBase:OpenConfigMenu()
|
||||
end )
|
||||
|
||||
list.Add( "DesktopWindows", {
|
||||
icon = "wos/dynabase/widget.png",
|
||||
title = "DynaBase Menu",
|
||||
init = function() wOS.DynaBase:OpenConfigMenu() end,
|
||||
})
|
||||
239
garrysmod/addons/wos/lua/wos/dynabase/core/cl_local_copy.lua
Normal file
239
garrysmod/addons/wos/lua/wos/dynabase/core/cl_local_copy.lua
Normal file
@@ -0,0 +1,239 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
|
||||
function wOS.DynaBase:CreateUserMount( data )
|
||||
if not data then return end
|
||||
if not data.Name then return end
|
||||
self.UserMounts[ data.Name ] = data
|
||||
|
||||
local mounts = file.Read( "wos/dynabase/usermounts/mounts.txt", "DATA" ) or "{}"
|
||||
local local_mounts = util.JSONToTable( mounts )
|
||||
|
||||
local_mounts[ data.Name ] = data
|
||||
local_mounts = util.TableToJSON( local_mounts )
|
||||
file.Write( "wos/dynabase/usermounts/mounts.txt", local_mounts )
|
||||
end
|
||||
|
||||
function wOS.DynaBase:DeleteUserMount( name )
|
||||
if not name then return end
|
||||
if not self.UserMounts[ name ] then return end
|
||||
self.UserMounts[ name ] = nil
|
||||
|
||||
local mounts = file.Read( "wos/dynabase/usermounts/mounts.txt", "DATA" ) or "{}"
|
||||
local local_mounts = util.JSONToTable( mounts )
|
||||
local_mounts[ name ] = nil
|
||||
|
||||
local_mounts = util.TableToJSON( local_mounts )
|
||||
file.Write( "wos/dynabase/usermounts/mounts.txt", local_mounts )
|
||||
end
|
||||
|
||||
function wOS.DynaBase:GetAllUserMounts()
|
||||
return self.UserMounts
|
||||
end
|
||||
|
||||
function wOS.DynaBase:GetUserMount( name )
|
||||
return self.UserMounts[ name ]
|
||||
end
|
||||
|
||||
function wOS.DynaBase:CreateLocalMenu( parent, old_data )
|
||||
old_data = old_data or {}
|
||||
local w, h = parent:GetSize()
|
||||
|
||||
local frame = vgui.Create( "DFrame", parent )
|
||||
frame:SetSize( w*0.5, h*0.4 )
|
||||
frame:Center()
|
||||
frame:MakePopup()
|
||||
frame:SetTitle( "Create User Mount" )
|
||||
frame.OnClose = function()
|
||||
parent:Remove()
|
||||
end
|
||||
frame.OldThink = frame.Think
|
||||
frame.Think = function( pan )
|
||||
pan:OldThink()
|
||||
if parent:HasFocus() then pan:MoveToFront() end
|
||||
if not self.AnimMenu then parent:Remove() end
|
||||
end
|
||||
|
||||
local fw, fh = frame:GetSize()
|
||||
|
||||
local addon_list = vgui.Create( "DListView", frame )
|
||||
addon_list:SetWide( fw*0.3 )
|
||||
addon_list:Dock( LEFT )
|
||||
addon_list:SetMultiSelect( false )
|
||||
addon_list:AddColumn( "Addon Name" )
|
||||
|
||||
local row = addon_list:AddLine( "Base Game" )
|
||||
row.title = "GAME"
|
||||
|
||||
for _, addon in ipairs( engine.GetAddons() ) do
|
||||
if not addon.downloaded then continue end
|
||||
if not addon.mounted then continue end
|
||||
local row = addon_list:AddLine( addon.title )
|
||||
end
|
||||
|
||||
local browser = vgui.Create( "DFileBrowser", frame )
|
||||
browser:SetTall( fh )
|
||||
browser:SetWide( fw*0.4 )
|
||||
browser:Dock( LEFT )
|
||||
browser:SetPath( "GAME" )
|
||||
browser:SetBaseFolder( "models" )
|
||||
browser:SetFileTypes( "*.mdl" )
|
||||
browser:SetOpen( true )
|
||||
|
||||
addon_list.OnRowSelected = function( pan, i, row )
|
||||
browser:SetPath( row.title or row:GetColumnText(1) )
|
||||
browser:SetBaseFolder( "models" )
|
||||
browser:SetOpen( true )
|
||||
end
|
||||
|
||||
local div = vgui.Create( "DPanel", frame )
|
||||
div:SetBackgroundColor( Color( 0, 0, 0 ) )
|
||||
div:SetWide( fw*0.01 )
|
||||
div:Dock( LEFT )
|
||||
|
||||
local creation_frame = vgui.Create( "DPanel", frame )
|
||||
creation_frame:SetWide( fw*0.29 )
|
||||
creation_frame:SetBackgroundColor( Color( 130, 130, 130 ) )
|
||||
creation_frame:Dock( LEFT )
|
||||
creation_frame:DockPadding( fw*0.005, 0, fw*0.01, 0 )
|
||||
|
||||
local cw, ch = creation_frame:GetSize()
|
||||
|
||||
local name_lab = vgui.Create( "DLabel", creation_frame )
|
||||
name_lab:SetTextColor( color_white )
|
||||
name_lab:SetFont( "wOS.DynaBase.DescFont" )
|
||||
name_lab:SetText( "Name of User Mount" )
|
||||
name_lab:Dock( TOP )
|
||||
name_lab.DefaultCol = name_lab:GetColor()
|
||||
|
||||
local name_ent = vgui.Create( "DTextEntry", creation_frame )
|
||||
name_ent:Dock( TOP )
|
||||
name_ent:SetFont( "DermaDefaultBold" )
|
||||
name_ent:SetText( old_data.Name or "" )
|
||||
name_ent:SetPlaceholderText( "Enter name of mount" )
|
||||
name_ent:DockMargin( fw*0.01, 0, 0, 0 )
|
||||
name_ent.OnGetFocus = function(pan)
|
||||
name_lab:SetTextColor( name_lab.DefaultCol )
|
||||
end
|
||||
|
||||
local name = vgui.Create( "DLabel", creation_frame )
|
||||
name:SetTextColor( color_white )
|
||||
name:SetFont( "wOS.DynaBase.DescFont" )
|
||||
name:SetText( "Shared Mounting Model" )
|
||||
name:Dock( TOP )
|
||||
name:DockMargin( 0, fh*0.02, 0, 0 )
|
||||
|
||||
local share_ent = vgui.Create( "DTextEntry", creation_frame )
|
||||
share_ent:Dock( TOP )
|
||||
share_ent:SetFont( "DermaDefaultBold" )
|
||||
share_ent:SetText( old_data.Shared or "" )
|
||||
share_ent:SetPlaceholderText( "Enter path or right click on model in browser" )
|
||||
share_ent:DockMargin( fw*0.01, 0, 0, 0 )
|
||||
|
||||
local name = vgui.Create( "DLabel", creation_frame )
|
||||
name:SetTextColor( color_white )
|
||||
name:SetFont( "wOS.DynaBase.DescFont" )
|
||||
name:SetText( "Male Mounting Model" )
|
||||
name:Dock( TOP )
|
||||
name:DockMargin( 0, fh*0.02, 0, 0 )
|
||||
|
||||
local male_ent = vgui.Create( "DTextEntry", creation_frame )
|
||||
male_ent:Dock( TOP )
|
||||
male_ent:SetText( old_data.Male or "" )
|
||||
male_ent:SetFont( "DermaDefaultBold" )
|
||||
male_ent:SetPlaceholderText( "Enter path or right click on model in browser" )
|
||||
male_ent:DockMargin( fw*0.01, 0, 0, 0 )
|
||||
|
||||
local name = vgui.Create( "DLabel", creation_frame )
|
||||
name:SetTextColor( color_white )
|
||||
name:SetFont( "wOS.DynaBase.DescFont" )
|
||||
name:SetText( "Female Mounting Model" )
|
||||
name:Dock( TOP )
|
||||
name:DockMargin( 0, fh*0.02, 0, 0 )
|
||||
|
||||
local female_ent = vgui.Create( "DTextEntry", creation_frame )
|
||||
female_ent:Dock( TOP )
|
||||
female_ent:SetText( old_data.Female or "" )
|
||||
female_ent:SetFont( "DermaDefaultBold" )
|
||||
female_ent:SetPlaceholderText( "Enter path or right click on model in browser" )
|
||||
female_ent:DockMargin( fw*0.01, 0, 0, 0 )
|
||||
|
||||
local name = vgui.Create( "DLabel", creation_frame )
|
||||
name:SetTextColor( color_white )
|
||||
name:SetFont( "wOS.DynaBase.DescFont" )
|
||||
name:SetText( "Zombie Mounting Model" )
|
||||
name:Dock( TOP )
|
||||
name:DockMargin( 0, fh*0.02, 0, 0 )
|
||||
|
||||
local zombie_ent = vgui.Create( "DTextEntry", creation_frame )
|
||||
zombie_ent:Dock( TOP )
|
||||
zombie_ent:SetText( old_data.Zombie or "" )
|
||||
zombie_ent:SetFont( "DermaDefaultBold" )
|
||||
zombie_ent:SetPlaceholderText( "Enter path or right click on model in browser" )
|
||||
zombie_ent:DockMargin( fw*0.01, 0, 0, 0 )
|
||||
|
||||
local cancel = vgui.Create("DButton", creation_frame )
|
||||
cancel:SetTall( fh*0.05 )
|
||||
cancel:Dock( BOTTOM )
|
||||
cancel:SetText( "Cancel" )
|
||||
cancel.DoClick = function() frame:Close() end
|
||||
|
||||
local save = vgui.Create("DButton", creation_frame )
|
||||
save:SetTall( fh*0.05 )
|
||||
save:Dock( BOTTOM )
|
||||
save:SetText( "Save User Mount" )
|
||||
save.DoClick = function()
|
||||
local name = name_ent:GetText()
|
||||
if #name < 1 then
|
||||
name_lab:SetTextColor( Color( 255, 0, 0 ) )
|
||||
surface.PlaySound( "buttons/button10.wav" )
|
||||
return
|
||||
end
|
||||
|
||||
local tbl = {
|
||||
Name = name,
|
||||
Shared = ( #share_ent:GetText() > 1 and share_ent:GetText() ) or nil,
|
||||
Male = ( #male_ent:GetText() > 1 and male_ent:GetText() ) or nil,
|
||||
Female = ( #female_ent:GetText() > 1 and female_ent:GetText() ) or nil,
|
||||
Zombie = ( #zombie_ent:GetText() > 1 and zombie_ent:GetText() ) or nil,
|
||||
}
|
||||
if old_data.Name then
|
||||
self:DeleteUserMount( old_data.Name )
|
||||
end
|
||||
self:CreateUserMount( tbl )
|
||||
parent:RefreshList()
|
||||
frame:Close()
|
||||
end
|
||||
|
||||
function browser:OnRightClick( path, pnl ) -- Called when a file is clicked
|
||||
local menu = DermaMenu()
|
||||
menu:AddOption( "Set as Shared Mount", function()
|
||||
share_ent:SetText( path )
|
||||
end ):SetIcon( "icon16/group.png" )
|
||||
|
||||
menu:AddOption( "Set as Male Mount", function()
|
||||
male_ent:SetText( path )
|
||||
end ):SetIcon( "icon16/male.png" )
|
||||
|
||||
menu:AddOption( "Set as Female Mount", function()
|
||||
female_ent:SetText( path )
|
||||
end ):SetIcon( "icon16/female.png" )
|
||||
|
||||
menu:AddOption( "Set as Zombie Mount", function()
|
||||
zombie_ent:SetText( path )
|
||||
end ):SetIcon( "icon16/bug.png" )
|
||||
|
||||
menu:Open()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
hook.Add( "Initialize", "wOS.DynaBase.LoadUserMounts", function()
|
||||
local mounts = file.Read( "wos/dynabase/usermounts/mounts.txt", "DATA" ) or "{}"
|
||||
local local_mounts = util.JSONToTable( mounts )
|
||||
|
||||
for mount, data in pairs( local_mounts ) do
|
||||
wOS.DynaBase.UserMounts[ mount ] = data
|
||||
end
|
||||
|
||||
end )
|
||||
31
garrysmod/addons/wos/lua/wos/dynabase/core/cl_net.lua
Normal file
31
garrysmod/addons/wos/lua/wos/dynabase/core/cl_net.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
|
||||
net.Receive( "wOS.DynaBase.SendAllRegisters", function()
|
||||
wOS.DynaBase.EnforceCount = net.ReadUInt( 32 )
|
||||
for i=1, wOS.DynaBase.EnforceCount do
|
||||
local name = net.ReadString()
|
||||
local tbl = wOS.DynaBase:GetSource( name )
|
||||
if not tbl then wOS.DynaBase:RegisterSource({Name = name, ServerValid = true}) return end
|
||||
tbl.ServerValid = true
|
||||
end
|
||||
end )
|
||||
|
||||
net.Receive( "wOS.DynaBase.SendRegister", function()
|
||||
local name = net.ReadString()
|
||||
local tbl = wOS.DynaBase:GetSource( name )
|
||||
if not tbl then wOS.DynaBase:RegisterSource({Name = name, ServerValid = true}) return end
|
||||
tbl.ServerValid = true
|
||||
wOS.DynaBase.EnforceCount = wOS.DynaBase.EnforceCount + 1
|
||||
end )
|
||||
|
||||
net.Receive( "wOS.DynaBase.ForceMountCallback", function()
|
||||
local tbl = cvars.GetConVarCallbacks( "wos_dynabase_mountorder" ) or {}
|
||||
|
||||
local oldval = net.ReadString()
|
||||
local newval = net.ReadString()
|
||||
|
||||
for _, func in ipairs( tbl ) do
|
||||
func( "wos_dynabase_mountorder", oldval, newval )
|
||||
end
|
||||
end )
|
||||
239
garrysmod/addons/wos/lua/wos/dynabase/core/sh_core.lua
Normal file
239
garrysmod/addons/wos/lua/wos/dynabase/core/sh_core.lua
Normal file
@@ -0,0 +1,239 @@
|
||||
// That's right, x64 won't work with .dat in this trick. Special thanks to 8Z
|
||||
WOS_DYNABASE_FILE_EXTENSION = ".dat"
|
||||
-- if jit.arch == "x64" then
|
||||
-- WOS_DYNABASE_FILE_EXTENSION = ".txt"
|
||||
-- end
|
||||
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
wOS.DynaBase.DataCachePass = 0
|
||||
wOS.DynaBase.InitCompleted = false
|
||||
|
||||
wOS.DynaBase.Registers = {}
|
||||
wOS.DynaBase.RegisterCount = 0
|
||||
|
||||
wOS.DynaBase.EnforcedOrder = {}
|
||||
wOS.DynaBase.EnforceCount = 1
|
||||
|
||||
wOS.DynaBase.PlayerOrder = {}
|
||||
wOS.DynaBase.PlayerCount = 1
|
||||
|
||||
WOS_DYNABASE = WOS_DYNABASE or {}
|
||||
WOS_DYNABASE.SHARED = 1
|
||||
WOS_DYNABASE.MALE = 2
|
||||
WOS_DYNABASE.FEMALE = 3
|
||||
WOS_DYNABASE.ZOMBIE = 4
|
||||
WOS_DYNABASE.MAXCACHE = 1
|
||||
|
||||
WOS_DYNABASE.EXTENSION = 1
|
||||
WOS_DYNABASE.REANIMATION = 2
|
||||
|
||||
wOS.DynaBase.DefaultTable = {}
|
||||
wOS.DynaBase.DefaultTable.Male = { "data/wos/dynabase/local_male" .. WOS_DYNABASE_FILE_EXTENSION, "models/m_wos.mdl" }
|
||||
wOS.DynaBase.DefaultTable.Female = { "data/wos/dynabase/local_female" .. WOS_DYNABASE_FILE_EXTENSION, "models/f_wos.mdl" }
|
||||
wOS.DynaBase.DefaultTable.Zombie = { "data/wos/dynabase/local_zombie" .. WOS_DYNABASE_FILE_EXTENSION, "models/z_wos.mdl" }
|
||||
wOS.DynaBase.DefaultTable.Shared = { "data/wos/dynabase/local_shared" .. WOS_DYNABASE_FILE_EXTENSION }
|
||||
|
||||
wOS.DynaBase.FilteredLoadOrder = {}
|
||||
wOS.DynaBase.FilteredPlayerOrder = {}
|
||||
|
||||
wOS.DynaBase.FilteredBlacklist = {}
|
||||
wOS.DynaBase.FilteredPlayerBlacklist = {}
|
||||
|
||||
local flags = {FCVAR_REPLICATED, FCVAR_PROTECTED, FCVAR_ARCHIVE}
|
||||
WOS_DYNABASE_ENFORCECONTENT_CVAR = CreateConVar( "wos_dynabase_restrict_client_content", "0", flags, "Prevents usage of custom content (animations) that are not registered on the server.\n \t0 = No Restrictions\n \t1 = Registered Addons\n \t2 = Registered and Mounted Addons" )
|
||||
WOS_DYNABASE_ENFORCEREANIMATE_CVAR = CreateConVar( "wos_dynabase_restrict_client_reanimation", "1", flags, "Prevents clients from being able to customize what re-animations are locally enabled" )
|
||||
WOS_DYNABASE_ENFORCEEXTENDERS_CVAR = CreateConVar( "wos_dynabase_restrict_client_extension", "1", flags, "Prevents clients from being able to customize what animation extensions are locally enabled" )
|
||||
WOS_DYNABASE_LOADORDERENFORCE_CVAR = CreateConVar( "wos_dynabase_restrict_server_loadorder", "1", flags, "Enforces the order of animations as registered by the order of wos_dynabase_mountaddon command executions. Addons not specified will be mounted after the initial list" )
|
||||
WOS_DYNABASE_MOUNTORDERLIST_CVAR = CreateConVar( "wos_dynabase_mountorder", "", flags, "Enforces the order of animations as comma seperated names of registered addons. Addons not specified will be mounted after the initial list unless content enforcement is set to 2. Any addons not installed are simply skipped" )
|
||||
WOS_DYNABASE_MOUNTBLACKLIST_CVAR = CreateConVar( "wos_dynabase_blacklist", "", flags, "A comma seperated list of the names of blacklisted registered sources" )
|
||||
WOS_DYNABASE_SHOULDHOTLOAD_CVAR = CreateConVar( "wos_dynabase_live_reload", "1", {FCVAR_ARCHIVE}, "Should animations reload in-game when changes are made automatically? If you are experiencing crashing issues, disable this" )
|
||||
|
||||
local function InitializeBase()
|
||||
if not wOS.DynaBase.InitCompleted then
|
||||
hook.Call( "InitLoadAnimations" )
|
||||
end
|
||||
wOS.DynaBase:ProcessLoadOrder()
|
||||
wOS.DynaBase:ReloadAnimations()
|
||||
|
||||
if SERVER then
|
||||
if wOS.DynaBase.InitCompleted and not WOS_DYNABASE_SHOULDHOTLOAD_CVAR:GetBool() then return end
|
||||
RunConsoleCommand( "r_flushlod" )
|
||||
end
|
||||
|
||||
wOS.DynaBase.InitCompleted = true
|
||||
end
|
||||
|
||||
local function HandleMountOrderList( args )
|
||||
if not args or #args < 1 then
|
||||
wOS.DynaBase.EnforceCount = 0
|
||||
wOS.DynaBase.EnforcedOrder = nil
|
||||
return
|
||||
end
|
||||
|
||||
wOS.DynaBase.EnforcedOrder = {}
|
||||
wOS.DynaBase.EnforceCount = 0
|
||||
|
||||
local tbl = string.Explode( ",", args )
|
||||
for _, arg in ipairs( tbl ) do
|
||||
if table.HasValue( wOS.DynaBase.EnforcedOrder, arg ) then continue end
|
||||
wOS.DynaBase.EnforceCount = wOS.DynaBase.EnforceCount + 1
|
||||
wOS.DynaBase.EnforcedOrder[ wOS.DynaBase.EnforceCount ] = arg
|
||||
end
|
||||
end
|
||||
|
||||
cvars.AddChangeCallback("wos_dynabase_mountorder", function(_, oldargs, args)
|
||||
|
||||
if SERVER then
|
||||
net.Start( "wOS.DynaBase.ForceMountCallback" )
|
||||
net.WriteString( oldargs )
|
||||
net.WriteString( args )
|
||||
net.Broadcast()
|
||||
end
|
||||
|
||||
HandleMountOrderList( args )
|
||||
|
||||
if not WOS_DYNABASE_LOADORDERENFORCE_CVAR:GetBool() then return end
|
||||
InitializeBase()
|
||||
wOS.DynaBase.InitCompleted = true
|
||||
end)
|
||||
|
||||
hook.Add( "CreateTeams", "wOS.DynaBase.InitLoadAnimations", function()
|
||||
if wOS.DynaBase.InitCompleted then return end
|
||||
if WOS_DYNABASE_LOADORDERENFORCE_CVAR:GetBool() then
|
||||
HandleMountOrderList( WOS_DYNABASE_MOUNTORDERLIST_CVAR:GetString() )
|
||||
end
|
||||
InitializeBase()
|
||||
end )
|
||||
|
||||
function wOS.DynaBase:RegisterSource( data )
|
||||
if not data then return end
|
||||
if not data.Name then return end
|
||||
self.Registers[ data.Name ] = data
|
||||
self.RegisterCount = self.RegisterCount + 1
|
||||
|
||||
print( "[wOS-DynaBase] Registered new animation source: " .. data.Name )
|
||||
|
||||
if data.PreventActivities then
|
||||
self:FixActivities( data )
|
||||
end
|
||||
|
||||
if CLIENT then
|
||||
if data.IconOverwrite then
|
||||
self.Registers[ data.Name ].IconOverwrite = Material( data.IconOverwrite, "unlitgeneric" )
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if not self.InitCompleted then return end
|
||||
net.Start( "wOS.DynaBase.SendRegister" )
|
||||
net.WriteString( data.Name )
|
||||
net.Broadcast()
|
||||
end
|
||||
|
||||
function wOS.DynaBase:ProcessLoadOrder()
|
||||
if self.EnforceCount < 1 then self.FilteredLoadOrder = {} return end
|
||||
|
||||
// Initialize it here so it can fail later
|
||||
self.FilteredLoadOrder[ WOS_DYNABASE.MALE ] = {}
|
||||
self.FilteredLoadOrder[ WOS_DYNABASE.FEMALE ] = {}
|
||||
self.FilteredLoadOrder[ WOS_DYNABASE.ZOMBIE ] = {}
|
||||
self.FilteredLoadOrder[ WOS_DYNABASE.SHARED ] = {}
|
||||
|
||||
for _, name in ipairs( self.EnforcedOrder ) do
|
||||
local data = self:GetSource( name )
|
||||
if not data then continue end
|
||||
|
||||
if data.Shared then
|
||||
table.insert( self.FilteredLoadOrder[ WOS_DYNABASE.SHARED ], data.Shared )
|
||||
end
|
||||
|
||||
if data.Male then
|
||||
table.insert( self.FilteredLoadOrder[ WOS_DYNABASE.MALE ], data.Male )
|
||||
end
|
||||
|
||||
if data.Female then
|
||||
table.insert( self.FilteredLoadOrder[ WOS_DYNABASE.FEMALE ], data.Female )
|
||||
end
|
||||
|
||||
if data.Zombie then
|
||||
table.insert( self.FilteredLoadOrder[ WOS_DYNABASE.ZOMBIE ], data.Zombie )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function wOS.DynaBase:ProcessPlayerOrder()
|
||||
if self.PlayerCount < 1 then
|
||||
self.FilteredPlayerBlacklist = {}
|
||||
self.FilteredPlayerOrder = {}
|
||||
return
|
||||
end
|
||||
|
||||
// Initialize it here so it can fail later
|
||||
self.FilteredPlayerOrder[ WOS_DYNABASE.MALE ] = {}
|
||||
self.FilteredPlayerOrder[ WOS_DYNABASE.FEMALE ] = {}
|
||||
self.FilteredPlayerOrder[ WOS_DYNABASE.ZOMBIE ] = {}
|
||||
self.FilteredPlayerOrder[ WOS_DYNABASE.SHARED ] = {}
|
||||
|
||||
self.FilteredPlayerBlacklist[ WOS_DYNABASE.MALE ] = {}
|
||||
self.FilteredPlayerBlacklist[ WOS_DYNABASE.FEMALE ] = {}
|
||||
self.FilteredPlayerBlacklist[ WOS_DYNABASE.ZOMBIE ] = {}
|
||||
self.FilteredPlayerBlacklist[ WOS_DYNABASE.SHARED ] = {}
|
||||
|
||||
for _, dt in ipairs( self.PlayerOrder ) do
|
||||
local name = dt.Name
|
||||
local data = self:GetSource( name )
|
||||
if not data then continue end
|
||||
|
||||
if data.Shared then
|
||||
table.insert( ( !dt.Toggled and self.FilteredPlayerBlacklist[ WOS_DYNABASE.SHARED ] ) or self.FilteredPlayerOrder[ WOS_DYNABASE.SHARED ], data.Shared )
|
||||
end
|
||||
|
||||
if data.Male then
|
||||
table.insert( ( !dt.Toggled and self.FilteredPlayerBlacklist[ WOS_DYNABASE.MALE ] ) or self.FilteredPlayerOrder[ WOS_DYNABASE.MALE ], data.Male )
|
||||
end
|
||||
|
||||
if data.Female then
|
||||
table.insert( ( !dt.Toggled and self.FilteredPlayerBlacklist[ WOS_DYNABASE.FEMALE ] ) or self.FilteredPlayerOrder[ WOS_DYNABASE.FEMALE ], data.Female )
|
||||
end
|
||||
|
||||
if data.Zombie then
|
||||
table.insert( ( !dt.Toggled and self.FilteredPlayerBlacklist[ WOS_DYNABASE.ZOMBIE ] ) or self.FilteredPlayerOrder[ WOS_DYNABASE.ZOMBIE ], data.Zombie )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function wOS.DynaBase:GetSourceCount()
|
||||
return self.RegisterCount
|
||||
end
|
||||
|
||||
function wOS.DynaBase:GetAllSources()
|
||||
return self.Registers
|
||||
end
|
||||
|
||||
function wOS.DynaBase:GetSource( name )
|
||||
return self.Registers[ name ]
|
||||
end
|
||||
|
||||
|
||||
// Need to register the base stuff LMAO
|
||||
wOS.DynaBase:RegisterSource({
|
||||
Name = "Base Animations",
|
||||
Type = WOS_DYNABASE.REANIMATION,
|
||||
IconOverwrite = "wos/dynabase/gmod.png",
|
||||
Core = true,
|
||||
Male = "models/m_wos.mdl",
|
||||
Female = "models/f_wos.mdl",
|
||||
Zombie = "models/z_wos.mdl",
|
||||
})
|
||||
|
||||
wOS.DynaBase:RegisterSource({
|
||||
Name = "Local Player Animations",
|
||||
Type = WOS_DYNABASE.REANIMATION,
|
||||
IconOverwrite = "wos/dynabase/local.png",
|
||||
Core = true,
|
||||
Male = "data/wos/dynabase/local_male" .. WOS_DYNABASE_FILE_EXTENSION,
|
||||
Female = "data/wos/dynabase/local_female" .. WOS_DYNABASE_FILE_EXTENSION,
|
||||
Zombie = "data/wos/dynabase/local_zombie" .. WOS_DYNABASE_FILE_EXTENSION,
|
||||
Shared = "data/wos/dynabase/local_shared" .. WOS_DYNABASE_FILE_EXTENSION,
|
||||
})
|
||||
@@ -0,0 +1,107 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
wOS.DynaBase.PreservedModels = wOS.DynaBase.PreservedModels or {}
|
||||
|
||||
local function FIX_MODEL_ACTIVITIES( path )
|
||||
if not path then return end
|
||||
|
||||
local new_path = string.Replace(path, "models/", "wos/dynabase/fixedmodels/")
|
||||
new_path = string.Replace( new_path, ".mdl", WOS_DYNABASE_FILE_EXTENSION )
|
||||
if file.Exists( new_path, "DATA" ) and not wOS.DynaBase.ReloadFixedModels then return "data/" .. new_path end
|
||||
|
||||
local mdl_file = file.Open( path, "r", "GAME" )
|
||||
if not mdl_file then return end
|
||||
|
||||
local str = ""
|
||||
local sanitary_str = ""
|
||||
for i=0, mdl_file:Size() do
|
||||
local byte = mdl_file:ReadByte()
|
||||
if not byte then continue end
|
||||
str = str .. string.char( byte )
|
||||
if byte == 0 then
|
||||
sanitary_str = sanitary_str .. string.char( 35 )
|
||||
else
|
||||
sanitary_str = sanitary_str .. string.char( byte )
|
||||
end
|
||||
end
|
||||
local _start, _end = string.find( sanitary_str, "ACT_" )
|
||||
while _start do
|
||||
local act_name = "WDB_"
|
||||
for i=0, 3 do
|
||||
str = string.SetChar( str, _start + i, act_name[i + 1] )
|
||||
end
|
||||
_start, _end = string.find( sanitary_str, "ACT_", _end )
|
||||
end
|
||||
|
||||
|
||||
local dt = string.Explode("/", new_path)
|
||||
dt = dt[#dt]
|
||||
|
||||
local file_path = string.Left( path, #path - #dt - 1 )
|
||||
|
||||
file.CreateDir( file_path )
|
||||
file.Write( new_path, str )
|
||||
|
||||
return "data/" .. new_path
|
||||
end
|
||||
|
||||
function wOS.DynaBase:FixActivities( data )
|
||||
if not data then return end
|
||||
|
||||
if data.Shared and ( not self.PreservedModels[ data.Shared ] or wOS.DynaBase.ReloadFixedModels ) then
|
||||
local path = FIX_MODEL_ACTIVITIES( data.Shared )
|
||||
if path then
|
||||
self.PreservedModels[ data.Shared ] = path
|
||||
end
|
||||
end
|
||||
|
||||
if data.Male and ( not self.PreservedModels[ data.Male ] or wOS.DynaBase.ReloadFixedModels ) then
|
||||
local path = FIX_MODEL_ACTIVITIES( data.Male )
|
||||
if path then
|
||||
self.PreservedModels[ data.Male ] = path
|
||||
end
|
||||
end
|
||||
|
||||
if data.Female and ( not self.PreservedModels[ data.Female ] or wOS.DynaBase.ReloadFixedModels ) then
|
||||
local path = FIX_MODEL_ACTIVITIES( data.Female )
|
||||
if path then
|
||||
self.PreservedModels[ data.Female ] = path
|
||||
end
|
||||
end
|
||||
|
||||
if data.Zombie and ( not self.PreservedModels[ data.Zombie ] or wOS.DynaBase.ReloadFixedModels ) then
|
||||
local path = FIX_MODEL_ACTIVITIES( data.Zombie )
|
||||
if path then
|
||||
self.PreservedModels[ data.Zombie ] = path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
concommand.Add( "wos_dynabase_debug_reloadfixedmodels", function()
|
||||
wOS.DynaBase.ReloadFixedModels = true
|
||||
for name, data in pairs( wOS.DynaBase:GetAllSources() ) do
|
||||
if not data.PreventActivities then continue end
|
||||
wOS.DynaBase:FixActivities( data )
|
||||
end
|
||||
wOS.DynaBase.ReloadFixedModels = false
|
||||
end )
|
||||
|
||||
file.CreateDir("wos/dynabase/fixedmodels")
|
||||
|
||||
|
||||
local function FixConflictingBases()
|
||||
for _, addon in ipairs( engine.GetAddons() ) do
|
||||
if addon.wsid == "2916561591" then
|
||||
game.MountGMA( addon.file )
|
||||
RunConsoleCommand( "r_flushlod" )
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
hook.Add( "InitLoadAnimations", "wOS.DynaBase.FixConflictingBases", FixConflictingBases )
|
||||
|
||||
concommand.Add( "wos_dynabase_fixconflicts", function()
|
||||
FixConflictingBases()
|
||||
print( "[wOS-DynaBase] Conflicting bases have been unloaded for this session. Double check by running the wos_dynabase_help command!\n\nNote: The addon may still be mounted when you restart your game.")
|
||||
end )
|
||||
384
garrysmod/addons/wos/lua/wos/dynabase/core/sh_mounting.lua
Normal file
384
garrysmod/addons/wos/lua/wos/dynabase/core/sh_mounting.lua
Normal file
@@ -0,0 +1,384 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
local added = {}
|
||||
|
||||
////////////////////////////////////// BASELINE STUFF //////////////////////////////////////
|
||||
local model_table = {}
|
||||
model_table[ WOS_DYNABASE.SHARED ] = "models/player/wiltos/anim_dynamic_pointer.mdl"
|
||||
model_table[ WOS_DYNABASE.MALE ] = "models/player/wiltos/anim_dynamic_maleptr.mdl"
|
||||
model_table[ WOS_DYNABASE.FEMALE ] = "models/player/wiltos/anim_dynamic_femaler.mdl"
|
||||
model_table[ WOS_DYNABASE.ZOMBIE ] = "models/player/wiltos/anim_dynamic_zombier.mdl"
|
||||
|
||||
local model_ext = {}
|
||||
model_ext[ WOS_DYNABASE.MALE ] = "_male"
|
||||
model_ext[ WOS_DYNABASE.FEMALE ] = "_female"
|
||||
model_ext[ WOS_DYNABASE.ZOMBIE ] = "_zombie"
|
||||
|
||||
local INCLUDE_MODEL_START = 737
|
||||
local INCLUDE_MODEL_END_SHARED = 806
|
||||
|
||||
// "Hard code the math idiot" says the guy who doesn't realize I'm making it easier on myself to change their names or expand in the future
|
||||
// I also can't count letters, only numbers?? GENIUS. NICE ONE
|
||||
local INCLUDE_MODEL_END_MALE = INCLUDE_MODEL_END_SHARED + ( #"_male" )*2
|
||||
local INCLUDE_MODEL_END_FEMALE = INCLUDE_MODEL_END_SHARED + ( #"_female" )*2
|
||||
local INCLUDE_MODEL_END_ZOMBIE = INCLUDE_MODEL_END_SHARED + ( #"_zombie" )*2
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function IncludeModel( mdl )
|
||||
if not mdl then return end
|
||||
if wOS.DynaBase.PreservedModels[ mdl ] then mdl = wOS.DynaBase.PreservedModels[ mdl ] end
|
||||
if table.HasValue( added, mdl ) then return end //This isn't needed but let's not bloat the mount file
|
||||
table.insert( added, 1, mdl )
|
||||
end
|
||||
|
||||
local function IntToByte( num )
|
||||
if not num then return end
|
||||
local t = {}
|
||||
t[1] = num % 256
|
||||
for i=1, 3 do
|
||||
t[i+1] = math.modf( num / ( 256^i ) ) % ( 256 )
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// If you don't know what this does do not mess with it or you're gonna mess up your player model
|
||||
// There'll be a lot of repeated code here for now while we get some TESTING done
|
||||
local function WRITE_TO_LOCAL( start, finish, type )
|
||||
if not type then return end
|
||||
local base_path = model_table[ type ]
|
||||
if not base_path then return end
|
||||
|
||||
local mdl_file = file.Open( base_path, "r", "GAME" )
|
||||
local dat = {}
|
||||
local str = ""
|
||||
for i=0, mdl_file:Size() do
|
||||
local byte = mdl_file:ReadByte()
|
||||
table.insert( dat, byte )
|
||||
if not byte then continue end
|
||||
str = str .. string.char( byte )
|
||||
end
|
||||
|
||||
|
||||
local endchar = str[finish]
|
||||
local tstr = ""
|
||||
for i=0, #str do
|
||||
if i == start then
|
||||
for _, newmodel in ipairs( added ) do
|
||||
tstr = tstr .. newmodel .. endchar
|
||||
end
|
||||
end
|
||||
if i >= start and i <= finish then continue end
|
||||
local char = str[i]
|
||||
tstr = tstr .. char
|
||||
end
|
||||
|
||||
local includenum = IntToByte( #added )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 336 + i, string.char( includenum[i] ) )
|
||||
end
|
||||
|
||||
local final_line = "models/player/wiltos/anim_dynamic_pointer/."
|
||||
local endptr = #tstr - #final_line
|
||||
|
||||
local null_insert = IntToByte( 0 )
|
||||
|
||||
// You can manipulate the list here to remove anything you don't want for this type
|
||||
hook.Call( "PreCreateLocalAnimation", nil, type, added )
|
||||
|
||||
local first_num = 60 + ( #added - 1 )*8
|
||||
local includenum = IntToByte( first_num )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 680 + i, string.char( includenum[i] ) )
|
||||
end
|
||||
|
||||
for i=1, #added - 1 do
|
||||
|
||||
local anim_pos = first_num - 7*i
|
||||
for j=1, i do
|
||||
anim_pos = anim_pos + #added[j]
|
||||
end
|
||||
local anim_num = IntToByte( anim_pos )
|
||||
|
||||
local start_pos = 676 + 8*i
|
||||
local start_half = string.sub( tstr, 1, start_pos )
|
||||
for j=1, 4 do
|
||||
start_half = start_half .. string.char( null_insert[j] )
|
||||
end
|
||||
for j=1, 4 do
|
||||
start_half = start_half .. string.char( anim_num[j] )
|
||||
end
|
||||
endptr = endptr + 8
|
||||
tstr = start_half .. string.sub( tstr, start_pos + 1 )
|
||||
end
|
||||
|
||||
|
||||
local endincludeaddr = IntToByte( endptr )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 684 + 8*(#added - 1 ) + i, string.char( endincludeaddr[i] ) )
|
||||
end
|
||||
|
||||
for i=0, #added - 1 do
|
||||
tstr = tstr .. endchar
|
||||
end
|
||||
|
||||
local datalen = IntToByte( #tstr )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 76 + i, string.char( datalen[i] ) )
|
||||
end
|
||||
|
||||
local ext = model_ext[ type ] or "_shared"
|
||||
file.Write( "wos/dynabase/local" .. ext .. WOS_DYNABASE_FILE_EXTENSION, tstr )
|
||||
hook.Call( "PostCreateLocalAnimation", nil, type, added )
|
||||
end
|
||||
|
||||
// If you don't know what this does do not mess with it or you're gonna mess up your player model
|
||||
local function WRITE_TO_POINTER( start, finish, type )
|
||||
if not type then return end
|
||||
local base_path = model_table[ type ]
|
||||
if not base_path then return end
|
||||
|
||||
local mdl_file = file.Open( base_path, "r", "GAME" )
|
||||
local str = ""
|
||||
for i=0, mdl_file:Size() do
|
||||
local byte = mdl_file:ReadByte()
|
||||
if not byte then continue end
|
||||
str = str .. string.char( byte )
|
||||
end
|
||||
|
||||
|
||||
local endchar = str[finish]
|
||||
local tstr = ""
|
||||
for i=0, #str do
|
||||
if i == start then
|
||||
for _, newmodel in ipairs( added ) do
|
||||
tstr = tstr .. newmodel .. endchar
|
||||
end
|
||||
end
|
||||
if i >= start and i <= finish then continue end
|
||||
local char = str[i]
|
||||
tstr = tstr .. char
|
||||
end
|
||||
|
||||
local includenum = IntToByte( #added )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 336 + i, string.char( includenum[i] ) )
|
||||
end
|
||||
|
||||
local final_line = "models/player/wiltos/anim_dynamic_pointer/."
|
||||
local endptr = #tstr - #final_line
|
||||
|
||||
local null_insert = IntToByte( 0 )
|
||||
|
||||
// You can manipulate the list here to remove anything you don't want for this type
|
||||
hook.Call( "PreMountAnimation", nil, type, added )
|
||||
|
||||
local first_num = 60 + ( #added - 1 )*8
|
||||
local includenum = IntToByte( first_num )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 680 + i, string.char( includenum[i] ) )
|
||||
end
|
||||
|
||||
for i=1, #added - 1 do
|
||||
|
||||
local anim_pos = first_num - 7*i
|
||||
for j=1, i do
|
||||
anim_pos = anim_pos + #added[j]
|
||||
end
|
||||
local anim_num = IntToByte( anim_pos )
|
||||
|
||||
local start_pos = 676 + 8*i
|
||||
local start_half = string.sub( tstr, 1, start_pos )
|
||||
for j=1, 4 do
|
||||
start_half = start_half .. string.char( null_insert[j] )
|
||||
end
|
||||
for j=1, 4 do
|
||||
start_half = start_half .. string.char( anim_num[j] )
|
||||
end
|
||||
endptr = endptr + 8
|
||||
tstr = start_half .. string.sub( tstr, start_pos + 1 )
|
||||
end
|
||||
|
||||
|
||||
local endincludeaddr = IntToByte( endptr )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 684 + 8*(#added - 1 ) + i, string.char( endincludeaddr[i] ) )
|
||||
end
|
||||
|
||||
for i=0, #added - 1 do
|
||||
tstr = tstr .. endchar
|
||||
end
|
||||
|
||||
local datalen = IntToByte( #tstr )
|
||||
for i=1, 4 do
|
||||
tstr = string.SetChar( tstr, 76 + i, string.char( datalen[i] ) )
|
||||
end
|
||||
|
||||
local ext = model_ext[ type ] or ""
|
||||
file.Write( "wos/dynabase/anim_dynamic" .. ext .. WOS_DYNABASE_FILE_EXTENSION, tstr )
|
||||
hook.Call( "PostMountAnimation", nil, type, added )
|
||||
end
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
local function AdjustMountOrder( tbl, typ )
|
||||
if not tbl then return end
|
||||
|
||||
local reference = wOS.DynaBase.FilteredLoadOrder[ typ ]
|
||||
local blacklist = wOS.DynaBase.FilteredBlacklist[ typ ]
|
||||
local plyref = wOS.DynaBase.FilteredPlayerOrder[ typ ]
|
||||
local plyblacklist = wOS.DynaBase.FilteredPlayerBlacklist[ typ ]
|
||||
|
||||
local new_tbl = {}
|
||||
|
||||
if WOS_DYNABASE_ENFORCECONTENT_CVAR:GetInt() > 0 then
|
||||
local cust_mount = wOS.DynaBase:GetSource( "Local Player Animations" )
|
||||
if cust_mount then
|
||||
if typ == WOS_DYNABASE.MALE then
|
||||
table.RemoveByValue( tbl, cust_mount.Male )
|
||||
elseif typ == WOS_DYNABASE.FEMALE then
|
||||
table.RemoveByValue( tbl, cust_mount.Female )
|
||||
elseif typ == WOS_DYNABASE.ZOMBIE then
|
||||
table.RemoveByValue( tbl, cust_mount.Zombie )
|
||||
else
|
||||
table.RemoveByValue( tbl, cust_mount.Shared )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if reference then
|
||||
for _, path in ipairs( reference ) do
|
||||
path = wOS.DynaBase.PreservedModels[ path ] or path
|
||||
if !table.HasValue( tbl, path ) then continue end
|
||||
table.insert( new_tbl, path )
|
||||
table.RemoveByValue( tbl, path )
|
||||
end
|
||||
end
|
||||
|
||||
// If we aren't allowed to use any other addon than the ones that are dictated, don't merge any extra models
|
||||
if WOS_DYNABASE_ENFORCECONTENT_CVAR:GetInt() >= 2 and reference then return new_tbl end
|
||||
|
||||
if plyref then
|
||||
for _, path in ipairs( plyref ) do
|
||||
path = wOS.DynaBase.PreservedModels[ path ] or path
|
||||
if !table.HasValue( tbl, path ) then continue end
|
||||
table.insert( new_tbl, path )
|
||||
table.RemoveByValue( tbl, path )
|
||||
end
|
||||
end
|
||||
|
||||
if plyblacklist then
|
||||
for _, path in ipairs( plyblacklist ) do
|
||||
path = wOS.DynaBase.PreservedModels[ path ] or path
|
||||
table.RemoveByValue( tbl, path )
|
||||
end
|
||||
end
|
||||
|
||||
// Add the ones we don't care about now
|
||||
table.Add( new_tbl, tbl )
|
||||
|
||||
// Server gets final word what we can use
|
||||
if blacklist then
|
||||
for _, path in ipairs( blacklist ) do
|
||||
path = wOS.DynaBase.PreservedModels[ path ] or path
|
||||
table.RemoveByValue( new_tbl, path )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return new_tbl
|
||||
end
|
||||
|
||||
function wOS.DynaBase:ReloadAnimations()
|
||||
|
||||
if self.LIVE_RELOAD then
|
||||
local seq = LocalPlayer():LookupSequence( "_dynamic_wiltos_enabled_" )
|
||||
if seq <= 0 then
|
||||
chat.AddText( Color( 255, 0, 0 ), "[wOS-Dynabase] Dynamic Animation Base failed due to conflicting animation base. Enter wos_dynabase_help into console to find the conflict, unsubscribe from the addon, and restart Garry's Mod.\n\nIf you are on someone's server, contact the owner to ensure they do not have a conflicting animation addon as required content." )
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
added = table.Copy( self.DefaultTable.Male )
|
||||
hook.Call( "PreLoadAnimations", nil, WOS_DYNABASE.MALE, added )
|
||||
local ntable = AdjustMountOrder( added, WOS_DYNABASE.MALE )
|
||||
added = ntable or added
|
||||
WRITE_TO_POINTER( INCLUDE_MODEL_START, INCLUDE_MODEL_END_MALE, WOS_DYNABASE.MALE )
|
||||
|
||||
added = table.Copy( wOS.DynaBase.DefaultTable.Female )
|
||||
hook.Call( "PreLoadAnimations", nil, WOS_DYNABASE.FEMALE, added )
|
||||
ntable = AdjustMountOrder( added, WOS_DYNABASE.FEMALE )
|
||||
added = ntable or added
|
||||
WRITE_TO_POINTER( INCLUDE_MODEL_START, INCLUDE_MODEL_END_FEMALE, WOS_DYNABASE.FEMALE )
|
||||
|
||||
added = table.Copy( wOS.DynaBase.DefaultTable.Zombie )
|
||||
hook.Call( "PreLoadAnimations", nil, WOS_DYNABASE.ZOMBIE, added )
|
||||
ntable = AdjustMountOrder( added, WOS_DYNABASE.ZOMBIE )
|
||||
added = ntable or added
|
||||
WRITE_TO_POINTER( INCLUDE_MODEL_START, INCLUDE_MODEL_END_ZOMBIE, WOS_DYNABASE.ZOMBIE )
|
||||
|
||||
added = table.Copy( wOS.DynaBase.DefaultTable.Shared )
|
||||
hook.Call( "PreLoadAnimations", nil, WOS_DYNABASE.SHARED, added )
|
||||
ntable = AdjustMountOrder( added, WOS_DYNABASE.SHARED )
|
||||
added = ntable or added
|
||||
WRITE_TO_POINTER( INCLUDE_MODEL_START, INCLUDE_MODEL_END_SHARED, WOS_DYNABASE.SHARED )
|
||||
|
||||
if SERVER then
|
||||
hook.Call( "PostLoadAnimations" ) --Server doesn't need to worry about render stuff so we load here
|
||||
return
|
||||
end
|
||||
|
||||
if wOS.DynaBase.InitCompleted and not WOS_DYNABASE_SHOULDHOTLOAD_CVAR:GetBool() then return end
|
||||
wOS.DynaBase.ReloadModelBool = true
|
||||
end
|
||||
|
||||
function wOS.DynaBase:ReloadLocalAnimations( order )
|
||||
|
||||
if not order then
|
||||
order = file.Read( "wos/dynabase/usermounts/preference.txt", "DATA" ) or "{}"
|
||||
order = util.JSONToTable( order )
|
||||
end
|
||||
|
||||
local shared_tbl = {}
|
||||
local male_tbl = {}
|
||||
local female_tbl = {}
|
||||
local zombie_tbl = {}
|
||||
|
||||
for _, mount in ipairs( order ) do
|
||||
if not mount.Toggled then continue end
|
||||
local data = self:GetUserMount( mount.Name )
|
||||
if not data then continue end
|
||||
|
||||
if data.Shared and not table.HasValue( shared_tbl, data.Shared ) then
|
||||
table.insert( shared_tbl, data.Shared )
|
||||
end
|
||||
|
||||
if data.Male and not table.HasValue( male_tbl, data.Male ) then
|
||||
table.insert( male_tbl, data.Male )
|
||||
end
|
||||
|
||||
if data.Female and not table.HasValue( female_tbl, data.Female ) then
|
||||
table.insert( female_tbl, data.Female )
|
||||
end
|
||||
|
||||
if data.Zombie and not table.HasValue( zombie_tbl, data.Zombie ) then
|
||||
table.insert( zombie_tbl, data.Zombie )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
added = male_tbl
|
||||
WRITE_TO_LOCAL( INCLUDE_MODEL_START, INCLUDE_MODEL_END_MALE, WOS_DYNABASE.MALE )
|
||||
|
||||
added = female_tbl
|
||||
WRITE_TO_LOCAL( INCLUDE_MODEL_START, INCLUDE_MODEL_END_FEMALE, WOS_DYNABASE.FEMALE )
|
||||
|
||||
added = zombie_tbl
|
||||
WRITE_TO_LOCAL( INCLUDE_MODEL_START, INCLUDE_MODEL_END_ZOMBIE, WOS_DYNABASE.ZOMBIE )
|
||||
|
||||
added = shared_tbl
|
||||
WRITE_TO_LOCAL( INCLUDE_MODEL_START, INCLUDE_MODEL_END_SHARED, WOS_DYNABASE.SHARED )
|
||||
end
|
||||
|
||||
file.CreateDir("wos/dynabase/usermounts")
|
||||
15
garrysmod/addons/wos/lua/wos/dynabase/core/sv_core.lua
Normal file
15
garrysmod/addons/wos/lua/wos/dynabase/core/sv_core.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
|
||||
util.AddNetworkString("wOS.DynaBase.SendAllRegisters")
|
||||
util.AddNetworkString("wOS.DynaBase.SendRegister")
|
||||
util.AddNetworkString("wOS.DynaBase.ForceMountCallback")
|
||||
|
||||
hook.Add( "PlayerInitialSpawn", "wOS.DynaBase.NetworkRegisteredAnimations", function( ply )
|
||||
net.Start( "wOS.DynaBase.SendAllRegisters" )
|
||||
net.WriteUInt( wOS.DynaBase:GetSourceCount(), 32 )
|
||||
for name, _ in pairs( wOS.DynaBase:GetAllSources() ) do
|
||||
net.WriteString( name )
|
||||
end
|
||||
net.Send( ply )
|
||||
end )
|
||||
81
garrysmod/addons/wos/lua/wos/dynabase/loader/loader.lua
Normal file
81
garrysmod/addons/wos/lua/wos/dynabase/loader/loader.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
--[[-------------------------------------------------------------------
|
||||
wiltOS Dynamic Animation Base:
|
||||
Powered by
|
||||
_ _ _ ___ ____
|
||||
__ _(_) | |_ / _ \/ ___|
|
||||
\ \ /\ / / | | __| | | \___ \
|
||||
\ V V /| | | |_| |_| |___) |
|
||||
\_/\_/ |_|_|\__|\___/|____/
|
||||
|
||||
_____ _ _ _
|
||||
|_ _|__ ___| |__ _ __ ___ | | ___ __ _(_) ___ ___
|
||||
| |/ _ \/ __| '_ \| '_ \ / _ \| |/ _ \ / _` | |/ _ \/ __|
|
||||
| | __/ (__| | | | | | | (_) | | (_) | (_| | | __/\__ \
|
||||
|_|\___|\___|_| |_|_| |_|\___/|_|\___/ \__, |_|\___||___/
|
||||
|___/
|
||||
-------------------------------------------------------------------]]--[[
|
||||
|
||||
Lua Developer: King David
|
||||
Contact: http://steamcommunity.com/groups/wiltostech
|
||||
|
||||
----------------------------------------]]--
|
||||
|
||||
wOS = wOS or {}
|
||||
wOS.DynaBase = wOS.DynaBase or {}
|
||||
|
||||
local string = string
|
||||
local file = file
|
||||
|
||||
local function _AddCSLuaFile( lua )
|
||||
|
||||
if SERVER then
|
||||
AddCSLuaFile( lua )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function _include( load_type, lua )
|
||||
|
||||
if load_type then
|
||||
include( lua )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function wOS.DynaBase:Autoloader()
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/sh_core.lua" )
|
||||
_include( SERVER, "wos/dynabase/core/sh_core.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/sh_core.lua" )
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/sh_model_operations.lua" )
|
||||
_include( SERVER, "wos/dynabase/core/sh_model_operations.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/sh_model_operations.lua" )
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/sh_mounting.lua" )
|
||||
_include( SERVER, "wos/dynabase/core/sh_mounting.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/sh_mounting.lua" )
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/cl_net.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/cl_net.lua" )
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/cl_core.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/cl_core.lua" )
|
||||
_include( SERVER, "wos/dynabase/core/sv_core.lua" )
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/cl_local_copy.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/cl_local_copy.lua" )
|
||||
|
||||
_AddCSLuaFile( "wos/dynabase/core/cl_config_menu.lua" )
|
||||
_include( CLIENT, "wos/dynabase/core/cl_config_menu.lua" )
|
||||
|
||||
for _,source in pairs( file.Find( "wos/dynabase/registers/*", "LUA"), true ) do
|
||||
local lua = "wos/dynabase/registers/" .. source
|
||||
_AddCSLuaFile( lua )
|
||||
_include( SERVER, lua )
|
||||
_include( CLIENT, lua )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
wOS.DynaBase:Autoloader()
|
||||
BIN
garrysmod/addons/wos/models/f_anm.ani
Normal file
BIN
garrysmod/addons/wos/models/f_anm.ani
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/f_anm.mdl
Normal file
BIN
garrysmod/addons/wos/models/f_anm.mdl
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/f_wos.mdl
Normal file
BIN
garrysmod/addons/wos/models/f_wos.mdl
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/m_anm.ani
Normal file
BIN
garrysmod/addons/wos/models/m_anm.ani
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/m_anm.mdl
Normal file
BIN
garrysmod/addons/wos/models/m_anm.mdl
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/m_wos.mdl
Normal file
BIN
garrysmod/addons/wos/models/m_wos.mdl
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
garrysmod/addons/wos/models/z_anm.ani
Normal file
BIN
garrysmod/addons/wos/models/z_anm.ani
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/z_anm.mdl
Normal file
BIN
garrysmod/addons/wos/models/z_anm.mdl
Normal file
Binary file not shown.
BIN
garrysmod/addons/wos/models/z_wos.mdl
Normal file
BIN
garrysmod/addons/wos/models/z_wos.mdl
Normal file
Binary file not shown.
Reference in New Issue
Block a user