This file contains hidden or 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
wire.adjustOutputs({"SFH_Clk", "SFH_Entity1", "SFH_Number1"}, {"number", "entity", "number"}) | |
local ports = wire.ports | |
local Player = getMethods("Player") | |
function Player:setHealth(amount) | |
ports.SFH_Entity1 = self | |
ports.SFH_Number1 = amount | |
ports.SFH_Clk = 1 | |
ports.SFH_Clk = 0 | |
end | |
function Player:spawn() |
This file contains hidden or 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
--@name Key debouncer | |
--@shared | |
local hook = hook | |
local hook_add = hook.add | |
local hook_remove = hook.remove | |
local hook_run = hook.run | |
local isFirstTimePredicted = isFirstTimePredicted | |
local string = string | |
local string_lower = string.lower | |
local string_sub = string.sub |
This file contains hidden or 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
--@shared | |
local env = {} | |
env.getfenv = getfenv | |
local function func(...) | |
local fenv = getfenv(...) | |
return fenv | |
end | |
setfenv(func, env) | |
local labels = { | |
[_G] = "_G", |
This file contains hidden or 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
-- https://lua-users.org/wiki/MetatableEvents | |
local metatable = { | |
__index = true, | |
__newindex = true, | |
--__mode = true, | |
__call = true, | |
--__metatable = true, | |
--__tostring = true, | |
__len = true, -- Lua 5.2+ | |
__pairs = true, -- Lua 5.2+ |
This file contains hidden or 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
--@name BASIC | |
--@server | |
local code = [[ | |
10 PRINT "Hello, World!" | |
20 END | |
]] | |
local lexer = {} | |
lexer.data = code |
This file contains hidden or 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
--@name Chop's Rampage | |
--@client | |
--@include chopsrampage/dither.lua | |
dofile('chopsrampage/dither.lua') | |
render.createRenderTarget('display') | |
local testang = Angle() | |
local test = holograms.create(Vector(100, 50, -30), testang, 'models/starfall/holograms/box.mdl', Vector(150, 150, 150)) | |
test:setNoDraw(true) |
This file contains hidden or 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
--@name 3D Tetris | |
--@author Sparky | |
--@client | |
-- Proof of concept for permission request clickjacking in StarfallEx. | |
-- Usage: Give the chip an interesting name, put a HUD next to it, | |
-- hook the HUD up to it, convince people to activate the HUD, laugh. | |
-- redressing | |
-- https://github.com/thegrb93/StarfallEx/blob/master/lua/starfall/editor/sfderma.lua |
This file contains hidden or 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
--@name Helicopter demo | |
--@client | |
--@includedata chopsrampage/chopper.obj | |
--@includedata chopsrampage/palette.png | |
-- Load a model of a helicopter and display it. | |
local data = getScripts() | |
local obj = assert(data['chopsrampage/chopper.obj'], "includedata failed! you need to update starfall!") | |
local matpath = file.writeTemp('palette.png', data['chopsrampage/palette.png']) | |
local mat = material.createFromImage('../'..matpath, '') | |
local threshold = quotaMax()*0.5 |
This file contains hidden or 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
--@includedata chopsrampage/chopper.obj | |
--@includedata chopsrampage/palette.png | |
local cacheIdentifier = 'chopsrampage' -- This must equal the prefix on the paths to includedata. | |
local cacheExtensions = { | |
txt = true, | |
dat = true, | |
json = true, | |
xml = true, | |
csv = true, | |
jpg = true, |
This file contains hidden or 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
--@name Super Mario 64 | |
--@client | |
-- assets | |
local SF_DATAPATH = 'data/sf_filedata/sm64/' | |
--[[ | |
local its_a_me | |
bass.loadFile( | |
datapath..'/sound/samples/sfx_mario_peach/07_mario_its_a_me_mario.aiff', | |
'noplay', |