饥荒代码actions.lua_第1页
饥荒代码actions.lua_第2页
饥荒代码actions.lua_第3页
饥荒代码actions.lua_第4页
饥荒代码actions.lua_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

require class require bufferedaction Action Class function self priority instant rmb distance self priority priority or 0 self fn function return false end self strfn nil self testfn nil self instant instant or false self rmb rmb or nil self distance distance or nil end ACTIONS REPAIR Action READ 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 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 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 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 MODE Action 1 for k v in pairs ACTIONS do v str STRINGS ACTIONS k or ACTION v id k end set up the action functions ACTIONS EAT fn function act local obj act target or act invobject if ponents eater and obj and ponents edible then return ponents eater Eat obj end end ACTIONS STEAL fn function act local obj act target local attack false if act attack then attack act attack end if ponents inventoryitem and ponents inventoryitem IsHeld then return ponents thief StealItem ponents inventoryitem owner obj attack end end ACTIONS MAKEBALLOON fn function act if act doer and act invobject and ponents balloonmaker then if ponents sanity then ponents sanity DoDelta TUNING SANITY TINY end local x y z act doer Transform GetWorldPosition local angle TheCamera headingtarget math random 10 DEGREES 5 DEGREES x x 5 math cos angle z z 5 math sin angle ponents balloonmaker MakeBalloon x y z end return true end ACTIONS EQUIP fn function act if ponents inventory then return ponents inventory Equip act invobject end end ACTIONS UNEQUIP fn function act if ponents inventory and act invobject and ponents inventoryitem cangoincontainer then ponents inventory GiveItem act invobject return ponents inventory Unequip act invobject return true elseif ponents inventory and act invobject and not ponents inventoryitem cangoincontainer then ponents inventory DropItem act invobject true true return true end end ACTIONS PICKUP fn function act if ponents inventory and act target and ponents inventoryitem and not act target IsInLimbo then act doer PushEvent onpickup item act target special case for trying to carry two backpacks if not ponents inventoryitem cangoincontainer and ponents equippable and ponents inventory GetEquippedItem ponents equippable equipslot then local item ponents inventory GetEquippedItem ponents equippable equipslot if ponents inventoryitem and ponents inventoryitem cangoincontainer then ponents inventory SelectActiveItemFromEquipSlot ponents equippable e quipslot ponents inventory GiveItem ponents inventory Unequip p onents equippable equipslot else ponents inventory DropItem ponents inventory GetEquippedItem act tar ponents equippable equipslot end ponents inventory Equip act target return true end if act doer HasTag player and ponents equippable and not ponents inventory GetEquippedItem ponents equippable equipslot then ponents inventory Equip act target else ponents inventory GiveItem act target nil Vector3 TheSim GetScreenPos act target Transform GetWorldPosition end return true end end ACTIONS REPAIR fn function act if act target and ponents repairable and act invobject and ponents repairer then return ponents repairable Repair act doer act invobject end end ACTIONS SEW fn function act if act target and ponents fueled and act invobject and ponents sewing then return ponents sewing DoSewing act target act doer end end ACTIONS RUMMAGE fn function act local targ act target or act invobject if act doer HUD and ponents container then if ponents container IsOpen then ponents container Close act doer else ponents container Open act doer end return true end end ACTIONS RUMMAGE strfn function act local targ act target or act invobject if targ and ponents container and ponents container IsOpen then return CLOSE end end ACTIONS DROP fn function act if ponents inventory then local wholestack act options wholestack if act invobject and ponents stackable and ponents stackable forcedropsingle then wholestack false end return ponents inventory DropItem act invobject wholestack false act pos end end ACTIONS DROP strfn function act if act invobject and ponents trap then return SETTRAP elseif act invobject and act invobject HasTag mine then return SETMINE elseif act invobject and act invobject prefab pumpkin lantern then return PLACELANTERN end end ACTIONS LOOKAT fn function act local targ act target or act invobject if targ and ponents inspectable then local desc ponents inspectable GetDescription act doer if desc then ponents locomotor Stop ponents talker Say desc 2 5 ponents inspectable noanim return true end end end ACTIONS READ fn function act local targ act target or act invobject if targ and ponents book and act doer and ponents reader then return ponents reader Read targ end end ACTIONS TALKTO fn function act local targ act target or act invobject if targ and ponents talkable then ponents locomotor Stop if ponents maxwelltalker then if not ponents maxwelltalker IsTalking then act target PushEvent talkedto act target task act target StartThread function ponents maxwelltalker DoTalk act target end end end return true end end ACTIONS BAIT fn function act if ponents trap then ponents trap SetBait ponents inventory RemoveItem act invobject return true end end ACTIONS DEPLOY fn function act if act invobject and ponents deployable and ponents deployable CanDeploy act pos then local container ponents inventoryitem and ponents inventoryitem GetContainer local obj container and container RemoveItem act invobject or act invobject if obj then if ponents deployable Deploy act pos act doer then return true elseif container then container GiveItem obj else ponents inventory GiveItem obj end end end end ACTIONS DEPLOY strfn function act if act invobject and act invobject HasTag groundtile then return GROUNDTILE elseif act invobject and act invobject HasTag wallbuilder then return WALL elseif act invobject and act invobject HasTag eyeturret then return TURRET end end ACTIONS CHECKTRAP fn function act if ponents trap then ponents trap Harvest act doer return true end end ACTIONS CHOP fn function act if ponents workable and ponents workable action ACTIONS CHOP then local numworks 1 if act invobject and ponents tool then numworks ponents tool GetEffectiveness ACTIONS CHOP elseif act doer and ponents worker then numworks ponents worker GetEffectiveness ACTIONS CHOP end ponents workable WorkedBy act doer numworks end return true end ACTIONS FERTILIZE fn function act if ponents crop and not ponents crop IsReadyForHarvest and act invobject and ponents fertilizer then local obj ponents inventory RemoveItem act invobject if ponents crop Fertilize obj then return true else ponents inventory GiveItem obj return false end elseif ponents grower and ponents grower IsEmpty and act invobject and ponents fertilizer then local obj ponents inventory RemoveItem act invobject ponents grower Fertilize obj return true elseif ponents pickable and ponents pickable CanBeFertilized and act invobject and ponents fertilizer then local obj ponents inventory RemoveItem act invobject ponents pickable Fertilize obj return true end end ACTIONS MINE fn function act if ponents workable and ponents workable action ACTIONS MINE then local numworks 1 if act invobject and ponents tool then numworks ponents tool GetEffectiveness ACTIONS MINE elseif act doer and ponents worker then numworks ponents worker GetEffectiveness ACTIONS MINE end ponents workable WorkedBy act doer numworks end return true end ACTIONS HAMMER fn function act if ponents workable and ponents workable action ACTIONS HAMMER then local numworks 1 if act invobject and ponents tool then numworks ponents tool GetEffectiveness ACTIONS HAMMER elseif act doer and ponents worker then numworks ponents worker GetEffectiveness ACTIONS HAMMER end ponents workable WorkedBy act doer numworks end return true end ACTIONS NET fn function act if ponents workable and ponents workable action ACTIONS NET then ponents workable WorkedBy act doer end return true end ACTIONS CATCH fn function act if ponents catcher then ponents catcher PrepareToCatch elseif ponents catcher then ponents catcher PrepareToCatch end return true end ACTIONS FISH fn function act local fishingrod ponents fishingrod if fishingrod then fishingrod StartFishing act target act doer end return true end ACTIONS REEL fn function act local fishingrod ponents fishingrod if fishingrod and fishingrod IsFishing then if fishingrod HasHookedFish then fishingrod Reel elseif fishingrod FishIsBiting then fishingrod Hook else fishingrod StopFishing end end return true end ACTIONS REEL strfn function act local fishingrod ponents fishingrod if fishingrod and fishingrod IsFishing then if fishingrod HasHookedFish then return REEL elseif fishingrod FishIsBiting then return HOOK else return CANCEL end end end ACTIONS DIG fn function act if ponents workable and ponents workable action ACTIONS DIG then local numworks 1 if act invobject and ponents tool then numworks ponents tool GetEffectiveness ACTIONS DIG elseif act doer and ponents worker then numworks ponents worker GetEffectiveness ACTIONS DIG end ponents workable WorkedBy act doer numworks end return true end ACTIONS PICK fn function act if ponents pickable then ponents pickable Pick act doer return true end end ACTIONS FORCEATTACK fn function act bat SetTarget act target bat ForceAttack return true end ACTIONS ATTACK fn function act if bat then bat SetTarget act target bat TryAttack return true end end ACTIONS ATTACK strfn function act local targ act target or act invobject if targ and targ HasTag smashable then return SMASHABLE end end ACTIONS COOK fn function act if ponents cooker then local ingredient ponents inventory RemoveItem act invobject if ponents health and bat then act doer PushEvent killed victim ingredient end local product ponents cooker CookItem ingredient act doer if product then ponents inventory GiveItem product nil Vector3 TheSim GetScreenPos act target Transform GetWorldPosition return true end elseif ponents stewer then ponents stewer StartCooking return true end end ACTIONS DRY fn function act if ponents dryer then local ingredient ponents inventory RemoveItem act invobject if not ponents dryer StartDrying ingredient then ponents inventory GiveItem product nil Vector3 TheSim GetScreenPos act target Transform GetWorldPosition return false end return true end end ACTIONS ADDFUEL fn function act if ponents inventory then local fuel ponents inventory RemoveItem act invobject if fuel then if ponents fueled TakeFuelItem fuel then return true else print False ponents inventory GiveItem fuel end end end end ACTIONS GIVE fn function act if ponents trader then ponents trader AcceptGift act doer act invobject return true end end ACTIONS GIVE strfn function act local targ act target or act invobject if targ and targ HasTag altar then if targ enabled then return READY else return NOTREADY end end end ACTIONS STORE fn function act if ponents container and ponents inventoryitem and ponents inventory then if not ponents container CanTakeItemInSlot act invobject then return false NOTALLOWED end local item ponents inventoryitem RemoveFromOwner ponents container acc eptsstacks if item then if not ponents inventoryitem then ponents container Open act doer end if not ponents container GiveItem item nil nil false then if TheInput ControllerAttached then ponents inventory GiveItem item else ponents inventory GiveActiveItem item end return false end return true end elseif ponents occupiable and act invobject and ponents occupier and ponents occupiable CanOccupy act invobject then local item ponents inventoryitem RemoveFromOwner return ponents occupiable Occupy item end end ACTIONS STORE strfn function act if act target and ponents stewer then return COOK elseif act target and ponents occupiable then return IMPRISON end end ACTIONS BUILD fn function act if ponents builder then if ponents builder DoBuild act recipe act pos then return true end end end ACTIONS PLANT fn function act if ponents inventory then local seed ponents inventory RemoveItem act invobject if seed then if ponents grower PlantItem seed then return true else ponents inventory GiveItem seed end end end end ACTIONS HARVEST fn function act if ponents crop then return ponents crop Harvest act doer elseif ponents harvestable then return ponents harvestable Harvest act doer elseif ponents stewer then return ponents stewer Harvest act doer elseif ponents dryer then return ponents dryer Harvest act doer elseif ponents occupiable and ponents occupiable IsOccupied then local item ponents occupiable Harvest act doer if item then ponents inventory GiveItem item return true end end end ACTIONS HARVEST strfn function act if act target and ponents occuipable then return FREE end end ACTIONS LIGHT fn function act if act invobject and ponents lighter then ponents lighter Light act target return true end end ACTIONS SLEEPIN fn function act local bag nil if act target and ponents sleepingbag then bag act target end if act invobject and ponents sleepingbag then bag act invobject end if bag and act doer then ponents sleepingbag DoSleep act doer return true end TheFrontEnd Fade true 2 ponents sleepingbag DoSleep act doer elseif act doer and act invobject and ponents sleepingbag then return true end end ACTIONS SHAVE testfn function act if act invobject and ponents shaver then local shavee act target or act doer if shavee and ponents beard then return ponents beard ShouldTryToShave act doer act invobject end end end ACTIONS SHAVE fn function act if act invobject and ponents shaver then local shavee act target or act doer if shavee and ponents beard then return ponents beard Shave act doer act invobject end end end ACTIONS PLAY fn function act if act invobject and ponents instrument then return ponents instrument Play act doer end end ACTIONS POLLINATE fn function act if ponents pollinator then if act target then return ponents pollinator Pollinate act target else return ponents pollinator CreateFlower end end end ACTIONS TERRAFORM fn function act if act invobject and ponents terraformer then return ponents terraformer Terraform act pos end end ACTIONS EXTINGUISH fn function act if ponents burnable and ponents burnable IsBurning then if ponents fueled and not ponents fueled IsEmpty then ponents fueled ChangeSection 1 else ponents burnable Extinguish end return true end end ACTIONS LAYEGG fn function act if ponents pickable and not ponents pickable canbepicked then return ponents pickable Regen end end ACTIONS INVESTIGATE fn function act local investigatePos ponents knownlocations and ponents knownlocations GetLocation investigate if investigatePos then ponents knownlocations RememberLocation investigate nil try to get a nearby target if bat then bat TryRetarget end return true end end ACTIONS GOHOME fn function act this is gross make it better later if ponents spawner then return ponents spawner GoHome act doer elseif ponents childspawner then return ponents childspawner GoHome act doer elseif act pos then if act target then act target PushEvent onwenthome doer act doer end act doer Remove return true end end ACTIONS JUMPIN fn function act if ponents teleporter then ponents teleporter Activate act doer return true end end ACTIONS RESETMINE fn function act if ponents mine then ponents mine Reset return true end end ACTIONS ACTIVATE fn function act if ponents activatable then ponents activatable DoActivate act doer return true end end ACTIONS ACTIVATE strfn function act if ponents activatable getverb then return ponents activatable getverb act target act doer end end ACTIONS MURDER fn function act local murdered act invobject or act target if murdered and ponents health then ponents inventoryitem RemoveFromOwner true if ponents health murdersound then act doer SoundEmitter PlaySound ponents health murdersound end local stacksize 1 if ponents stackable then stacksize ponents stackable stacksize end if ponents lootdropper then for i 1 stacksize do local loots ponents lootdropper GenerateLoot for k v in pairs loots do local loot SpawnPrefab v ponents inventory GiveItem loot end end end act doer PushEvent killed victim murdered murdered Remove return true end end ACTIONS HEAL fn function act if act invobject and ponents healer then local target act target or act doer return ponents healer Heal target end end ACTIONS UNLOCK fn function act if ponents lock then if ponents lock IsLocked then ponents lock Unlock act invobject act doer else ponents lock Lock act doer end return true end end ACTIONS UNLOCK strfn function act if ponents lock and not ponents lock IsLocked then return LOCK end end ACTIONS TEACH fn function act if act invobject and ponents teacher then local target act target or act doer return ponen

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论