77范文网 - 专业文章范例文档资料分享平台

饥荒代码actions.lua(4)

来源:网络收集 时间:2020-06-17 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

return true end -- TheFrontEnd:Fade(true,2) -- act.target.components.sleepingbag:DoSleep(act.doer)

-- elseif act.doer and act.invobject and act.invobject.components.sleepingbag then -- return true --end end

ACTIONS.SHAVE.testfn = function(act)

if act.invobject and act.invobject.components.shaver then local shavee = act.target or act.doer

if shavee and shavee.components.beard then

return shavee.components.beard:ShouldTryToShave(act.doer, act.invobject) end end end

ACTIONS.SHAVE.fn = function(act)

if act.invobject and act.invobject.components.shaver then local shavee = act.target or act.doer

if shavee and shavee.components.beard then

return shavee.components.beard:Shave(act.doer, act.invobject) end end end

ACTIONS.PLAY.fn = function(act)

if act.invobject and act.invobject.components.instrument then return act.invobject.components.instrument:Play(act.doer) end end

ACTIONS.POLLINATE.fn = function(act) if act.doer.components.pollinator then if act.target then return act.doer.components.pollinator:Pollinate(act.target) else return act.doer.components.pollinator:CreateFlower() end end

end

ACTIONS.TERRAFORM.fn = function(act) if act.invobject and act.invobject.components.terraformer then return act.invobject.components.terraformer:Terraform(act.pos) end end

ACTIONS.EXTINGUISH.fn = function(act) if act.target.components.burnable

and act.target.components.burnable:IsBurning() then

if act.target.components.fueled and not act.target.components.fueled:IsEmpty() then act.target.components.fueled:ChangeSection(-1) else

act.target.components.burnable:Extinguish() end

return true end end

ACTIONS.LAYEGG.fn = function(act)

if act.target.components.pickable and not act.target.components.pickable.canbepicked then return act.target.components.pickable:Regen() end end

ACTIONS.INVESTIGATE.fn = function(act) local investigatePos = act.doer.components.knownlocations and act.doer.components.knownlocations:GetLocation(\ if investigatePos then

act.doer.components.knownlocations:RememberLocation(\ --try to get a nearby target

if act.doer.components.combat then

act.doer.components.combat:TryRetarget() end return true end end

ACTIONS.GOHOME.fn = function(act) --this is gross. make it better later. if act.target.components.spawner then

return act.target.components.spawner:GoHome(act.doer)

elseif act.target.components.childspawner then

return act.target.components.childspawner:GoHome(act.doer) elseif act.pos then if act.target then

act.target:PushEvent(\ end

act.doer:Remove() return true end end

ACTIONS.JUMPIN.fn = function(act)

if act.target.components.teleporter then act.target.components.teleporter:Activate(act.doer) return true end end

ACTIONS.RESETMINE.fn = function(act) if act.target.components.mine then act.target.components.mine:Reset() return true end end

ACTIONS.ACTIVATE.fn = function(act) if act.target.components.activatable then

act.target.components.activatable:DoActivate(act.doer) return true end end

ACTIONS.ACTIVATE.strfn = function(act)

if act.target.components.activatable.getverb then

return act.target.components.activatable.getverb(act.target, act.doer) end end

ACTIONS.MURDER.fn = function(act)

local murdered = act.invobject or act.target

if murdered and murdered.components.health then

murdered.components.inventoryitem:RemoveFromOwner(true)

if murdered.components.health.murdersound then

act.doer.SoundEmitter:PlaySound(murdered.components.health.murdersound) end

local stacksize = 1

if murdered.components.stackable then

stacksize = murdered.components.stackable.stacksize end

if murdered.components.lootdropper then for i = 1, stacksize do

local loots = murdered.components.lootdropper:GenerateLoot() for k, v in pairs(loots) do

local loot = SpawnPrefab(v)

act.doer.components.inventory:GiveItem(loot) end end end

act.doer:PushEvent(\ murdered:Remove()

return true end end

ACTIONS.HEAL.fn = function(act)

if act.invobject and act.invobject.components.healer then local target = act.target or act.doer return act.invobject.components.healer:Heal(target) end end

ACTIONS.UNLOCK.fn = function(act) if act.target.components.lock then

if act.target.components.lock:IsLocked() then

act.target.components.lock:Unlock(act.invobject, act.doer) --else

--act.target.components.lock:Lock(act.doer) end

return true end end

--ACTIONS.UNLOCK.strfn = function(act)

--if act.target.components.lock and not act.target.components.lock:IsLocked() then --return \ --end --end

ACTIONS.TEACH.fn = function(act)

if act.invobject and act.invobject.components.teacher then local target = act.target or act.doer

return act.invobject.components.teacher:Teach(target) end end

ACTIONS.TURNON.fn = function(act) local tar = act.target or act.invobject

if tar and tar.components.machine and not tar.components.machine:IsOn() then tar.components.machine:TurnOn(tar) return true end end

ACTIONS.TURNOFF.fn = function(act) local tar = act.target or act.invobject

if tar and tar.components.machine and tar.components.machine:IsOn() then tar.components.machine:TurnOff(tar) return true end end

ACTIONS.USEITEM.fn = function(act)

if act.invobject and act.invobject.components.useableitem then if act.invobject.components.useableitem:CanInteract() then act.invobject.components.useableitem:StartUsingItem() end end end

ACTIONS.TAKEITEM.fn = function(act)

--Use this for taking a specific item as opposed to having an item be generated as it is in Pick/ Harvest

if act.target and act.target.components.shelf and act.target.components.shelf.cantakeitem then act.target.components.shelf:TakeItem(act.doer) return true

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库饥荒代码actions.lua(4)在线全文阅读。

饥荒代码actions.lua(4).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/1105421.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: