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)在线全文阅读。
相关推荐: