This commit is contained in:
Aria 2025-03-21 22:23:30 +11:00
commit 9c94d113d3
Signed by untrusted user who does not match committer: aria
GPG key ID: 19AB7AA462B8AB3B
10260 changed files with 1237388 additions and 0 deletions

View file

@ -0,0 +1,24 @@
require "/scripts/vec2.lua"
function init()
script.setUpdateDelta(20)
end
function update(dt)
local targetIds = world.entityQuery(mcontroller.position(), 30, {
withoutEntityId = entity.id(),
includedTypes = {"creature"},
order = "nearest"
})
for i,id in ipairs(targetIds) do
if entity.isValidTarget(id) and not world.lineTileCollision(mcontroller.position(), world.entityPosition(id)) then
local directionTo = vec2.norm(world.distance(world.entityPosition(id), mcontroller.position()))
world.spawnProjectile("teslabolt", mcontroller.position(), entity.id(), directionTo, false, {speed = 100, power = 999})
end
end
end
function uninit()
end