YN250-小油灯(用蜘蛛腺体种小油灯,放在地上自动点燃,无限燃烧,可烧炭、烤食物、取暖、照明)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五0.小油灯(用蜘蛛腺体种小油灯,放在地上自动点燃,无限燃烧,可烧炭、烤食物、取暖、照明) 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/log.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: inst:AddComponent("cookable") inst.components.cookable.product = "charcoal" 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/spidergland.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255}, } local function OnDeploy (inst, pt) local lamp = SpawnPrefab("spidergland") lamp.Transform:SetPosition(pt.x, pt.y, pt.z) lamp.AnimState:SetBank("trinkets") lamp.AnimState:SetBuild("trinkets") lamp.AnimState:PlayAnimation(tostring(2)) lamp.components.inventoryitem:ChangeImageName("trinket_2") lamp.entity:AddSoundEmitter() lamp.Transform:SetScale(1.2,1.2,1.2) lamp.colour_idx = math.random(#colours) lamp.AnimState:SetMultColour(colours[lamp.colour_idx][1],colours[lamp.colour_idx][2],colours[lamp.colour_idx][3],1) lamp:RemoveComponent("stackable") lamp:RemoveComponent("tradable") lamp:RemoveComponent("healer") lamp:RemoveComponent("burnable") lamp:RemoveComponent("propagator") lamp:RemoveComponent("deployable") lamp:RemoveTag("cattoy") lamp:AddComponent("cooker") lamp:AddComponent("burnable") lamp.components.burnable:SetFXLevel(3) lamp.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.5,0) ) lamp.components.burnable:Ignite(true) lamp.components.inventoryitem:SetOnDroppedFn(function() lamp.components.burnable:Ignite(true) lamp:AddTag("ontheground") end ) lamp.components.inventoryitem:SetOnPickupFn(function() lamp.components.burnable:Extinguish() lamp:RemoveTag("ontheground") end ) lamp.components.inventoryitem:SetOnPutInInventoryFn(function() lamp.components.burnable:Extinguish() lamp:RemoveTag("ontheground") end ) lamp:ListenForEvent("onignite", function() if not lamp.components.cooker then lamp:AddComponent("cooker") end end ) lamp:ListenForEvent("onextinguish", function() lamp.SoundEmitter:PlaySound("dontstarve/common/fireOut") if lamp.components.cooker then lamp:RemoveComponent("cooker") end end ) lamp:AddComponent("workable") lamp.components.workable:SetWorkAction(ACTIONS.HAMMER) lamp.components.workable:SetWorkLeft(3) lamp.components.workable:SetOnFinishCallback(function(lamp) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(lamp.Transform:GetWorldPosition()) lamp:Remove() end ) lamp:AddTag("ontheground") lamp:AddTag("light") lamp:AddTag("lamps") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("lamps") then data.lamps = true end if inst:HasTag("ontheground") then data.ontheground = true end data.colour_idx = inst.colour_idx end local function onload(inst, data) if data and data.lamps then inst.AnimState:SetBank("trinkets") inst.AnimState:SetBuild("trinkets") inst.AnimState:PlayAnimation(tostring(2)) inst.components.inventoryitem:ChangeImageName("trinket_2") inst.entity:AddSoundEmitter() inst.Transform:SetScale(1.2,1.2,1.2) inst.colour_idx = math.random(#colours) inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) inst:RemoveComponent("stackable") inst:RemoveComponent("tradable") inst:RemoveComponent("healer") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst:RemoveTag("cattoy") inst:AddComponent("burnable") inst.components.burnable:SetFXLevel(3) inst.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.5,0) ) inst.components.inventoryitem:SetOnDroppedFn(function() inst.components.burnable:Ignite(true) inst:AddTag("ontheground") end ) inst.components.inventoryitem:SetOnPickupFn(function() inst.components.burnable:Extinguish() inst:RemoveTag("ontheground") end ) inst.components.inventoryitem:SetOnPutInInventoryFn(function() inst.components.burnable:Extinguish() inst:RemoveTag("ontheground") end ) inst:ListenForEvent("onignite", function() if not inst.components.cooker then inst:AddComponent("cooker") end end ) inst:ListenForEvent("onextinguish", function() inst.SoundEmitter:PlaySound("dontstarve/common/fireOut") if inst.components.cooker then inst:RemoveComponent("cooker") end end ) inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:Remove() end ) inst:AddTag("light") inst:AddTag("lamps") end if data and data.ontheground then inst.components.burnable:Ignite(true) inst:AddComponent("cooker") inst:AddTag("ontheground") end if data and data.colour_idx then inst.colour_idx = math.min(#colours, data.colour_idx) inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) end end inst.OnSave = onsave inst.OnLoad = onload 即可用蜘蛛腺体种小油灯(颜色随机),无须任何燃料,放在地上自动点燃,拿起来自动熄灭。拿着木头对油灯按鼠标左键,可将木头烧成炭。也可烤食物、取暖、照明,出行必备。不想要小油灯时,用锤子砸掉即可

2025/04/23 · Bny

YN251-我的王国(用远古短棒种国王雕像,可获得税收,有警察巡逻并听你调遣)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五一.我的王国(用远古短棒种国王雕像,可获得税收,有警察巡逻并听你调遣) 用MT管理器打开游戏目录/assets/scripts/prefabs/ruins_bat.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local items = { SWORD = "swap_spear" } local function EquipItem(inst, item) if item then inst.AnimState:OverrideSymbol("swap_object", item, item) inst.AnimState:Show("ARM_carry") inst.AnimState:Hide("ARM_normal") end end inst.items = items inst.equipfn = EquipItem EquipItem(inst) local function createguru(inst) local pt = inst:GetPosition() local guru = SpawnPrefab("ruins_bat") guru.Transform:SetPosition(pt.x, pt.y, pt.z) guru.AnimState:SetBank("wilson") if GetPlayer().prefab == "wilson" then guru.AnimState:SetBuild("wilson") end if GetPlayer().prefab == "wendy" then guru.AnimState:SetBuild("wendy") end if GetPlayer().prefab == "wes" then guru.AnimState:SetBuild("wes") end if GetPlayer().prefab == "wickerbottom" then guru.AnimState:SetBuild("wickerbottom") end if GetPlayer().prefab == "willow" then guru.AnimState:SetBuild("willow") end if GetPlayer().prefab == "wolfgang" then guru.AnimState:SetBuild("wolfgang") end if GetPlayer().prefab == "wx78" then guru.AnimState:SetBuild("wx78") end if GetPlayer().prefab == "woodie" then guru.AnimState:SetBuild("woodie") end if GetPlayer().prefab == "waxwell" then guru.AnimState:SetBuild("waxwell") end if GetPlayer().prefab == "wathgrithr" then guru.AnimState:SetBuild("wathgrithr") end if GetPlayer().prefab == "webber" then guru.AnimState:SetBuild("webber") end guru.AnimState:PlayAnimation("idle") guru.AnimState:OverrideSymbol("swap_object", "swap_cane", "swap_cane") guru.AnimState:Hide("ARM_normal") guru.AnimState:Show("ARM_carry") guru.AnimState:OverrideSymbol("swap_hat", "hat_ruins", "swap_hat") guru.AnimState:Show("HAT") guru.AnimState:Show("HAT_HAIR") guru.AnimState:Hide("HAIR_NOHAT") guru.AnimState:Hide("HAIR") guru.Transform:SetFourFaced() guru.Transform:SetRotation( 0 ) guru.Transform:SetScale(3.5, 3.5, 3.5) local shadow = guru.entity:AddDynamicShadow() shadow:SetSize( 6, 3.5 ) local minimap = guru.entity:AddMiniMapEntity() minimap:SetIcon( "obelisk.png" ) guru.AnimState:SetBloomEffectHandle("shaders/anim.ksh") guru:AddTag("guru") guru:RemoveTag("sharp") guru:RemoveComponent("weapon") guru:RemoveComponent("finiteuses") guru:RemoveComponent("inventoryitem") guru:RemoveComponent("equippable") guru:RemoveComponent("deployable") local light = guru.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(10) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) guru:AddComponent("workable") guru.components.workable:SetWorkAction(ACTIONS.HAMMER) guru.components.workable:SetWorkLeft(5) guru.components.workable:SetOnFinishCallback(function(guru) SpawnPrefab("collapse_big").Transform:SetPosition(guru.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") guru:Remove() end ) guru:AddComponent("pickable") guru.components.pickable:SetUp("goldnugget", 480, math.random(15,25)) guru.components.pickable:SetOnPickedFn(function(guru) guru.AnimState:SetBloomEffectHandle("") end ) guru.components.pickable:SetOnRegenFn(function(guru) guru.AnimState:SetBloomEffectHandle("shaders/anim.ksh") end ) guru:ListenForEvent( "daytime", function() for k = 1,math.random(10,25) do local pt0 = guru:GetPosition() local ground = GetWorld() local x = pt0.x+(math.random(50)-math.random(50)) local z = pt0.z+(math.random(50)-math.random(50)) local tile = ground.Map:GetTileAtPoint(x,0, z) if tile ~= GROUND.IMPASSABLE and tile ~= GROUND.INVALID then local militia = SpawnPrefab("ruins_bat") militia.Transform:SetPosition(x,0,z) militia.AnimState:SetBank("wilson") local buildnames = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = buildnames[math.random(#buildnames)] militia.AnimState:SetBuild(buildname) militia.AnimState:OverrideSymbol("swap_hat", "hat_walrus", "swap_hat") militia.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body") militia.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear") militia.AnimState:Show("HAT") militia.AnimState:Show("HAT_HAIR") militia.AnimState:Hide("HAIR_NOHAT") militia.AnimState:Hide("HAIR") militia.AnimState:Hide("ARM_normal") militia.AnimState:Show("ARM_carry") militia.AnimState:PlayAnimation("idle") militia.Transform:SetFourFaced() local shadow = militia.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) MakeCharacterPhysics(militia, 75, .5) local minimap = militia.entity:AddMiniMapEntity() minimap:SetIcon( "statue_small.png" ) militia:AddTag("militia") militia:AddComponent("locomotor") militia.components.locomotor.walkspeed = 5 militia.components.locomotor.runspeed = 10 militia:SetStateGraph("SGshadowwaxwell") local brain = require "brains/frogbrain" militia:SetBrain(brain) militia:RemoveTag("sharp") militia:RemoveComponent("weapon") militia:RemoveComponent("finiteuses") militia:RemoveComponent("inventoryitem") militia:RemoveComponent("equippable") militia:RemoveComponent("deployable") militia:AddComponent("follower") militia:AddComponent("knownlocations") militia:AddComponent("health") militia.components.health:SetMaxHealth(1200) militia.components.health.nofadeout = true militia:AddComponent("combat") militia.components.combat:SetDefaultDamage(20) militia.components.combat:SetAttackPeriod(1) militia.components.combat.hiteffectsymbol = "torso" militia.components.combat:SetRange(2, 3) militia.components.combat:SetRetargetFunction(2, function(militia) if not militia.components.health:IsDead() then return FindEntity(militia, 25, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") end end ) end end ) militia.components.combat:SetKeepTargetFunction(function(militia, target) return target and target:IsValid() end ) militia:ListenForEvent("attacked", function(militia, data) militia.components.combat:SetTarget(data.attacker) end ) militia.components.inspectable.getstatus = function(militia) if not militia:HasTag("letsgo") then local brain = require "brains/abigailbrain" militia:SetBrain(brain) militia:RestartBrain() militia.components.follower:SetLeader(GetPlayer()) militia:AddTag("letsgo") else local brain = require "brains/frogbrain" militia:SetBrain(brain) militia:RestartBrain() militia.components.follower:SetLeader(nil) militia:RemoveTag("letsgo") end end militia:ListenForEvent( "nighttime", function() militia:Remove() end , GetWorld()) end end end , GetWorld()) end local function OnDeploy (inst, pt) if GetPlayer().components.inventory:Has("goldnugget", 1000) then GetPlayer().components.inventory:ConsumeByName("goldnugget", 1000) createguru(inst) inst:Remove() end end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("guru") then data.guru = true end if inst:HasTag("militia") then data.militia = true end if inst:HasTag("letsgo") then data.letsgo = true end end local function onload(inst, data) if data and data.guru then createguru(inst) inst:Remove() end if data and data.militia then inst.AnimState:SetBank("wilson") local buildnames = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = buildnames[math.random(#buildnames)] inst.AnimState:SetBuild(buildname) inst.AnimState:OverrideSymbol("swap_hat", "hat_walrus", "swap_hat") inst.AnimState:OverrideSymbol("swap_body", "armor_wood", "swap_body") inst.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear") inst.AnimState:Show("HAT") inst.AnimState:Show("HAT_HAIR") inst.AnimState:Hide("HAIR_NOHAT") inst.AnimState:Hide("HAIR") inst.AnimState:Hide("ARM_normal") inst.AnimState:Show("ARM_carry") inst.AnimState:PlayAnimation("idle") inst.Transform:SetFourFaced() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) MakeCharacterPhysics(inst, 75, .5) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "statue_small.png" ) inst:AddTag("militia") inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 10 inst:SetStateGraph("SGshadowwaxwell") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RemoveTag("sharp") inst:RemoveComponent("weapon") inst:RemoveComponent("finiteuses") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("equippable") inst:RemoveComponent("deployable") inst:AddComponent("follower") inst:AddComponent("knownlocations") inst:AddComponent("health") inst.components.health:SetMaxHealth(1200) inst.components.health.nofadeout = true inst:AddComponent("combat") inst.components.combat:SetDefaultDamage(20) inst.components.combat:SetAttackPeriod(1) inst.components.combat.hiteffectsymbol = "torso" inst.components.combat:SetRange(2, 3) inst.components.combat:SetRetargetFunction(2, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 25, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy.components.combat.target == GetPlayer() or GetPlayer().components.combat.target == guy or guy:HasTag("monster") end end ) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) end ) inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("letsgo") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst:AddTag("letsgo") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst:RemoveTag("letsgo") end end inst:ListenForEvent( "nighttime", function() inst:Remove() end , GetWorld()) end if data and data.letsgo then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst:AddTag("letsgo") end end inst.OnSave = onsave inst.OnLoad = onload 即可在身上有1000个黄金时,用远古短棒种国王雕像(你自己的形象),宣誓你在这块大陆上的主权,将消费1000个黄金,身上黄金数不足时,不会种出雕像。当雕像发光时,代表当地的税收已经上缴(每日一次),用鼠标左键点雕像,可收到税款。每天白天,雕像周围会有警察巡逻,黑夜将离去,他们会攻击任何来犯的敌人。鼠标左键点警察(不要拿武器,以免误伤),可让他跟随你(黑夜离去),再次点击可解除跟随。在大陆各地树起国王雕像,建立你的王国,统治整块大陆吧。可通过小地图查看你的势力范围,国王雕像在小地图上显示为方尖碑图标,警察显示为天使雕像图标。不想要国王雕像时,用锤子砸掉即可。远古短棒在远古选项(画着远古祭坛)下,用3个活木头、4个铥矿石、4个噩梦燃料制造,制造时须靠近远古祭坛

2025/04/23 · Bny

YN252-鲜果龙树(用蝙蝠棒种龙树,每天掉落水果,可上树)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五二.鲜果龙树(用蝙蝠棒种龙树,每天掉落水果,可上树) 用MT管理器打开游戏目录/assets/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个紫宝石制造

2025/04/23 · Bny

YN253-小病小灾(主角会感冒、食物中毒,吃曼德拉草可痊愈)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五三.小病小灾(主角会感冒、食物中毒,吃曼德拉草可痊愈) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("eater")的下一行插入以下内容: local function OnEat(inst, food) if food and food.prefab ~= "mandrake" then if math.random()<0.1 then if not inst:HasTag("poisoning") and not inst:HasTag("fever") then inst:AddTag("poisoning") inst.AnimState:SetMultColour(0/255,255/255,0/255,1) inst.components.health:DoDelta(-inst.components.health.maxhealth*.2) inst.components.sanity:DoDelta(-inst.components.sanity.max*.5) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*.3 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*.3 inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD*5) inst.poison = inst:DoPeriodicTask(10, function() inst.components.hunger:DoDelta(-20) inst.components.locomotor:Stop() inst.AnimState:PlayAnimation("pickup") SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) end end end if food.prefab == "mandrake" then if inst:HasTag("poisoning") then inst:RemoveTag("poisoning") end if inst:HasTag("fever") then inst:RemoveTag("fever") end if inst.poison then inst.poison:Cancel() inst.poison = nil end if inst.fever then inst.fever:Cancel() inst.fever = nil end inst.AnimState:SetMultColour(255/255,255/255,255/255,1) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD) end end inst.components.eater:SetOnEatFn(OnEat) local function OnDay(inst) if inst:HasTag("poisoning") then inst:RemoveTag("poisoning") inst.AnimState:SetMultColour(255/255,255/255,255/255,1) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD) if inst.poison then inst.poison:Cancel() inst.poison = nil end end if not inst:HasTag("fever") then if math.random()<0.1 then inst:AddTag("fever") inst.AnimState:SetMultColour(255/255,0/255,0/255,1) inst.components.sanity:DoDelta(-inst.components.sanity.max*.5) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED*.3 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED*.3 inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD*5) inst.fever = inst:DoPeriodicTask(15, function() inst.components.health:DoDelta(-inst.components.health.maxhealth*.05) inst.components.locomotor:Stop() inst.AnimState:PlayAnimation("idle_shiver_pre") inst.AnimState:PushAnimation("idle_shiver_loop") inst.AnimState:PushAnimation("idle_shiver_pst", false) end ) end else inst:RemoveTag("fever") inst.AnimState:SetMultColour(255/255,255/255,255/255,1) inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED inst.components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD) if inst.fever then inst.fever:Cancel() inst.fever = nil end end end inst:ListenForEvent( "daytime", function() OnDay(inst) end, GetWorld()) 即可让游戏有更加真实的体验,主角会感冒,浑身因发烧而呈红色,行动迟缓,生命值不断下降,如不注意补血,则有生命危险。另外,在吃食物时,也有一定概率发生食物中毒,浑身呈绿色,行动迟缓,且不断出现腹泻,饥饿值下降速度加快。无论感冒还是食物中毒,只要你抗过一天,基本都能痊愈,如果服用曼德拉草,则可立即痊愈。如果修改了“小诊所”,也可以给护士5个黄金治疗疾病。不要与“伍迪吃疯肉立即变海狸且随身物品不掉落”一同修改

2025/04/23 · Bny

YN254-噩梦草(用鸟粪种噩梦草,可采噩梦燃料,有一定概率出现地下巨人)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五四.噩梦草(用鸟粪种噩梦草,可采噩梦燃料,有一定概率出现地下巨人) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/guano.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local items = { SWORD = "swap_ham_bat" } local function EquipItem(inst, item) if item then inst.AnimState:OverrideSymbol("swap_object", item, item) inst.AnimState:Show("ARM_carry") inst.AnimState:Hide("ARM_normal") end end inst.items = items inst.equipfn = EquipItem EquipItem(inst) local function OnDeploy (inst, pt) local darkgrass = SpawnPrefab("guano") darkgrass.Transform:SetPosition(pt.x, pt.y, pt.z) darkgrass.AnimState:SetBank("marsh_plant") darkgrass.AnimState:SetBuild("marsh_plant") darkgrass.AnimState:PlayAnimation("idle") darkgrass.Transform:SetScale(1.8, 1.8, 1.8) darkgrass.AnimState:SetMultColour(255/255,255/255,0/255,1) darkgrass:RemoveComponent("stackable") darkgrass:RemoveComponent("inventoryitem") darkgrass:RemoveComponent("fertilizer") darkgrass:RemoveComponent("smotherer") darkgrass:RemoveComponent("fuel") darkgrass:RemoveComponent("burnable") darkgrass:RemoveComponent("propagator") darkgrass:RemoveComponent("deployable") MakeMediumBurnable(darkgrass) MakeSmallPropagator(darkgrass) if darkgrass.flies then darkgrass.flies:Remove() darkgrass.flies = nil end darkgrass:AddComponent("workable") darkgrass.components.workable:SetWorkAction(ACTIONS.DIG) darkgrass.components.workable:SetWorkLeft(1) darkgrass.components.workable:SetOnFinishCallback(function(darkgrass) SpawnPrefab("nightmarefuel").Transform:SetPosition(darkgrass.Transform:GetWorldPosition()) darkgrass:Remove() end ) darkgrass:AddComponent("pickable") darkgrass.components.pickable:SetUp("nightmarefuel", 480) darkgrass.components.pickable:SetOnRegenFn(function(darkgrass) darkgrass.AnimState:SetMultColour(255/255,255/255,0/255,1) end ) darkgrass.components.pickable:SetOnPickedFn(function(darkgrass) darkgrass.AnimState:SetMultColour(255/255,255/255,255/255,1) if math.random()<0.05 then GetPlayer().components.playercontroller:ShakeCamera(darkgrass, "FULL", 1.5, 0.03, 2, 30) GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("collapse_big").Transform:SetPosition(darkgrass.Transform:GetWorldPosition()) local giant = SpawnPrefab("guano") giant.Transform:SetPosition(darkgrass.Transform:GetWorldPosition()) giant.entity:AddSoundEmitter() giant.AnimState:SetBank("wilson") giant.AnimState:SetBuild("wolfgang") giant.AnimState:PlayAnimation("idle") giant.AnimState:OverrideSymbol("swap_object", "swap_ham_bat", "swap_ham_bat") giant.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body") giant.AnimState:Show("ARM_carry") giant.AnimState:Hide("ARM_normal") giant.Transform:SetFourFaced() giant.Transform:SetScale(3.5,3.5,3.5) local sound = giant.entity:AddSoundEmitter() local shadow = giant.entity:AddDynamicShadow() shadow:SetSize( 6, 3.5 ) MakeCharacterPhysics(giant, 200, 1) local minimap = giant.entity:AddMiniMapEntity() minimap:SetIcon("wolfgang.png") local brain = require "brains/leifbrain" giant:SetBrain(brain) giant:AddComponent("locomotor") giant.components.locomotor.walkspeed = 1 giant.components.locomotor.runspeed = 2 giant:SetStateGraph("SGshadowwaxwell") giant:RemoveComponent("stackable") giant:RemoveComponent("inventoryitem") giant:RemoveComponent("fertilizer") giant:RemoveComponent("smotherer") giant:RemoveComponent("fuel") giant:RemoveComponent("burnable") giant:RemoveComponent("propagator") giant:RemoveComponent("deployable") if giant.flies then giant.flies:Remove() giant.flies = nil end giant:AddComponent("follower") giant:AddComponent("inventory") giant:AddComponent("combat") giant.components.combat.hiteffectsymbol = "torso" giant.components.combat:SetDefaultDamage(70) giant.components.combat:SetAttackPeriod(3) giant.components.combat.onhitotherfn = function() giant.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") GetPlayer().components.playercontroller:ShakeCamera(giant, "FULL", 0.5, 0.05, 2, 40) end giant.components.combat:SetAreaDamage(5, 0.8) giant.components.combat:SetRetargetFunction(3, function(giant) if not giant.components.health:IsDead() then return FindEntity(giant, 20, function(guy) return giant.components.combat:CanTarget(guy) and not guy:HasTag("giant") end ) end end ) giant:ListenForEvent("attacked", function(giant, data) giant.components.combat:SetTarget(data.attacker) end ) giant.Physics:SetCollisionCallback(function(giant, other) if other and other.components.workable and other.components.workable.workleft > 0 then other.components.workable:Destroy(giant) end end ) giant:AddComponent("health") giant.components.health:SetMaxHealth(8000) giant.components.health.nofadeout = true giant:AddComponent("sanityaura") giant.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE giant:ListenForEvent("death", function() local pt1 = giant:GetPosition() for k = 1,math.random(20,35) do local gold = SpawnPrefab("goldnugget") gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end local rewards = {"walrus_tusk","trunk_summer","trunk_winter","deerclops_eyeball","minotaurhorn"} local reward = rewards[math.random(#rewards)] SpawnPrefab(reward).Transform:SetPosition(pt1.x, 0, pt1.z) end ) giant:DoTaskInTime(480, function(giant) giant:Remove() end ) giant:AddTag("monster") giant:AddTag("giant") end end ) darkgrass:AddTag("darkgrass") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("darkgrass") then data.darkgrass = true end if inst:HasTag("giant") then data.giant = true end end local function onload(inst, data) if data and data.darkgrass then inst.AnimState:SetBank("marsh_plant") inst.AnimState:SetBuild("marsh_plant") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(1.8, 1.8, 1.8) inst.AnimState:SetMultColour(255/255,255/255,0/255,1) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("fertilizer") inst:RemoveComponent("smotherer") inst:RemoveComponent("fuel") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") MakeMediumBurnable(inst) MakeSmallPropagator(inst) if inst.flies then inst.flies:Remove() inst.flies = nil end inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.DIG) inst.components.workable:SetWorkLeft(1) inst.components.workable:SetOnFinishCallback(function(inst) SpawnPrefab("nightmarefuel").Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:Remove() end ) inst:AddComponent("pickable") inst.components.pickable:SetUp("nightmarefuel", 480) inst.components.pickable:SetOnRegenFn(function(inst) inst.AnimState:SetMultColour(255/255,255/255,0/255,1) end ) inst.components.pickable:SetOnPickedFn(function(inst) inst.AnimState:SetMultColour(255/255,255/255,255/255,1) if math.random()<0.05 then GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 1.5, 0.03, 2, 30) GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) local giant = SpawnPrefab("guano") giant.Transform:SetPosition(inst.Transform:GetWorldPosition()) giant.entity:AddSoundEmitter() giant.AnimState:SetBank("wilson") giant.AnimState:SetBuild("wolfgang") giant.AnimState:PlayAnimation("idle") giant.AnimState:OverrideSymbol("swap_object", "swap_ham_bat", "swap_ham_bat") giant.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body") giant.AnimState:Show("ARM_carry") giant.AnimState:Hide("ARM_normal") giant.Transform:SetFourFaced() giant.Transform:SetScale(3.5,3.5,3.5) local sound = giant.entity:AddSoundEmitter() local shadow = giant.entity:AddDynamicShadow() shadow:SetSize( 6, 3.5 ) MakeCharacterPhysics(giant, 200, 1) local minimap = giant.entity:AddMiniMapEntity() minimap:SetIcon("wolfgang.png") local brain = require "brains/leifbrain" giant:SetBrain(brain) giant:AddComponent("locomotor") giant.components.locomotor.walkspeed = 1 giant.components.locomotor.runspeed = 2 giant:SetStateGraph("SGshadowwaxwell") giant:RemoveComponent("stackable") giant:RemoveComponent("inventoryitem") giant:RemoveComponent("fertilizer") giant:RemoveComponent("smotherer") giant:RemoveComponent("fuel") giant:RemoveComponent("burnable") giant:RemoveComponent("propagator") giant:RemoveComponent("deployable") if giant.flies then giant.flies:Remove() giant.flies = nil end giant:AddComponent("follower") giant:AddComponent("inventory") giant:AddComponent("combat") giant.components.combat.hiteffectsymbol = "torso" giant.components.combat:SetDefaultDamage(70) giant.components.combat:SetAttackPeriod(3) giant.components.combat.onhitotherfn = function() giant.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") GetPlayer().components.playercontroller:ShakeCamera(giant, "FULL", 0.5, 0.05, 2, 40) end giant.components.combat:SetAreaDamage(5, 0.8) giant.components.combat:SetRetargetFunction(3, function(giant) if not giant.components.health:IsDead() then return FindEntity(giant, 20, function(guy) return giant.components.combat:CanTarget(guy) and not guy:HasTag("giant") end ) end end ) giant:ListenForEvent("attacked", function(giant, data) giant.components.combat:SetTarget(data.attacker) end ) giant.Physics:SetCollisionCallback(function(giant, other) if other and other.components.workable and other.components.workable.workleft > 0 then other.components.workable:Destroy(giant) end end ) giant:AddComponent("health") giant.components.health:SetMaxHealth(8000) giant.components.health.nofadeout = true giant:AddComponent("sanityaura") giant.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE giant:ListenForEvent("death", function() local pt1 = giant:GetPosition() for k = 1,math.random(20,35) do local gold = SpawnPrefab("goldnugget") gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end local rewards = {"walrus_tusk","trunk_summer","trunk_winter","deerclops_eyeball","minotaurhorn"} local reward = rewards[math.random(#rewards)] SpawnPrefab(reward).Transform:SetPosition(pt1.x, 0, pt1.z) end ) giant:DoTaskInTime(480, function(giant) giant:Remove() end ) giant:AddTag("monster") giant:AddTag("giant") end end ) inst:AddTag("darkgrass") end if data and data.giant then inst.entity:AddSoundEmitter() inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild("wolfgang") inst.AnimState:PlayAnimation("idle") inst.AnimState:OverrideSymbol("swap_object", "swap_ham_bat", "swap_ham_bat") inst.AnimState:OverrideSymbol("swap_body", "armor_slurper", "swap_body") inst.AnimState:Show("ARM_carry") inst.AnimState:Hide("ARM_normal") inst.Transform:SetFourFaced() inst.Transform:SetScale(3.5,3.5,3.5) local sound = inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize( 6, 3.5 ) MakeCharacterPhysics(inst, 200, 1) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("wolfgang.png") local brain = require "brains/leifbrain" inst:SetBrain(brain) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 1 inst.components.locomotor.runspeed = 2 inst:SetStateGraph("SGshadowwaxwell") inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("fertilizer") inst:RemoveComponent("smotherer") inst:RemoveComponent("fuel") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") if inst.flies then inst.flies:Remove() inst.flies = nil end inst:AddComponent("follower") inst:AddComponent("inventory") inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "torso" inst.components.combat:SetDefaultDamage(70) inst.components.combat:SetAttackPeriod(3) inst.components.combat.onhitotherfn = function() inst.SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40) end inst.components.combat:SetAreaDamage(5, 0.8) inst.components.combat:SetRetargetFunction(3, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 20, function(guy) return inst.components.combat:CanTarget(guy) and not guy:HasTag("giant") end ) end end ) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) end ) inst.Physics:SetCollisionCallback(function(inst, other) if other and other.components.workable and other.components.workable.workleft > 0 then other.components.workable:Destroy(inst) end end ) inst:AddComponent("health") inst.components.health:SetMaxHealth(8000) inst.components.health.nofadeout = true inst:AddComponent("sanityaura") inst.components.sanityaura.aura = -TUNING.SANITYAURA_LARGE inst:ListenForEvent("death", function() local pt1 = inst:GetPosition() for k = 1,math.random(20,35) do local gold = SpawnPrefab("goldnugget") gold.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end local rewards = {"walrus_tusk","trunk_summer","trunk_winter","deerclops_eyeball","minotaurhorn"} local reward = rewards[math.random(#rewards)] SpawnPrefab(reward).Transform:SetPosition(pt1.x, 0, pt1.z) end ) inst:DoTaskInTime(480, function(inst) inst:Remove() end ) inst:AddTag("monster") inst:AddTag("giant") end end inst.OnSave = onsave inst.OnLoad = onload 即可用鸟粪(白色便便)种噩梦草(请远离基地种植),可采摘噩梦燃料,每天都能采一次。采摘时有一定概率出现地下巨人,将攻击你,消灭巨人可获得黄金、巨鹿眼球、远古守护者角、海象牙等宝物。巨人的血量及攻击力都很强,如果打不过,就先逃跑避避风头,一天后巨人将回到地下。巨人在小地图上显示为大力士的图标,绕着点走吧

2025/04/23 · Bny

YN255-天然温泉(用触手皮种温泉,可恢复生命和脑,可抓鱼)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五五.天然温泉(用触手皮种温泉,可恢复生命和脑,可抓鱼) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/tentaclespots.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function spa(inst) local pt = inst:GetPosition() local spa = SpawnPrefab("tentaclespots") spa.Transform:SetPosition(pt.x, pt.y, pt.z) spa.AnimState:SetBank("marsh_tile") spa.AnimState:SetBuild("marsh_tile") spa.AnimState:PlayAnimation("idle_cave",true) spa.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) spa.AnimState:SetLayer( LAYER_BACKGROUND ) spa.AnimState:SetSortOrder( 3 ) spa.Transform:SetScale(1.5, 1.5, 1.5) spa:RemoveComponent("inventoryitem") spa:RemoveComponent("stackable") spa:RemoveComponent("fuel") spa:RemoveComponent("burnable") spa:RemoveComponent("propagator") spa:RemoveComponent("deployable") if spa.components.edible then spa:RemoveComponent("edible") end spa:AddTag("NOCLICK") spa:AddTag("spa") spa:DoPeriodicTask(math.random(10,20), function(spa) local pt1 = spa:GetPosition() local names = {"fish","eel"} local name = names[math.random(#names)] local fish = SpawnPrefab(name) fish.Transform:SetPosition(pt1.x+(math.random(4)-math.random(4)), 0, pt1.z+(math.random(4)-math.random(4))) SpawnPrefab("splash").Transform:SetPosition(fish.Transform:GetWorldPosition()) spa:DoTaskInTime(0.5, function(spa) local pos = Vector3(spa.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 == "fish" or v.prefab == "eel" then SpawnPrefab("splash").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end end end ) end ) spa:DoPeriodicTask(3, function(spa) local pos2 = Vector3(spa.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 4.8) for k,v in pairs(ents) do if v:HasTag("player") then v.components.health:DoDelta(v.components.health.maxhealth*.02) v.components.sanity:DoDelta(v.components.sanity.max*.02) end end end ) local rock1 = SpawnPrefab("tentaclespots") rock1.Transform:SetPosition(pt.x-3.3-0.5, 0, pt.z-3.3+0.5) rock1.AnimState:SetBank("rock") rock1.AnimState:SetBuild("rock") rock1.AnimState:PlayAnimation("full") rock1.Transform:SetScale(2, 2, 2) rock1:AddTag("sparock") rock1:RemoveComponent("inventoryitem") rock1:RemoveComponent("stackable") rock1:RemoveComponent("fuel") rock1:RemoveComponent("burnable") rock1:RemoveComponent("propagator") rock1:RemoveComponent("deployable") if rock1.components.edible then rock1:RemoveComponent("edible") end rock1:AddComponent("workable") rock1.components.workable:SetWorkAction(ACTIONS.HAMMER) rock1.components.workable:SetWorkLeft(3) rock1.components.workable:SetOnFinishCallback(function(rock1) SpawnPrefab("collapse_big").Transform:SetPosition(rock1.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break") local pos3 = Vector3(rock1.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos3.x,pos3.y,pos3.z, 10) for k,v in pairs(ents) do if v:HasTag("spa") then v:Remove() end if v:HasTag("sparock") then v:Remove() end end rock1:Remove() end ) local rock2 = SpawnPrefab("tentaclespots") rock2.Transform:SetPosition(pt.x-2.1-2.8, 0, pt.z-2.1+2.8) rock2.AnimState:SetBank("firepit") rock2.AnimState:SetBuild("firepit") rock2.AnimState:PlayAnimation("idle",false) rock2.Transform:SetScale(0.6, 1, 0.6) rock2:AddTag("sparock") rock2:RemoveComponent("inventoryitem") rock2:RemoveComponent("stackable") rock2:RemoveComponent("fuel") rock2:RemoveComponent("burnable") rock2:RemoveComponent("propagator") rock2:RemoveComponent("deployable") if rock2.components.edible then rock2:RemoveComponent("edible") end rock2:AddComponent("burnable") rock2.components.burnable:SetFXLevel(5) rock2.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.6,0) ) rock2.components.burnable:Ignite(true) rock2:AddComponent("cooker") local rock3 = SpawnPrefab("tentaclespots") rock3.Transform:SetPosition(pt.x+2.1+2.1, 0, pt.z-2.1+2.1) rock3.AnimState:SetBank("flowers") rock3.AnimState:SetBuild("flowers") rock3.AnimState:PlayAnimation("f10") rock3.Transform:SetScale(1.8, 1.8, 1.8) rock3:AddTag("sparock") rock3:RemoveComponent("inventoryitem") rock3:RemoveComponent("stackable") rock3:RemoveComponent("fuel") rock3:RemoveComponent("burnable") rock3:RemoveComponent("propagator") rock3:RemoveComponent("deployable") if rock3.components.edible then rock3:RemoveComponent("edible") end end local function OnDeploy (inst, pt) spa(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("spa") then data.spa = true end if inst:HasTag("sparock") then data.sparock = true end end local function onload(inst, data) if data and data.spa then spa(inst) inst:Remove() end if data and data.sparock then inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可用触手皮种温泉(拿着1个触手皮对地面点鼠标右键,如果拿着多个触手皮,则不会种出来),站在水里可以取暖,并补充生命值和脑值。温泉里会有鱼跳出水面,按住键盘空格键不放,有机会抓住鱼,在温泉旁的火盆里烤鱼吃吧。不想要温泉时,用锤子砸掉大石头即可

2025/04/23 · Bny

YN256-小冰山(用铥矿碎片种小冰山,靠近可解暑,无限开采冰和永冻冰,吃了能降温)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五六.小冰山(用铥矿碎片种小冰山,靠近可解暑,无限开采冰和永冻冰,吃了能降温) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/thulecite_pieces.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function makeiceberg(inst) local pt = inst:GetPosition() local iceberg = SpawnPrefab("thulecite_pieces") iceberg.Transform:SetPosition(pt.x, pt.y, pt.z) iceberg.AnimState:SetBank("ice_boulder") iceberg.AnimState:SetBuild("ice_boulder") iceberg.AnimState:PlayAnimation("full") iceberg.Transform:SetScale(2, 2, 2) iceberg:AddComponent("named") iceberg.components.named:SetName("Ice") local minimap = iceberg.entity:AddMiniMapEntity() minimap:SetIcon( "iceboulder.png" ) MakeObstaclePhysics(iceberg, 1) MakeLargeBurnable(iceberg) iceberg.AnimState:SetBloomEffectHandle("shaders/anim.ksh") iceberg.entity:AddLight() iceberg.Light:SetFalloff(1) iceberg.Light:SetIntensity(.8) iceberg.Light:SetRadius(7) iceberg.Light:SetColour(255/255,255/255,255/255) iceberg.Light:Enable(true) iceberg:RemoveComponent("edible") iceberg:RemoveComponent("tradable") iceberg:RemoveComponent("inventoryitem") iceberg:RemoveComponent("stackable") iceberg:RemoveComponent("bait") iceberg:RemoveComponent("repairer") iceberg:RemoveComponent("deployable") iceberg:RemoveTag("molebait") iceberg:AddComponent("heater") iceberg.components.heater.iscooler = true iceberg.components.heater.heatfn = function(iceberg) return -40 end iceberg:AddComponent("workable") iceberg.components.workable:SetWorkAction(ACTIONS.MINE) iceberg.components.workable:SetWorkLeft(30) iceberg.components.workable:SetOnWorkCallback(function(iceberg) iceberg.components.workable:SetWorkLeft(30) local pt1 = iceberg:GetPosition() if math.random()<.2 then local icecream = SpawnPrefab("thulecite_pieces") icecream.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 3, pt1.z+(math.random(3)-math.random(3))) icecream.AnimState:SetBank("ice") icecream.AnimState:SetBuild("ice") icecream.AnimState:PlayAnimation("f1") icecream:RemoveComponent("edible") icecream:RemoveComponent("tradable") icecream:RemoveComponent("stackable") icecream:RemoveComponent("bait") icecream:RemoveComponent("repairer") icecream:RemoveComponent("deployable") icecream:RemoveTag("molebait") icecream:AddComponent("named") icecream.components.named:SetName("Ice") icecream.components.inventoryitem.imagename = "ice" icecream:AddComponent("edible") icecream.components.edible.foodtype = "SEEDS" icecream.components.edible.healthvalue = TUNING.HEALING_TINY/2 icecream.components.edible.hungervalue = TUNING.CALORIES_TINY/4 icecream.components.edible:SetOnEatenFn(function(icecream, eater) if eater and eater.components.temperature then local temp = eater.components.temperature:GetCurrent() eater.components.temperature:SetTemperature(temp - 70) end end ) icecream.components.edible.degrades_with_spoilage = false icecream:AddTag("icecream") elseif math.random()<.4 then local ice = SpawnPrefab("ice") ice.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 3, pt1.z+(math.random(3)-math.random(3))) end end ) iceberg.components.workable:SetOnFinishCallback(function(iceberg) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(iceberg.Transform:GetWorldPosition()) iceberg:Remove() end ) iceberg:AddTag("iceberg") end local function OnDeploy (inst, pt) makeiceberg(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("iceberg") then data.iceberg = true end if inst:HasTag("icecream") then data.icecream = true end end local function onload(inst, data) if data and data.iceberg then makeiceberg(inst) inst:Remove() end if data and data.icecream then inst.AnimState:SetBank("ice") inst.AnimState:SetBuild("ice") inst.AnimState:PlayAnimation("f1") inst:RemoveComponent("edible") inst:RemoveComponent("tradable") inst:RemoveComponent("stackable") inst:RemoveComponent("bait") inst:RemoveComponent("repairer") inst:RemoveComponent("deployable") inst:RemoveTag("molebait") inst:AddComponent("named") inst.components.named:SetName("Ice") inst.components.inventoryitem.imagename = "ice" inst:AddComponent("edible") inst.components.edible.foodtype = "SEEDS" inst.components.edible.healthvalue = TUNING.HEALING_TINY/2 inst.components.edible.hungervalue = TUNING.CALORIES_TINY/4 inst.components.edible:SetOnEatenFn(function(inst, eater) if eater and eater.components.temperature then local temp = eater.components.temperature:GetCurrent() eater.components.temperature:SetTemperature(temp - 70) end end ) inst.components.edible.degrades_with_spoilage = false inst:AddTag("icecream") end end inst.OnSave = onsave inst.OnLoad = onload 即可用铥矿碎片种小冰山(拿着1个铥矿碎片对地面点鼠标右键,如果拿着多个,则不会种出来),靠近可解暑。用锄头凿冰山,有一定概率获得冰和永冻冰(不会腐烂且不可堆叠的是永冻冰),永冻冰可食用,吃了能降温,如果没有中暑就不要吃,否则会冻伤。不想要小冰山了,烧掉即可。不要与“用铥矿碎片种猴子桶”一同修改

2025/04/23 · Bny

YN257-生物克隆机(用夜魔盔甲种克隆机,随身携带,大量克隆各种生物)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五七.生物克隆机(用夜魔盔甲种克隆机,随身携带,大量克隆各种生物) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/armor_sanity.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function itemtest(inst, item, slot) if item.prefab == "silk" or item.prefab == "houndstooth" or item.prefab == "beefalowool" or item.prefab == "tentaclespots" or item.prefab == "froglegs" or item.prefab == "stinger" or item.prefab == "mosquitosack" or item.prefab == "tallbirdegg" or item.prefab == "walrus_tusk" or item.prefab == "livinglog" or item.prefab == "bird_egg" or item.prefab == "trunk_summer" or item.prefab == "trunk_winter" or item.prefab == "deerclops_eyeball" or item.prefab == "fish" or item.prefab == "plantmeat" or item.prefab == "rocks" or item.prefab == "cave_banana" or item.prefab == "slurper_pelt" or item.prefab == "minotaurhorn" or item.prefab == "wormlight" or item.prefab == "slurtle_shellpieces" or item.prefab == "slurtleslime" or item.prefab == "batwing" or item.prefab == "manrabbit_tail" or item.prefab == "pigskin" or item.prefab == "lightninggoathorn" or item.prefab == "dragon_scales" or item.prefab == "goose_feather" or item.prefab == "bearger_fur" then return true end return false end local slotpos = { Vector3(0,-75,0)} local widgetbuttoninfo = { text = "GO", position = Vector3(0, -135, 0), fn = function(inst) if inst:HasTag("machines") then if not inst.components.container:IsEmpty() then for k,v in pairs(inst.components.container.slots) do if v and v.prefab == "silk" then inst.weirdo = "spiderqueen" end if v and v.prefab == "houndstooth" then inst.weirdo = "firehound" end if v and v.prefab == "beefalowool" then inst.weirdo = "beefalo" end if v and v.prefab == "tentaclespots" then inst.weirdo = "tentacle" end if v and v.prefab == "froglegs" then inst.weirdo = "frog" end if v and v.prefab == "stinger" then inst.weirdo = "killerbee" end if v and v.prefab == "mosquitosack" then inst.weirdo = "mosquito" end if v and v.prefab == "tallbirdegg" then inst.weirdo = "tallbird" end if v and v.prefab == "walrus_tusk" then inst.weirdo = "walrus" end if v and v.prefab == "livinglog" then inst.weirdo = "leif_sparse" end if v and v.prefab == "bird_egg" then inst.weirdo = "perd" end if v and v.prefab == "trunk_summer" then inst.weirdo = "koalefant_summer" end if v and v.prefab == "trunk_winter" then inst.weirdo = "koalefant_winter" end if v and v.prefab == "deerclops_eyeball" then inst.weirdo = "deerclops" end if v and v.prefab == "fish" then inst.weirdo = "merm" end if v and v.prefab == "plantmeat" then inst.weirdo = "lureplant" end if v and v.prefab == "rocks" then inst.weirdo = "rocky" end if v and v.prefab == "cave_banana" then inst.weirdo = "monkey" end if v and v.prefab == "slurper_pelt" then inst.weirdo = "slurper" end if v and v.prefab == "minotaurhorn" then inst.weirdo = "minotaur" end if v and v.prefab == "wormlight" then inst.weirdo = "worm" end if v and v.prefab == "slurtle_shellpieces" then inst.weirdo = "slurtle" end if v and v.prefab == "slurtleslime" then inst.weirdo = "snurtle" end if v and v.prefab == "batwing" then inst.weirdo = "bat" end if v and v.prefab == "manrabbit_tail" then inst.weirdo = "bunnyman" end if v and v.prefab == "pigskin" then inst.weirdo = "pigman" end if v and v.prefab == "lightninggoathorn" then inst.weirdo = "lightninggoat" end if v and v.prefab == "dragon_scales" then inst.weirdo = "dragonfly" end if v and v.prefab == "goose_feather" then inst.weirdo = "moose" end if v and v.prefab == "bearger_fur" then inst.weirdo = "bearger" end v:Remove() end local pt0 = Vector3(GetPlayer().Transform:GetWorldPosition()) for k = 1, 20 do local result_offset = FindValidPositionByFan(1 * 2 * PI, 10, 20, function(offset) local x,y,z = (pt0 + offset):Get() local ents = TheSim:FindEntities(x,y,z , 1) return not next(ents) end) if result_offset then local newweirdo = SpawnPrefab(inst.weirdo) newweirdo.Transform:SetPosition((pt0 + result_offset):Get()) GetPlayer().components.playercontroller:ShakeCamera(inst, "FULL", 0.2, 0.02, .25, 40) local fx = SpawnPrefab("collapse_small") local pos = pt0 + result_offset fx.Transform:SetPosition(pos.x, pos.y, pos.z) end end end end end } local function OnDeploy (inst, pt) local machine = SpawnPrefab("armor_sanity") machine.Transform:SetPosition(pt.x, pt.y, pt.z) machine.AnimState:SetBank("rain_meter") machine.AnimState:SetBuild("rain_meter") machine.AnimState:PlayAnimation("meter", 0) machine.Transform:SetScale(0.5, 0.5, 0.5) machine:RemoveTag("sanity") machine:RemoveComponent("inventoryitem") machine:RemoveComponent("armor") machine:RemoveComponent("equippable") machine:RemoveComponent("deployable") machine.components.container.canbeopened = true machine:AddComponent("inventoryitem") machine.components.inventoryitem:ChangeImageName("rainometer") machine:AddComponent("equippable") machine.components.equippable.equipslot = EQUIPSLOTS.BODY machine.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2 machine.components.equippable:SetOnEquip( function(machine) GetPlayer().components.inventory:SetOverflow(machine) machine.components.container:Open(GetPlayer()) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open") GetPlayer():Hide() local shadow = GetPlayer().entity:AddDynamicShadow() shadow:SetSize( 0, 0 ) end ) machine.components.equippable:SetOnUnequip( function(machine) machine.components.container:Close(GetPlayer()) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open") GetPlayer():Show() local shadow = GetPlayer().entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) end ) machine:AddTag("machines") inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("machines") then data.machines = true end end local function onload(inst, data) if data and data.machines then inst.AnimState:SetBank("rain_meter") inst.AnimState:SetBuild("rain_meter") inst.AnimState:PlayAnimation("meter", 0) inst.Transform:SetScale(0.5, 0.5, 0.5) inst:RemoveTag("sanity") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("armor") inst:RemoveComponent("equippable") inst:RemoveComponent("deployable") inst.components.container.canbeopened = true inst:AddComponent("inventoryitem") inst.components.inventoryitem:ChangeImageName("rainometer") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.BODY inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2 inst.components.equippable:SetOnEquip( function(inst) GetPlayer().components.inventory:SetOverflow(inst) inst.components.container:Open(GetPlayer()) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_open", "open") GetPlayer():Hide() local shadow = GetPlayer().entity:AddDynamicShadow() shadow:SetSize( 0, 0 ) end ) inst.components.equippable:SetOnUnequip( function(inst) inst.components.container:Close(GetPlayer()) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/backpack_close", "open") GetPlayer():Show() local shadow = GetPlayer().entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) end ) inst:AddTag("machines") end end inst.OnSave = onsave inst.OnLoad = onload inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(-80,150,0) inst.components.container.side_widget = true inst.components.container.itemtestfn = itemtest inst.components.container.widgetbuttoninfo = widgetbuttoninfo inst.components.container.acceptsstacks = false inst.components.container.canbeopened = false 即可用夜魔盔甲种克隆机,装备克隆机后主角隐身(以免遭怪物围攻),屏幕右侧会出现格子和按钮,在格子中放入1个生物掉落的物品,按GO按钮,就可以克隆20个该生物,具体为:蜘蛛丝克隆蜘蛛女王、犬牙克隆火狗、牛毛克隆牛、触手皮克隆触手、蛙腿克隆青蛙、蜂刺克隆杀人蜂、蚊子血囊克隆蚊子、高鸟蛋克隆大高鸟、海象牙克隆海象、活木头克隆树精、鸡蛋克隆火鸡、夏象鼻克隆夏象、冬象鼻克隆冬象、巨鹿眼球克隆巨鹿、鱼克隆鱼人、食人花肉克隆食人花、岩石克隆龙虾、香蕉克隆猴子、缀食者皮克隆缀食者、远古守护者角克隆远古守护者、虫子果克隆虫子、蜗牛龟壳片克隆蜗牛龟、蜗牛龟粘液克隆黏糊虫、蝙蝠翅膀克隆蝙蝠、兔人尾巴克隆兔人、猪皮克隆猪人、闪电羊角克隆闪电羊、蜻蜓鳞片克隆蜻蜓、熊皮克隆熊、鹿鸭羽毛克隆鹿鸭。卸载克隆机后主角现身。拥有克隆机,让你有无限的怪物可刷,也可用于以怪制怪,比如在牛群里制造触手,在蜘蛛群里释放杀人蜂等,创造一个生机勃勃的世界吧。夜魔盔甲在魔法选项(画着红骷髅)下用5个噩梦燃料、3张纸制造

2025/04/23 · Bny

YN258-强迫症标尺(按键盘Insert键在地上画坐标,方便建造、种植,再按Insert键消失)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五八.强迫症标尺(按键盘Insert键在地上画坐标,方便建造、种植,再按Insert键消失) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_INSERT, function() if not inst:HasTag("ruler") then inst:AddTag("ruler") local pt = inst:GetPosition() for y = 10, 0, -1 do for x = 0, 10 do local coordinate = SpawnPrefab("gridplacer") coordinate.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) coordinate.AnimState:SetLayer( LAYER_BACKGROUND ) coordinate.AnimState:SetSortOrder( 1 ) coordinate.Transform:SetRotation( 45 ) coordinate.Transform:SetPosition(pt.x-14.1+x*2.82, 0, pt.z-14.1+y*2.82) local light = coordinate.entity:AddLight() light:SetIntensity(.6) light:SetRadius(.5) light:SetFalloff(.6) light:Enable(true) light:SetColour(180/255, 195/255, 225/255) coordinate:AddTag("NOCLICK") coordinate:AddTag("coordinate") end end else inst:RemoveTag("ruler") local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("coordinate") then v:Remove() end end end end ) 即可按键盘Insert键,以主角为中心在地上画出白色坐标,可作为建造或种植的参照线,也可测量你现有的建筑、植物是不是歪了,强迫症必备,还有夜光效果哦,再按一次Insert键坐标消失

2025/04/23 · Bny

YN259-制冰机(用草伞种制冰机,下雨时自动制冰,可加工成大冰块永久保存,大冰块可砸碎成冰)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二五九.制冰机(用草伞种制冰机,下雨时自动制冰,可加工成大冰块永久保存,大冰块可砸碎成冰) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/umbrella.lua文件,在inst:AddTag("show_spoilage")的下一行插入以下内容: local function itemtest(inst, item, slot) if item.prefab == "ice" then return true end return false end local slotpos = { Vector3(0,-75,0)} local widgetbuttoninfo = { text = "Make", position = Vector3(0, -135, 0), fn = function(inst) if inst:HasTag("icemaker") then if inst.components.container:Has("ice", 10) then GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break") inst.components.container:ConsumeByName("ice", 10) local pt = inst:GetPosition() local bigice = SpawnPrefab("grass_umbrella") bigice.Transform:SetPosition(pt.x+(math.random(3)-math.random(3)), 0, pt.z+(math.random(3)-math.random(3))) bigice.AnimState:SetBank("icehat") bigice.AnimState:SetBuild("hat_ice") bigice.AnimState:PlayAnimation("anim") bigice.Transform:SetScale(1.5, 1.5, 1.5) bigice:RemoveComponent("waterproofer") bigice:RemoveComponent("equippable") bigice:RemoveComponent("insulator") bigice:RemoveComponent("perishable") bigice:RemoveComponent("fuel") bigice:RemoveComponent("burnable") bigice:RemoveComponent("propagator") bigice:RemoveComponent("deployable") bigice:RemoveComponent("container") bigice:RemoveTag("nopunch") bigice:RemoveTag("show_spoilage") bigice:RemoveAllEventCallbacks() bigice:AddComponent("named") bigice.components.named:SetName("Big ice") bigice.components.inventoryitem:ChangeImageName("icehat") bigice:AddComponent("heater") bigice.components.heater.iscooler = true bigice.components.heater.heatfn = function(bigice) return -40 end bigice:AddComponent("workable") bigice.components.workable:SetWorkAction(ACTIONS.HAMMER) bigice.components.workable:SetWorkLeft(1) bigice.components.workable:SetOnFinishCallback(function(bigice) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(bigice.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") for k = 1, 10 do local pt1 = bigice:GetPosition() local ice = SpawnPrefab("ice") ice.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end bigice:Remove() end ) bigice:AddTag("bigice") end end end } local function OnDeploy (inst, pt) local icemaker = SpawnPrefab("grass_umbrella") icemaker.Transform:SetPosition(pt.x, pt.y, pt.z) icemaker.AnimState:SetBank("eyeball_turret_base") icemaker.AnimState:SetBuild("eyeball_turret_base") icemaker.AnimState:PlayAnimation("idle_loop") icemaker.Transform:SetScale(0.8, 0.8, 0.8) icemaker.AnimState:SetMultColour(0/255,255/255,0/255,1) icemaker:RemoveComponent("waterproofer") icemaker:RemoveComponent("inventoryitem") icemaker:RemoveComponent("equippable") icemaker:RemoveComponent("insulator") icemaker:RemoveComponent("perishable") icemaker:RemoveComponent("fuel") icemaker:RemoveComponent("burnable") icemaker:RemoveComponent("propagator") icemaker:RemoveComponent("deployable") icemaker:RemoveTag("nopunch") icemaker:RemoveTag("show_spoilage") icemaker:RemoveAllEventCallbacks() icemaker:AddComponent("named") icemaker.components.named:SetName("Ice maker") icemaker.components.container.canbeopened = true icemaker:AddComponent("workable") icemaker.components.workable:SetWorkAction(ACTIONS.HAMMER) icemaker.components.workable:SetWorkLeft(3) icemaker.components.workable:SetOnFinishCallback(function(icemaker) SpawnPrefab("collapse_big").Transform:SetPosition(icemaker.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") icemaker:Remove() end ) icemaker:ListenForEvent("rainstart", function() icemaker.task = icemaker:DoPeriodicTask(10, function() local ice = SpawnPrefab("ice") icemaker.components.container:GiveItem(ice) end ) end, GetWorld()) icemaker:ListenForEvent("rainstop", function() if icemaker.task then icemaker.task:Cancel() icemaker.task = nil end end, GetWorld()) icemaker:AddTag("icemaker") inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(0,150,0) inst.components.container.side_align_tip = 160 inst.components.container.itemtestfn = itemtest inst.components.container.widgetbuttoninfo = widgetbuttoninfo inst.components.container.canbeopened = false inst.components.container.onopenfn = function(inst) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end inst.components.container.onclosefn = function(inst) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end inst:AddTag("fridge") local function onsave(inst, data) if inst:HasTag("icemaker") then data.icemaker = true end if inst:HasTag("bigice") then data.bigice = true end end local function onload(inst, data) if data and data.icemaker then inst.AnimState:SetBank("eyeball_turret_base") inst.AnimState:SetBuild("eyeball_turret_base") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.8, 0.8, 0.8) inst.AnimState:SetMultColour(0/255,255/255,0/255,1) inst:RemoveComponent("waterproofer") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("equippable") inst:RemoveComponent("insulator") inst:RemoveComponent("perishable") inst:RemoveComponent("fuel") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst:RemoveTag("nopunch") inst:RemoveTag("show_spoilage") inst:RemoveAllEventCallbacks() inst:AddComponent("named") inst.components.named:SetName("Ice maker") inst.components.container.canbeopened = true inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") inst:Remove() end ) inst:ListenForEvent("rainstart", function() inst.task = inst:DoPeriodicTask(10, function() local ice = SpawnPrefab("ice") inst.components.container:GiveItem(ice) end ) end, GetWorld()) inst:ListenForEvent("rainstop", function() if inst.task then inst.task:Cancel() inst.task = nil end end, GetWorld()) inst:AddTag("icemaker") end if data and data.bigice then inst.AnimState:SetBank("icehat") inst.AnimState:SetBuild("hat_ice") inst.AnimState:PlayAnimation("anim") inst.Transform:SetScale(1.5, 1.5, 1.5) inst:RemoveComponent("waterproofer") inst:RemoveComponent("equippable") inst:RemoveComponent("insulator") inst:RemoveComponent("perishable") inst:RemoveComponent("fuel") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst:RemoveComponent("container") inst:RemoveTag("nopunch") inst:RemoveTag("show_spoilage") inst:RemoveAllEventCallbacks() inst:AddComponent("named") inst.components.named:SetName("Big ice") inst.components.inventoryitem:ChangeImageName("icehat") inst:AddComponent("heater") inst.components.heater.iscooler = true inst.components.heater.heatfn = function(inst) return -40 end inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(1) inst.components.workable:SetOnFinishCallback(function(inst) SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") for k = 1, 10 do local pt1 = inst:GetPosition() local ice = SpawnPrefab("ice") ice.Transform:SetPosition(pt1.x+(math.random(3)-math.random(3)), 0, pt1.z+(math.random(3)-math.random(3))) end inst:Remove() end ) inst:AddTag("bigice") end end inst.OnSave = onsave inst.OnLoad = onload 即可用草伞种制冰机,下雨时每10秒制成一块冰,鼠标左键点制冰机,可打开格子,在格子中拿取。当格子中至少有10块冰时,点格子下面的“Make”按钮,可将冰加工成大冰块,用以永久保存。靠近大冰块可降温,用锤子砸大冰块,可还原成小冰。不想要制冰机了,用锤子炸毁即可。草伞在生存选项(画着绳套)下,用4个树枝、3个草、6个花瓣制造

2025/04/23 · Bny