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
return function(model) | |
assert(model.PrimaryPart, | |
("%s has no primary part. Cannot create cache."):format( | |
model:GetFullName() | |
)) | |
local root = model.PrimaryPart | |
local offsets = {} |
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
UI | |
Menu | |
Splash* | |
CONTINUE -> Title | |
Title | |
TO_SAVESELECT -> SaveSelect | |
TO_OPTIONS -> Options | |
SaveSelect | |
SAVE_SELECTED -> Game | |
BACK -> Title |
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
Running test: example1 | |
Input: [7 -> 7 -> 3 -> 5] | |
Rotation: 2 | |
Expected: [3 -> 5 -> 7 -> 7] | |
Got: [3 -> 5 -> 7 -> 7] | |
Success! | |
Running test: example2 | |
Input: [1 -> 2 -> 3 -> 4 -> 5] |
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
local ReplicatedStorage = game:GetService("ReplicatedStorage") | |
local common = ReplicatedStorage:WaitForChild("common") | |
local util = common:WaitForChild("util") | |
local lib = ReplicatedStorage:WaitForChild("lib") | |
local component = script:FindFirstAncestor("uiComponents") | |
local Dictionary = require(util:WaitForChild("Dictionary")) | |
local Roact = require(lib:WaitForChild("Roact")) |
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
{ | |
// Place your snippets for lua here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", |
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
function calcTrajectoryTheta(start,goal,speed,pickHighAngle) | |
local xzStart = start * Vector3.new(1,0,1) | |
local xzGoal = goal * Vector3.new(1,0,1) | |
local range = (xzGoal-xzStart).Magnitude | |
local yDiff = goal.Y - start.Y | |
local g = workspace.Gravity | |
if range == 0 then return nil end | |
if g == 0 then | |
return math.atan(yDiff/range) -- simply return angle to the goal | |
end |
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
local errors = { | |
incompatibleSequences = "Passed origin and goal NumberSequences do not have the same number of keypoints. Origin: $d Goal: $d", | |
} | |
-- double iter accepts two tables and the previous index and returns a new index and two values | |
local function doubleIter (tables, iterState) | |
iterState = iterState + 1 | |
local valueOne = tables[1][iterState] | |
local valueTwo = tables[2][iterState] | |
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
-- trying to make an ergonomic state machine | |
-- maybe im just making madness | |
local FSM = {} | |
function FSM.new(states,startState) | |
local self = setmetatable({},{__index=FSM}) | |
self.states = states | |
self:transition(startState) |
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
{ | |
awake = { | |
enter = function() | |
return "idle" | |
end, | |
step = function() | |
end, | |
}, | |
idle = { | |
enter = function() |
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
return function() | |
return { | |
attack = { | |
inputs = { | |
{ | |
type = Enum.UserInputType.MouseButton1, | |
keyCode = nil, -- respond to all inputs of the type | |
passThrough = true, -- dont block | |
state = Enum.UserInputState.Begin, -- trigger on this state | |
}, |