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,27 @@
function setupAbility(altAbilityConfig)
local knockbackAttack = altAbilityConfig
function knockbackAttack.init()
-- sb.logInfo("Initializing knockbackAttack")
end
function knockbackAttack.update(dt, fireMode, shiftHeld)
if fireMode == "alt"
and storage.fireTimer == 0
and not world.pointTileCollision(firePosition())
and status.overConsumeResource("energy", knockbackAttack.energyCost) then
storage.fireTimer = knockbackAttack.cooldown -- TODO: maybe use separate cooldown?
-- TODO: appropriate projectile
animator.setAnimationState("firing", "fire", true)
animator.setPartTag("muzzleFlash", "variant", math.random(1, 3))
animator.playSound("knockback")
animator.burstParticleEmitter("knockback")
self.recoilTimer = config.getParameter("recoilTime", 0.08)
mcontroller.addMomentum(vec2.mul(aimVector(), -knockbackAttack.momentum))
-- TODO: knock back enemies
end
end
return knockbackAttack
end

View file

@ -0,0 +1,77 @@
{
"animationCustom" : {
"sounds" : {
"knockback" : [ "/sfx/gun/grenadeblast1.ogg", "/sfx/gun/grenadeblast2.ogg", "/sfx/gun/grenadeblast3.ogg" ]
},
"particleEmitters" : {
"knockback" : {
"emissionRate" : 10.0,
"particles" : [
{
"particle" : {
"type" : "animated",
"animation" : "/animations/smoke/smoke.animation",
"timeToLive" : 0.8,
"initialVelocity" : [10.0, 0.0],
"finalVelocity" : [1.0, 2.0],
"approach" : [15, 10],
"variance" : {
"position" : [0, 0.5],
"initialVelocity" : [5.0, 3.0],
"timeToLive" : 0.2
}
},
"offset" : [2.75, 0.125],
"count" : 2
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/mediumflame/mediumflame.animation",
"timeToLive" : 0.6,
"initialVelocity" : [10.0, 0.0],
"finalVelocity" : [1.0, 2.0],
"approach" : [15, 7],
"variance" : {
"position" : [0, 0.5],
"initialVelocity" : [5.0, 3.0],
"timeToLive" : 0.2
}
},
"offset" : [2.75, 0.125],
"count" : 4
},
{
"particle" : {
"type" : "ember",
"color" : [240, 230, 70, 255],
"light" : [160, 120, 70],
"fade" : 0.9,
"initialVelocity" : [20, 0.0],
"finalVelocity" : [0, -10.0],
"approach" : [10, 20],
"timeToLive" : 0.6,
"layer" : "middle",
"variance" : {
"position" : [0, 0.5],
"size" : 0.5,
"initialVelocity" : [10.0, 4.0],
"timeToLive" : 0.2
}
},
"offset" : [2.75, 0.125],
"count" : 10
}
]
}
}
},
"ability" : {
"type" : "knockback",
"scripts" : ["/items/active/weapons/ranged/abilities/shotgun/knockbackattack.lua"],
"cooldown" : 2.0,
"energyCost" : 30,
"momentum" : 20
}
}