Repository navigation
Misconceptions about CelLuAPI
This is an exaggeration about a feature request for CelLuAPI made by someone in the CelLua discord server.
This does bring a fair point however, its not obvious how you would add stuff like custom sliders and custom drillers.
Using what we already learned from other parts of the WiKi, we can do this very simply.
The pushability callback here is the key.
The pushability callback function of a slider would be:
function PushabilityOfSlider(myX, myY, myDirection, XofPusher, YofPusher, DirectionOfPusher, TypeOfPusher)
local myRotation = cells[myY][myX].ctype
if myRotation%2 == 0 and ((myX ~= XofPusher) and myY == YofPusher) then
-- We should be pushed, so we return true
return true -- We return true, cuz I said we will
end
if myRotation%2 == 1 and ((myY ~= YofPusher) and myX == XofPusher) then
-- We should be pushed, so we return true
return true -- We return true, cuz I said we will
end
return false
endLets say we want to make a driller that can move through every cell no matter what because screw reasonability, we can do whatever we want with mods.
This would be the function for updating it, it just puts us in front and the thing in front of us back. It also says if we have already updated we should not update again.
function DoUnstoppableDriller(x, y, dir)
if cells[y][x].updated == true then return end -- If we already updated, we don't do anything.
local fx, fy = x, y -- We declare our variables for the position of the cell in front of us.
-- Assuming our texture has the same orientation as the mover texture, we calculate the front position like this.
if dir == 0 then fx = x + 1 elseif dir == 2 then fx = x - 1 end
if dir == 1 then fy = y + 1 elseif dir == 3 then fy = y - 1 end
-- We backup what is in front
local front = CopyTable(cells[fy][fx])
--[[
In case you want your driller to be stoppable, where these comments begin would be a great place to put a if statement determining the conditions
needed to stop your driller, you could check if those conditions are met by checking the properties of front.
]]
cells[y][x].updated = true
cells[fy][fx] = CopyTable(cells[y][x]) -- We move forward
cells[y][x] = front -- We put back the cell that used to be in front of us.
endThis is false.
Well, this used to be true. Before version 0.1.0.0 we had no security. Mods could exploit a weakness in Love2D, which was that you could still use os.execute. That has been fixed by the API however in CelLuAPI version 0.1.0.0, as the function is just set to a blank function now.
All other security risks have already been patched by Love2D itself, and CelLuAPI only cares about fixing exploits in Love2D at the API level.
CelLuAPI allows other developers to make PRs and push their fixes to bugs or add new features. In the past it didn't, but it became open for PRs for at least 2 weeks now. There just aren't any people who know what to add and how.
CelLuAPI is fully open source. Anyone can, if they want to, make a PR and I will review it. I will test if it even works, see what it actually does, and if everything is good merge it with the main branch.
Just make sure to not edit the same file as someone else.... which is kind of hard when KyYay left us with this big main.lua file that is the center of everything.
Don't worry, a future commit will split it into multiple parts for ease of management because yes.