欢迎访问雅美居装饰装修网,专注于装饰装修百科知识解答!
当前位置:雅美居装饰装修网 >> 装饰 >> 圣诞树 >> 百科详情

饥荒圣诞树的装饰代码

2024-02-13 装饰 责编:雅美居装饰装修网 6161浏览

```lua

饥荒圣诞树的装饰代码

local assets =

{

Asset("ANIM", "anim/tree_christmas.zip"),

}

local function oninit(inst)

inst.AnimState:PlayAnimation("idle", true)

inst.AnimState:PushAnimation("festive_loop", true)

end

local function fn()

local inst = CreateEntity()

inst.entity:AddTransform()

inst.entity:AddAnimState()

inst.entity:AddSoundEmitter()

inst.entity:AddNetwork()

MakeObstaclePhysics(inst, 1)

inst.AnimState:SetBank("tree_christmas")

inst.AnimState:SetBuild("tree_christmas")

inst.AnimState:PlayAnimation("idle", true)

MakeSnowCoveredPristine(inst)

if not TheWorld.ismastersim then

return inst

end

inst:AddComponent("inspectable")

inst:AddComponent("burnable")

inst.components.burnable:AddBurnFX("tree_christmas_fireFx", Vector3(0, 5, 0), "tree_christmas_burn")

inst:ListenForEvent("onignite", function(inst) inst.AnimState:PlayAnimation("fire_loop", true) end)

inst:ListenForEvent("onextinguish", function(inst) inst.AnimState:PlayAnimation("idle", true) end)

inst:AddComponent("transformer")

inst.components.transformer:SetBeast("crocodile")

inst.components.transformer.cantags = {"prey"}

inst.components.transformer.onchargedelta = {1, 1.5} --回复两个百分比能量

inst:AddComponent("workable")

inst.components.workable:SetWorkAction(ACTIONS.CHOP)

inst.components.workable:SetWorkLeft(10)

inst.components.workable:SetOnWorkCallback(function(inst, worker, workleft)

inst.AnimState:PlayAnimation("chop")

inst.AnimState:PushAnimation("idle", true)

inst.SoundEmitter:PlaySound("dontstarve/winter/destroy_orb")

inst.components.lootdropper:SpawnLootPrefab("log")

end)

inst.components.workable:SetOnFinishCallback(function(inst, worker)

inst:Remove()

end)

inst:AddComponent("lootdropper")

---------------------winter's feast-----------------------------

inst.AnimState:Hide("BIRD") -- 隐藏鸟

inst:AddTag("winter_treestar")

inst:ListenForEvent("ornamenttransform", function()

inst.AnimState:OverrideSymbol("tree_christmas_01", "tree_christmas", "tree_christmas_star")

end)

MakeSnowCovered(inst)

inst.OnSave = function(inst, data)

data.isstar = inst.starhide

end

inst.OnLoad = function(inst, data)

if data and data.isstar then

inst.starhide = data.isstar

else -- 默认状态即 starhide == nil

inst:RemoveComponent("winter_tree") -- 掉落 isstar=true 材料

end

end

MakeHauntableIgnite(inst)

inst.OnEntityReplicated = inst.OnEntityReplicated or function(inst)

if inst._winter_tree_decor then

inst._winter_tree_decor:Remove()

inst._winter_tree_decor = nil

end

if inst._Task ~= nil then

inst._Task:Cancel()

inst._Task = nil

end

inst:RestartWinterLight()

end

inst.RestartWinterLight = function(inst)

if not inst:IsValid() then

inst._Task:Cancel()

return

end

if inst._winter_tree_decor == nil then

inst._winter_tree_decor = SpawnPrefab("winter_tree_decor")

inst._winter_tree_decor.entity:SetParent(inst.entity)

end

local x, y, z = inst.Transform:GetWorldPosition()

inst._winter_tree_decor.Transform:SetPosition(x, y + 10, z)

if inst.components.winter_tree ~= nil and inst.components.winter_tree.status == "light" then

if inst._Task == nil then

local offset = math.random(0, 2 * PI)

inst._Task = inst:DoPeriodicTask((3 + 4 * math.random()) * FRAMES, function(inst)

inst:PushEvent("lightchange", {offset = offset})

end)

end

elseif inst._Task ~= nil then

inst._Task:Cancel()

inst._Task = nil

end

end

---------------------winter's feast-----------------------------

inst:DoTaskInTime(0, oninit)

inst:SetPrefabNameOverride("tree")

return inst

end

local function fn_decor()

local inst = CreateEntity()

inst.entity:AddTransform()

--[[Non-networked entity]]

inst:AddTag("CLASSIFIED")

inst:AddTag("FX")

inst:AddTag("NOCLICK")

inst:AddTag("NOBLOCK")

inst:AddTag("DECOR")

inst:AddTag("NOPLAYERS")

inst:AddTag("sittable")

inst:AddTag("nosteal")

return inst

end

return Prefab("tree_christmas", fn, assets, prefabs),

Prefab("winter_tree_decor", fn_decor, MakeDecor) -- "winter_tree_decor" 实际基础是 "generic_snowfall", 因为都是在雪中飘的

```

文章标签:圣诞树
本站申明:雅美居装饰装修网为装饰装修类百科展示网站,网站所有信息均来源于网络,若有误或侵权请联系本站!
为您推荐
  • 巩义汽车装饰业务转让涉及多方面的考量和操作流程,以下从市场分析、转让注意事项、行业趋势及法律风险等角度展开说明: 一、市场背景与行业现状1. 区域市场需求 巩义作为郑州下辖县级市,汽车保有量逐年增长,带动
    2025-06-24 汽车装饰 9998浏览
  • 进户门墙面装饰画的选择与设计需综合考虑功能性、美学性及风水寓意,以下为专业建议:1. 材质与工艺 - 油画:适合古典或轻奢风格,质地厚重可提升空间质感,建议选择风景或抽象主题。 - 水墨画:中式家装首选,山水
    2025-06-24 装饰画 1691浏览
  • 大转湾装饰材料城通常是区域性的装饰建材集散地,主要从事装修材料的批发与零售业务。以下从多个维度展开分析:1. 业态构成 此类市场通常涵盖瓷砖、卫浴、灯具、五金、板材、涂料等全品类建材,部分大型市场会引入定
    2025-06-24 装饰材料 6820浏览
  • 装饰令牌可以从材质、工艺、图案、配件等多个维度进行个性化定制,以下列出具体方法和专业建议: 1. 材质升级金属雕刻:采用黄铜、纯银或钛钢等材质,通过激光雕刻或手工錾刻增加立体纹理。高级定制可选用珐琅填色(景
    2025-06-23 令牌 1654浏览
  • 栏目推荐
  • 以下是关于屋檐加装饰的详细分析:1. 传统瓦当装饰 采用青瓦或琉璃瓦制作瓦当,常见图案包括兽面纹、莲花纹等,兼具防水与美学功能。汉代瓦当多采用"四神"图案(青龙、白虎、朱雀、玄武),具有镇宅寓意。2. 悬鱼惹草构
    2025-05-25 1321浏览
  • 徐州建筑装饰行业招聘信息 行业概况徐州作为江苏省重要城市,建筑装饰行业发展迅速,市场需求旺盛。近年来,随着城市化进程加快和居民生活水平提高,装饰行业对专业人才需求持续增长。 招聘岗位1. 室内设计师:要求具备
    2025-05-24 建筑装饰 5075浏览
  • 扇形树叶装饰花朵的设计手法及应用技巧:1. 形态互补原理扇形叶片的放射状叶脉与圆形花朵形成几何对比,叶缘的波浪形或裂刻能增强视觉层次。优选银杏、棕榈等具有明显扇形特征的植物,其黄金分割比例的叶片角度(约137
    2025-05-24 装饰花朵 5262浏览
  • 栏目热点
  • 建筑装饰工程材料是完成建筑装饰工程所必需的物质基础。以下是常见的建筑装饰工程材料:1. 墙体材料:包括乳胶漆、墙纸墙布、饰面砖、饰面板等。这些材料用于墙面的装饰和保护,赋予墙面不同的质感和视觉效果。2. 地面
  • 我的世界黑白装饰画

    查看详情

    我的世界黑白装饰画
  • 装饰材料代理加盟

    查看详情

    装饰材料代理加盟
  • 全站推荐
  • 竹子的摆放位置需综合考虑光照、通风、湿度及空间功能等因素,以下为专业建议:1. 光照条件 竹子喜散射光,忌暴晒或长期荫蔽。室内建议摆放在东向或北向窗边,确保每日3-5小时柔和光照。若光照不足,可用全光谱植物补
    2025-07-02 竹子 5060浏览
  • 黄石装饰材料预算软件的选择与使用需综合考虑功能适配性、行业规范性及本地化服务需求,以下为专业分析及扩展知识:1. 核心功能需求 - 材料库本地化:软件需内置黄石地区常用装饰材料价格数据库,包含瓷砖、涂料、板
    2025-07-02 装饰材料 5490浏览
  • 厕所正对客厅的装修方案需兼顾功能性、美观性与风水考量,以下是详细的解决思路:1. 物理隔断法 - 实体隔墙:新建轻钢龙骨石膏板墙或砖墙彻底遮挡门洞,墙面可融入整体风格做乳胶漆、木饰面或挂画装饰。若空间允许,
    2025-07-02 6816浏览
  • 友情链接
    底部分割线