Skip to content

Instantly share code, notes, and snippets.

@x4fx77x4f
Created February 17, 2021 05:19
Show Gist options
  • Save x4fx77x4f/96d2fc914987fee5fd4f49dc750a57ec to your computer and use it in GitHub Desktop.
Save x4fx77x4f/96d2fc914987fee5fd4f49dc750a57ec to your computer and use it in GitHub Desktop.
Starfall helper; proof of concept of using Expression 2 to bring extra functionality to Starfall
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()
ports.SFH_Entity1 = self
ports.SFH_Clk = 2
ports.SFH_Clk = 0
end
function Player:setGodMode(bool)
ports.SFH_Entity1 = self
ports.SFH_Number1 = bool and 1 or 0
ports.SFH_Clk = 3
ports.SFH_Clk = 0
end
function Player:setNoclipped(bool)
ports.SFH_Entity1 = self
ports.SFH_Number1 = bool and 1 or 0
ports.SFH_Clk = 4
ports.SFH_Clk = 0
end
function Player:setAlpha(amount)
ports.SFH_Entity1 = self
ports.SFH_Number1 = amount
ports.SFH_Clk = 5
ports.SFH_Clk = 0
end
function Player:setNoclipEnabled(bool)
ports.SFH_Entity1 = self
ports.SFH_Number1 = bool and 0 or 1
ports.SFH_Clk = 6
ports.SFH_Clk = 0
end
@name Starfall sucks
@inputs Clk:number Entity1:entity Number1:number
@trigger Clk
if (Clk & !first()) {
switch (Clk) {
case 1,
Entity1:plySetHealth(Number1)
break
case 2,
Entity1:plySpawn()
break
case 3,
Entity1:plyGod(Number1)
break
case 4,
Entity1:plyNoclip(Number1)
break
case 5,
Entity1:plyAlpha(Number1)
break
case 6,
Entity1:plyDisableNoclip(Number1)
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment