Created
July 24, 2025 07:53
-
-
Save ArvidSilverlock/9f3cdbdd51105947d229c8f5c425bf6f to your computer and use it in GitHub Desktop.
A dynamically tickable, temperature controlling (utilising the game's back-end formulas), auto refueling & tamper resistant auto-reactor for the Roblox game Waste of Space.
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
| local DESIRED_TEMPERATURE = 950 | |
| local FULL_BAR_COUNT = 4 | |
| local FUEL_EJECT_LEVEL = 0 | |
| local FUEL_WAIT_TIME = 1 / 10 | |
| local EPSILON = 0.01 | |
| for _, port: Port in Network:GetPorts() do | |
| local subnet = Network:GetSubnet(port) | |
| local reactor: Reactor? = subnet:GetPart("Reactor") | |
| local dispenser: Dispenser? = subnet:GetPart("Dispenser") | |
| local polysilicon: Polysilicon? = subnet:GetPart("Polysilicon") | |
| if not reactor or not polysilicon or not dispenser then | |
| warn("invalid port", reactor, polysilicon, dispenser) | |
| continue | |
| end | |
| local controlRodPosition = 10 | |
| local dispenseCooldown = 0 | |
| local function triggerPolysilicon(mode: PolysiliconMode, frequency: number) | |
| polysilicon.PolysiliconMode = mode | |
| polysilicon.Frequency = frequency | |
| polysilicon:Trigger() | |
| end | |
| dispenser.Filter = "Uranium" | |
| triggerPolysilicon("Activate", 10) | |
| local previousTemperature = reactor:GetTemp() | |
| local estimatedTempreatureChange | |
| local isFirstTick = true | |
| reactor.Loop:Connect(function(deltaTime) | |
| local fuelData = reactor:GetFuel() | |
| local fullBars = 0 | |
| for index, fuel in fuelData do | |
| if fuel <= 0 then | |
| continue | |
| end | |
| if fullBars + 1 > FULL_BAR_COUNT or fuel < FUEL_EJECT_LEVEL then | |
| triggerPolysilicon("FlipFlop", 1) | |
| else | |
| fullBars += 1 | |
| end | |
| end | |
| if dispenseCooldown <= 0 and fullBars < FULL_BAR_COUNT then | |
| dispenser:Dispense() | |
| dispenseCooldown = FUEL_WAIT_TIME | |
| else | |
| dispenseCooldown -= deltaTime | |
| end | |
| local currentTemperature = reactor:GetTemp() | |
| local temperatureChange = currentTemperature - previousTemperature | |
| if not isFirstTick and temperatureChange == 0 then | |
| return | |
| elseif isFirstTick then | |
| isFirstTick = false | |
| end | |
| previousTemperature = currentTemperature | |
| if estimatedTempreatureChange and math.abs(estimatedTempreatureChange - temperatureChange) > EPSILON then | |
| local jumpFactor = temperatureChange / estimatedTempreatureChange | |
| local fraction = jumpFactor % 1 | |
| if jumpFactor < 0 or (fraction > EPSILON and fraction < 1 - EPSILON) then | |
| local estimatedControlRodPosition = (3 * (temperatureChange / deltaTime) + 20) / fullBars | |
| controlRodPosition = math.clamp(math.floor(estimatedControlRodPosition), 0, 10) | |
| end | |
| end | |
| local desiredTemperatureChange = DESIRED_TEMPERATURE - currentTemperature | |
| local desiredFractionalPosition = (3 * (desiredTemperatureChange / deltaTime) + 20) / fullBars | |
| local desiredPosition = math.clamp(math.floor(desiredFractionalPosition), 0, 10) | |
| local positionDelta = controlRodPosition - desiredPosition | |
| estimatedTempreatureChange = (desiredPosition * fullBars - 20) / 3 * deltaTime | |
| if positionDelta ~= 0 then | |
| local polysiliconMode = if positionDelta > 0 then "Activate" else "Deactivate" | |
| triggerPolysilicon(polysiliconMode, math.abs(positionDelta)) | |
| controlRodPosition = desiredPosition | |
| end | |
| end) | |
| end |
skibidi und sigma
hello everybody my name is markiplier and welcome to five night's a freddy's an indie horror game that you guys suggested en masse and i saw that yamimash played it and he said it was really, really good
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tuff mango wolf phonK 🔥