Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lua/pac3/core/client/hooks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ do
if ply.pac_global_animation_rate == 0 then
animrate = ply:GetModelScale() * 2
elseif ply.pac_global_animation_rate ~= 1 then
ply:SetCycle((pac.RealTime * ply.pac_global_animation_rate)%1)
ply:SetCycle((pac.RealTime * ply.pac_global_animation_rate) % 1)
animrate = ply.pac_global_animation_rate
end
end

if ply.pac_animation_sequences then
local part, thing = next(ply.pac_animation_sequences)
local part = next(ply.pac_animation_sequences)

if part and part:IsValid() then

Expand Down Expand Up @@ -195,8 +195,3 @@ pac.AddHook("pac_PlayerFootstep", "events", function(ply, pos, snd, vol)
return true
end
end)

net.Receive("pac_effect_precached", function()
local name = net.ReadString()
pac.CallHook("EffectPrecached", name)
end)
1 change: 1 addition & 0 deletions lua/pac3/core/client/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pac.animations = include("pac3/libraries/animations.lua")

include("pac3/core/shared/init.lua")

pac.pcfprovider = include("pac3/libraries/pcfprovider.lua")
pac.urltex = include("pac3/libraries/urltex.lua")

include("parts.lua")
Expand Down
85 changes: 7 additions & 78 deletions lua/pac3/core/client/parts/effect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ local ParticleEffect = ParticleEffect
local BUILDER, PART = pac.PartTemplate("base_drawable")

PART.ClassName = "effect"
PART.Groups = {'effects', 'model', 'entity'}
PART.Icon = 'icon16/wand.png'
PART.Groups = {"effects", "model", "entity"}
PART.Icon = "icon16/wand.png"

BUILDER:StartStorableVars()
BUILDER:GetSet("Effect", "default", {enums = function() return pac.particle_list end})
BUILDER:GetSet("Effect", "default", {enums = function() return pac.pcfprovider.GetParticleList() end})
BUILDER:GetSet("Loop", true)
BUILDER:GetSet("Follow", true)
BUILDER:GetSet("Rate", 1, {editor_sensitivity = 0.1})
Expand All @@ -24,97 +24,26 @@ BUILDER:EndStorableVars()
BUILDER:RemoveProperty("Translucent")
PART.Translucent = false -- otherwise OnDraw won't be called

local BaseClass_GetOwner = PART.GetOwner
--local BaseClass_GetOwner = PART.GetOwner

function PART:GetNiceName()
return pac.PrettifyName(self:GetEffect())
end

function PART:Initialize()
self:SetEffect(self.Effect)

if not pac.particle_list then
local found = {}

for file_name in pairs(pac_loaded_particle_effects) do
local ok, err = pcall(function()
local data = file.Read("particles/"..file_name, "GAME", "b")
if data then
for str in data:gmatch("\3%c([%a_]+)%c") do
if #str > 1 then
found[str] = str
end
end
end
end)

if not ok then
local msg = "unable to parse particle file " .. file_name .. ": " .. err
self:SetError(msg)
pac.Message(Color(255, 50, 50), msg)
end
end

pac.particle_list = found
end
end

PART.last_spew = 0

if not pac_loaded_particle_effects then
pac_loaded_particle_effects = {}

for _, file_name in pairs(file.Find("particles/*.pcf", "GAME")) do
if not pac_loaded_particle_effects[file_name] and not pac.BlacklistedParticleSystems[file_name:lower()] then
game.AddParticles("particles/" .. file_name)
end

pac_loaded_particle_effects[file_name] = true
end
end

local already = {}
local alreadyServer = {}
local function pac_request_precache(name)
if already[name] then return end
already[name] = true
PrecacheParticleSystem(name)
net.Start("pac_request_precache")
net.WriteString(name)
net.SendToServer()
end

function PART:SetEffect(name)
self.waitingForServer = true
self.Effect = name
self.Ready = alreadyServer[name] or false

if not alreadyServer[name] then
pac_request_precache(name)
else
self.waitingForServer = false
end
end

pac.AddHook("pac_EffectPrecached", "pac_Effects", function(name)
if alreadyServer[name] then return end
alreadyServer[name] = true
pac.dprint("effect %q precached!", name)
pac.CallRecursiveOnAllParts("OnEffectPrecached", name)
end)

function PART:OnEffectPrecached(name)
if self.Effect == name then
self.Ready = true
self.waitingForServer = false
end
self.Ready = false
end

function PART:OnDraw()
if not self.Ready then
if not self.waitingForServer then
self:SetEffect(self.Effect)
end
self.Ready = pac.pcfprovider.LoadEffect(self.Effect)
return
end

Expand Down Expand Up @@ -143,7 +72,7 @@ function PART:OnHide()
end

function PART:OnShow(from_rendering)
if from_rendering then
if from_rendering and self.Ready then
self:Emit(self:GetDrawPosition())
end
end
Expand Down
59 changes: 0 additions & 59 deletions lua/pac3/core/server/effects.lua

This file was deleted.

1 change: 0 additions & 1 deletion lua/pac3/core/server/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ include("util.lua")

include("pac3/core/shared/init.lua")

include("effects.lua")
include("event.lua")
include("net_messages.lua")
include("test_suite_backdoor.lua")
Expand Down
92 changes: 52 additions & 40 deletions lua/pac3/core/shared/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,55 @@ include("entity_mutator.lua")
include("hash.lua")

pac.StringStream = include("pac3/libraries/string_stream.lua")
pac.pcfparser = include("pac3/libraries/pcfparser.lua")

CreateConVar("pac_sv_draw_distance", 0, CLIENT and FCVAR_REPLICATED or bit.bor(FCVAR_REPLICATED, FCVAR_ARCHIVE))

do
local tohash = {
-- Crash
'eye_muzzle.pcf', -- E.Y.E: Divine Cybermancy effect that crashes gmod. https://github.com/CapsAdmin/pac3/issues/1410
'weapon_unusual_isotope.pcf',
"eye_muzzle.pcf", -- E.Y.E: Divine Cybermancy effect that crashes gmod. https://github.com/CapsAdmin/pac3/issues/1410
"weapon_unusual_isotope.pcf",

-- Invalid
'blood_fx.pcf',
'boomer_fx.pcf',
'charger_fx.pcf',
'default.pcf',
'electrical_fx.pcf',
'environmental_fx.pcf',
'fire_01l4d.pcf',
'fire_fx.pcf',
'fire_infected_fx.pcf',
'firework_crate_fx.pcf',
'fireworks_fx.pcf',
'footstep_fx.pcf',
'gen_dest_fx.pcf',
'hunter_fx.pcf',
'infected_fx.pcf',
'insect_fx.pcf',
'item_fx.pcf',
'locator_fx.pcf',
'military_artillery_impacts.pcf',
'rain_fx.pcf',
'rain_storm_fx.pcf',
'rope_fx.pcf',
'screen_fx.pcf',
'smoker_fx.pcf',
'speechbubbles.pcf',
'spitter_fx.pcf',
'steam_fx.pcf',
'steamworks.pcf',
'survivor_fx.pcf',
'tank_fx.pcf',
'tanker_explosion.pcf',
'test_collision.pcf',
'test_distancealpha.pcf',
'ui_fx.pcf',
'vehicle_fx.pcf',
'water_fx.pcf',
'weapon_fx.pcf',
'witch_fx.pcf'
"blood_fx.pcf",
"boomer_fx.pcf",
"charger_fx.pcf",
"default.pcf",
"electrical_fx.pcf",
"environmental_fx.pcf",
"fire_01l4d.pcf",
"fire_fx.pcf",
"fire_infected_fx.pcf",
"firework_crate_fx.pcf",
"fireworks_fx.pcf",
"footstep_fx.pcf",
"gen_dest_fx.pcf",
"hunter_fx.pcf",
"infected_fx.pcf",
"insect_fx.pcf",
"item_fx.pcf",
"locator_fx.pcf",
"military_artillery_impacts.pcf",
"rain_fx.pcf",
"rain_storm_fx.pcf",
"rope_fx.pcf",
"screen_fx.pcf",
"smoker_fx.pcf",
"speechbubbles.pcf",
"spitter_fx.pcf",
"steam_fx.pcf",
"steamworks.pcf",
"survivor_fx.pcf",
"tank_fx.pcf",
"tanker_explosion.pcf",
"test_collision.pcf",
"test_distancealpha.pcf",
"ui_fx.pcf",
"vehicle_fx.pcf",
"water_fx.pcf",
"weapon_fx.pcf",
"witch_fx.pcf"
}

pac.BlacklistedParticleSystems = {}
Expand All @@ -63,3 +64,14 @@ do
pac.BlacklistedParticleSystems[val] = true
end
end

pac.EffectsBlackList =
{
frozen_steam = true,
portal_rift_01 = true,
explosion_silo = true,
citadel_shockwave_06 = true,
citadel_shockwave = true,
choreo_launch_rocket_start = true,
choreo_launch_rocket_jet = true,
}
1 change: 1 addition & 0 deletions lua/pac3/extra/client/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pacx = pacx or {}
include("pac3/extra/shared/init.lua")

include("contraption.lua")
include("map_outfit.lua")
include("pac2_compat.lua")
include("wire_expression_extension.lua")
22 changes: 22 additions & 0 deletions lua/pac3/extra/client/map_outfit.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
local WAIT_INTERVAL = 0.1
local WAIT_ATTEMPTS = 300

local pending = 0

net.Receive("pac_map_outfit_effect", function()
local index = net.ReadUInt(16)
local effect = net.ReadString()

pending = pending + 1
local timer_name = "pac_map_outfit_effect_" .. pending

timer.Create(timer_name, WAIT_INTERVAL, WAIT_ATTEMPTS, function()
local ent = Entity(index)
if not ent:IsValid() then return end
if not pac.pcfprovider.LoadEffect(effect) then return end

timer.Remove(timer_name)
Comment thread
Earu marked this conversation as resolved.

ParticleEffectAttach(effect, PATTACH_ABSORIGIN_FOLLOW, ent, 0)
end)
end)
Loading
Loading