-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
290 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,4 @@ local function interval(s) | |
return throttle | ||
end | ||
|
||
return interval | ||
return interval |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
local std = game:GetService("ReplicatedStorage").std | ||
local Players = game:GetService("Players") | ||
|
||
local scheduler = require(std.scheduler) | ||
local PHASE = scheduler.PHASE | ||
|
||
return { | ||
PlayerAdded = PHASE({ | ||
event = Players.PlayerAdded | ||
}), | ||
PlayerRemoved = PHASE({ | ||
event = Players.PlayerRemoving | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
local handle = require(script.Parent.handle) | ||
local world = require(script.Parent.world) | ||
local refs = {} | ||
local jecs = require(game:GetService("ReplicatedStorage").ecs) | ||
local refs: {[any]: jecs.Entity} = {} | ||
|
||
local function fini(key) | ||
local function fini(key): () -> () | ||
return function() | ||
refs[key] = nil | ||
end | ||
end | ||
|
||
local function ref(key): (handle.Handle, (() -> ())?) | ||
local function noop() end | ||
|
||
local function ref(key): (jecs.Entity, () -> ()) | ||
if not key then | ||
return handle(world:entity()) | ||
return world:entity(), noop | ||
end | ||
local e = refs[key] | ||
if not e then | ||
e = world:entity() | ||
refs[key] = e | ||
end | ||
-- Cannot cache handles because they will get invalidated | ||
return handle(e), fini(key) | ||
return e, fini(key) | ||
end | ||
|
||
return ref |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.