-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b633b2b
commit 1f358e5
Showing
8 changed files
with
257 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function init() | ||
self.species = world.entitySpecies(entity.id()) | ||
if not self.species == "elduukhar" then | ||
effect.die() | ||
end | ||
self.healingRate = 1.01 / config.getParameter("healTime", 220) | ||
hungerLevel = status.resource("food") | ||
baseValue = config.getParameter("healthDown",0)*(status.resourceMax("food")) | ||
self.tickTime = 1.0 | ||
self.tickTimePenalty = 5.0 | ||
self.tickTimer = self.tickTime | ||
self.tickTimerPenalty = self.tickTimePenalty | ||
end | ||
|
||
function getLight() | ||
local position = mcontroller.position() | ||
position[1] = math.floor(position[1]) | ||
position[2] = math.floor(position[2]) | ||
local lightLevel = world.lightLevel(position) | ||
lightLevel = math.floor(lightLevel * 100) | ||
return lightLevel | ||
end | ||
|
||
|
||
function update(dt) | ||
if status.isResource("food") then | ||
self.foodValue = status.resource("food") | ||
hungerLevel = status.resource("food") | ||
else | ||
self.foodValue = 50 | ||
hungerLevel = 50 | ||
end | ||
baseValue = config.getParameter("healthDown",0)*(status.resourceMax("food")) | ||
self.tickTimer = self.tickTimer - dt | ||
self.tickTimerPenalty = self.tickTimerPenalty - dt | ||
self.foodValue = status.resource("food") | ||
end | ||
|
||
|
||
function uninit() | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name" : "elduukharflight", | ||
"effectConfig" : {}, | ||
"defaultDuration" : 3, | ||
|
||
"scripts" : [ | ||
"elduukharflight.lua" | ||
], | ||
|
||
"animationConfig" : "/tech/other/flighttest.animation", | ||
|
||
"label" : "Elduukhar Flight", | ||
"icon" : "/interface/statuses/flutter.png" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name" : "flight_elduukhar", | ||
"type" : "head", | ||
|
||
"scripts" : ["flighttestelduukhar.lua"], | ||
"animator" : "flighttest.animation", | ||
|
||
"description" : "Moth flight. Best in light.^green;[F]^reset;.", | ||
"shortDescription" : "Elduu'khar Flight", | ||
"rarity" : "Legendary", | ||
"icon" : "/items/active/raceEffectEnabler/raceeffectenabler.png", | ||
"chipCost" : 1, | ||
"energyCostPerSecond" : 1.30, | ||
|
||
"maxFallSpeed" : -5, | ||
"removesFallDamage" : 1, | ||
"fallingParameters" : { | ||
"gravityMultiplier" : -0.025, | ||
"airForce" : 35, | ||
"runSpeed" : 15, | ||
"walkSpeed" : 15, | ||
"flySpeed" : 15 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
require "/scripts/vec2.lua" | ||
|
||
function init() | ||
self.energyCostPerSecond = config.getParameter("energyCostPerSecond") | ||
self.active=false | ||
self.available = true | ||
self.species = world.entitySpecies(entity.id()) | ||
self.timer = 0 | ||
self.boostSpeed = 8 | ||
self.active=false | ||
self.available = true | ||
self.forceDeactivateTime = 3 | ||
end | ||
|
||
function uninit() | ||
animator.stopAllSounds("activate") | ||
status.clearPersistentEffects("glide") | ||
animator.setParticleEmitterActive("feathers", false) | ||
end | ||
|
||
function checkFood() | ||
if status.isResource("food") then | ||
self.foodValue = status.resource("food") | ||
else | ||
self.foodValue = 15 | ||
end | ||
end | ||
|
||
function boost(direction) | ||
self.boostVelocity = vec2.mul(vec2.norm(direction), self.boostSpeed) | ||
if self.boostSpeed > 25 then -- prevent super-rapid movement | ||
self.boostSpeed = 25 | ||
end | ||
end | ||
|
||
function update(args) | ||
if not self.specialLast and args.moves["special1"] then --toggle on | ||
attemptActivation() | ||
end | ||
|
||
self.specialLast = args.moves["special1"] | ||
|
||
if not args.moves["special1"] then | ||
self.forceTimer = nil | ||
end | ||
|
||
if status.resource("energy") < 1 then | ||
deactivate() | ||
end | ||
|
||
if self.active and status.overConsumeResource("energy", 0.0001) and not mcontroller.zeroG() and not mcontroller.liquidMovement() then -- do we have energy and the ability is active? | ||
checkFood() | ||
status.addEphemeralEffects{{effect = "elduukharflight", duration = 2}} | ||
|
||
self.upVal = args.moves["up"] --set core movement variables | ||
self.downVal = args.moves["down"] | ||
self.leftVal = args.moves["right"] | ||
self.rightVal = args.moves["left"] | ||
self.runVal = args.moves["run"] | ||
|
||
--enable air physics | ||
mcontroller.controlParameters(config.getParameter("fallingParameters")) | ||
mcontroller.setYVelocity(math.max(mcontroller.yVelocity(), config.getParameter("maxFallSpeed"))) | ||
|
||
-- boost in direction pressed | ||
local direction = {0, 0} -- set default | ||
if self.upVal then direction[2] = direction[2] + 1 end | ||
if self.downVal then direction[2] = direction[2] - 1 end | ||
if self.leftVal then direction[1] = direction[1] + 1 end | ||
if self.rightVal then direction[1] = direction[1] - 1 end | ||
|
||
self.boostSpeed = self.boostSpeed + args.dt | ||
boost(direction) | ||
if vec2.eq(direction, {0, 0}) then | ||
direction = {0, 0} | ||
end | ||
mcontroller.controlApproachVelocity(self.boostVelocity, 30) | ||
-- end boost | ||
|
||
if self.foodValue > 15 then | ||
if self.runVal and not self.downVal and not self.leftVal and not self.rightVal and not self.upVal then | ||
status.setPersistentEffects("glide", { | ||
{stat = "gliding", amount = 1}, | ||
{stat = "fallDamageResistance", effectiveMultiplier = 1.65} | ||
}) | ||
else | ||
status.setPersistentEffects("glide", { | ||
{stat = "gliding", amount = 0}, | ||
{stat = "foodDelta", amount = -5}, | ||
{stat = "fallDamageResistance", effectiveMultiplier = 1.65} | ||
}) | ||
end | ||
else | ||
if self.runVal and not self.downVal and not self.leftVal and not self.rightVal and not self.upVal then | ||
status.overConsumeResource("energy", 0.01) | ||
status.setPersistentEffects("glide", { | ||
{stat = "fallDamageResistance", effectiveMultiplier = 1.65} | ||
}) | ||
else | ||
status.overConsumeResource("energy", 0.65) | ||
status.setPersistentEffects("glide", { | ||
{stat = "fallDamageResistance", effectiveMultiplier = 1.65} | ||
}) | ||
end | ||
|
||
end | ||
checkForceDeactivate(args.dt) -- force deactivation | ||
end | ||
end | ||
|
||
function attemptActivation() | ||
if not self.active then | ||
activate() | ||
elseif self.active then | ||
deactivate() | ||
if not self.forceTimer then | ||
self.forceTimer = 0 | ||
end | ||
end | ||
end | ||
|
||
function checkForceDeactivate(dt) | ||
if self.forceTimer then | ||
self.forceTimer = self.forceTimer + dt | ||
if self.forceTimer >= self.forceDeactivateTime then | ||
deactivate() | ||
self.forceTimer = nil | ||
else | ||
attemptActivation() | ||
end | ||
return true | ||
else | ||
return false | ||
end | ||
end | ||
|
||
function activate() | ||
if not self.active then | ||
animator.playSound("activate") | ||
end | ||
self.active = true | ||
end | ||
|
||
function deactivate() | ||
if self.active then | ||
status.clearPersistentEffects("glide") | ||
animator.setParticleEmitterActive("feathers", false) | ||
self.boostSpeed = 8 | ||
status.addEphemeralEffects{{effect = "nofalldamage", duration = 2}} | ||
end | ||
self.active = false | ||
end |