mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-04 05:13:19 +00:00
Move scripts to files, to make automated overriding easier
This commit is contained in:
parent
373ccff7e4
commit
96195219e8
782 changed files with 0 additions and 0 deletions
113
files/scripts/include/collectiblecostumetemplate.lua
Normal file
113
files/scripts/include/collectiblecostumetemplate.lua
Normal file
|
@ -0,0 +1,113 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
|
||||
-- generic collectible costume
|
||||
|
||||
dofile("scripts/include/collectibletemplate.lua")
|
||||
|
||||
v.on = false
|
||||
v.cname = ""
|
||||
|
||||
function v.commonInit2(me, gfx, flag, costumeName)
|
||||
v.commonInit(me, gfx, flag, true)
|
||||
v.cname = costumeName
|
||||
entity_setEntityLayer(me, -1)
|
||||
|
||||
-- cached now
|
||||
loadSound("ChangeClothes1")
|
||||
loadSound("ChangeClothes2")
|
||||
end
|
||||
|
||||
function update(me, dt)
|
||||
v.commonUpdate(me, dt)
|
||||
|
||||
if entity_isState(me, STATE_COLLECTEDINHOUSE) then
|
||||
if getCostume() == v.cname then
|
||||
if v.on then
|
||||
entity_alpha(me, 0.5)
|
||||
v.on = false
|
||||
end
|
||||
else
|
||||
if not v.on then
|
||||
entity_alpha(me, 1)
|
||||
v.on = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function enterState(me, state)
|
||||
v.commonEnterState(me, state)
|
||||
if entity_isState(me, STATE_COLLECTEDINHOUSE) then
|
||||
entity_setActivation(me, AT_CLICK, 32, 700)
|
||||
end
|
||||
end
|
||||
|
||||
function activate(me)
|
||||
if entity_isState(me, STATE_COLLECTEDINHOUSE) then
|
||||
-- go to changing area
|
||||
|
||||
if not isForm(FORM_NORMAL) then
|
||||
changeForm(FORM_NORMAL)
|
||||
end
|
||||
local node = getNode("CHANGE")
|
||||
avatar_fallOffWall()
|
||||
watch(0.5)
|
||||
entity_swimToNode(getNaija(), node)
|
||||
entity_watchForPath(getNaija())
|
||||
entity_idle(getNaija())
|
||||
entity_setColor(getNaija(), 0.01, 0.01, 0.01, 1)
|
||||
watch(0.5)
|
||||
|
||||
entity_animate(getNaija(), "changeCostume")
|
||||
watch(1)
|
||||
playSfx("ChangeClothes1")
|
||||
watch(1)
|
||||
playSfx("ChangeClothes2")
|
||||
watch(1.2)
|
||||
|
||||
watch(0.6)
|
||||
playSfx("ChangeClothes1")
|
||||
if getCostume() == v.cname then
|
||||
setCostume("")
|
||||
else
|
||||
setCostume(v.cname)
|
||||
end
|
||||
while entity_isAnimating(getNaija()) do
|
||||
watch(FRAME_TIME)
|
||||
end
|
||||
|
||||
watch(0.5)
|
||||
-- change
|
||||
|
||||
--watch(0.5)
|
||||
entity_setColor(getNaija(), 1, 1, 1, 0.5)
|
||||
entity_swimToNode(getNaija(), getNode("CHANGEEXIT"))
|
||||
entity_watchForPath(getNaija())
|
||||
if chance(50) then
|
||||
emote(EMOTE_NAIJAGIGGLE)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function exitState(me, state)
|
||||
v.commonExitState(me, state)
|
||||
end
|
135
files/scripts/include/collectibletemplate.lua
Normal file
135
files/scripts/include/collectibletemplate.lua
Normal file
|
@ -0,0 +1,135 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
-- COLLECTIBLE ITEM
|
||||
|
||||
v.myFlag = 0
|
||||
v.back = false
|
||||
|
||||
v.isCostume = false
|
||||
|
||||
function v.commonInit(me, gfx, flag, cst)
|
||||
v.myFlag = flag
|
||||
setupEntity(me, gfx)
|
||||
debugLog("in common init")
|
||||
if isFlag(flag, 1) then
|
||||
debugLog("setting state collected")
|
||||
entity_setState(me, STATE_COLLECTED)
|
||||
entity_alpha(me, 0, 0)
|
||||
end
|
||||
|
||||
local nd = entity_getNearestNode(me, "layerback")
|
||||
if nd ~= 0 and node_isEntityIn(nd, me) then
|
||||
entity_setEntityLayer(me, -1)
|
||||
v.back = true
|
||||
end
|
||||
|
||||
v.isCostume = cst or false
|
||||
end
|
||||
|
||||
function v.commonUpdate(me, dt)
|
||||
if entity_isState(me, STATE_IDLE) then
|
||||
if v.back then
|
||||
local e = getFirstEntity()
|
||||
while e ~= 0 do
|
||||
if eisv(e, EV_TYPEID, EVT_ROCK) then
|
||||
if entity_isEntityInRange(me, e, 64) then
|
||||
return
|
||||
end
|
||||
end
|
||||
e = getNextEntity()
|
||||
end
|
||||
end
|
||||
if entity_isEntityInRange(me, getNaija(), 96) then
|
||||
entity_setState(me, STATE_COLLECT, 6)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
v.incut = false
|
||||
|
||||
function v.commonEnterState(me, state)
|
||||
if v.incut then return end
|
||||
|
||||
if entity_isState(me, STATE_COLLECT) then
|
||||
v.incut = true
|
||||
entity_idle(getNaija())
|
||||
entity_flipToEntity(getNaija(), me)
|
||||
cam_toEntity(me)
|
||||
|
||||
overrideZoom(1.2, 7)
|
||||
musicVolume(0.1, 3)
|
||||
|
||||
setSceneColor(1, 0.9, 0.5, 3)
|
||||
|
||||
spawnParticleEffect("treasure-glow", entity_x(me), entity_y(me))
|
||||
|
||||
playSfx("low-note1", 0, 0.4)
|
||||
playSfx("low-note5", 0, 0.4)
|
||||
watch(3)
|
||||
|
||||
setFlag(v.myFlag, 1)
|
||||
entity_setPosition(me, entity_x(me), entity_y(me)-100, 3, 0, 0, 1)
|
||||
entity_scale(me, 1.2, 1.2, 3)
|
||||
--playSfx("secret")
|
||||
playSfx("Collectible")
|
||||
|
||||
|
||||
watch(3)
|
||||
|
||||
playSfx("secret", 0, 0.5)
|
||||
cam_toEntity(getNaija())
|
||||
|
||||
musicVolume(1, 2)
|
||||
|
||||
setSceneColor(1, 1, 1, 1)
|
||||
|
||||
overrideZoom(0)
|
||||
|
||||
if v.isCostume then
|
||||
setControlHint(getStringBank(224), 0, 0, 0, 8, "gui/icon-treasures")
|
||||
else
|
||||
if isFlag(FLAG_HINT_COLLECTIBLE, 0) then
|
||||
setControlHint(getStringBank(222), 0, 0, 0, 8)
|
||||
setFlag(FLAG_HINT_COLLECTIBLE, 1)
|
||||
else
|
||||
setControlHint(getStringBank(223), 0, 0, 0, 8, "gui/icon-treasures")
|
||||
end
|
||||
end
|
||||
v.incut = false
|
||||
elseif entity_isState(me, STATE_COLLECTED) then
|
||||
debugLog("COLLECTED, fading OUT alpha")
|
||||
entity_alpha(me, 0, 1)
|
||||
elseif entity_isState(me, STATE_COLLECTEDINHOUSE) then
|
||||
debugLog("COLLECTEDINHOUSE.. fading IN")
|
||||
entity_alpha(me, 1, 0.1)
|
||||
end
|
||||
end
|
||||
|
||||
function v.commonExitState(me, state)
|
||||
if entity_isState(me, STATE_COLLECT) then
|
||||
entity_alpha(me, 0, 1)
|
||||
spawnParticleEffect("Collect", entity_x(me), entity_y(me))
|
||||
--clearControlHint()
|
||||
entity_setState(me, STATE_COLLECTED)
|
||||
end
|
||||
end
|
81
files/scripts/include/energyslottemplate.lua
Normal file
81
files/scripts/include/energyslottemplate.lua
Normal file
|
@ -0,0 +1,81 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
|
||||
local chargeIDOffset = 5000
|
||||
|
||||
function init(me)
|
||||
node_setCursorActivation(me, false)
|
||||
if getFlag(v.flag) > 0 then
|
||||
local charged = true
|
||||
local id = getFlag(v.flag)
|
||||
if id > chargeIDOffset then
|
||||
charged = false
|
||||
id = id - chargeIDOffset
|
||||
end
|
||||
--[[
|
||||
if getFlag(chargeFlag) == 0 then
|
||||
charged = false
|
||||
end
|
||||
]]--
|
||||
|
||||
v.orbHolder = getEntityByID(v.holderID)
|
||||
v.energyOrb = getEntityByID(id)
|
||||
if v.energyOrb ~= 0 and v.orbHolder ~= 0 then
|
||||
--debugLog(string.format("%s : setting orb to %d, %d", node_getName(me), entity_x(v.orbHolder), entity_y(v.orbHolder)))
|
||||
entity_setPosition(v.energyOrb, entity_x(v.orbHolder), entity_y(v.orbHolder))
|
||||
if charged then
|
||||
entity_setState(v.energyOrb, STATE_CHARGED)
|
||||
end
|
||||
end
|
||||
if charged then
|
||||
v.door = getEntityByID(v.doorID)
|
||||
if v.door ~= 0 then
|
||||
entity_setState(v.door, STATE_OPENED)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function activate(me)
|
||||
if getFlag(v.flag) == 0 or getFlag(v.flag) >= chargeIDOffset then
|
||||
v.energyOrb = node_getNearestEntity(me, "EnergyOrb")
|
||||
if v.energyOrb ~= 0 then
|
||||
if entity_isState(v.energyOrb, STATE_CHARGED) then
|
||||
debugLog("Saving orb in slot, charged")
|
||||
setFlag(v.flag, entity_getID(v.energyOrb))
|
||||
v.door = getEntityByID(v.doorID)
|
||||
if v.door ~= 0 then
|
||||
entity_setState(v.door, STATE_OPEN)
|
||||
else
|
||||
debugLog("COULD NOT FIND DOOR")
|
||||
end
|
||||
else
|
||||
debugLog("Saving orb in slot, not charged")
|
||||
setFlag(v.flag, entity_getID(v.energyOrb)+chargeIDOffset)
|
||||
end
|
||||
else
|
||||
debugLog("Could not find orb")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function update(me, dt)
|
||||
end
|
195
files/scripts/include/healthupgradetemplate.lua
Normal file
195
files/scripts/include/healthupgradetemplate.lua
Normal file
|
@ -0,0 +1,195 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
local NOTE_TIME = 2.5
|
||||
|
||||
v.myNote = 0
|
||||
v.timingNote = false
|
||||
v.noteTimer = 0
|
||||
v.core = 0
|
||||
v.shell1 = 0
|
||||
v.shell2 = 0
|
||||
v.glow = 0
|
||||
|
||||
v.myID = 0
|
||||
|
||||
local STATE_SHAKE = 1000
|
||||
|
||||
local function glowNormal(me)
|
||||
bone_alpha(v.glow, 0.3)
|
||||
bone_alpha(v.glow, 0.4, 1, -1, 1, 1)
|
||||
bone_scale(v.glow, 6, 6)
|
||||
bone_scale(v.glow, 8, 8, 1, -1, 1, 1)
|
||||
end
|
||||
|
||||
local function glowSinging(me)
|
||||
bone_alpha(v.glow, 0.5)
|
||||
bone_alpha(v.glow, 0.7, 0.2, -1, 1, 1)
|
||||
|
||||
bone_scale(v.glow, 6, 6)
|
||||
bone_scale(v.glow, 24, 24, 0.2, -1, 1, 1)
|
||||
end
|
||||
|
||||
function v.commonInit(me, id)
|
||||
-- set color based on note
|
||||
setupEntity(me, "", "")
|
||||
entity_setEntityType(me, ET_NEUTRAL)
|
||||
entity_initSkeletal(me, "HealthUpgrade")
|
||||
|
||||
|
||||
v.core = entity_getBoneByName(me, "Core")
|
||||
v.shell1 = entity_getBoneByName(me, "Shell1")
|
||||
v.shell2 = entity_getBoneByName(me, "Shell2")
|
||||
v.glow = entity_getBoneByName(me, "Glow")
|
||||
|
||||
if id == 0 then
|
||||
v.myNote = 0
|
||||
elseif id == 1 then
|
||||
v.myNote = 2
|
||||
elseif id == 2 then
|
||||
v.myNote = 4
|
||||
elseif id == 3 then
|
||||
v.myNote = 6
|
||||
elseif id == 4 then
|
||||
v.myNote = 1
|
||||
end
|
||||
|
||||
v.myID = id
|
||||
|
||||
bone_setColor(v.core, getNoteColor(v.myNote))
|
||||
bone_setColor(v.shell1, getNoteColor(v.myNote))
|
||||
bone_setColor(v.shell2, getNoteColor(v.myNote))
|
||||
|
||||
bone_setBlendType(v.glow, BLEND_ADD)
|
||||
bone_setColor(v.glow, getNoteColor(v.myNote))
|
||||
|
||||
glowNormal(me)
|
||||
|
||||
|
||||
entity_scale(me, 0.6, 0.6)
|
||||
|
||||
entity_setState(me, STATE_IDLE)
|
||||
|
||||
entity_setEntityLayer(me, -1)
|
||||
|
||||
entity_setAllDamageTargets(me, false)
|
||||
end
|
||||
|
||||
function postInit(me)
|
||||
--if entity_isFlag(me, 1) then
|
||||
if isFlag(FLAG_HEALTHUPGRADES + v.myID, 1) then
|
||||
entity_delete(me)
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
||||
v.incut = false
|
||||
|
||||
function update(me, dt)
|
||||
if v.incut then return end
|
||||
|
||||
if entity_isState(me, STATE_OPENED) then
|
||||
if entity_isEntityInRange(me, getNaija(), 64) then
|
||||
v.incut = true
|
||||
playSfx("HealthUpgrade-Collect")
|
||||
spawnParticleEffect("HealthUpgradeReceived", entity_getPosition(me))
|
||||
setFlag(FLAG_HEALTHUPGRADES + v.myID, 1)
|
||||
upgradeHealth()
|
||||
setSceneColor(1, 1, 1, 4)
|
||||
entity_idle(getNaija())
|
||||
watch(3)
|
||||
|
||||
if isFlag(FLAG_FIRSTHEALTHUPGRADE, 0) then
|
||||
voice("Naija_HealthUpgrade")
|
||||
setFlag(FLAG_FIRSTHEALTHUPGRADE, 1)
|
||||
else
|
||||
voice("naija_healthupgrade2")
|
||||
end
|
||||
entity_delete(me)
|
||||
end
|
||||
elseif entity_isState(me, STATE_OPEN) and not entity_isAnimating(me) then
|
||||
entity_setState(me, STATE_OPENED)
|
||||
else
|
||||
if v.timingNote then
|
||||
v.noteTimer = v.noteTimer + dt
|
||||
if v.noteTimer > NOTE_TIME then
|
||||
v.noteTimer = 0
|
||||
v.timingNote = false
|
||||
entity_setState(me, STATE_OPEN)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function songNote(me, note)
|
||||
if entity_getAlpha(me) < 1 then return end
|
||||
if entity_isState(me, STATE_OPEN) or entity_isState(me, STATE_OPENED) then return end
|
||||
if note == v.myNote then
|
||||
entity_setState(me, STATE_SHAKE)
|
||||
v.timingNote = true
|
||||
v.noteTimer = 0
|
||||
else
|
||||
v.timingNote = false
|
||||
end
|
||||
v.timer = 0
|
||||
end
|
||||
|
||||
function songNoteDone(me, note, len)
|
||||
if entity_isState(me, STATE_OPEN) or entity_isState(me, STATE_OPENED) then return end
|
||||
if v.timingNote and note == v.myNote then
|
||||
if not entity_isState(me, STATE_OPEN) then
|
||||
entity_setState(me, STATE_IDLE)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function enterState(me, state)
|
||||
--debugLog("HU enterState!")
|
||||
if entity_isState(me, STATE_IDLE) then
|
||||
if v.shell1 ~= 0 and v.shell2 ~= 0 then
|
||||
bone_alpha(v.shell1, 0)
|
||||
bone_alpha(v.shell2, 0)
|
||||
end
|
||||
v.timingNote = false
|
||||
v.noteTimer = 0
|
||||
entity_animate(me, "idle", LOOP_INF)
|
||||
|
||||
glowNormal(me)
|
||||
elseif entity_isState(me, STATE_SHAKE) then
|
||||
glowSinging(me)
|
||||
entity_animate(me, "shake", LOOP_INF)
|
||||
elseif entity_isState(me, STATE_OPEN) then
|
||||
bone_alpha(v.core, 0.01, 0.5)
|
||||
bone_alpha(v.shell1, 1, 0.1)
|
||||
bone_alpha(v.shell2, 1, 0.1)
|
||||
entity_animate(me, "open")
|
||||
|
||||
local r, g, b = getNoteColor(v.myNote)
|
||||
setSceneColor(r, g, b, 2)
|
||||
|
||||
playSfx(getNoteName(v.myNote, "low-"))
|
||||
end
|
||||
end
|
||||
|
||||
function exitState(me, state)
|
||||
end
|
||||
|
33
files/scripts/include/nodecollectibletemplate.lua
Normal file
33
files/scripts/include/nodecollectibletemplate.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
function v.commonInit(me, object, flag)
|
||||
if isFlag(flag, 1) then
|
||||
debugLog("CollectibleNode: Creating object")
|
||||
debugLog(object)
|
||||
local collectible = createEntity(object, "", node_x(me), node_y(me))
|
||||
debugLog("seting state to inhouse")
|
||||
entity_setState(collectible, STATE_COLLECTEDINHOUSE)
|
||||
else
|
||||
debugLog("CollectibleNode: Flag not set")
|
||||
end
|
||||
end
|
100
files/scripts/include/rocktemplate.lua
Normal file
100
files/scripts/include/rocktemplate.lua
Normal file
|
@ -0,0 +1,100 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
v.n = 0
|
||||
v.myWeight = 0
|
||||
function v.commonInit(me, gfx, r)
|
||||
-- note: if you want to add different weight to each rock, then
|
||||
-- send it through here
|
||||
if r == 0 then
|
||||
r = 80
|
||||
end
|
||||
setupEntity(me, gfx, -1)
|
||||
entity_setProperty(me, EP_MOVABLE, true)
|
||||
entity_setProperty(me, EP_BLOCKER, true)
|
||||
v.myWeight = 400
|
||||
entity_setCollideRadius(me, r)
|
||||
entity_setBounce(me, 0.2)
|
||||
entity_setCanLeaveWater(me, true)
|
||||
|
||||
entity_setAllDamageTargets(me, false)
|
||||
|
||||
esetv(me, EV_TYPEID, EVT_ROCK)
|
||||
end
|
||||
|
||||
function postInit(me)
|
||||
v.n = getNaija()
|
||||
end
|
||||
|
||||
function v.commonUpdate(me, dt)
|
||||
|
||||
--entity_updateCurrents(me)
|
||||
entity_updateMovement(me, dt)
|
||||
|
||||
if entity_checkSplash(me) then
|
||||
end
|
||||
if not entity_isUnderWater(me) then
|
||||
if not entity_isBeingPulled(me) then
|
||||
entity_setWeight(me, v.myWeight*2)
|
||||
entity_setMaxSpeedLerp(me, 5, 0.1)
|
||||
end
|
||||
else
|
||||
entity_setMaxSpeedLerp(me, 1, 0.1)
|
||||
entity_setWeight(me, v.myWeight)
|
||||
end
|
||||
|
||||
|
||||
if not entity_isBeingPulled(me) then
|
||||
if entity_touchAvatarDamage(me, entity_getCollideRadius(me), 0) then
|
||||
if avatar_isBursting() and entity_setBoneLock(v.n, me) then
|
||||
-- yay!
|
||||
else
|
||||
--[[
|
||||
x, y = entity_getVectorToEntity(me, v.n, 1000)
|
||||
entity_addVel(n, x, y)
|
||||
]]--
|
||||
end
|
||||
end
|
||||
else
|
||||
if entity_getBoneLockEntity(v.n) == me then
|
||||
avatar_fallOffWall()
|
||||
end
|
||||
end
|
||||
|
||||
entity_handleShotCollisions(me)
|
||||
end
|
||||
|
||||
function damage(me, attacker, bone, damageType, dmg)
|
||||
return false
|
||||
end
|
||||
|
||||
function enterState(me)
|
||||
end
|
||||
|
||||
function exitState(me)
|
||||
end
|
||||
|
||||
function hitSurface(me)
|
||||
end
|
||||
|
||||
function activate(me)
|
||||
end
|
86
files/scripts/include/sealtemplate.lua
Normal file
86
files/scripts/include/sealtemplate.lua
Normal file
|
@ -0,0 +1,86 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
v.flag = 0
|
||||
v.node = 0
|
||||
v.gfx = ""
|
||||
function v.commonInit(me, g, f)
|
||||
v.gfx = g
|
||||
v.flag = f
|
||||
setupEntity(me, v.gfx)
|
||||
entity_setEntityType(me, ET_NEUTRAL)
|
||||
--[[
|
||||
if not isFlag(v.flag, 0) then
|
||||
entity_alpha(me, 0)
|
||||
end
|
||||
]]--
|
||||
entity_setWeight(me, 200)
|
||||
if isFlag(v.flag, 0) then
|
||||
debugLog("SETTING MOVABLE to TRUE")
|
||||
entity_setProperty(me, EP_MOVABLE, true)
|
||||
else
|
||||
entity_setProperty(me, EP_MOVABLE, false)
|
||||
end
|
||||
--entity_setActivation(me, AT_CLICK, 512, 32)
|
||||
end
|
||||
|
||||
function hitSurface(me)
|
||||
end
|
||||
|
||||
function update(me, dt)
|
||||
if v.node == 0 then
|
||||
v.node = entity_getNearestNode(me, v.gfx)
|
||||
end
|
||||
if isFlag(v.flag, 0) then
|
||||
entity_updateMovement(me, dt)
|
||||
local x = node_x(v.node)
|
||||
local y = node_y(v.node)
|
||||
--debugLog(string.format("node(%d, %d)", x, y))
|
||||
if entity_isPositionInRange(me, x, y, 64) then
|
||||
--debugLog("IN RANGE!")
|
||||
entity_stopPull(me)
|
||||
entity_setProperty(me, EP_MOVABLE, false)
|
||||
setFlag(v.flag, 1)
|
||||
end
|
||||
else
|
||||
entity_setPosition(me, node_x(v.node), node_y(v.node))
|
||||
end
|
||||
end
|
||||
|
||||
function activate(me)
|
||||
--[[
|
||||
if isFlag(v.flag, 0) then
|
||||
entity_alpha(me, 0, 1)
|
||||
spawnParticleEffect("Collect", entity_x(me), entity_y(me))
|
||||
setFlag(v.flag, 1)
|
||||
entity_setActivation(me, AT_NONE)
|
||||
end
|
||||
]]--
|
||||
end
|
||||
|
||||
function enterState(me, state)
|
||||
end
|
||||
|
||||
function exitState(me, state)
|
||||
end
|
||||
|
||||
|
92
files/scripts/include/sporechildflowertemplate.lua
Normal file
92
files/scripts/include/sporechildflowertemplate.lua
Normal file
|
@ -0,0 +1,92 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
v.openTimer = 8
|
||||
|
||||
function v.commonInit(me, gfx)
|
||||
setupEntity(me)
|
||||
entity_setEntityType(me, ET_ENEMY)
|
||||
entity_setName(me, "SporeChildFlower")
|
||||
entity_initSkeletal(me, gfx)
|
||||
entity_setState(me, STATE_IDLE)
|
||||
--entity_setDamageTarget(me, DT_AVATAR_NATURE, true)
|
||||
entity_setAllDamageTargets(me, false)
|
||||
--entity_setDamageTarget(me, DT_AVATAR_ENERGYBLAST, false)
|
||||
entity_setDamageTarget(me, DT_AVATAR_NATURE, true)
|
||||
entity_setCullRadius(me, 1024)
|
||||
end
|
||||
|
||||
function postInit(me)
|
||||
end
|
||||
|
||||
function v.commonUpdate(me, dt)
|
||||
if entity_isState(me, STATE_OPEN) and not entity_isAnimating(me) then
|
||||
entity_setState(me, STATE_OPENED)
|
||||
end
|
||||
if entity_isState(me, STATE_CLOSE) and not entity_isAnimating(me) then
|
||||
entity_setState(me, STATE_CLOSED)
|
||||
end
|
||||
end
|
||||
|
||||
function songNote(me, note)
|
||||
--[[
|
||||
if entity_isState(me, STATE_IDLE) then
|
||||
entity_setState(me, STATE_OPEN)
|
||||
end
|
||||
]]--
|
||||
end
|
||||
|
||||
function sporesDropped(me, x, y)
|
||||
if entity_isState(me, STATE_IDLE) or entity_isState(me, STATE_CLOSED) then
|
||||
if entity_isPositionInRange(me, x, y, 128) then
|
||||
entity_setState(me, STATE_OPEN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function damage(me, attacker, bone, damageType, dmg)
|
||||
--[[
|
||||
if damageType == DT_AVATAR_NATURE then
|
||||
if entity_isState(me, STATE_IDLE) then
|
||||
entity_setState(me, STATE_OPEN)
|
||||
end
|
||||
return false
|
||||
end
|
||||
]]--
|
||||
return false
|
||||
end
|
||||
|
||||
function songNoteDone(me, note, len)
|
||||
end
|
||||
|
||||
function v.commonEnterState(me, state)
|
||||
if entity_isState(me, STATE_OPEN) then
|
||||
playSfx("plant-open")
|
||||
entity_animate(me, "open")
|
||||
elseif entity_isState(me, STATE_CLOSE) then
|
||||
entity_animate(me, "close")
|
||||
end
|
||||
end
|
||||
|
||||
function exitState(me, state)
|
||||
end
|
||||
|
58
files/scripts/include/sporefungus.lua
Normal file
58
files/scripts/include/sporefungus.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
-- Copyright (C) 2007, 2010 - Bit-Blot
|
||||
--
|
||||
-- This file is part of Aquaria.
|
||||
--
|
||||
-- Aquaria is free software; you can redistribute it and/or
|
||||
-- modify it under the terms of the GNU General Public License
|
||||
-- as published by the Free Software Foundation; either version 2
|
||||
-- of the License, or (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
--
|
||||
-- See the GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
if not v then v = {} end
|
||||
if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end
|
||||
|
||||
v.delayMax = 2
|
||||
v.delay = v.delayMax
|
||||
|
||||
function v.commonInit(me, gfx)
|
||||
setupBasicEntity(me,
|
||||
0, -- texture
|
||||
12, -- health
|
||||
2, -- manaballamount
|
||||
2, -- exp
|
||||
1, -- money
|
||||
0, -- collideRadius (for hitting entities + spells)
|
||||
STATE_IDLE, -- initState
|
||||
128, -- sprite width
|
||||
128, -- sprite height
|
||||
1, -- particle "explosion" type, maps to particleEffects.txt -1 = none
|
||||
1, -- 0/1 hit other entities off/on (uses collideRadius)
|
||||
4000 -- updateCull -1: disabled, default: 4000
|
||||
)
|
||||
entity_setTexture(me, gfx)
|
||||
entity_setWidth(me, 128)
|
||||
entity_setHeight(me, 128)
|
||||
entity_setAllDamageTargets(me, false)
|
||||
end
|
||||
|
||||
function update(me, dt)
|
||||
v.delay = v.delay - dt
|
||||
if v.delay < 0 then
|
||||
v.delay = v.delayMax
|
||||
entity_fireGas(me, 96, 2.1, 0.5, "Gas", 0, 0.8, 0.6, 0, -128, 3)
|
||||
end
|
||||
end
|
||||
|
||||
function damage(me, attacker, bone, damageType, dmg)
|
||||
return false
|
||||
end
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue