v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"frameGrid" : {
|
||||
"size" : [10, 3],
|
||||
"dimensions" : [1, 5],
|
||||
|
||||
"names" : [
|
||||
[ "reload.1" ],
|
||||
[ "reload.2" ],
|
||||
[ "reload.3" ],
|
||||
[ "reload.4" ],
|
||||
[ "ready" ]
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 221 B |
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"itemName" : "testrocket",
|
||||
|
||||
"maxStack" : 1,
|
||||
"rarity" : "legendary",
|
||||
"description" : "Fwoosh... pchoom!",
|
||||
"shortdescription" : "Rocket Lawnchair",
|
||||
"tooltipKind" : "gun",
|
||||
"weaponType" : "Gun",
|
||||
"twoHanded" : true,
|
||||
"itemTags" : ["weapon"],
|
||||
|
||||
"inventoryIcon" : "testrocket.png",
|
||||
"animation" : "testrocket.animation",
|
||||
"animationCustom" : {},
|
||||
"scripts" : ["testrocket.lua"],
|
||||
"fireOffset" : [2.0, 1.0],
|
||||
|
||||
"level" : 6,
|
||||
"fireTime" : 2.0,
|
||||
"inaccuracy" : 0.02,
|
||||
"projectileType" : "rocketshell",
|
||||
"projectileParameters" : {
|
||||
"power" : 12
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"animatedParts" : {
|
||||
"stateTypes" : {
|
||||
"reload" : {
|
||||
"default" : "ready",
|
||||
"states" : {
|
||||
"ready" : {},
|
||||
"reload" : {
|
||||
"frames" : 4,
|
||||
"cycle" : 1.0,
|
||||
"mode" : "transition",
|
||||
"transition" : "ready"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"parts" : {
|
||||
"gun" : {
|
||||
"properties" : {
|
||||
"centered" : true,
|
||||
"image" : "testrocket.png",
|
||||
"offset" : [-0.75, 0.75]
|
||||
}
|
||||
},
|
||||
"reloadLights" : {
|
||||
"properties" : {
|
||||
"centered" : true,
|
||||
"offset" : [-0.5, 0.875],
|
||||
"zLevel" : 1,
|
||||
"fullbright" : true
|
||||
},
|
||||
|
||||
"partStates" : {
|
||||
"reload" : {
|
||||
"ready" : {
|
||||
"properties" : {
|
||||
"image" : "reloadlights.png:ready"
|
||||
}
|
||||
},
|
||||
"reload" : {
|
||||
"properties" : {
|
||||
"image" : "reloadlights.png:reload.<frame>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"particleEmitters" : {
|
||||
"fireParticles" : {
|
||||
"emissionRate" : 10.0,
|
||||
"particles" : [
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
},
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
},
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
},
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
},
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
},
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
},
|
||||
{
|
||||
"particle" : "rocketbarrelpuff",
|
||||
"offset" : [2, 0.75]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"sounds" : {
|
||||
"fire" : [ "/sfx/gun/rocket_shot.ogg" ]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
require "/scripts/vec2.lua"
|
||||
|
||||
function init()
|
||||
-- scale damage and calculate energy cost
|
||||
self.pType = config.getParameter("projectileType")
|
||||
self.pParams = config.getParameter("projectileParameters", {})
|
||||
if not self.pParams.power then
|
||||
local projectileConfig = root.projectileConfig(self.pType)
|
||||
self.pParams.power = projectileConfig.power
|
||||
end
|
||||
self.pParams.power = self.pParams.power * root.evalFunction("weaponDamageLevelMultiplier", config.getParameter("level", 1))
|
||||
self.energyPerShot = 3 * self.pParams.power
|
||||
|
||||
self.fireOffset = config.getParameter("fireOffset")
|
||||
updateAim()
|
||||
|
||||
storage.fireTimer = storage.fireTimer or 0
|
||||
self.recoilTimer = 0
|
||||
|
||||
animator.setAnimationRate(1 / config.getParameter("fireTime", 1.0))
|
||||
end
|
||||
|
||||
function update(dt, fireMode, shiftHeld)
|
||||
updateAim()
|
||||
|
||||
storage.fireTimer = math.max(storage.fireTimer - dt, 0)
|
||||
self.recoilTimer = math.max(self.recoilTimer - dt, 0)
|
||||
|
||||
if fireMode ~= "none"
|
||||
and storage.fireTimer <= 0
|
||||
and not world.pointTileCollision(firePosition())
|
||||
and status.overConsumeResource("energy", self.energyPerShot) then
|
||||
|
||||
storage.fireTimer = config.getParameter("fireTime", 1.0)
|
||||
fire()
|
||||
end
|
||||
|
||||
activeItem.setRecoil(self.recoilTimer > 0)
|
||||
end
|
||||
|
||||
function fire()
|
||||
self.pParams.powerMultiplier = activeItem.ownerPowerMultiplier()
|
||||
world.spawnProjectile(
|
||||
self.pType,
|
||||
firePosition(),
|
||||
activeItem.ownerEntityId(),
|
||||
aimVector(),
|
||||
false,
|
||||
self.pParams
|
||||
)
|
||||
animator.setAnimationState("reload", "reload", true)
|
||||
animator.burstParticleEmitter("fireParticles")
|
||||
animator.playSound("fire")
|
||||
self.recoilTimer = config.getParameter("recoilTime", 0.12)
|
||||
end
|
||||
|
||||
function updateAim()
|
||||
self.aimAngle, self.aimDirection = activeItem.aimAngleAndDirection(self.fireOffset[2], activeItem.ownerAimPosition())
|
||||
activeItem.setArmAngle(self.aimAngle)
|
||||
activeItem.setFacingDirection(self.aimDirection)
|
||||
end
|
||||
|
||||
function firePosition()
|
||||
return vec2.add(mcontroller.position(), activeItem.handPosition(self.fireOffset))
|
||||
end
|
||||
|
||||
function aimVector()
|
||||
local aimVector = vec2.rotate({1, 0}, self.aimAngle + sb.nrand(config.getParameter("inaccuracy", 0), 0))
|
||||
aimVector[1] = aimVector[1] * self.aimDirection
|
||||
return aimVector
|
||||
end
|
Binary file not shown.
After Width: | Height: | Size: 456 B |
Loading…
Add table
Add a link
Reference in a new issue