资源描述:
《饥荒代码actions.lua》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、require"class"require"bufferedaction"Action=Class(function(self,priority,instant,rmb,distance)self.priority=priorityor0self.fn=function()returnfalseendself.strfn=nilself.testfn=nilself.instant=instantorfalseself.rmb=rmbornilself.distance=distanceornilend)ACTIONS={REPAIR=Action(),REA
2、D=Action(),DROP=Action(-1),TRAVEL=Action(),CHOP=Action(),ATTACK=Action(2,true),FORCEATTACK=Action(2,true),EAT=Action(),PICK=Action(),PICKUP=Action(1),MINE=Action(),DIG=Action(nil,nil,true),GIVE=Action(),COOK=Action(),DRY=Action(),ADDFUEL=Action(),LIGHT=Action(-4),EXTINGUISH=Action(0
3、),LOOKAT=Action(-3,true),TALKTO=Action(3,true),WALKTO=Action(-4),BAIT=Action(),CHECKTRAP=Action(2),BUILD=Action(),PLANT=Action(),HARVEST=Action(),GOHOME=Action(),SLEEPIN=Action(),EQUIP=Action(0,true),UNEQUIP=Action(-2,true),--OPEN_SHOP=Action(),SHAVE=Action(),STORE=Action(),RUMMAGE=
4、Action(-1),DEPLOY=Action(),PLAY=Action(),NET=Action(3),CATCH=Action(3,true),FISH=Action(),REEL=Action(0,true),POLLINATE=Action(),FERTILIZE=Action(),LAYEGG=Action(),HAMMER=Action(3),TERRAFORM=Action(),JUMPIN=Action(),RESETMINE=Action(3),ACTIVATE=Action(),MURDER=Action(0),HEAL=Action(
5、),INVESTIGATE=Action(),UNLOCK=Action(),TEACH=Action(),TURNON=Action(2),TURNOFF=Action(2),SEW=Action(),STEAL=Action(),USEITEM=Action(1,true),TAKEITEM=Action(),MAKEBALLOON=Action(),CASTSPELL=Action(0,false,true,20),BLINK=Action(10,false,true,36),COMBINESTACK=Action(),TOGGLE_DEPLOY_MOD
6、E=Action(1),}fork,vinpairs(ACTIONS)dov.str=STRINGS.ACTIONS[k]or"ACTION"v.id=kend----setuptheactionfunctions!ACTIONS.EAT.fn=function(act)localobj=act.targetoract.invobjectifact.doer.components.eaterandobjandobj.components.ediblethenreturnact.doer.components.eater:Eat(obj)endendACTION
7、S.STEAL.fn=function(act)localobj=act.targetlocalattack=falseifact.attackthenattack=act.attackendif(obj.components.inventoryitemandobj.components.inventoryitem:IsHeld())thenreturnact.doer.components.thief:StealItem(obj.components.inventoryitem.owner,obj,attack)endendACTIONS.MAKEBALLO
8、ON.fn=function(act)