2024-08-07 16:45:56 +00:00
|
|
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
|
|
local blink = require(ReplicatedStorage.net)
|
|
|
|
local std = require(ReplicatedStorage.std)
|
|
|
|
local ref = std.ref
|
|
|
|
local world = std.world
|
|
|
|
local cts = std.components
|
|
|
|
|
|
|
|
local function syncMobs()
|
2024-10-12 20:18:11 +00:00
|
|
|
for _, id, cf, vel in blink.SpawnMob.Iter() do
|
|
|
|
local part = Instance.new("Part")
|
|
|
|
part.Size = Vector3.one * 5
|
|
|
|
part.BrickColor = BrickColor.Red()
|
|
|
|
part.Anchored = true
|
|
|
|
local model = Instance.new("Model")
|
|
|
|
model.PrimaryPart = part
|
|
|
|
part.Parent = model
|
|
|
|
model.Parent = workspace
|
2024-08-07 16:45:56 +00:00
|
|
|
|
2024-10-12 20:18:11 +00:00
|
|
|
ref("server-" .. id)
|
|
|
|
:set(cts.Transform, { new = cf, old = cf })
|
|
|
|
:set(cts.Velocity, vel)
|
|
|
|
:set(cts.Model, model)
|
|
|
|
:add(cts.Mob)
|
|
|
|
end
|
2024-08-07 16:45:56 +00:00
|
|
|
end
|
|
|
|
|
2024-08-21 15:57:40 +00:00
|
|
|
return function(scheduler: std.Scheduler)
|
2024-10-12 20:18:11 +00:00
|
|
|
local phases = scheduler.phases
|
|
|
|
local system_new = scheduler.systems.new
|
|
|
|
system_new(syncMobs, phases.RenderStepped)
|
2024-08-21 15:57:40 +00:00
|
|
|
end
|