About this guide
Difficulty: Hard
Components
Components are at the core of the terminal, they are responsible for handling the logic and can be swapped out to change the terminal's behavior. Use them to turn change a dualcap behaves or to account for bots in the player count.
Installing terminal components
In the server file:
wrapper:SwitchTerminalComponent("updatePoints",myNewUpdatePointsFunction)
Examples
[dualcap] -Lock the capture state only if there are the same amount of players of both teams on the terminal
function updateCaptureProgress(terminal: terminal, tickRate: number) : number
local newCaptureProgress = terminal.CaptureProgress
local attackersCount, defendersCount = terminal.attackersCount, terminal.defendersCount
if attackersCount > defendersCount then
newCaptureProgress += 1 / tickRate
elseif defendersCount > attackersCount then
newCaptureProgress -= 1 / tickRate
elseif attackersCount == 0 and defendersCount == 0 then
if(terminal.Config.resetIfTermIsEmpty == true) then
if(math.abs(newCaptureProgress) < 0.1)then
newCaptureProgress = 0
end
if(newCaptureProgress > 0) then
newCaptureProgress -= (1/tickRate)
elseif(newCaptureProgress < 0) then
newCaptureProgress += (1/tickRate)
end
end
end
if newCaptureProgress > terminal.Config.captureTime then
newCaptureProgress = terminal.Config.captureTime
elseif newCaptureProgress < -terminal.Config.captureTime then
newCaptureProgress = -terminal.Config.captureTime
end
return newCaptureProgress
end
wrapper:SwitchTerminalComponent("updateCaptureProgress",updateCaptureProgress)
Instantly capture the point from neutral
function updateCaptureProgress(terminal: terminal, tickRate: number) : number
local newCaptureProgress = terminal.CaptureProgress
local attackersCount, defendersCount = terminal.attackersCount, terminal.defendersCount
if attackersCount > 0 and defendersCount == 0 then
if(newCaptureProgress + (1 / tickRate) > 0)then
newCaptureProgress = terminal.Config.captureTime
else
newCaptureProgress += 1 / tickRate
end
elseif defendersCount > 0 and attackersCount == 0 then
if(newCaptureProgress - (1 / tickRate) < 0)then
newCaptureProgress = -terminal.Config.captureTime
else
newCaptureProgress -= 1 / tickRate
end
elseif attackersCount == 0 and defendersCount == 0 then
if(terminal.Config.resetIfTermIsEmpty == true) then
if(math.abs(newCaptureProgress) < 0.1)then
newCaptureProgress = 0
end
if(newCaptureProgress > 0) then
newCaptureProgress -= (1/tickRate)
elseif(newCaptureProgress < 0) then
newCaptureProgress += (1/tickRate)
end
end
end
if newCaptureProgress > terminal.Config.captureTime then
newCaptureProgress = terminal.Config.captureTime
elseif newCaptureProgress < -terminal.Config.captureTime then
newCaptureProgress = -terminal.Config.captureTime
end
return newCaptureProgress
end
wrapper:SwitchTerminalComponent("updateCaptureProgress",updateCaptureProgress)