v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"itemName" : "delaygun",
|
||||
"maxStack" : 1,
|
||||
"rarity" : "legendary",
|
||||
"description" : "Meh, I'll kill you later.",
|
||||
"shortdescription" : "Test Delay Rifle",
|
||||
"tooltipKind" : "gun",
|
||||
"weaponType" : "Delay Rifle",
|
||||
"twoHanded" : true,
|
||||
"itemTags" : ["weapon"],
|
||||
|
||||
"inventoryIcon" : "delaygun.png",
|
||||
|
||||
"animation" : "delaygun.animation",
|
||||
"animationParts" : {
|
||||
"gun" : "delaygun.png",
|
||||
"muzzleFlash" : "muzzleflash.png"
|
||||
},
|
||||
"animationCustom" : {
|
||||
"animatedParts" : { "parts" : {
|
||||
"gun" : { "properties" : {
|
||||
"offset" : [0.75, 0.125]
|
||||
}},
|
||||
"muzzleFlash" : { "properties" : {
|
||||
"offset" : [4.0, 0.375]
|
||||
}}
|
||||
}},
|
||||
"sounds" : {
|
||||
"fire" : [ "/sfx/gun/ar6.ogg" ]
|
||||
}
|
||||
},
|
||||
"fireOffset" : [3.625, 0.375],
|
||||
"aimOffset" : 0, // fireOffset[2] - gun offset - 0.25
|
||||
|
||||
"scripts" : ["delaygun.lua"],
|
||||
|
||||
"level" : 5,
|
||||
"fireTime" : 0.3,
|
||||
"inaccuracy" : 0.01,
|
||||
|
||||
"projectileType" : "delaybullet",
|
||||
"projectileParameters" : {
|
||||
"power" : 3
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
"animatedParts" : {
|
||||
"stateTypes" : {
|
||||
"firing" : {
|
||||
"default" : "off",
|
||||
"states" : {
|
||||
"off" : {},
|
||||
"fire" : {
|
||||
"frames" : 2,
|
||||
"cycle" : 0.07,
|
||||
"mode" : "transition",
|
||||
"transition" : "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"parts" : {
|
||||
"gun" : {
|
||||
"properties" : {
|
||||
"centered" : true,
|
||||
"image" : "<partImage>",
|
||||
"offset" : [0.5, 0.125]
|
||||
}
|
||||
},
|
||||
"muzzleFlash" : {
|
||||
"properties" : {
|
||||
"zLevel" : -1,
|
||||
"centered" : true,
|
||||
"offset" : [3.625, 0.375],
|
||||
"fullbright" : true
|
||||
},
|
||||
|
||||
"partStates" : {
|
||||
"firing" : {
|
||||
"off" : {
|
||||
"properties" : {
|
||||
"image" : ""
|
||||
}
|
||||
},
|
||||
"fire" : {
|
||||
"properties" : {
|
||||
"image" : "<partImage>:<variant>.<frame>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"lights" : {
|
||||
"muzzleFlash" : {
|
||||
"active" : false,
|
||||
"position" : [3.25, 0.25],
|
||||
"color" : [60, 60, 0]
|
||||
}
|
||||
},
|
||||
|
||||
"sounds" : {
|
||||
"fire" : [ ]
|
||||
}
|
||||
}
|
101
assets/devel/items/active/weapons/ranged/delaygun/delaygun.lua
Normal file
101
assets/devel/items/active/weapons/ranged/delaygun/delaygun.lua
Normal file
|
@ -0,0 +1,101 @@
|
|||
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.setPartTag("muzzleFlash", "variant", "1")
|
||||
activeItem.setCursor("/cursors/reticle0.cursor")
|
||||
|
||||
self.activeBullets = {}
|
||||
end
|
||||
|
||||
function activate(fireMode, shiftHeld)
|
||||
if fireMode == "alt" then
|
||||
triggerBullets()
|
||||
end
|
||||
end
|
||||
|
||||
function update(dt, fireMode, shiftHeld)
|
||||
updateAim()
|
||||
updateBullets()
|
||||
|
||||
storage.fireTimer = math.max(storage.fireTimer - dt, 0)
|
||||
self.recoilTimer = math.max(self.recoilTimer - dt, 0)
|
||||
|
||||
if fireMode == "primary"
|
||||
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)
|
||||
animator.setLightActive("muzzleFlash", self.recoilTimer > 0)
|
||||
end
|
||||
|
||||
function fire()
|
||||
self.pParams.powerMultiplier = activeItem.ownerPowerMultiplier()
|
||||
local bulletId = world.spawnProjectile(
|
||||
self.pType,
|
||||
firePosition(),
|
||||
activeItem.ownerEntityId(),
|
||||
aimVector(),
|
||||
false,
|
||||
self.pParams
|
||||
)
|
||||
if bulletId then
|
||||
self.activeBullets[#self.activeBullets + 1] = bulletId
|
||||
end
|
||||
animator.setAnimationState("firing", "fire", true)
|
||||
animator.setPartTag("muzzleFlash", "variant", math.random(1, 3))
|
||||
animator.playSound("fire")
|
||||
self.recoilTimer = config.getParameter("recoilTime", 0.08)
|
||||
end
|
||||
|
||||
function updateAim()
|
||||
self.aimAngle, self.aimDirection = activeItem.aimAngleAndDirection(config.getParameter("aimOffset"), activeItem.ownerAimPosition())
|
||||
activeItem.setArmAngle(self.aimAngle)
|
||||
activeItem.setFacingDirection(self.aimDirection)
|
||||
end
|
||||
|
||||
function updateBullets()
|
||||
local newBullets = {}
|
||||
for i, bullet in ipairs(self.activeBullets) do
|
||||
if world.entityExists(bullet) then
|
||||
newBullets[#newBullets + 1] = bullet
|
||||
end
|
||||
end
|
||||
self.activeBullets = newBullets
|
||||
end
|
||||
|
||||
function triggerBullets()
|
||||
for i, bullet in ipairs(self.activeBullets) do
|
||||
world.callScriptedEntity(bullet, "trigger")
|
||||
end
|
||||
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
|
BIN
assets/devel/items/active/weapons/ranged/delaygun/delaygun.png
Normal file
BIN
assets/devel/items/active/weapons/ranged/delaygun/delaygun.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 350 B |
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"frameGrid" : {
|
||||
"size" : [15, 15],
|
||||
"dimensions" : [2, 3],
|
||||
|
||||
"names" : [
|
||||
[ "1.1", "1.2" ],
|
||||
[ "2.1", "2.2" ],
|
||||
[ "3.1", "3.2" ]
|
||||
]
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 379 B |
Loading…
Add table
Add a link
Reference in a new issue