1-- Copyright (C) 2007, 2010 - Bit-Blot 2-- 3-- This file is part of Aquaria. 4-- 5-- Aquaria is free software; you can redistribute it and/or 6-- modify it under the terms of the GNU General Public License 7-- as published by the Free Software Foundation; either version 2 8-- of the License, or (at your option) any later version. 9-- 10-- This program is distributed in the hope that it will be useful, 11-- but WITHOUT ANY WARRANTY; without even the implied warranty of 12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13-- 14-- See the GNU General Public License for more details. 15-- 16-- You should have received a copy of the GNU General Public License 17-- along with this program; if not, write to the Free Software 18-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 20if not v then v = {} end 21if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end 22 23-- ================================================================================================ 24-- W A L K E R (alpha) 25-- ================================================================================================ 26 27-- ================================================================================================ 28-- L O C A L V A R I A B L E S 29-- ================================================================================================ 30 31v.moveTimer = 0 32v.n = 0 33 34v.seen = false 35v.sighTimer = 5 36 37-- ================================================================================================ 38-- F U N C T I O N S 39-- ================================================================================================ 40 41function init(me) 42 setupBasicEntity(me, 43 "Walker/Body", -- texture 44 123, -- health 45 4, -- manaballamount 46 0, -- exp 47 0, -- money 48 480, -- collideRadius (for hitting entities + spells) 49 STATE_IDLE, -- initState 50 512, -- sprite width 51 512, -- sprite height 52 1, -- particle "explosion" type, maps to particleEffects.txt -1 = none 53 1, -- 0/1 hit other entities off/on (uses collideRadius) 54 3210 -- updateCull -1: disabled, default: 4000 55 ) 56 57 entity_setCullRadius(me, 2048) 58 59 entity_setEntityType(me, ET_NEUTRAL) 60 entity_setDeathParticleEffect(me, "Explode") 61 62 entity_initSkeletal(me, "Walker") 63 v.bone_body = entity_getBoneByName(me, "Body") 64 entity_generateCollisionMask(me) 65 66 -- DARKEN BACK LEGS 67 local backLeg1Bottom = entity_getBoneByName(me, "BackLeg1Bottom") 68 local backLeg1Top = entity_getBoneByName(me, "BackLeg1Top") 69 local BackLeg2Bottom = entity_getBoneByName(me, "BackLeg2Bottom") 70 local backLeg2Top = entity_getBoneByName(me, "BackLeg2Top") 71 local cl = 0.64 72 bone_setColor(backLeg1Bottom, cl, cl, cl) 73 bone_setColor(backLeg1Top, cl, cl, cl) 74 bone_setColor(BackLeg2Bottom, cl, cl, cl) 75 bone_setColor(backLeg2Top, cl, cl, cl) 76 77 entity_scale(me, 1.23, 1.23) 78 79 80 entity_setDamageTarget(me, DT_AVATAR_LIZAP, false) 81 entity_setDamageTarget(me, DT_AVATAR_PET, false) 82 83 --esetv(me, EV_WALLOUT, 23) 84 --entity_clampToSurface(me) 85end 86 87function postInit(me) 88 entity_setState(me, STATE_IDLE) 89 90 v.n = getNaija() 91 92 -- FLIP WITH A FLIP NODE 93 local node = entity_getNearestNode(me, "FLIP") 94 if node ~=0 then 95 if node_isEntityIn(node, me) then 96 entity_fh(me) 97 --entity_switchSurfaceDirection(me) 98 end 99 end 100end 101 102function update(me, dt) 103 -- NAIJA ATTACHING TO BODY 104 local rideBone = entity_collideSkeletalVsCircle(me, v.n) 105 if rideBone == v.bone_body and avatar_isBursting() and entity_setBoneLock(v.n, me, rideBone) then 106 elseif rideBone ~=0 then 107 local vecX, vecY = entity_getVectorToEntity(me, v.n, 1000) 108 entity_addVel(v.n, vecX, vecY) 109 end 110 111 -- emote 112 if entity_isEntityInRange(me, v.n, 512) then 113 if not v.seen then 114 if chance(50) then 115 emote(EMOTE_NAIJAWOW) 116 else 117 emote(EMOTE_NAIJALAUGH) 118 end 119 end 120 v.seen = true 121 v.sighTimer = v.sighTimer - dt 122 if v.sighTimer < 0 then 123 emote(EMOTE_NAIJAGIGGLE) 124 v.sighTimer = 8 + math.random(4) 125 end 126 end 127 128 -- MOVEMENT 129 --entity_rotateToSurfaceNormal(me, 0.54) 130 -- COLLISIONS 131 entity_handleShotCollisionsSkeletal(me) 132end 133 134function enterState(me) 135 if entity_getState(me) == STATE_IDLE then 136 entity_animate(me, "idle", LOOP_INF) 137 end 138end 139 140function damage(me, attacker, bone, damageType, dmg) 141 playNoEffect() 142 return false 143end 144