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

饥荒圣诞树的装饰代码

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", 因为都是在雪中飘的

```

文章标签:圣诞树
本站申明:雅美居装饰装修网为装饰装修类百科展示网站,网站所有信息均来源于网络,若有误或侵权请联系本站!
为您推荐
  • 幼儿园大班环境创设装饰画的设计需要兼顾教育性、艺术性和安全性,同时契合5-6岁儿童的审美特点与发展需求。以下是专业化的设计建议:1. 主题设计与领域整合 推荐采用模块化主题,如"四季变换""太空探索""海底世界"等,
    2025-09-04 8933浏览
  • 装饰工程管理案例与关键要点 1. 项目管理流程标准化 - 案例:某五星级酒店装修项目中,采用全流程BIM(建筑信息模型)技术整合设计、施工与采购,通过三维模拟提前发现管线冲突,减少返工30%。 - 扩展:标准化流程需
    2025-09-03 3940浏览
  • 废报纸创意装饰画的及设计思路可以从以下几个方向展开,兼具环保性与艺术性:1. 拼贴艺术(Collage) 将报纸撕成不规则形状,利用不同版面的文字、图片、广告色块进行拼贴重组。可通过主题性构图(如城市景观、人物肖
    2025-09-03 9062浏览
  • 今朝装饰的墙面工艺涵盖了从基层处理到表面装饰的全流程,注重细节和耐久性,以下是核心工艺要点及技术解析: 1. 基层处理 - 墙面检查与修补:检测空鼓、裂缝,剔除松脱层,用水泥砂浆或石膏填补凹陷,确保基层平整
    2025-09-03 3940浏览
  • 栏目推荐
  • 电视墙采用三角形元素的装饰手法可以营造出强烈的视觉冲击力和现代感,以下是具体的装饰方案及设计思路:1. 几何拼贴造型 利用三角形板材、金属条或石膏线在墙面拼接成不规则或对称的几何图案。可选择对比色(如黑白
    2025-07-29 5441浏览
  • 工业风浴室会所装饰的核心在于融合粗犷的工业美学与实用功能,同时兼顾舒适感和艺术氛围。以下是具体的设计要点与扩展知识:1. 材质选择 - 裸露结构:保留原始建筑的混凝土墙面、天花横梁或金属管道,通过清漆防潮处
    2025-07-28 9414浏览
  • 用千纸鹤装饰屋子是一种充满文化与艺术气息的选择,既能传递美好寓意,又能增添空间的灵动感。以下是一些具体的建议和知识扩展:1. 材料选择与色彩搭配 - 传统千纸鹤通常使用和纸或彩色折纸制作,现代装饰也可尝试金
    2025-07-28 3331浏览
  • 栏目热点
  • 无锡作为长三角地区重要的经济中心城市,装饰材料市场发展成熟,业态多元。以下是关于无锡装饰材料市场的详细分析,涵盖主要市场分布、品类特点及行业趋势: 一、主要装饰材料市场分布1. 无锡华东装饰城 位于锡山区
  • 蒙城装饰线条批发

    查看详情

    蒙城装饰线条批发
  • 太原华佑装饰地址

    查看详情

    太原华佑装饰地址
  • 全站推荐
  • 在办公卡座上摆放一对狮子作为一种装饰,涉及多方面的文化寓意、风水考量及职场心理影响。以下从不同角度展开分析:1. 风水学意义 狮子在传统风水学中被视为"瑞兽",具有镇宅、化解煞气的象征意义。办公场所摆放狮子(
    2025-09-13 691浏览
  • 摩尔庄园餐厅装饰的核心在于营造温馨活泼的氛围,同时兼顾功能性与美观性。以下从布局、风格、道具搭配和互动细节四个方面展开分析:1. 主题风格选择森系自然风*:使用木质桌椅搭配藤编灯饰,墙面装饰建议采用蘑菇壁灯
    2025-09-13 369浏览
  • 硅藻泥装修的价格受多种因素影响,每平方米成本通常在80-300元之间浮动,具体差异取决于以下因素:1. 材料品质与品牌 国内常见品牌(如、大津、绿森林)的基础款价格约80-150元/㎡,高端进口产品(如日本四国化成)可达
    2025-09-13 2764浏览
  • 友情链接
    底部分割线