第302页:鲜果龙树
展开二五二.鲜果龙树(用蝙蝠棒种龙树,每天掉落水果,可上树)
用记事本打开游戏目录\data\scripts\prefabs\batbat.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local colours=
{
{198/255,43/255,43/255},
{0/255,255/255,0/255},
{0/255,0/255,255/255},
{255/255,255/255,0/255},
{109/255,50/255,163/255},
{255/255,0/255,0/255},
{255/255,255/255,255/255},
}
local function createtree(inst)
local pt = inst:GetPosition()
local phantom = SpawnPrefab("batbat")
phantom.Transform:SetPosition(pt.x, pt.y, pt.z)
phantom.AnimState:SetBank("firepit")
phantom.AnimState:SetBuild("firepit")
phantom.AnimState:PlayAnimation("idle",false)
phantom.Transform:SetScale(0.8, 0.8, 0.8)
phantom:RemoveComponent("weapon")
phantom:RemoveComponent("finiteuses")
phantom:RemoveComponent("inventoryitem")
phantom:RemoveComponent("equippable")
phantom:RemoveComponent("deployable")
phantom:RemoveTag("dull")
phantom:AddTag("NOCLICK")
local light = phantom.entity:AddLight()
phantom.Light:SetFalloff(0.6)
phantom.Light:SetIntensity(.8)
phantom.Light:SetRadius(5)
phantom.colour_idx = math.random(#colours)
phantom.Light:SetColour(colours[phantom.colour_idx][1],colours[phantom.colour_idx][2],colours[phantom.colour_idx][3])
phantom.Light:Enable(true)
phantom:DoPeriodicTask(15, function()
phantom.colour_idx = math.random(#colours)
phantom.Light:SetColour(colours[phantom.colour_idx][1],colours[phantom.colour_idx][2],colours[phantom.colour_idx][3])
end )
phantom:ListenForEvent( "daytime", function()
local pos = Vector3(phantom.Transform:GetWorldPosition())
local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 5)
for k,v in pairs(ents) do
if v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then
if v.prefab == "durian" or v.prefab == "pomegranate" or v.prefab == "dragonfruit" then
v:Remove()
end
end
end
phantom:DoTaskInTime(0.3, function(phantom)
phantom:StartThread(function()
for k = 1,math.random(3,7) do
local pt1 = phantom:GetPosition()
local names = {"durian","pomegranate","dragonfruit"}
local name = names[math.random(#names)]
local fruit = SpawnPrefab(name)
fruit.Transform:SetPosition(pt1.x+(math.random(5)-math.random(5)), 5, pt1.z+(math.random(5)-math.random(5)))
Sleep(0.3)
end
end )
end )
end , GetWorld() )
phantom:AddTag("phantom")
phantom.long = SpawnPrefab("batbat")
phantom.long.AnimState:SetBank("worm")
phantom.long.AnimState:SetBuild("worm")
phantom.long.AnimState:SetPercent("atk", 0.40)
phantom.long.Transform:SetScale(1.5, 1.5, 1.5)
phantom.long.Physics:SetActive(false)
phantom.long:RemoveComponent("weapon")
phantom.long:RemoveComponent("finiteuses")
phantom.long:RemoveComponent("inventoryitem")
phantom.long:RemoveComponent("equippable")
phantom.long:RemoveComponent("deployable")
phantom.long:RemoveTag("dull")
local follower = phantom.long.entity:AddFollower()
follower:FollowSymbol( phantom.GUID, "swap_object", 10, -90, 0 )
phantom.long.components.inspectable.getstatus = function()
if not GetPlayer():HasTag("climbtree") then
GetPlayer():AddTag("climbtree")
GetPlayer().components.playercontroller:Enable(false)
local pt0 = phantom:GetPosition()
GetPlayer().Transform:SetPosition(pt0.x, 10.2, pt0.z)
GetPlayer():DoTaskInTime(5, function()
GetPlayer().Transform:SetPosition(pt0.x, 0, pt0.z)
GetPlayer():RemoveTag("climbtree")
GetPlayer().components.playercontroller:Enable(true)
end )
end
end
phantom.long:AddTag("lightningrod")
phantom.long:ListenForEvent("lightningstrike", function()
phantom.long.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" )
phantom.long:DoTaskInTime(60, function()
phantom.long.AnimState:SetBloomEffectHandle("")
end )
end )
phantom.long:AddComponent("sanityaura")
phantom.long.components.sanityaura.aura = TUNING.SANITYAURA_MED
phantom.long:AddTag("goodbye")
phantom.guo1 = SpawnPrefab("batbat")
phantom.guo1.AnimState:SetBank("durian")
phantom.guo1.AnimState:SetBuild("durian")
phantom.guo1.AnimState:PlayAnimation("idle")
phantom.guo1.Transform:SetScale(1.5, 1.5, 1.5)
phantom.guo1.Physics:SetActive(false)
phantom.guo1:RemoveComponent("weapon")
phantom.guo1:RemoveComponent("finiteuses")
phantom.guo1:RemoveComponent("inventoryitem")
phantom.guo1:RemoveComponent("equippable")
phantom.guo1:RemoveComponent("deployable")
phantom.guo1:RemoveTag("dull")
local follower = phantom.guo1.entity:AddFollower()
follower:FollowSymbol( phantom.GUID, "swap_object", -550, -580, 0 )
phantom.guo1:AddTag("NOCLICK")
phantom.guo1:AddTag("goodbye")
phantom.guo2 = SpawnPrefab("batbat")
phantom.guo2.AnimState:SetBank("pomegranate")
phantom.guo2.AnimState:SetBuild("pomegranate")
phantom.guo2.AnimState:PlayAnimation("idle")
phantom.guo2.Transform:SetScale(1.5, 1.5, 1.5)
phantom.guo2.Physics:SetActive(false)
phantom.guo2:RemoveComponent("weapon")
phantom.guo2:RemoveComponent("finiteuses")
phantom.guo2:RemoveComponent("inventoryitem")
phantom.guo2:RemoveComponent("equippable")
phantom.guo2:RemoveComponent("deployable")
phantom.guo2:RemoveTag("dull")
local follower = phantom.guo2.entity:AddFollower()
follower:FollowSymbol( phantom.GUID, "swap_object", 610, -690, 0 )
phantom.guo2:AddTag("NOCLICK")
phantom.guo2:AddTag("goodbye")
phantom.guo3 = SpawnPrefab("batbat")
phantom.guo3.AnimState:SetBank("dragonfruit")
phantom.guo3.AnimState:SetBuild("dragonfruit")
phantom.guo3.AnimState:PlayAnimation("idle")
phantom.guo3.Transform:SetScale(1.5, 1.5, 1.5)
phantom.guo3.Physics:SetActive(false)
phantom.guo3:RemoveComponent("weapon")
phantom.guo3:RemoveComponent("finiteuses")
phantom.guo3:RemoveComponent("inventoryitem")
phantom.guo3:RemoveComponent("equippable")
phantom.guo3:RemoveComponent("deployable")
phantom.guo3:RemoveTag("dull")
local follower = phantom.guo3.entity:AddFollower()
follower:FollowSymbol( phantom.GUID, "swap_object", -290, -1385, 0 )
phantom.guo3:AddTag("NOCLICK")
phantom.guo3:AddTag("goodbye")
end
local function OnDeploy (inst, pt)
createtree(inst)
inst:Remove()
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
if inst:HasTag("goodbye") then
data.goodbye = true
end
if inst:HasTag("phantom") then
data.phantom = true
end
end
local function onload(inst, data)
if data and data.goodbye then
inst:Remove()
end
if data and data.phantom then
createtree(inst)
inst:Remove()
end
end
inst.OnSave = onsave
inst.OnLoad = onload
MakeLargeBurnable(inst)
MakeLargePropagator(inst)
即可用蝙蝠棒种龙树,靠近可补脑,每天会掉落各种水果。龙树可吸收闪电,起到避雷针的作用。鼠标左键点龙树,会爬上树顶眺望风景,5秒后滑下。龙树会不断变化七彩光,夜晚可照明。不想要龙树时,烧掉即可。蝙蝠棒在魔法选项(画着红骷髅)下,用5个蝙蝠翅膀、2个活木头、1个紫宝石制造
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏