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,125 @@
--------------------------------------------------------------------------------
function init()
self.sensors = sensors.create()
self.state = stateMachine.create({
"idleState",
"moveState",
"attackState"
})
self.state.enteringState = function(stateName)
self.state.shuffleStates()
end
self.state.leavingState = function(stateName)
entity.setAggressive(false)
end
entity.setAggressive(false)
end
--------------------------------------------------------------------------------
function update(dt)
if util.trackTarget(30) then
self.state.pickState({ targetId = self.targetId })
end
if not self.state.update(dt) then
mcontroller.controlFly({ 0, 0 })
end
if self.state.stateDesc() ~= "attackState" then
if mcontroller.onGround() then
entity.setAnimationState("movement", "idle")
else
entity.setAnimationState("movement", "fly")
end
end
self.sensors.clear()
end
--------------------------------------------------------------------------------
function damage(args)
if entity.health() > 0 then
self.state.pickState({ targetId = args.sourceId })
end
end
--------------------------------------------------------------------------------
idleState = {}
function idleState.enter()
if mcontroller.onGround() or self.sensors.idleLandSensor.collisionTrace.any(true) then
return { timer = entity.randomizeParameterRange("idleTimeRange") }
end
return nil
end
function idleState.update(dt, stateData)
if not mcontroller.onGround() then
if not self.sensors.idleLandSensor.collisionTrace.any(true) then
return true, entity.configParameter("idleCooldown")
end
mcontroller.controlFly({0, -entity.flySpeed() / 2 })
end
stateData.timer = stateData.timer - dt
if stateData.timer <= 0 then
return true, entity.configParameter("idleCooldown")
end
end
--------------------------------------------------------------------------------
moveState = {}
function moveState.enter()
return {
timer = entity.randomizeParameterRange("moveTimeRange"),
direction = util.randomDirection()
}
end
function moveState.update(dt, stateData)
if self.sensors.blockedSensors.collision.any(true) then
stateData.direction = -stateData.direction
end
local delta = { stateData.direction, 0 }
if self.sensors.moveGroundSensor.collisionTrace[1].value then
delta[2] = 0.5
elseif self.sensors.moveCeilingSensor.collisionTrace[1].value then
delta[2] = -0.5
end
delta = vec2.mul(vec2.norm(delta), entity.flySpeed())
mcontroller.controlFly(delta)
stateData.timer = stateData.timer - dt
if stateData.timer <= 0 then
return true
end
return false
end
--------------------------------------------------------------------------------
attackState = {}
function attackState.enterWith(args)
if args.targetId ~= nil then
return nil -- TODO
end
return nil
end
function attackState.enteringState(stateData)
entity.setAggressive(true)
end
function attackState.update(dt, stateData)
return true -- TODO
end

View file

@ -0,0 +1,9 @@
{
"name" : "body",
"category" : "toxicfly",
"type" : "body",
"frames" : {
"body" : "body.png"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -0,0 +1,13 @@
{
"frameGrid" : {
"size" : [40, 40],
"dimensions" : [6, 4],
"names" : [
[ null, "fly.1", "fly.2", "fly.3", "fly.4", "fly.5" ],
[ null, "ground", null, null, null, null ],
[ null, "attack.1", "attack.2", "attack.3", "attack.4", "attack.5" ],
[ null, "idle.1", "idle.2", "idle.3", "idle.4", "idle.5" ]
]
}
}

View file

@ -0,0 +1,9 @@
{
"name" : "head",
"category" : "toxicfly",
"type" : "head",
"frames" : {
"head" : "head.png"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -0,0 +1,336 @@
{
"animatedParts" : {
"stateTypes" : {
"movement" : {
"priority" : 0,
"default" : "standing",
"states" : {
"standing" : {
"frames" : 1
},
"flying" : {
"frames" : 5,
"cycle" : 0.30,
"mode" : "loop"
},
"knockback" : {
"frames" : 1
},
"knockout" : {
"frames" : 1
},
"gliding" : {
"frames" : 5,
"cycle" : 0.30,
"mode" : "loop"
},
"flyingAttack" : {
"frames" : 4,
"cycle" : 0.25,
"mode" : "loop"
}
}
}
},
"parts" : {
"body" : {
"partStates" : {
"movement" : {
"standing" : {
"properties" : {
"image" : "<partImage>:ground"
}
},
"flying" : {
"properties" : {
"image" : "<partImage>:fly.<frame>"
}
},
"knockback" : {
"properties" : {
"image" : "<partImage>:ground"
}
},
"knockout" : {
"properties" : {
"image" : "<partImage>:ground"
}
},
"gliding" : {
"properties" : {
"image" : "<partImage>:fly.<frame>"
}
},
"flyingAttack" : {
"properties" : {
"image" : "<partImage>:attack.<frame>"
}
}
}
}
},
"head" : {
"properties" : {
"zLevel" : 1,
"rotationGroup" : "head"
},
"partStates" : {
"movement" : {
"standing" : {
"properties" : {
"image" : "<partImage>:ground"
}
},
"flying" : {
"properties" : {
"image" : "<partImage>:fly.<frame>"
}
},
"knockback" : {
"properties" : {
"image" : "<partImage>:ground"
}
},
"knockout" : {
"properties" : {
"image" : "<partImage>:ground"
}
},
"gliding" : {
"properties" : {
"image" : "<partImage>:fly.<frame>"
}
},
"flyingAttack" : {
"properties" : {
"image" : "<partImage>:attack.<frame>"
}
}
}
}
}
}
},
"rotationGroups" : {
"head" : {
"rotationCenter" : [0.625, -0.25],
"angularVelocity" : 1.5
}
},
"particleEmitters" : {
"damage" : {
"emissionRate" : 0.7,
"particles" : [
]
},
"deathPoof" : {
"particles" : [
{
"particle" : {
"type" : "animated",
"animation" : "/animations/puff2c/puff2c.animation",
"size" : 1,
"angularVelocity" : 35,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [0, 0],
"finalVelocity" : [0, 0],
"approach" : [1, 1],
"timeToLive" : 0.4,
"layer" : "middle"
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz1/fizz1.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz1/fizz1.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz2/fizz2.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz2/fizz2.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz3/fizz3.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz3/fizz3.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz4/fizz4.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz4/fizz4.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
}
]
}
},
"sounds" : {
"turnHostile" : [ ],
"deathPuff" : [ "/sfx/npc/enemydeathpuff.ogg" ]
},
"effects" : {
"blink" : {
"type" : "flash",
"time" : 0.25,
"directives" : "fade=ffffff;0.5"
}
}
}

View file

@ -0,0 +1,161 @@
{
"type" : "toxicfly",
"categories" : [ "toxicfly" ],
"parts" : [ "body", "head" ],
"animation" : "toxicfly.animation",
"reversed" : true,
"dropPools" : [ "noMeatMonsterTreasure" ],
"baseParameters" : {
"scripts" : [
"/monsters/generated/flying/flyingMonster.lua",
"/scripts/util.lua",
"/scripts/sensors.lua",
"/scripts/stateMachine.lua",
"/scripts/vec2.lua",
"/monsters/generated/flying/skills/createFlyingRangedAttack.lua",
"/monsters/generated/flying/circleState.lua",
"/monsters/generated/flying/wanderState.lua",
"/monsters/generated/flying/landState.lua" ,
"/monsters/generated/flying/turnState.lua"
],
"baseSkills" : [ "flyingSwoopBounceAttack" ],
"specialSkills" : [ "acidicSpitAttack" ],
"projectileSourcePosition" : [1.5, -0.5],
"attackStartDistance" : 20.0,
"attackMaxDistance" : 30.0,
"attackCooldownTime" : 4.0,
"targetRadius" : 30.0,
"targetSearchTime" : 0.5,
"targetHoldTime" : 5.0,
"wanderRiseSpeed" : 0.9,
"wanderRiseTimeRange" : [0.5, 2.0],
"wanderGlideSpeed" : 0.6,
"wanderGlideTimeRange" : [1.0, 4.0],
"wanderFormationOffset" : 2.0,
"wanderSpeedMultiplier" : 0.4,
"wanderEndChance" : 0.2,
"turnTime" : 1.0,
"turnTiltRatio" : 0.5,
"circleWidthRange" : [8.0, 12.0],
"circleHeight" : 1.0,
"circleOffsetYRange" : [8.0, 12.0],
"circleTiltRadius" : 1.5,
"circleTime" : 2.0,
"landRestTimeRange" : [0, 0],
"landDisturbDistance" : 10.0,
"landCooldownTimeRange" : [10.0, 30.0],
"glideTime" : 2.0,
"glideCooldownTime" : 10.0,
"glideSinkingSpeed" : 0.8,
"glideSpiralDispersion" : 0.2,
"metaBoundBox" : [-1.625, -1.25, 1.875, 1.625],
"scale" : 1.0,
"movementSettings" : {
"collisionPoly" : [ [-1.625, -1.25], [1.875, -1.25], [1.875, 1.625], [-1.0, 1.625] ],
"mass" : 0.1,
"walkSpeed" : 3,
"runSpeed" : 6,
"jumpSpeed" : 5,
"flySpeed" : 10,
"airFriction" : 0.1,
"airForce" : 50.0
},
"bodyMaterialKind" : "organic",
"knockoutTime" : 0.1,
"knockoutEffect" : "blink",
"deathParticles" : "deathPoof",
"touchDamage" : {
"poly" : [ [-1.625, -1.25], [1.875, -1.25], [1.875, 1.625], [-1.0, 1.625] ],
"damage" : 15,
"teamType" : "enemy",
"damageSourceKind" : "bite",
"statusEffects" : [ ]
},
"statusSettings" : {
"statusProperties" : {
"targetMaterialKind" : "organic"
},
"appliesEnvironmentStatusEffects" : false,
"minimumLiquidStatusEffectPercentage" : 0.1,
"primaryScriptSources" : [
"/stats/monster_primary.lua"
],
"primaryScriptDelta" : 5,
"stats" : {
"knockbackStunTime" : {
"baseValue" : 0.25
},
"knockbackThreshold" : {
"baseValue" : 10
},
"maxHealth" : {
"baseValue" : 60
},
"protection" : {
"baseValue" : 1.0
},
"healthRegen" : {
"baseValue" : 0.0
},
"poisonImmunity" : {
"baseValue" : 1.0
}
},
"resources" : {
"stunned" : {
"deltaValue" : -1.0,
"initialValue" : 0.0
},
"health" : {
"maxStat" : "maxHealth",
"deltaStat" : "healthRegen",
"defaultPercentage" : 100
}
}
},
"mouthOffset" : [0, 0],
"feetOffset" : [0, -8],
"blockedSensors" : [ [1.5, -1.1], [1.5, -0.5], [1.5, 0.5], [1.5, 1.1] ],
"upSensors" : [ [-0.75, -1.8], [0.75, -1.8], [1.5, -1.8] ],
"downSensors" : [ [-0.75, 1.8], [0.75, 1.8], [1.5, 1.8] ],
"groundSensors" : [ [0.0, -2.0], [0.0, -6.0], [0.0, -15.0], [0.0, -30.0] ],
"ceilingSensors" : [ [0.0, 2.0], [0.0, 6.0], [0.0, 10.0] ],
"environmentSensors" : [ [0.0, 0.0], [0.0, 2.0], [0.0, -2.0], [2.0, 0.0], [-2.0, 0.0], [2.0, 2.0], [2.0, -2.0], [-2.0, 2.0], [-2.0, -2.0] ],
"idleTimeRange" : [10, 25.0],
"idleLandSensor" : [ [0, -5] ],
"idleCooldown" : 10,
"moveTimeRange" : [5.0, 15.0],
"moveGroundSensor" : [ [0, -6] ],
"moveCeilingSensor" : [ [0, 4] ]
}
}