local Y=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\118\101\114\109\111\114\101"))local w=game:GetService("\080\108\097\121\101\114\115")local T={}function T.Init(w)w._remoteEvent=Y.GetRemoteEvent("\080\097\114\116\105\099\108\101\069\118\101\110\116\068\105\115\116\114\105\098\117\116\111\114")w._remoteEvent.OnServerEvent:Connect(function(Y,T)w:_replicate(Y,T)end)end function T._replicate(t,Y,T)T.Global=nil for w,M in pairs(w:GetPlayers())do if M~=Y then t._remoteEvent:FireClient(M,T)end end end function T.ParticleNew(w,Y)assert(w._remoteEvent)Y.Position=Y.Position or error("\078\111 \080\111\115\105\116\105\111\110")Y.Velocity=Y.Velocity or Vector3.new()Y.Size=Y.Size or Vector2.new(.2,.2)Y.Bloom=Y.Bloom or Vector2.new(0,0)Y.Gravity=Y.Gravity or Vector3.new()Y.LifeTime=Y.LifeTime Y.Color=Y.Color or Color3.new(1,1,1)Y.Transparency=Y.Transparency or.5 w._remoteEvent:FireAllClients(Y)return Y end return T
--- Handles replication on the server side
-- @module ParticleEngineServer

local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))

local Players = game:GetService("Players")

local ParticleEngineServer = {}

function ParticleEngineServer:Init()
	self._remoteEvent = require.GetRemoteEvent("ParticleEventDistributor")

	self._remoteEvent.OnServerEvent:Connect(function(player, particle)
		self:_replicate(player, particle)
	end)
end

function ParticleEngineServer:_replicate(player, particle)
	particle.Global = nil

	for _, otherPlayer in pairs(Players:GetPlayers()) do
		if otherPlayer ~= player then
			self._remoteEvent:FireClient(otherPlayer, particle)
		end
	end
end

-- @param p PropertiesTable
function ParticleEngineServer:ParticleNew(p)
	assert(self._remoteEvent)

	p.Position = p.Position or error("No Position")
	p.Velocity = p.Velocity or Vector3.new()
	p.Size = p.Size or Vector2.new(0.2,0.2)
	p.Bloom = p.Bloom or Vector2.new(0,0)
	p.Gravity = p.Gravity or Vector3.new()
	p.LifeTime = p.LifeTime;
	p.Color = p.Color or Color3.new(1,1,1)
	p.Transparency = p.Transparency or 0.5

	self._remoteEvent:FireAllClients(p)

	return p
end

return ParticleEngineServer