YN302-经营动物园(用黄油种动物园,买卖、繁殖小动物,赚门票钱)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0二.经营动物园(用黄油种动物园,买卖、繁殖小动物,赚门票钱) 用MT管理器打开游戏目录/assets/scripts/prefabs/butter.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local slotpos = { Vector3(0,-100,0)} local function itemtest(inst, item, slot) if item.prefab == "carrot" then return true end return false end local widgetbuttoninfo = { text = "Sell", position = Vector3(0, -30, 0), fn = function(inst) local target = FindEntity(inst, 9, function(guy) return guy:HasTag("zoobaby") end ) if target then for k = 1,20 do local pt5 = target:GetPosition() SpawnPrefab("goldnugget").Transform:SetPosition(pt5.x, 0, pt5.z) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") target:Remove() end end end } local function OnDeploy (inst, pt) local brand = SpawnPrefab("butter") brand.Transform:SetPosition(pt.x, pt.y, pt.z) brand.AnimState:SetBank("sign_home") brand.AnimState:SetBuild("sign_home") brand.AnimState:PlayAnimation("idle") brand.Transform:SetScale(0.8, 0.8, 0.8) brand.AnimState:SetMultColour(0/255,255/255,0/255,1) brand:RemoveComponent("stackable") brand:RemoveComponent("inventoryitem") brand:RemoveComponent("edible") brand:RemoveComponent("perishable") brand:RemoveComponent("deployable") brand:RemoveComponent("container") brand:AddTag("brand") local slotpos1 = { Vector3(0,-75,0)} brand:AddComponent("container") brand.components.container:SetNumSlots(#slotpos1) brand.components.container.widgetslotpos = slotpos1 brand.components.container.widgetpos = Vector3(0,180,0) brand.components.container.side_align_tip = 160 brand.components.container.acceptsstacks = false brand.components.container.itemtestfn = function(brand, item, slot) if item.prefab == "charcoal" or item.prefab == "trunk_summer" or item.prefab == "trunk_winter" or item.prefab == "walrus_tusk" or item.prefab == "cave_banana" then return true end return false end brand.components.container.widgetbuttoninfo = { text = "Buy", position = Vector3(0, -145, 0), fn = function(brand) if GetPlayer().components.inventory:Has("goldnugget", 30) then if brand.components.container:Has("charcoal", 1) then brand.components.container:ConsumeByName("charcoal", 1) local zoobaby = SpawnPrefab("butter") local pt1 = brand:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("krampus") zoobaby.AnimState:SetBuild("krampus_build") zoobaby.AnimState:PlayAnimation("idle", true) zoobaby.entity:AddSoundEmitter() zoobaby.AnimState:Hide("SACK") zoobaby.AnimState:Show("ARM") zoobaby.Transform:SetScale(0.7,0.7,0.7) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkrampus") zoobaby:AddTag("zoobaby1") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if brand.components.container:Has("trunk_summer", 1) then brand.components.container:ConsumeByName("trunk_summer", 1) local zoobaby = SpawnPrefab("butter") local pt1 = brand:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_summer_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby2") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if brand.components.container:Has("trunk_winter", 1) then brand.components.container:ConsumeByName("trunk_winter", 1) local zoobaby = SpawnPrefab("butter") local pt1 = brand:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_winter_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby3") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if brand.components.container:Has("walrus_tusk", 1) then brand.components.container:ConsumeByName("walrus_tusk", 1) local zoobaby = SpawnPrefab("butter") local pt1 = brand:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("walrus") zoobaby.AnimState:SetBuild("walrus_baby_build") zoobaby.AnimState:PlayAnimation("idle_happy") zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.8,0.8,0.8) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGwalrus") zoobaby:AddTag("zoobaby4") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if brand.components.container:Has("cave_banana", 1) then brand.components.container:ConsumeByName("cave_banana", 1) local zoobaby = SpawnPrefab("butter") local pt1 = brand:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("kiki") zoobaby.AnimState:SetBuild("kiki_basic") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.soundtype = "" zoobaby.Transform:SetScale(1.2,1.2,1.2) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGmonkey") zoobaby:AddTag("zoobaby5") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end end end } local zooroom = SpawnPrefab("butter") zooroom.Transform:SetPosition(pt.x-7, 0, pt.z-7) zooroom.AnimState:SetBank("rabbithouse") zooroom.AnimState:SetBuild("rabbit_house") zooroom.AnimState:PlayAnimation("idle", true) zooroom.Transform:SetScale(0.4, 0.4, 0.4) zooroom:RemoveComponent("stackable") zooroom:RemoveComponent("inventoryitem") zooroom:RemoveComponent("edible") zooroom:RemoveComponent("perishable") zooroom:RemoveComponent("deployable") zooroom.components.container.canbeopened = true zooroom.entity:AddLight() zooroom.Light:SetFalloff(1) zooroom.Light:SetIntensity(.8) zooroom.Light:SetRadius(15) zooroom.Light:SetColour(180/255, 195/255, 50/255) zooroom.Light:Enable(true) zooroom:AddTag("zooroom") zooroom:DoPeriodicTask(180, function(zooroom) local target = FindEntity(zooroom, 9, function(guy) return guy:HasTag("zoobaby") end ) if target then local target1 = FindEntity(zooroom, 9, function(guy) return guy.prefab == "poop" end ) if not target1 then for k = 1,math.random(5,10) do local pt2 = zooroom:GetPosition() SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5) end else for k = 1,math.random(1,3) do local pt2 = zooroom:GetPosition() SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5) end end if zooroom.components.container:Has("carrot", 3) then zooroom.components.container:ConsumeByName("carrot", 3) if math.random()<0.1 then if target:HasTag("zoobaby1") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("krampus") zoobaby.AnimState:SetBuild("krampus_build") zoobaby.AnimState:PlayAnimation("idle", true) zoobaby.entity:AddSoundEmitter() zoobaby.AnimState:Hide("SACK") zoobaby.AnimState:Show("ARM") zoobaby.Transform:SetScale(0.7,0.7,0.7) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkrampus") zoobaby:AddTag("zoobaby1") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby2") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_summer_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby2") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby3") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_winter_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby3") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby4") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("walrus") zoobaby.AnimState:SetBuild("walrus_baby_build") zoobaby.AnimState:PlayAnimation("idle_happy") zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.8,0.8,0.8) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGwalrus") zoobaby:AddTag("zoobaby4") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby5") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("kiki") zoobaby.AnimState:SetBuild("kiki_basic") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.soundtype = "" zoobaby.Transform:SetScale(1.2,1.2,1.2) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGmonkey") zoobaby:AddTag("zoobaby5") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end end else target.components.health:Kill() end end end ) zooroom:AddComponent("workable") zooroom.components.workable:SetWorkAction(ACTIONS.HAMMER) zooroom.components.workable:SetWorkLeft(3) zooroom.components.workable:SetOnFinishCallback(function(zooroom) local pos = Vector3(zooroom.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) for k,v in pairs(ents) do if v:HasTag("zoofence") or v:HasTag("brand") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") v:Remove() end end zooroom:Remove() end ) local pt0 = Vector3(zooroom.Transform:GetWorldPosition()) for k = 1, 40 do local result_offset = FindValidPositionByFan(1 * 2 * PI, 8, 40, 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 zoofence = SpawnPrefab("butter") zoofence.AnimState:SetBank("wall") zoofence.AnimState:SetBuild("wall_wood") zoofence.AnimState:PlayAnimation("1_2", false) MakeObstaclePhysics(zoofence, .5) zoofence:RemoveComponent("stackable") zoofence:RemoveComponent("inventoryitem") zoofence:RemoveComponent("edible") zoofence:RemoveComponent("perishable") zoofence:RemoveComponent("deployable") zoofence:RemoveComponent("container") zoofence:AddTag("zoofence") zoofence.Transform:SetPosition((pt0 + result_offset):Get()) zoofence.components.inspectable.getstatus = function(zoofence) zoofence.Transform:SetScale(1, 0.1, 1) zoofence.Physics:SetActive(false) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") zoofence:DoTaskInTime(5, function(zoofence) zoofence.Transform:SetScale(1, 1, 1) zoofence.Physics:SetActive(true) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") end ) end end end inst.components.stackable:Get():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,180,0) inst.components.container.side_align_tip = 160 inst.components.container.itemtestfn = itemtest inst.components.container.canbeopened = false inst.components.container.widgetbuttoninfo = widgetbuttoninfo local function onsave(inst, data) if inst:HasTag("brand") then data.brand = true end if inst:HasTag("zooroom") then data.zooroom = true end if inst:HasTag("zoofence") then data.zoofence = true end if inst:HasTag("zoobaby1") then data.zoobaby1 = true end if inst:HasTag("zoobaby2") then data.zoobaby2 = true end if inst:HasTag("zoobaby3") then data.zoobaby3 = true end if inst:HasTag("zoobaby4") then data.zoobaby4 = true end if inst:HasTag("zoobaby5") then data.zoobaby5 = true end if inst:HasTag("followme") then data.followme = true end end local function onload(inst, data) if data and data.brand then inst.AnimState:SetBank("sign_home") inst.AnimState:SetBuild("sign_home") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.8, 0.8, 0.8) inst.AnimState:SetMultColour(0/255,255/255,0/255,1) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") inst:AddTag("brand") local slotpos1 = { Vector3(0,-75,0)} inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos1) inst.components.container.widgetslotpos = slotpos1 inst.components.container.widgetpos = Vector3(0,180,0) inst.components.container.side_align_tip = 160 inst.components.container.acceptsstacks = false inst.components.container.itemtestfn = function(inst, item, slot) if item.prefab == "charcoal" or item.prefab == "trunk_summer" or item.prefab == "trunk_winter" or item.prefab == "walrus_tusk" or item.prefab == "cave_banana" then return true end return false end inst.components.container.widgetbuttoninfo = { text = "Buy", position = Vector3(0, -145, 0), fn = function(inst) if GetPlayer().components.inventory:Has("goldnugget", 30) then if inst.components.container:Has("charcoal", 1) then inst.components.container:ConsumeByName("charcoal", 1) local zoobaby = SpawnPrefab("butter") local pt1 = inst:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("krampus") zoobaby.AnimState:SetBuild("krampus_build") zoobaby.AnimState:PlayAnimation("idle", true) zoobaby.entity:AddSoundEmitter() zoobaby.AnimState:Hide("SACK") zoobaby.AnimState:Show("ARM") zoobaby.Transform:SetScale(0.7,0.7,0.7) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkrampus") zoobaby:AddTag("zoobaby1") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if inst.components.container:Has("trunk_summer", 1) then inst.components.container:ConsumeByName("trunk_summer", 1) local zoobaby = SpawnPrefab("butter") local pt1 = inst:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_summer_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby2") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if inst.components.container:Has("trunk_winter", 1) then inst.components.container:ConsumeByName("trunk_winter", 1) local zoobaby = SpawnPrefab("butter") local pt1 = inst:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_winter_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby3") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if inst.components.container:Has("walrus_tusk", 1) then inst.components.container:ConsumeByName("walrus_tusk", 1) local zoobaby = SpawnPrefab("butter") local pt1 = inst:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("walrus") zoobaby.AnimState:SetBuild("walrus_baby_build") zoobaby.AnimState:PlayAnimation("idle_happy") zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.8,0.8,0.8) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGwalrus") zoobaby:AddTag("zoobaby4") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end if inst.components.container:Has("cave_banana", 1) then inst.components.container:ConsumeByName("cave_banana", 1) local zoobaby = SpawnPrefab("butter") local pt1 = inst:GetPosition() zoobaby.Transform:SetPosition(pt1.x-6, 0, pt1.z-6) zoobaby.AnimState:SetBank("kiki") zoobaby.AnimState:SetBuild("kiki_basic") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.soundtype = "" zoobaby.Transform:SetScale(1.2,1.2,1.2) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGmonkey") zoobaby:AddTag("zoobaby5") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 30) end end end } end if data and data.zooroom then inst.AnimState:SetBank("rabbithouse") inst.AnimState:SetBuild("rabbit_house") inst.AnimState:PlayAnimation("idle", true) inst.Transform:SetScale(0.4, 0.4, 0.4) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst.components.container.canbeopened = true inst.entity:AddLight() inst.Light:SetFalloff(1) inst.Light:SetIntensity(.8) inst.Light:SetRadius(15) inst.Light:SetColour(180/255, 195/255, 50/255) inst.Light:Enable(true) inst:AddTag("zooroom") inst:DoPeriodicTask(180, function(inst) local target = FindEntity(inst, 9, function(guy) return guy:HasTag("zoobaby") end ) if target then local target1 = FindEntity(inst, 9, function(guy) return guy.prefab == "poop" end ) if not target1 then for k = 1,math.random(5,10) do local pt2 = inst:GetPosition() SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5) end else for k = 1,math.random(1,3) do local pt2 = inst:GetPosition() SpawnPrefab("goldnugget").Transform:SetPosition(pt2.x+7.5, 0, pt2.z+7.5) end end if inst.components.container:Has("carrot", 3) then inst.components.container:ConsumeByName("carrot", 3) if math.random()<0.1 then if target:HasTag("zoobaby1") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("krampus") zoobaby.AnimState:SetBuild("krampus_build") zoobaby.AnimState:PlayAnimation("idle", true) zoobaby.entity:AddSoundEmitter() zoobaby.AnimState:Hide("SACK") zoobaby.AnimState:Show("ARM") zoobaby.Transform:SetScale(0.7,0.7,0.7) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkrampus") zoobaby:AddTag("zoobaby1") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby2") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_summer_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby2") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby3") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("koalefant") zoobaby.AnimState:SetBuild("koalefant_winter_build") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.5,0.5,0.5) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGkoalefant") zoobaby:AddTag("zoobaby3") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby4") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("walrus") zoobaby.AnimState:SetBuild("walrus_baby_build") zoobaby.AnimState:PlayAnimation("idle_happy") zoobaby.entity:AddSoundEmitter() zoobaby.Transform:SetScale(0.8,0.8,0.8) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGwalrus") zoobaby:AddTag("zoobaby4") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end if target:HasTag("zoobaby5") then local zoobaby = SpawnPrefab("butter") local pt4 = target:GetPosition() zoobaby.Transform:SetPosition(pt4.x, 0, pt4.z) zoobaby.AnimState:SetBank("kiki") zoobaby.AnimState:SetBuild("kiki_basic") zoobaby.AnimState:PlayAnimation("idle_loop", true) zoobaby.entity:AddSoundEmitter() zoobaby.soundtype = "" zoobaby.Transform:SetScale(1.2,1.2,1.2) zoobaby:AddComponent("locomotor") zoobaby.components.locomotor.walkspeed = 3 zoobaby.components.locomotor.runspeed = 6 zoobaby:SetStateGraph("SGmonkey") zoobaby:AddTag("zoobaby5") local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby.Transform:SetFourFaced() MakeCharacterPhysics(zoobaby, 15, .5) zoobaby:AddComponent("knownlocations") zoobaby:AddComponent("combat") zoobaby:AddComponent("health") zoobaby.components.health:SetMaxHealth(100) zoobaby:RemoveComponent("stackable") zoobaby:RemoveComponent("inventoryitem") zoobaby:RemoveComponent("edible") zoobaby:RemoveComponent("perishable") zoobaby:RemoveComponent("deployable") zoobaby:RemoveComponent("container") local minimap = zoobaby.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") zoobaby:AddComponent("follower") zoobaby.components.inspectable.getstatus = function(zoobaby) if not zoobaby:HasTag("followme") then local brain = require "brains/abigailbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(GetPlayer()) zoobaby.AnimState:SetBloomEffectHandle("shaders/anim.ksh") zoobaby:AddTag("followme") else local brain = require "brains/frogbrain" zoobaby:SetBrain(brain) zoobaby:RestartBrain() zoobaby.components.follower:SetLeader(nil) zoobaby.AnimState:SetBloomEffectHandle("") zoobaby:RemoveTag("followme") end end zoobaby:DoPeriodicTask(math.random(360, 480), function(zoobaby) SpawnPrefab("poop").Transform:SetPosition(zoobaby.Transform:GetWorldPosition()) end ) zoobaby:AddComponent("lootdropper") zoobaby.components.lootdropper:SetLoot({"smallmeat"}) zoobaby:AddTag("zoobaby") end end else target.components.health:Kill() end end end ) inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) for k,v in pairs(ents) do if v:HasTag("zoofence") or v:HasTag("brand") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") v:Remove() end end inst:Remove() end ) end if data and data.zoofence then inst.AnimState:SetBank("wall") inst.AnimState:SetBuild("wall_wood") inst.AnimState:PlayAnimation("1_2", false) MakeObstaclePhysics(inst, .5) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") inst:AddTag("zoofence") inst.components.inspectable.getstatus = function(inst) inst.Transform:SetScale(1, 0.1, 1) inst.Physics:SetActive(false) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") inst:DoTaskInTime(5, function(inst) inst.Transform:SetScale(1, 1, 1) inst.Physics:SetActive(true) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") end ) end end if data and data.zoobaby1 then inst.AnimState:SetBank("krampus") inst.AnimState:SetBuild("krampus_build") inst.AnimState:PlayAnimation("idle", true) inst.entity:AddSoundEmitter() inst.AnimState:Hide("SACK") inst.AnimState:Show("ARM") inst.Transform:SetScale(0.7,0.7,0.7) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 6 inst:SetStateGraph("SGkrampus") inst:AddTag("zoobaby1") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 15, .5) inst:AddComponent("knownlocations") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(100) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") inst:AddComponent("follower") inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("followme") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("followme") end end inst:DoPeriodicTask(math.random(360, 480), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat"}) inst:AddTag("zoobaby") end if data and data.zoobaby2 then inst.AnimState:SetBank("koalefant") inst.AnimState:SetBuild("koalefant_summer_build") inst.AnimState:PlayAnimation("idle_loop", true) inst.entity:AddSoundEmitter() inst.Transform:SetScale(0.5,0.5,0.5) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 6 inst:SetStateGraph("SGkoalefant") inst:AddTag("zoobaby2") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 15, .5) inst:AddComponent("knownlocations") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(100) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") inst:AddComponent("follower") inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("followme") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("followme") end end inst:DoPeriodicTask(math.random(360, 480), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat"}) inst:AddTag("zoobaby") end if data and data.zoobaby3 then inst.AnimState:SetBank("koalefant") inst.AnimState:SetBuild("koalefant_winter_build") inst.AnimState:PlayAnimation("idle_loop", true) inst.entity:AddSoundEmitter() inst.Transform:SetScale(0.5,0.5,0.5) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 6 inst:SetStateGraph("SGkoalefant") inst:AddTag("zoobaby3") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 15, .5) inst:AddComponent("knownlocations") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(100) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") inst:AddComponent("follower") inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("followme") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("followme") end end inst:DoPeriodicTask(math.random(360, 480), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat"}) inst:AddTag("zoobaby") end if data and data.zoobaby4 then inst.AnimState:SetBank("walrus") inst.AnimState:SetBuild("walrus_baby_build") inst.AnimState:PlayAnimation("idle_happy") inst.entity:AddSoundEmitter() inst.Transform:SetScale(0.8,0.8,0.8) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 6 inst:SetStateGraph("SGwalrus") inst:AddTag("zoobaby4") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 15, .5) inst:AddComponent("knownlocations") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(100) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") inst:AddComponent("follower") inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("followme") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("followme") end end inst:DoPeriodicTask(math.random(360, 480), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat"}) inst:AddTag("zoobaby") end if data and data.zoobaby5 then inst.AnimState:SetBank("kiki") inst.AnimState:SetBuild("kiki_basic") inst.AnimState:PlayAnimation("idle_loop", true) inst.entity:AddSoundEmitter() inst.soundtype = "" inst.Transform:SetScale(1.2,1.2,1.2) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 3 inst.components.locomotor.runspeed = 6 inst:SetStateGraph("SGmonkey") inst:AddTag("zoobaby5") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst.Transform:SetFourFaced() MakeCharacterPhysics(inst, 15, .5) inst:AddComponent("knownlocations") inst:AddComponent("combat") inst:AddComponent("health") inst.components.health:SetMaxHealth(100) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("edible") inst:RemoveComponent("perishable") inst:RemoveComponent("deployable") inst:RemoveComponent("container") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("monkey_barrel.png") inst:AddComponent("follower") inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("followme") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("followme") end end inst:DoPeriodicTask(math.random(360, 480), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat"}) inst:AddTag("zoobaby") end if data and data.followme then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") end end inst.OnSave = onsave inst.OnLoad = onload 即可在开阔的空地上,用黄油种动物园,在身上有30个黄金时,用鼠标左键点牌子,可打开格子,放入木炭点Buy按钮,可买一只小龙,花费30个黄金;放入夏象鼻点Buy按钮,可买小红象;放入冬象鼻点Buy按钮,可买小蓝象;放入海象牙点Buy按钮,可买小海象;放入香蕉点Buy按钮,可买猴子。鼠标左键点木栅栏,可开门,5秒后自动关门。鼠标左键点中间的胡萝卜房可打开格子,放入小动物爱吃的胡萝卜(每天消耗9个),当格子里的胡萝卜不足3个时,圈里的动物将陆续饿死。当动物园里有动物时,每天都能收到15-30个黄金的门票钱(放在牌子前面),动物会产便便,如果不及时清扫,门票钱将下降为正常的1/3。如果食物充足,小动物还有一定概率会繁殖,点胡萝卜房格子上方的Sell按钮,可卖掉圈舍中的动物,每只20个黄金。如果动物跑出圈舍,或想带领动物转场,就用鼠标左键点动物(手里不要拿武器),它会跟随你,再次用鼠标左键点动物,可以取消跟随。动物在小地图上显示为猴子的图标。不想要动物园时,用锤子砸掉胡萝卜房即可。黄油可以打蝴蝶获得,如果修改了“巨型超市”,也可花1-3个黄金购得

2025/04/23 · Bny

YN303-良种山羊(用闪电羊角种良种山羊,会生小羊,能跟随、产羊奶)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0三.良种山羊(用闪电羊角种良种山羊,会生小羊,能跟随、产羊奶) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/lightninggoathorn.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local goodgoat = SpawnPrefab("lightninggoathorn") goodgoat.Transform:SetPosition(pt.x, pt.y, pt.z) goodgoat.AnimState:SetBank("lightning_goat") goodgoat.AnimState:SetBuild("lightning_goat_build") goodgoat.AnimState:PlayAnimation("idle_loop", true) goodgoat.Transform:SetFourFaced() goodgoat.entity:AddSoundEmitter() local shadow = goodgoat.entity:AddDynamicShadow() shadow:SetSize(1.75,.75) MakeCharacterPhysics(goodgoat, 100, 1) goodgoat.entity:AddLight() goodgoat.Light:Enable(false) local minimap = goodgoat.entity:AddMiniMapEntity() minimap:SetIcon( "toothtrap.png" ) goodgoat:RemoveComponent("stackable") goodgoat:RemoveComponent("inventoryitem") goodgoat:RemoveComponent("deployable") goodgoat:AddComponent("knownlocations") goodgoat:AddComponent("leader") goodgoat:AddComponent("follower") goodgoat.components.follower:SetLeader(GetPlayer()) goodgoat.AnimState:SetBloomEffectHandle("shaders/anim.ksh") goodgoat:AddTag("followme") goodgoat:AddComponent("locomotor") goodgoat.components.locomotor.walkspeed = 4 goodgoat.components.locomotor.runspeed = 8 goodgoat:SetStateGraph("SGlightninggoat") local brain = require "brains/chesterbrain" goodgoat:SetBrain(brain) goodgoat:AddComponent("health") goodgoat.components.health:SetMaxHealth(200) goodgoat:AddComponent("combat") goodgoat.components.combat.hiteffectsymbol = "lightning_goat_body" goodgoat.components.combat:SetAttackPeriod(1) goodgoat.components.combat:SetRange(1, 2) goodgoat.components.combat:SetDefaultDamage(10) goodgoat:AddComponent("lootdropper") goodgoat.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat"}) goodgoat:ListenForEvent("attacked", function(goodgoat, data) if data.attacker ~= GetPlayer() then goodgoat.components.combat:SetTarget(data.attacker) goodgoat.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10) else goodgoat.components.health:Kill() end end ) goodgoat.components.inspectable.getstatus = function(goodgoat) if not goodgoat:HasTag("followme") then local brain = require "brains/chesterbrain" goodgoat:SetBrain(brain) goodgoat:RestartBrain() goodgoat.components.follower:SetLeader(GetPlayer()) goodgoat.AnimState:SetBloomEffectHandle("shaders/anim.ksh") goodgoat:AddTag("followme") else local brain = require "brains/frogbrain" goodgoat:SetBrain(brain) goodgoat:RestartBrain() goodgoat.components.follower:SetLeader(nil) goodgoat.AnimState:SetBloomEffectHandle("") goodgoat:RemoveTag("followme") end end goodgoat:DoPeriodicTask(math.random(180, 360), function(goodgoat) SpawnPrefab("goatmilk").Transform:SetPosition(goodgoat.Transform:GetWorldPosition()) end ) goodgoat:ListenForEvent( "nighttime", function() if math.random()<.3 then local pt0 = goodgoat:GetPosition() local smallgoat = SpawnPrefab("lightninggoathorn") smallgoat.Transform:SetPosition(pt0.x, pt0.y, pt0.z) smallgoat.AnimState:SetBank("lightning_goat") smallgoat.AnimState:SetBuild("lightning_goat_build") smallgoat.AnimState:PlayAnimation("idle_loop", true) smallgoat.Transform:SetFourFaced() smallgoat.Transform:SetScale(0.6, 0.6, 0.6) smallgoat.entity:AddSoundEmitter() local shadow = smallgoat.entity:AddDynamicShadow() shadow:SetSize(1,.5) MakeCharacterPhysics(smallgoat, 60, 0.6) smallgoat.entity:AddLight() smallgoat.Light:Enable(false) local minimap = smallgoat.entity:AddMiniMapEntity() minimap:SetIcon( "toothtrap.png" ) smallgoat:RemoveComponent("stackable") smallgoat:RemoveComponent("inventoryitem") smallgoat:RemoveComponent("deployable") smallgoat:AddComponent("knownlocations") smallgoat:AddComponent("follower") smallgoat:AddComponent("locomotor") smallgoat.components.locomotor.walkspeed = 4 smallgoat.components.locomotor.runspeed = 8 smallgoat:SetStateGraph("SGlightninggoat") smallgoat:AddComponent("health") smallgoat.components.health:SetMaxHealth(100) smallgoat:AddComponent("combat") smallgoat.components.combat.hiteffectsymbol = "lightning_goat_body" smallgoat.components.combat:SetAttackPeriod(1) smallgoat.components.combat:SetRange(1, 2) smallgoat.components.combat:SetDefaultDamage(5) smallgoat:AddComponent("lootdropper") smallgoat.components.lootdropper:SetLoot({"meat","meat","meat","lightninggoathorn"}) smallgoat:ListenForEvent("attacked", function(smallgoat, data) if data.attacker ~= GetPlayer() then smallgoat.components.combat:SetTarget(data.attacker) smallgoat.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10) else smallgoat.components.health:Kill() end end ) smallgoat:DoPeriodicTask(math.random(180, 360), function(smallgoat) SpawnPrefab("poop").Transform:SetPosition(smallgoat.Transform:GetWorldPosition()) end ) smallgoat:DoTaskInTime(1, function(smallgoat) local mama = FindEntity(smallgoat, 100, function(guy) return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead() end) if mama then local brain = require "brains/chesterbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(mama) else local brain = require "brains/frogbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(nil) end end ) smallgoat.components.inspectable.getstatus = function(smallgoat) local mama = FindEntity(smallgoat, 100, function(guy) return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead() end) if mama then local brain = require "brains/chesterbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(mama) else local brain = require "brains/frogbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(nil) end end smallgoat:AddTag("smallgoats") end end , GetWorld()) goodgoat:AddTag("goodgoats") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("goodgoats") then data.goodgoats = true end if inst:HasTag("followme") then data.followme = true end if inst:HasTag("smallgoats") then data.smallgoats = true end end local function onload(inst, data) if data and data.goodgoats then inst.AnimState:SetBank("lightning_goat") inst.AnimState:SetBuild("lightning_goat_build") inst.AnimState:PlayAnimation("idle_loop", true) inst.Transform:SetFourFaced() inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize(1.75,.75) MakeCharacterPhysics(inst, 100, 1) inst.entity:AddLight() inst.Light:Enable(false) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "toothtrap.png" ) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("deployable") inst:AddComponent("knownlocations") inst:AddComponent("leader") inst:AddComponent("follower") inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 4 inst.components.locomotor.runspeed = 8 inst:SetStateGraph("SGlightninggoat") local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:AddComponent("health") inst.components.health:SetMaxHealth(200) inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "lightning_goat_body" inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRange(1, 2) inst.components.combat:SetDefaultDamage(10) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat"}) inst:ListenForEvent("attacked", function(inst, data) if data.attacker ~= GetPlayer() then inst.components.combat:SetTarget(data.attacker) inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10) else inst.components.health:Kill() end end ) inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("followme") then local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("followme") end end inst:DoPeriodicTask(math.random(180, 360), function(inst) SpawnPrefab("goatmilk").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:ListenForEvent( "nighttime", function() if math.random()<.3 then local pt0 = inst:GetPosition() local smallgoat = SpawnPrefab("lightninggoathorn") smallgoat.Transform:SetPosition(pt0.x, pt0.y, pt0.z) smallgoat.AnimState:SetBank("lightning_goat") smallgoat.AnimState:SetBuild("lightning_goat_build") smallgoat.AnimState:PlayAnimation("idle_loop", true) smallgoat.Transform:SetFourFaced() smallgoat.Transform:SetScale(0.6, 0.6, 0.6) smallgoat.entity:AddSoundEmitter() local shadow = smallgoat.entity:AddDynamicShadow() shadow:SetSize(1,.5) MakeCharacterPhysics(smallgoat, 60, 0.6) smallgoat.entity:AddLight() smallgoat.Light:Enable(false) local minimap = smallgoat.entity:AddMiniMapEntity() minimap:SetIcon( "toothtrap.png" ) smallgoat:RemoveComponent("stackable") smallgoat:RemoveComponent("inventoryitem") smallgoat:RemoveComponent("deployable") smallgoat:AddComponent("knownlocations") smallgoat:AddComponent("follower") smallgoat:AddComponent("locomotor") smallgoat.components.locomotor.walkspeed = 4 smallgoat.components.locomotor.runspeed = 8 smallgoat:SetStateGraph("SGlightninggoat") smallgoat:AddComponent("health") smallgoat.components.health:SetMaxHealth(100) smallgoat:AddComponent("combat") smallgoat.components.combat.hiteffectsymbol = "lightning_goat_body" smallgoat.components.combat:SetAttackPeriod(1) smallgoat.components.combat:SetRange(1, 2) smallgoat.components.combat:SetDefaultDamage(5) smallgoat:AddComponent("lootdropper") smallgoat.components.lootdropper:SetLoot({"meat","meat","meat","lightninggoathorn"}) smallgoat:ListenForEvent("attacked", function(smallgoat, data) if data.attacker ~= GetPlayer() then smallgoat.components.combat:SetTarget(data.attacker) smallgoat.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10) else smallgoat.components.health:Kill() end end ) smallgoat:DoPeriodicTask(math.random(180, 360), function(smallgoat) SpawnPrefab("poop").Transform:SetPosition(smallgoat.Transform:GetWorldPosition()) end ) smallgoat:DoTaskInTime(1, function(smallgoat) local mama = FindEntity(smallgoat, 100, function(guy) return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead() end) if mama then local brain = require "brains/chesterbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(mama) else local brain = require "brains/frogbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(nil) end end ) smallgoat.components.inspectable.getstatus = function(smallgoat) local mama = FindEntity(smallgoat, 100, function(guy) return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead() end) if mama then local brain = require "brains/chesterbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(mama) else local brain = require "brains/frogbrain" smallgoat:SetBrain(brain) smallgoat:RestartBrain() smallgoat.components.follower:SetLeader(nil) end end smallgoat:AddTag("smallgoats") end end , GetWorld()) inst:AddTag("goodgoats") end if data and data.followme then local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("followme") end if data and data.smallgoats then inst.AnimState:SetBank("lightning_goat") inst.AnimState:SetBuild("lightning_goat_build") inst.AnimState:PlayAnimation("idle_loop", true) inst.Transform:SetFourFaced() inst.Transform:SetScale(0.6, 0.6, 0.6) inst.entity:AddSoundEmitter() local shadow = inst.entity:AddDynamicShadow() shadow:SetSize(1,.5) MakeCharacterPhysics(inst, 60, 0.6) inst.entity:AddLight() inst.Light:Enable(false) local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "toothtrap.png" ) inst:RemoveComponent("stackable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("deployable") inst:AddComponent("knownlocations") inst:AddComponent("follower") inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 4 inst.components.locomotor.runspeed = 8 inst:SetStateGraph("SGlightninggoat") inst:AddComponent("health") inst.components.health:SetMaxHealth(100) inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "lightning_goat_body" inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRange(1, 2) inst.components.combat:SetDefaultDamage(5) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"meat","meat","meat","lightninggoathorn"}) inst:ListenForEvent("attacked", function(inst, data) if data.attacker ~= GetPlayer() then inst.components.combat:SetTarget(data.attacker) inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("goodgoats") and not dude.components.health:IsDead() end, 10) else inst.components.health:Kill() end end ) inst:DoPeriodicTask(math.random(180, 360), function(inst) SpawnPrefab("poop").Transform:SetPosition(inst.Transform:GetWorldPosition()) end ) inst:DoTaskInTime(1, function(inst) local mama = FindEntity(inst, 100, function(guy) return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead() end) if mama then local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(mama) else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) end end ) inst.components.inspectable.getstatus = function(inst) local mama = FindEntity(inst, 100, function(guy) return guy:HasTag("goodgoats") and guy.components.leader and guy.components.health and not guy.components.health:IsDead() end) if mama then local brain = require "brains/chesterbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(mama) else local brain = require "brains/frogbrain" inst:SetBrain(brain) inst:RestartBrain() inst.components.follower:SetLeader(nil) end end inst:AddTag("smallgoats") end end inst.OnSave = onsave inst.OnLoad = onload 即可用闪电羊角种良种山羊,鼠标左键点山羊(手里不要拿武器,以免误伤)可跟随,再次点击取消跟随。良种山羊每天可产1-2份羊奶,夜里还有一定概率生下小羊,杀掉良种山羊可得6块大肉。小羊只跟随大羊,如果你杀掉了小羊的妈妈,它会乱跑,这时带一只大羊,用鼠标左键点小羊,可让它认新的妈妈。小羊会产便便,不会长大,可作为你的肉食来源,屠宰后得到3块大肉和闪电羊角,其中闪电羊角可用于再种良种山羊,逐步壮大你的羊群。良种山羊在小地图上显示为犬牙陷阱图标。闪电羊角可打闪电羊获得,如修改了“巨型超市”,也可花1-3个黄金购得

2025/04/23 · Bny

YN304-商业采矿机(用晶体管种商业采矿机,20个黄金租用一次,收购采出的矿石,赔钱、赚钱天注定)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0四.商业采矿机(用晶体管种商业采矿机,20个黄金租用一次,收购采出的矿石,赔钱、赚钱天注定) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/transistor.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function makeluckypit(inst) local pt = inst:GetPosition() local luckypit = SpawnPrefab("transistor") luckypit.Transform:SetPosition(pt.x, pt.y, pt.z) luckypit.AnimState:SetBank("coldfirepit") luckypit.AnimState:SetBuild("coldfirepit") luckypit.AnimState:PlayAnimation("idle",false) luckypit.entity:AddSoundEmitter() luckypit.Transform:SetScale(1.5,1.5,1.5) luckypit:RemoveComponent("stackable") luckypit:RemoveComponent("inventoryitem") luckypit:RemoveComponent("deployable") luckypit:AddComponent("workable") luckypit.components.workable:SetWorkAction(ACTIONS.HAMMER) luckypit.components.workable:SetWorkLeft(3) luckypit.components.workable:SetOnFinishCallback(function(luckypit) SpawnPrefab("collapse_big").Transform:SetPosition(luckypit.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") luckypit:Remove() end ) luckypit:AddComponent("trader") luckypit.components.trader:SetAcceptTest(function(luckypit, item) if GetPlayer().components.inventory:Has("goldnugget", 20) then if not luckypit:HasTag("domining") then if item.prefab == "goldnugget" then return true end end end if item.prefab == "rocks" or item.prefab == "nitre" or item.prefab == "flint" or item.prefab == "redgem" or item.prefab == "bluegem" or item.prefab == "purplegem" or item.prefab == "greengem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "thulecite" or item.prefab == "ice" then return true end return false end ) luckypit.components.trader.onaccept = function(luckypit, giver, item) if item.prefab == "goldnugget" then giver.components.inventory:ConsumeByName("goldnugget", 19) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") luckypit:AddTag("domining") luckypit.task = luckypit:DoPeriodicTask(1, function() local pt0 = luckypit:GetPosition() luckypit.AnimState:SetBloomEffectHandle("shaders/anim.ksh") luckypit:DoTaskInTime(0.5, function() luckypit.AnimState:SetBloomEffectHandle("") end ) SpawnPrefab("collapse_small").Transform:SetPosition(pt0.x, 1, pt0.z) luckypit.SoundEmitter:PlaySound("dontstarve/wilson/rock_break") GetPlayer().components.playercontroller:ShakeCamera(luckypit, "FULL", 0.7, 0.02, .5, 40) local ores = {"rocks","nitre","flint","redgem","bluegem","purplegem","greengem","orangegem","yellowgem","thulecite","ice","goldnugget","ash"} local ore = ores[math.random(#ores)] local myore = SpawnPrefab(ore) myore.Transform:SetPosition(pt0.x, 0, pt0.z) myore.components.inventoryitem.canbepickedup = false myore:AddComponent("complexprojectile") myore.components.complexprojectile.yOffset = 2.5 myore.components.complexprojectile:Launch(Point(pt0.x+(math.random(10)-math.random(10)), 0, pt0.z+(math.random(10)-math.random(10)))) myore.components.complexprojectile:SetOnHit(function() SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(myore.Transform:GetWorldPosition()) myore:RemoveComponent("complexprojectile") myore.components.inventoryitem.canbepickedup = true end ) end ) luckypit:DoTaskInTime(math.random(10,60), function() SpawnPrefab("collapse_big").Transform:SetPosition(luckypit.Transform:GetWorldPosition()) luckypit.SoundEmitter:PlaySound("dontstarve/common/destroy_wood") if luckypit.task then luckypit.task:Cancel() luckypit.task = nil end luckypit:RemoveTag("domining") end ) end if item.prefab == "thulecite" then for k = 1, 3 do local goldnugget = SpawnPrefab("goldnugget") giver.components.inventory:GiveItem(goldnugget) end end if item.prefab == "rocks" or item.prefab == "nitre" or item.prefab == "flint" or item.prefab == "redgem" or item.prefab == "bluegem" or item.prefab == "purplegem" or item.prefab == "greengem" or item.prefab == "orangegem" or item.prefab == "yellowgem" or item.prefab == "ice" then local goldnugget = SpawnPrefab("goldnugget") giver.components.inventory:GiveItem(goldnugget) end end luckypit:AddTag("luckypit") end local function OnDeploy (inst, pt) makeluckypit(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("luckypit") then data.luckypit = true end end local function onload(inst, data) if data and data.luckypit then makeluckypit(inst) inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可用晶体管种商业采矿机(拿着1个晶体管对地面点鼠标右键,如果拿着多个,则不会种出来),给它20个黄金(拿着黄金对采矿机点鼠标左键)可租用一次,采出的矿石数量不确定,还有一定概率采出灰。你可以将矿石留下自用,也可以卖给商业采矿机(拿着矿石对采矿机点鼠标左键),除铥矿石可卖3个黄金外,其余每个矿石可卖1个黄金,能否平衡你支付的租金,就要看天意了,开启矿业大亨的生涯吧。不想要商业采矿机了,用锤子砸掉即可。晶体管在精炼选项(画着白色宝石)下,用2个黄金、1个石砖制造

2025/04/23 · Bny

YN305-环保公司(用草种环保公司,将接收的垃圾搬到粉碎区,点铃粉碎后得黄金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0五.环保公司(用草种环保公司,将接收的垃圾搬到粉碎区,点铃粉碎后得黄金) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/cutgrass.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function makegrinder(inst) local pt = inst:GetPosition() local redmark = SpawnPrefab("cutgrass") redmark.Transform:SetPosition(pt.x, pt.y, pt.z) redmark.AnimState:SetBank("gridplacer") redmark.AnimState:SetBuild("gridplacer") redmark.AnimState:PlayAnimation("anim", true) redmark.Transform:SetScale(1.5, 1.5, 1.5) redmark.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) redmark.AnimState:SetLayer( LAYER_BACKGROUND ) redmark.AnimState:SetSortOrder( 3 ) redmark.Transform:SetRotation( 45 ) redmark.AnimState:SetMultColour(255/255,0/255,0/255,1) redmark.AnimState:SetLightOverride(1) redmark:AddTag("NOCLICK") redmark:RemoveComponent("stackable") redmark:RemoveComponent("edible") redmark:RemoveComponent("tradable") redmark:RemoveComponent("fuel") redmark:RemoveComponent("burnable") redmark:RemoveComponent("propagator") redmark:RemoveComponent("repairer") redmark:RemoveComponent("inventoryitem") redmark:RemoveComponent("deployable") redmark:RemoveTag("cattoy") redmark:AddTag("redmark") local yellowmark = SpawnPrefab("cutgrass") yellowmark.Transform:SetPosition(pt.x-12.5, 0, pt.z+12.5) yellowmark.AnimState:SetBank("gridplacer") yellowmark.AnimState:SetBuild("gridplacer") yellowmark.AnimState:PlayAnimation("anim", true) yellowmark.Transform:SetScale(2, 2, 2) yellowmark.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) yellowmark.AnimState:SetLayer( LAYER_BACKGROUND ) yellowmark.AnimState:SetSortOrder( 3 ) yellowmark.Transform:SetRotation( 45 ) yellowmark.AnimState:SetMultColour(255/255,255/255,0/255,1) yellowmark.AnimState:SetLightOverride(1) yellowmark:AddTag("NOCLICK") yellowmark:RemoveComponent("stackable") yellowmark:RemoveComponent("edible") yellowmark:RemoveComponent("tradable") yellowmark:RemoveComponent("fuel") yellowmark:RemoveComponent("burnable") yellowmark:RemoveComponent("propagator") yellowmark:RemoveComponent("repairer") yellowmark:RemoveComponent("inventoryitem") yellowmark:RemoveComponent("deployable") yellowmark:RemoveTag("cattoy") yellowmark:ListenForEvent( "daytime", function() for k = 1,math.random(6,12) do local pt1 = yellowmark:GetPosition() local trash = SpawnPrefab("cutgrass") trash.Transform:SetPosition(pt1.x+(math.random(6)-math.random(6)), 0, pt1.z+(math.random(6)-math.random(6))) trash.AnimState:SetBank("fertilizer") trash.AnimState:SetBuild("fertilizer") trash.AnimState:PlayAnimation("idle") trash.Transform:SetScale(1.5, 1.5, 1.5) trash.AnimState:SetMultColour(0/255,255/255,0/255,1) trash.components.inventoryitem:ChangeImageName("fertilizer") trash:RemoveComponent("stackable") trash:RemoveComponent("edible") trash:RemoveComponent("tradable") trash:RemoveComponent("fuel") trash:RemoveComponent("burnable") trash:RemoveComponent("propagator") trash:RemoveComponent("repairer") trash:RemoveComponent("deployable") trash:RemoveTag("cattoy") trash:AddComponent("named") trash.components.named:SetName("Refuse") trash.flies = trash:SpawnChild("flies") trash.components.inventoryitem:SetOnDroppedFn(function() trash.flies = trash:SpawnChild("flies") end ) trash.components.inventoryitem:SetOnPickupFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end ) trash.components.inventoryitem:SetOnPutInInventoryFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end ) MakeSmallBurnable(trash) MakeSmallPropagator(trash) trash:AddTag("trash") end end , GetWorld() ) yellowmark:ListenForEvent( "nighttime", function() for k = 1,math.random(3,5) do local pt1 = yellowmark:GetPosition() local trash = SpawnPrefab("cutgrass") trash.Transform:SetPosition(pt1.x+(math.random(6)-math.random(6)), 0, pt1.z+(math.random(6)-math.random(6))) trash.AnimState:SetBank("fertilizer") trash.AnimState:SetBuild("fertilizer") trash.AnimState:PlayAnimation("idle") trash.Transform:SetScale(1.5, 1.5, 1.5) trash.AnimState:SetMultColour(0/255,255/255,0/255,1) trash.components.inventoryitem:ChangeImageName("fertilizer") trash:RemoveComponent("stackable") trash:RemoveComponent("edible") trash:RemoveComponent("tradable") trash:RemoveComponent("fuel") trash:RemoveComponent("burnable") trash:RemoveComponent("propagator") trash:RemoveComponent("repairer") trash:RemoveComponent("deployable") trash:RemoveTag("cattoy") trash:AddComponent("named") trash.components.named:SetName("Refuse") trash.flies = trash:SpawnChild("flies") trash.components.inventoryitem:SetOnDroppedFn(function() trash.flies = trash:SpawnChild("flies") end ) trash.components.inventoryitem:SetOnPickupFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end ) trash.components.inventoryitem:SetOnPutInInventoryFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end ) MakeSmallBurnable(trash) MakeSmallPropagator(trash) trash:AddTag("trash") end end , GetWorld() ) yellowmark:ListenForEvent( "dusktime", function() for k = 1,math.random(5,7) do local pt1 = yellowmark:GetPosition() local trash = SpawnPrefab("cutgrass") trash.Transform:SetPosition(pt1.x+(math.random(6)-math.random(6)), 0, pt1.z+(math.random(6)-math.random(6))) trash.AnimState:SetBank("fertilizer") trash.AnimState:SetBuild("fertilizer") trash.AnimState:PlayAnimation("idle") trash.Transform:SetScale(1.5, 1.5, 1.5) trash.AnimState:SetMultColour(0/255,255/255,0/255,1) trash.components.inventoryitem:ChangeImageName("fertilizer") trash:RemoveComponent("stackable") trash:RemoveComponent("edible") trash:RemoveComponent("tradable") trash:RemoveComponent("fuel") trash:RemoveComponent("burnable") trash:RemoveComponent("propagator") trash:RemoveComponent("repairer") trash:RemoveComponent("deployable") trash:RemoveTag("cattoy") trash:AddComponent("named") trash.components.named:SetName("Refuse") trash.flies = trash:SpawnChild("flies") trash.components.inventoryitem:SetOnDroppedFn(function() trash.flies = trash:SpawnChild("flies") end ) trash.components.inventoryitem:SetOnPickupFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end ) trash.components.inventoryitem:SetOnPutInInventoryFn(function() if trash.flies then trash.flies:Remove() trash.flies = nil end end ) MakeSmallBurnable(trash) MakeSmallPropagator(trash) trash:AddTag("trash") end end , GetWorld() ) yellowmark:AddTag("yellowmark") local footbell = SpawnPrefab("cutgrass") footbell.Transform:SetPosition(pt.x-5, 0, pt.z+5) footbell.AnimState:SetBank("bell") footbell.AnimState:SetBuild("bell") footbell.AnimState:PlayAnimation("idle") footbell.AnimState:SetMultColour(255/255,255/255,0/255,1) footbell.AnimState:SetBloomEffectHandle("shaders/anim.ksh") footbell:RemoveComponent("stackable") footbell:RemoveComponent("edible") footbell:RemoveComponent("tradable") footbell:RemoveComponent("fuel") footbell:RemoveComponent("burnable") footbell:RemoveComponent("propagator") footbell:RemoveComponent("repairer") footbell:RemoveComponent("inventoryitem") footbell:RemoveComponent("deployable") footbell:RemoveTag("cattoy") footbell:AddComponent("named") footbell.components.named:SetName("Bell") footbell:AddTag("footbell") footbell:AddComponent("workable") footbell.components.workable:SetWorkAction(ACTIONS.HAMMER) footbell.components.workable:SetWorkLeft(3) footbell.components.workable:SetOnFinishCallback(function() SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(footbell.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") local pos2 = Vector3(footbell.Transform:GetWorldPosition()) local ents2 = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 30) for k,v in pairs(ents2) do if v:HasTag("redmark") or v:HasTag("yellowmark") or v:HasTag("trash") or v:HasTag("footfoot") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end footbell:Remove() end ) footbell.components.inspectable.getstatus = function() GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") local foot = SpawnPrefab("cutgrass") foot.Transform:SetPosition(pt.x, 10, pt.z) foot.AnimState:SetBank("foot") foot.AnimState:SetBuild("foot_build") foot.AnimState:PlayAnimation("idle") foot.Transform:SetFourFaced() foot.Transform:SetRotation( 270 ) foot:RemoveComponent("stackable") foot:RemoveComponent("edible") foot:RemoveComponent("tradable") foot:RemoveComponent("fuel") foot:RemoveComponent("burnable") foot:RemoveComponent("propagator") foot:RemoveComponent("repairer") foot:RemoveComponent("inventoryitem") foot:RemoveComponent("deployable") foot:RemoveTag("cattoy") foot:AddTag("footfoot") foot.falling = foot:DoPeriodicTask(.01, function() foot.Physics:SetMotorVelOverride(0,-55,0) end) foot:DoTaskInTime(0.1, function() if foot.falling then foot.falling:Cancel() foot.falling = nil end GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") GetPlayer().components.playercontroller:ShakeCamera(foot, "FULL", 0.5, 0.05, 2, 40) SpawnPrefab("collapse_big").Transform:SetPosition(pt.x, 0, pt.z) local pos = Vector3(foot.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,0,pos.z, 5) for k,v in pairs(ents) do if v:HasTag("trash") and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then SpawnPrefab("goldnugget").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end if v:HasTag("player") then v.AnimState:PlayAnimation("hit") v.components.health:DoDelta(-5) end end foot:DoTaskInTime(0.5, function() GetPlayer().SoundEmitter:PlaySound("dontstarve/common/stone_drop") SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(foot.Transform:GetWorldPosition()) foot:Remove() end ) end ) end end local function OnDeploy (inst, pt) makegrinder(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("redmark") then data.redmark = true end if inst:HasTag("yellowmark") then data.yellowmark = true end if inst:HasTag("trash") then data.trash = true end if inst:HasTag("footbell") then data.footbell = true end if inst:HasTag("footfoot") then data.footfoot = true end end local function onload(inst, data) if data and data.redmark then makegrinder(inst) inst:Remove() end if data and data.yellowmark then inst:Remove() end if data and data.footbell then inst:Remove() end if data and data.footfoot then inst:Remove() end if data and data.trash then inst.AnimState:SetBank("fertilizer") inst.AnimState:SetBuild("fertilizer") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(1.5, 1.5, 1.5) inst.AnimState:SetMultColour(0/255,255/255,0/255,1) inst.components.inventoryitem:ChangeImageName("fertilizer") inst:RemoveComponent("stackable") inst:RemoveComponent("edible") inst:RemoveComponent("tradable") inst:RemoveComponent("fuel") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("repairer") inst:RemoveComponent("deployable") inst:RemoveTag("cattoy") inst:AddComponent("named") inst.components.named:SetName("Refuse") inst.flies = inst:SpawnChild("flies") inst.components.inventoryitem:SetOnDroppedFn(function() inst.flies = inst:SpawnChild("flies") end ) inst.components.inventoryitem:SetOnPickupFn(function() if inst.flies then inst.flies:Remove() inst.flies = nil end end ) inst.components.inventoryitem:SetOnPutInInventoryFn(function() if inst.flies then inst.flies:Remove() inst.flies = nil end end ) MakeSmallBurnable(inst) MakeSmallPropagator(inst) inst:AddTag("trash") end end inst.OnSave = onsave inst.OnLoad = onload 即可在开阔的空地上,用草种环保公司(拿着1个草对地面点鼠标右键,如果拿着多个,则不会种出来),每天白天、傍晚、黑夜都会有垃圾被送到黄区,将它们搬到红区后,鼠标左键点地上的铃,可将垃圾粉碎,其中的贵金属(黄金)将留在地上,这就是环保公司的收入来源。粉碎垃圾时,不要站在红区附近,会被砸伤(减5点血)。黄区的垃圾如不及时清理,会越来越多,如果实在处理不过来,可以将垃圾烧掉,但那样就没有收入了。这是饥荒世界唯一一家环保公司,整块大陆的清洁就仰赖你了,承担起这肮脏而又崇高的事业吧。不想要环保公司了,用锤子砸掉铃即可

2025/04/23 · Bny

YN306-生鲜售卖机(用木板种生鲜售卖机,放入生鲜产品,每天清晨自动卖出换黄金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0六.生鲜售卖机(用木板种生鲜售卖机,放入生鲜产品,每天清晨自动卖出换黄金) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/boards.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function OnDeploy (inst, pt) local vending = SpawnPrefab("boards") vending.Transform:SetPosition(pt.x, pt.y, pt.z) vending.AnimState:SetBank("icebox") vending.AnimState:SetBuild("ice_box") vending.AnimState:PlayAnimation("closed") vending.Transform:SetScale(1.3, 1.3, 1.3) vending.AnimState:SetMultColour(255/255,255/255,0/255,1) vending:RemoveComponent("stackable") vending:RemoveComponent("tradable") vending:RemoveComponent("edible") vending:RemoveComponent("inventoryitem") vending:RemoveComponent("repairer") vending:RemoveComponent("fuel") vending:RemoveComponent("burnable") vending:RemoveComponent("propagator") vending:RemoveComponent("deployable") vending.components.container.canbeopened = true vending:DoPeriodicTask(2, function(vending) vending.AnimState:SetBloomEffectHandle("shaders/anim.ksh") vending:DoTaskInTime(1, function() vending.AnimState:SetBloomEffectHandle("") end ) end ) vending:AddComponent("workable") vending.components.workable:SetWorkAction(ACTIONS.HAMMER) vending.components.workable:SetWorkLeft(3) vending.components.workable:SetOnFinishCallback(function(vending) SpawnPrefab("collapse_big").Transform:SetPosition(vending.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") vending:Remove() end ) vending:ListenForEvent( "daytime", function() local num_found = 0 for k,v in pairs(vending.components.container.slots) do if v and v.prefab ~= "goldnugget" and v.prefab ~= "spoiled_food" then num_found = num_found + v.components.stackable:StackSize() v:Remove() end end for k = 1, num_found do local goldnugget = SpawnPrefab("goldnugget") vending.components.container:GiveItem(goldnugget) end end, GetWorld()) vending:AddTag("vendings") inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("vendings") then data.vendings = true end end local function onload(inst, data) if data and data.vendings then inst.AnimState:SetBank("icebox") inst.AnimState:SetBuild("ice_box") inst.AnimState:PlayAnimation("closed") inst.Transform:SetScale(1.3, 1.3, 1.3) inst.AnimState:SetMultColour(255/255,255/255,0/255,1) inst:RemoveComponent("stackable") inst:RemoveComponent("tradable") inst:RemoveComponent("edible") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("repairer") inst:RemoveComponent("fuel") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst.components.container.canbeopened = true inst:DoPeriodicTask(2, function(inst) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:DoTaskInTime(1, function() inst.AnimState:SetBloomEffectHandle("") end ) end ) 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( "daytime", function() local num_found = 0 for k,v in pairs(inst.components.container.slots) do if v and v.prefab ~= "goldnugget" and v.prefab ~= "spoiled_food" then num_found = num_found + v.components.stackable:StackSize() v:Remove() end end for k = 1, num_found do local goldnugget = SpawnPrefab("goldnugget") inst.components.container:GiveItem(goldnugget) end end, GetWorld()) inst:AddTag("vendings") end end inst.OnSave = onsave inst.OnLoad = onload local slotpos = {} for y = 3, 0, -1 do for x = 0, 2 do table.insert(slotpos, Vector3(75*x-75*2+75, 75*y-75*2+75,0)) end end inst:AddComponent("container") inst.components.container:SetNumSlots(#slotpos) inst.components.container.widgetslotpos = slotpos inst.components.container.widgetpos = Vector3(0,100,0) inst.components.container.side_align_tip = 160 inst.components.container.canbeopened = false inst.components.container.onopenfn = function(inst) inst.AnimState:PlayAnimation("open") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end inst.components.container.onclosefn = function(inst) inst.AnimState:PlayAnimation("close") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end inst.components.container.itemtestfn = function(inst, item, slot) if item.prefab == "cave_banana" or item.prefab == "carrot" or item.prefab == "corn" or item.prefab == "pumpkin" or item.prefab == "eggplant" or item.prefab == "durian" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" or item.prefab == "berries" or item.prefab == "cactus_meat" or item.prefab == "watermelon" or item.prefab == "acorn" or item.prefab == "meat" or item.prefab == "smallmeat" or item.prefab == "fish" or item.prefab == "eel" or item.prefab == "drumstick" or item.prefab == "bird_egg" or item.prefab == "froglegs" or item.prefab == "monstermeat" or item.prefab == "spoiled_food" or item.prefab == "butter" or item.prefab == "butterflywings" or item.prefab == "cutlichen" or item.prefab == "foliage" or item.prefab == "honey" or item.prefab == "lightbulb" or item.prefab == "red_cap" or item.prefab == "green_cap" or item.prefab == "blue_cap" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "goatmilk" or item.prefab == "goldnugget" then return true end return false end inst:AddTag("fridge") 即可用木板种生鲜售卖机,鼠标左键点售卖机,可打开格子,将蔬菜和肉类等生鲜产品放入格子中,每天清晨将全部卖出,每个售价1个黄金,结算的黄金在售卖机中领取。有了生鲜售卖机,不用发愁过剩的产品不好销售了。可以出售的生鲜产品包括香蕉、胡萝卜、玉米、南瓜、茄子、榴莲、石榴、火龙果、浆果、仙人掌肉、西瓜、橡果、大肉、小肉、鱼、鳗鱼、鸡腿、鸟蛋、蛙腿、疯肉、黄油、蝴蝶翅膀、苔藓、叶子、蜂蜜、荧光果、红蘑菇、绿蘑菇、蓝蘑菇、花瓣、噩梦花瓣。不想要生鲜售卖机了,用锤子砸掉即可。不要与“用木板种鱼人房”一同修改

2025/04/23 · Bny

YN307-炸弹客(用红色护身符种炸弹客,购买遥控炸弹,放在地上按键盘Delete键引爆)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0七.炸弹客(用红色护身符种炸弹客,购买遥控炸弹,放在地上按键盘Delete键引爆) 1.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_DELETE, function() GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") inst:DoTaskInTime(0.1, function() local pos = Vector3(inst.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 100) for k,v in pairs(ents) do if v:HasTag("bomballright") and v.components.inventoryitem and not v.components.inventoryitem:IsHeld() then local pos1 = Vector3(v.Transform:GetWorldPosition()) local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 15) for k,i in pairs(ents1) do if i.components.combat and i.components.health and not i.components.health:IsDead() and not i:HasTag("player") then SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(i.Transform:GetWorldPosition()) i.components.health:Kill() end if i.components.workable and i.components.workable.workleft > 0 and not i.components.inventoryitem then SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(i.Transform:GetWorldPosition()) i.components.workable:Destroy(v) end end GetPlayer().SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/foot_ground") SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) SpawnPrefab("explode_small").Transform:SetPosition(v.Transform:GetWorldPosition()) SpawnPrefab("groundpoundring_fx").Transform:SetPosition(v.Transform:GetWorldPosition()) GetClock():DoLightningLighting() GetPlayer().components.playercontroller:ShakeCamera(v, "FULL", 0.7, 0.02, .5, 40) v:Remove() end end end ) end ) 2.用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/amulet.lua文件,在inst.AnimState:PlayAnimation("redamulet")的下一行插入以下内容: local function makebomber(inst) local pt = inst:GetPosition() local bomber = SpawnPrefab("amulet") bomber.Transform:SetPosition(pt.x, pt.y, pt.z) bomber.AnimState:SetBank("wilson") bomber.AnimState:SetBuild("wx78") bomber.AnimState:OverrideSymbol("swap_hat", "hat_catcoon", "swap_hat") bomber.AnimState:OverrideSymbol("swap_body", "swap_krampus_sack", "backpack") bomber.AnimState:OverrideSymbol("swap_body", "swap_krampus_sack", "swap_body") bomber.AnimState:Show("HAT") bomber.AnimState:Show("HAT_HAIR") bomber.AnimState:Hide("HAIR_NOHAT") bomber.AnimState:Hide("HAIR") bomber.AnimState:Hide("ARM_carry") bomber.AnimState:Show("ARM_normal") bomber.Transform:SetFourFaced() bomber.AnimState:PlayAnimation("idle") bomber:RemoveComponent("equippable") bomber:RemoveComponent("inventoryitem") bomber:RemoveComponent("finiteuses") bomber:RemoveComponent("deployable") MakeLargeBurnable(bomber) MakeLargePropagator(bomber) bomber:AddComponent("trader") bomber.components.trader:SetAcceptTest(function(bomber, item) if GetPlayer().components.inventory:Has("goldnugget", 10) then if item.prefab == "goldnugget" then return true end end return false end ) bomber.components.trader.onaccept = function(bomber, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 9) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") bomber.AnimState:PlayAnimation("give") local bomb = SpawnPrefab("amulet") bomb.AnimState:SetBank("bee_mine_maxwell") bomb.AnimState:SetBuild("bee_mine_maxwell") bomb.AnimState:PlayAnimation("idle") bomb.Transform:SetScale(0.8, 0.8, 0.8) bomb.AnimState:SetMultColour(255/255,255/255,0/255,1) bomb.AnimState:SetBloomEffectHandle("shaders/anim.ksh") bomb:AddComponent("named") bomb.components.named:SetName("Bomb") local minimap = bomb.entity:AddMiniMapEntity() minimap:SetIcon( "beemine.png" ) bomb:RemoveComponent("equippable") bomb:RemoveComponent("inventoryitem") bomb:RemoveComponent("finiteuses") bomb:RemoveComponent("deployable") bomb:AddComponent("inventoryitem") bomb.components.inventoryitem:ChangeImageName("beemine") bomb.components.inventoryitem:SetOnDroppedFn(function() bomb:AddTag("bomballright") end ) bomb.components.inventoryitem:SetOnPickupFn(function() bomb:RemoveTag("bomballright") end ) bomb.components.inventoryitem:SetOnPutInInventoryFn(function() bomb:RemoveTag("bomballright") end ) bomb:AddTag("bomb") GetPlayer().components.inventory:GiveItem(bomb) end bomber:AddTag("bomber") for k = 1, 11 do local result_offset = FindValidPositionByFan(1 * 2 * PI, 2, 11, function(offset) local x,y,z = (pt + offset):Get() local ents = TheSim:FindEntities(x,y,z , 1) return not next(ents) end) if result_offset then local bombbye = SpawnPrefab("amulet") bombbye.Transform:SetPosition((pt + result_offset):Get()) bombbye.AnimState:SetBank("bee_mine_maxwell") bombbye.AnimState:SetBuild("bee_mine_maxwell") bombbye.AnimState:PlayAnimation("idle") bombbye.Transform:SetScale(0.8, 0.8, 0.8) bombbye.AnimState:SetMultColour(255/255,255/255,0/255,1) bombbye.AnimState:SetBloomEffectHandle("shaders/anim.ksh") bombbye:RemoveComponent("equippable") bombbye:RemoveComponent("inventoryitem") bombbye:RemoveComponent("finiteuses") bombbye:RemoveComponent("deployable") MakeLargeBurnable(bombbye) MakeLargePropagator(bombbye) bombbye:AddTag("NOCLICK") bombbye:AddTag("bombbye") end end end local function OnDeploy (inst, pt) makebomber(inst) inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("bomber") then data.bomber = true end if inst:HasTag("bombbye") then data.bombbye = true end if inst:HasTag("bomb") then data.bomb = true end if inst:HasTag("bomballright") then data.bomballright = true end end local function onload(inst, data) if data and data.bomber then makebomber(inst) inst:Remove() end if data and data.bombbye then inst:Remove() end if data and data.bomb then inst.AnimState:SetBank("bee_mine_maxwell") inst.AnimState:SetBuild("bee_mine_maxwell") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.8, 0.8, 0.8) inst.AnimState:SetMultColour(255/255,255/255,0/255,1) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddComponent("named") inst.components.named:SetName("Bomb") local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "beemine.png" ) inst:RemoveComponent("equippable") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("finiteuses") inst:RemoveComponent("deployable") inst:AddComponent("inventoryitem") inst.components.inventoryitem:ChangeImageName("beemine") inst.components.inventoryitem:SetOnDroppedFn(function() inst:AddTag("bomballright") end ) inst.components.inventoryitem:SetOnPickupFn(function() inst:RemoveTag("bomballright") end ) inst.components.inventoryitem:SetOnPutInInventoryFn(function() inst:RemoveTag("bomballright") end ) inst:AddTag("bomb") end if data and data.bomballright then inst:AddTag("bomballright") end end inst.OnSave = onsave inst.OnLoad = onload 即可用红色护身符种炸弹客,给炸弹客10个黄金(拿着黄金对炸弹客点鼠标左键),可购买遥控炸弹,将炸弹放在地上,按键盘Delete键可遥控引爆,能炸死除主角外的任何生物,炸毁建筑、树木等。遥控炸弹在小地图上显示为炸弹图标,引爆时不要让同伴靠近。不想要炸弹客了,烧掉即可(拿着火炬对其点鼠标右键)。红色护身符在魔法选项(画着红骷髅)下,用3个黄金、2个噩梦燃料、1个红宝石制造

2025/04/23 · Bny

YN308-百变存钱罐(用鱼竿种百变存钱罐,每天获得3个黄金的零花钱,可变外型、防雷击、照明、补脑)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0八.百变存钱罐(用鱼竿种百变存钱罐,每天获得3个黄金的零花钱,可变外型、防雷击、照明、补脑) 用MT管理器打开游戏目录/assets/scripts/prefabs/fishingrod.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function itemtest(inst, item, slot) if item.prefab == "goldnugget" then return true end return false end local slotpos = { Vector3(0,-75,0)} local widgetbuttoninfo = { text = "Change", position = Vector3(0, -15, 0), fn = function(inst) GetPlayer().SoundEmitter:PlaySound("dontstarve/characters/wx78/levelup") inst:RemoveTag("doll_1") inst:RemoveTag("doll_2") inst:RemoveTag("doll_3") inst:RemoveTag("doll_4") inst:RemoveTag("doll_5") inst:RemoveTag("doll_6") inst:RemoveTag("doll_7") inst:RemoveTag("doll_8") inst:RemoveTag("doll_9") inst:RemoveTag("doll_10") if math.random()<.08 then inst:AddTag("doll_1") inst.AnimState:SetBank("bearger") inst.AnimState:SetBuild("bearger_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.2,0.2,0.2) elseif math.random()<.16 then inst:AddTag("doll_2") inst.AnimState:SetBank("lightning_goat") inst.AnimState:SetBuild("lightning_goat_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.6,0.6,0.6) elseif math.random()<.24 then inst:AddTag("doll_3") inst.AnimState:SetBank("leif") inst.AnimState:SetBuild("leif_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.35,0.35,0.35) elseif math.random()<.32 then inst:AddTag("doll_4") inst.AnimState:SetBank("beefalo") inst.AnimState:SetBuild("beefalo_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.5,0.5,0.5) elseif math.random()<.4 then inst:AddTag("doll_5") inst.AnimState:SetBank("rook") inst.AnimState:SetBuild("rook_build") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) elseif math.random()<.48 then inst:AddTag("doll_6") inst.AnimState:SetBank("deerclops") inst.AnimState:SetBuild("deerclops_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.35,0.35,0.35) elseif math.random()<.56 then inst:AddTag("doll_7") inst.AnimState:SetBank("rook") inst.AnimState:SetBuild("rook_rhino") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) elseif math.random()<.64 then inst:AddTag("doll_8") inst.AnimState:SetBank("Pig_King") inst.AnimState:SetBuild("Pig_King") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.4,0.4,0.4) elseif math.random()<.72 then inst:AddTag("doll_9") inst.AnimState:SetBank("goosemoose") inst.AnimState:SetBuild("goosemoose_build") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) elseif math.random()<.95 then inst:AddTag("doll_10") inst.AnimState:SetBank("dragonfly") inst.AnimState:SetBuild("dragonfly_build") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) else inst.AnimState:SetBank("trinkets") inst.AnimState:SetBuild("trinkets") inst.AnimState:PlayAnimation(tostring(4)) inst.Transform:SetScale(1.5,1.5,1.5) end end } local function OnDeploy (inst, pt) local doll = SpawnPrefab("fishingrod") doll.Transform:SetPosition(pt.x, pt.y, pt.z) doll.AnimState:SetBank("trinkets") doll.AnimState:SetBuild("trinkets") doll.AnimState:PlayAnimation(tostring(4)) doll.Transform:SetFourFaced() doll.Transform:SetScale(1.5,1.5,1.5) local light = doll.entity:AddLight() light:SetFalloff(0.5) light:SetIntensity(.8) light:SetRadius(3.0) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) MakeObstaclePhysics(doll, 0.5) doll:RemoveComponent("fishingrod") doll:RemoveComponent("finiteuses") doll:RemoveComponent("inventoryitem") doll:RemoveComponent("equippable") if doll.components.weapon then doll:RemoveComponent("weapon") end doll:RemoveComponent("deployable") doll.components.container.canbeopened = true doll:AddComponent("named") doll.components.named:SetName("Piggy bank") doll:AddComponent("sanityaura") doll.components.sanityaura.aura = TUNING.SANITYAURA_MED doll:AddTag("lightningrod") doll:ListenForEvent("lightningstrike", function() doll.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) doll:DoTaskInTime(60, function() doll.AnimState:SetBloomEffectHandle("") end ) end ) doll:AddComponent("workable") doll.components.workable:SetWorkAction(ACTIONS.HAMMER) doll.components.workable:SetWorkLeft(3) doll.components.workable:SetOnFinishCallback(function(doll) doll.Light:Enable(false) doll.components.container:DropEverything() SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(doll.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") doll:Remove() end ) doll:ListenForEvent( "daytime", function() for k = 1, 3 do local goldnugget = SpawnPrefab("goldnugget") doll.components.container:GiveItem(goldnugget) end end, GetWorld()) doll:AddTag("scarytoprey") doll:AddTag("dolls") inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("dolls") then data.dolls = true end if inst:HasTag("doll_1") then data.doll_1 = true end if inst:HasTag("doll_2") then data.doll_2 = true end if inst:HasTag("doll_3") then data.doll_3 = true end if inst:HasTag("doll_4") then data.doll_4 = true end if inst:HasTag("doll_5") then data.doll_5 = true end if inst:HasTag("doll_6") then data.doll_6 = true end if inst:HasTag("doll_7") then data.doll_7 = true end if inst:HasTag("doll_8") then data.doll_8 = true end if inst:HasTag("doll_9") then data.doll_9 = true end if inst:HasTag("doll_10") then data.doll_10 = true end end local function onload(inst, data) if data and data.dolls then inst.AnimState:SetBank("trinkets") inst.AnimState:SetBuild("trinkets") inst.AnimState:PlayAnimation(tostring(4)) inst.Transform:SetFourFaced() inst.Transform:SetScale(1.5,1.5,1.5) local light = inst.entity:AddLight() light:SetFalloff(0.5) light:SetIntensity(.8) light:SetRadius(3.0) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) MakeObstaclePhysics(inst, 0.5) inst:RemoveComponent("fishingrod") inst:RemoveComponent("finiteuses") inst:RemoveComponent("inventoryitem") inst:RemoveComponent("equippable") if inst.components.weapon then inst:RemoveComponent("weapon") end inst:RemoveComponent("deployable") inst.components.container.canbeopened = true inst:AddComponent("named") inst.components.named:SetName("Piggy bank") inst:AddComponent("sanityaura") inst.components.sanityaura.aura = TUNING.SANITYAURA_MED inst:AddTag("lightningrod") inst:ListenForEvent("lightningstrike", function() inst.AnimState:SetBloomEffectHandle( "shaders/anim.ksh" ) inst:DoTaskInTime(60, function() inst.AnimState:SetBloomEffectHandle("") end ) end ) inst:AddComponent("workable") inst.components.workable:SetWorkAction(ACTIONS.HAMMER) inst.components.workable:SetWorkLeft(3) inst.components.workable:SetOnFinishCallback(function(inst) inst.Light:Enable(false) inst.components.container:DropEverything() SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") inst:Remove() end ) inst:ListenForEvent( "daytime", function() for k = 1, 3 do local goldnugget = SpawnPrefab("goldnugget") inst.components.container:GiveItem(goldnugget) end end, GetWorld()) inst:AddTag("scarytoprey") inst:AddTag("dolls") end if data and data.doll_1 then inst:AddTag("doll_1") inst.AnimState:SetBank("bearger") inst.AnimState:SetBuild("bearger_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.2,0.2,0.2) end if data and data.doll_2 then inst:AddTag("doll_2") inst.AnimState:SetBank("lightning_goat") inst.AnimState:SetBuild("lightning_goat_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.6,0.6,0.6) end if data and data.doll_3 then inst:AddTag("doll_3") inst.AnimState:SetBank("leif") inst.AnimState:SetBuild("leif_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.35,0.35,0.35) end if data and data.doll_4 then inst:AddTag("doll_4") inst.AnimState:SetBank("beefalo") inst.AnimState:SetBuild("beefalo_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.5,0.5,0.5) end if data and data.doll_5 then inst:AddTag("doll_5") inst.AnimState:SetBank("rook") inst.AnimState:SetBuild("rook_build") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) end if data and data.doll_6 then inst:AddTag("doll_6") inst.AnimState:SetBank("deerclops") inst.AnimState:SetBuild("deerclops_build") inst.AnimState:PlayAnimation("idle_loop") inst.Transform:SetScale(0.35,0.35,0.35) end if data and data.doll_7 then inst:AddTag("doll_7") inst.AnimState:SetBank("rook") inst.AnimState:SetBuild("rook_rhino") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) end if data and data.doll_8 then inst:AddTag("doll_8") inst.AnimState:SetBank("Pig_King") inst.AnimState:SetBuild("Pig_King") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.4,0.4,0.4) end if data and data.doll_9 then inst:AddTag("doll_9") inst.AnimState:SetBank("goosemoose") inst.AnimState:SetBuild("goosemoose_build") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) end if data and data.doll_10 then inst:AddTag("doll_10") inst.AnimState:SetBank("dragonfly") inst.AnimState:SetBuild("dragonfly_build") inst.AnimState:PlayAnimation("idle") inst.Transform:SetScale(0.3,0.3,0.3) 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(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 即可用鱼竿种百变存钱罐,鼠标左键点存钱罐可打开格子,每天将获得3个黄金的零花钱,在格子中拿取。点格子上方的“Change”按钮,可使存钱罐改换为巨鹿、猪王、熊等造型。百变存钱罐放在家中,可防雷击、照明,靠近会补脑,并且可以吓阻火鸡、兔子等小动物,让它们不敢偷吃你扔在地上的食物。不想要百变存钱罐了,用锤子砸掉即可,里面的黄金会掉在地上。鱼竿在生存选项(画着绳套)下,用2个树枝、2个蛛丝制造

2025/04/23 · Bny

YN309-度假营地(按键盘B键租赁度假营地,各种设施一应俱全,再按B键退房)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0九.度假营地(按键盘B键租赁度假营地,各种设施一应俱全,再按B键退房) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容: TheInput:AddKeyUpHandler(KEY_B, function() if not inst:HasTag("campsite") then if inst.components.inventory:Has("goldnugget", 50) then inst.components.inventory:ConsumeByName("goldnugget", 50) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") inst:AddTag("campsite") local pt = inst:GetPosition() local pt0 = Vector3(inst.Transform:GetWorldPosition()) for k = 1, 50 do local result_offset = FindValidPositionByFan(1 * 2 * PI, 8.5, 50, 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 wall = SpawnPrefab("wall_wood") wall.Transform:SetScale(0.65,0.65,0.65) MakeObstaclePhysics(wall, .25) wall:RemoveComponent("workable") wall.components.health:SetInvincible(true) wall.persists = false wall:AddTag("tempbuilding") wall.Transform:SetPosition((pt0 + result_offset):Get()) wall.components.inspectable.getstatus = function(wall) wall.Transform:SetScale(0.65, 0.1, 0.65) wall.Physics:SetActive(false) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") wall:DoTaskInTime(5, function(wall) wall.Transform:SetScale(0.65, 0.65, 0.65) wall.Physics:SetActive(true) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") end ) end end end local building1 = SpawnPrefab("tent") building1.Transform:SetPosition(pt.x-4, 0, pt.z-4) building1.AnimState:SetMultColour(255/255,105/255,0/255,1) building1.persists = false building1:AddTag("tempbuilding") local building2 = SpawnPrefab("ancient_altar") building2.Transform:SetPosition(pt.x-4+2.5, 0, pt.z-4-2.5) building2.Transform:SetScale(0.45,0.45,0.45) building2.persists = false building2:AddTag("NOCLICK") building2:AddTag("tempbuilding") local building3 = SpawnPrefab("lightning_rod") building3.Transform:SetPosition(pt.x-4-2.4, 0, pt.z-4+2.4) building3.Transform:SetScale(0.7,0.7,0.7) building3.persists = false building3:AddTag("NOCLICK") building3:AddTag("tempbuilding") local building4 = SpawnPrefab("ruins_table") building4.Transform:SetPosition(pt.x+3.3, 0, pt.z-3.3) building4.persists = false building4:AddTag("NOCLICK") building4:AddTag("tempbuilding") local building5 = SpawnPrefab("ruins_chair") building5.Transform:SetPosition(pt.x+4.9, 0, pt.z-4.9) building5.persists = false building5:AddTag("NOCLICK") building5:AddTag("tempbuilding") local building6 = SpawnPrefab("cookpot") building6.Transform:SetPosition(pt.x+4.3, 0, pt.z+4.3) building6.Transform:SetScale(0.7,0.7,0.7) building6.persists = false building6:AddTag("tempbuilding") local building7 = SpawnPrefab("icebox") building7.Transform:SetPosition(pt.x+4.5-1.3, 0, pt.z+4.5+1.3) building7.persists = false building7:AddTag("tempbuilding") for k = 1, 3 do local foodnames = {"butterflymuffin","frogglebunwich","taffy","pumpkincookie","stuffedeggplant","fishsticks","honeynuggets","honeyham","dragonpie","kabobs","mandrakesoup","baconeggs","meatballs","bonestew","perogies","turkeydinner","ratatouille","jammypreserves","fruitmedley","fishtacos","waffles","unagi","flowersalad","icecream","watermelonicle","trailmix","hotchili","guacamole"} local foodname = foodnames[math.random(#foodnames)] local food = SpawnPrefab(foodname) building7.components.container:GiveItem(food) end local building8 = SpawnPrefab("dragonflychest") building8.Transform:SetPosition(pt.x+3.8+3, 0, pt.z-3.8+3) building8.persists = false building8:AddTag("tempbuilding") local lantern = SpawnPrefab("lantern") building8.components.container:GiveItem(lantern) if not GetSeasonManager():IsSummer() then local building9 = SpawnPrefab("firepit") building9.Transform:SetPosition(pt.x, 0, pt.z) building9:RemoveAllEventCallbacks() building9:ListenForEvent("onextinguish", function(building9) if building9.components.cooker then building9:RemoveComponent("cooker") end if building9.components.fueled then building9.components.fueled:InitializeFuelLevel(0) end end ) building9:ListenForEvent("onignite", function(building9) if not building9.components.cooker then building9:AddComponent("cooker") end end ) building9.persists = false building9:AddTag("tempbuilding") for k = 1, 10 do local log = SpawnPrefab("log") building8.components.container:GiveItem(log) end else local building9 = SpawnPrefab("coldfirepit") building9.Transform:SetPosition(pt.x, 0, pt.z) building9.persists = false building9:AddTag("tempbuilding") for k = 1, 10 do local nitre = SpawnPrefab("nitre") building8.components.container:GiveItem(nitre) end end local building10 = SpawnPrefab("firesuppressor") building10.Transform:SetPosition(pt.x-4+3, 0, pt.z+4+3) building10.Transform:SetScale(0.8,0.8,0.8) building10.persists = false building10:AddTag("tempbuilding") local building11 = SpawnPrefab("eyeturret") building11.Transform:SetPosition(pt.x-4+1, 0, pt.z+4+1) building11.components.combat:SetAttackPeriod(0.5) if building11.components.machine then building11:RemoveComponent("machine") end building11.persists = false building11:AddTag("tempbuilding") local building12 = SpawnPrefab("pumpkin_lantern") building12.Transform:SetPosition(pt.x-4-2, 0, pt.z+4-2) building12.Transform:SetScale(1.5,1.5,1.5) building12.components.inventoryitem.canbepickedup = false building12.persists = false building12:AddTag("NOCLICK") building12:AddTag("tempbuilding") end else GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") inst:RemoveTag("campsite") 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("tempbuilding") then v:Remove() end end end end ) 即可在身上有50个黄金时,在空旷的地方,按键盘B键租赁度假营地(身上黄金不足时无法租赁),再次按B键退房。度假营地外有围墙保护(鼠标左键点围墙可开门,5秒后自动关门),内有火堆、帐篷、锅、箱子、冰箱、南瓜灯等生活设施,还配有眼睛炮塔、灭火器、避雷针等安全设备,其中箱子里有火堆燃料(夏天为硝石,其余季节为木头),还提供一盏提灯供你外出使用,冰箱里有3份料理(品种随机),让你在野外也可以品尝新鲜美味。由于环保原因,度假营地为临时设施,存档退出后再读档,度假营地将消失,记得之前取出箱子中的私人物品哦

2025/04/23 · Bny

YN310-疯狂躲避球(用浣熊尾巴种躲避球场,在圈内60秒不被球打到,赢50个黄金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三一0.疯狂躲避球(用浣熊尾巴种躲避球场,在圈内60秒不被球打到,赢50个黄金) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/coontail.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function makecourt(inst) local pt = inst:GetPosition() local caddie = SpawnPrefab("coontail") caddie.Transform:SetPosition(pt.x, pt.y, pt.z) caddie.AnimState:SetBank("wilson") caddie.AnimState:SetBuild("wes") caddie.AnimState:OverrideSymbol("swap_hat", "hat_football", "swap_hat") caddie.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body") caddie.AnimState:Show("HAT") caddie.AnimState:Show("HAT_HAIR") caddie.AnimState:Hide("HAIR_NOHAT") caddie.AnimState:Hide("HAIR") caddie.AnimState:Hide("ARM_carry") caddie.AnimState:Show("ARM_normal") caddie.Transform:SetFourFaced() caddie.AnimState:PlayAnimation("idle") caddie:RemoveComponent("inventoryitem") caddie:RemoveComponent("stackable") caddie:RemoveComponent("deployable") caddie:RemoveTag("cattoy") caddie:AddComponent("workable") caddie.components.workable:SetWorkAction(ACTIONS.HAMMER) caddie.components.workable:SetWorkLeft(1) caddie.components.workable:SetOnFinishCallback(function(caddie) SpawnPrefab("collapse_big").Transform:SetPosition(caddie.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") GetPlayer().SoundEmitter:KillSound("beavermusic") local pos = Vector3(caddie.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) for k,v in pairs(ents) do if v:HasTag("border") or v:HasTag("landmine") then SpawnPrefab("collapse_big").Transform:SetPosition(v.Transform:GetWorldPosition()) v:Remove() end end caddie:Remove() end ) caddie:AddComponent("named") caddie.components.named:SetName("Pitcher") caddie:AddComponent("talker") caddie:AddComponent("trader") caddie.components.trader:SetAcceptTest(function(caddie, item) if not caddie:HasTag("startgame") then if GetPlayer().components.inventory:Has("goldnugget", 10) then if item.prefab == "goldnugget" then return true end end end return false end ) caddie.components.trader.onaccept = function(caddie, giver, item) caddie:AddTag("startgame") GetPlayer().components.inventory:ConsumeByName("goldnugget", 9) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") caddie.components.talker:Say("Are you ready ?", 3, false) GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic") for k = 1, 10 do local landmine = SpawnPrefab("coontail") landmine.Transform:SetPosition(pt.x+(math.random(7)-math.random(7)), 0, pt.z+(math.random(7)-math.random(7))) landmine.AnimState:SetBank("bee_mine") landmine.AnimState:SetBuild("bee_mine") landmine.AnimState:PlayAnimation("idle") landmine.Transform:SetScale(1.2, 1.2, 1.2) landmine.AnimState:SetMultColour(255/255,105/255,0/255,1) landmine.AnimState:SetBloomEffectHandle("shaders/anim.ksh") landmine:RemoveComponent("inventoryitem") landmine:RemoveComponent("stackable") landmine:RemoveComponent("deployable") landmine:RemoveTag("cattoy") landmine.persists = false landmine:DoPeriodicTask(0.01, function() local pos0 = Vector3(landmine.Transform:GetWorldPosition()) local ents0 = TheSim:FindEntities(pos0.x,pos0.y,pos0.z, 1) for k,v in pairs(ents0) do if v and v:HasTag("player") and not v:HasTag("pain")then v:AddTag("pain") v.sg:GoToState("hit") if v.components.health then v.components.health:DoDelta(-3) end v:DoTaskInTime(0.5, function() v:RemoveTag("pain") end ) end end end ) landmine:AddTag("landmine") end caddie:DoTaskInTime(3, function() caddie.components.talker:Say("Go !", 1, false) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") caddie.task = caddie:DoPeriodicTask(0.4, function(caddie) local target = FindEntity(caddie, 9, function(guy) return guy:HasTag("player") end ) if target then caddie.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180) caddie.AnimState:PlayAnimation("give") local dodgeball = SpawnPrefab("coontail") dodgeball.AnimState:SetBank("bulb") dodgeball.AnimState:SetBuild("bulb") dodgeball.AnimState:PlayAnimation("idle") dodgeball.Transform:SetPosition(pt.x, 0, pt.z) dodgeball:RemoveComponent("inventoryitem") dodgeball:RemoveComponent("stackable") dodgeball:RemoveComponent("deployable") dodgeball:RemoveTag("cattoy") dodgeball.persists = false dodgeball:AddComponent("complexprojectile") dodgeball.components.complexprojectile.yOffset = 1 if math.random()<.5 then local targetpos = target:GetPosition() dodgeball.components.complexprojectile:Launch(targetpos) else dodgeball.components.complexprojectile:Launch(Point(pt.x+(math.random(9)-math.random(9)), 0, pt.z+(math.random(9)-math.random(9)))) end dodgeball.components.complexprojectile:SetOnHit(function() SpawnPrefab("small_puff").Transform:SetPosition(dodgeball.Transform:GetWorldPosition()) dodgeball:Remove() end ) dodgeball:DoPeriodicTask(0.01, function() local pos = Vector3(dodgeball.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 1) for k,v in pairs(ents) do if v and v:HasTag("player") then v.sg:GoToState("hit") if caddie.task then caddie.task:Cancel() caddie.task = nil end if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end caddie.Transform:SetRotation( 0 ) caddie.AnimState:PlayAnimation("idle_onemanband1_loop",true) caddie:DoTaskInTime(2, function() caddie.AnimState:PlayAnimation("idle") end ) caddie.components.talker:Say("Game over !", 3, false) GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") GetPlayer().SoundEmitter:KillSound("beavermusic") SpawnPrefab("collapse_small").Transform:SetPosition(dodgeball.Transform:GetWorldPosition()) dodgeball:Remove() local pos1 = Vector3(caddie.Transform:GetWorldPosition()) local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10) for k,v in pairs(ents1) do if v:HasTag("landmine") then v:Remove() end end caddie:RemoveTag("startgame") end end end ) else if caddie.task then caddie.task:Cancel() caddie.task = nil end if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end caddie.Transform:SetRotation( 0 ) caddie.AnimState:PlayAnimation("idle_onemanband1_loop",true) caddie:DoTaskInTime(2, function() caddie.AnimState:PlayAnimation("idle") end ) caddie.components.talker:Say("Game over !", 3, false) GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") GetPlayer().SoundEmitter:KillSound("beavermusic") local pos1 = Vector3(caddie.Transform:GetWorldPosition()) local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10) for k,v in pairs(ents1) do if v:HasTag("landmine") then v:Remove() end end caddie:RemoveTag("startgame") end end ) end ) caddie.task2 = caddie:DoTaskInTime(63, function() if caddie:HasTag("startgame") then if caddie.task then caddie.task:Cancel() caddie.task = nil end if caddie.task2 then caddie.task2:Cancel() caddie.task2 = nil end caddie.Transform:SetRotation( 0 ) caddie.AnimState:PlayAnimation("give") caddie.components.talker:Say("You win !", 3, false) GetPlayer().SoundEmitter:KillSound("beavermusic") caddie:StartThread(function() for k = 1, 10 do GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") Sleep(0.15) end end ) for k = 1, 50 do local goldnugget = SpawnPrefab("goldnugget") GetPlayer().components.inventory:GiveItem(goldnugget) end local pos1 = Vector3(caddie.Transform:GetWorldPosition()) local ents1 = TheSim:FindEntities(pos1.x,pos1.y,pos1.z, 10) for k,v in pairs(ents1) do if v:HasTag("landmine") then v:Remove() end end caddie:RemoveTag("startgame") end end ) end caddie:AddTag("caddie") for k = 1, 50 do local result_offset = FindValidPositionByFan(1 * 2 * PI, 8.5, 50, function(offset) local x,y,z = (pt + offset):Get() local ents = TheSim:FindEntities(x,y,z , 1) return not next(ents) end) if result_offset then local border = SpawnPrefab("coontail") border.Transform:SetPosition((pt + result_offset):Get()) border.AnimState:SetBank("bulb") border.AnimState:SetBuild("bulb") border.AnimState:PlayAnimation("idle") border.Transform:SetScale(1.2, 1.2, 1.2) border.AnimState:SetMultColour(255/255,0/255,0/255,1) border.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) border.AnimState:SetLayer( LAYER_BACKGROUND ) border.AnimState:SetSortOrder( 1 ) border:RemoveComponent("inventoryitem") border:RemoveComponent("stackable") border:RemoveComponent("deployable") border:RemoveTag("cattoy") border:DoPeriodicTask(2, function(shopsign) border.AnimState:SetMultColour(0/255,255/255,0/255,1) border:DoTaskInTime(1, function() border.AnimState:SetMultColour(255/255,0/255,0/255,1) end ) end ) border:AddTag("NOCLICK") border:AddTag("border") end end end local function OnDeploy (inst, pt) makecourt(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("caddie") then data.caddie = true end if inst:HasTag("border") then data.border = true end end local function onload(inst, data) if data and data.caddie then makecourt(inst) inst:Remove() end if data and data.border then inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可在空旷的地上,用浣熊尾巴种躲避球场(拿着1个浣熊尾巴对地面点鼠标右键,如果拿着多个,则不会种出来)。给投手10个黄金玩一次(拿着黄金对投手点鼠标左键),他会不断向你扔球,在不跑出圆圈边界、不被砸到的情况下,坚持60秒,就可赢得50个黄金的奖励。球场内会随机出现障碍物,碰到会被扎伤(减3点血),绕着点跑吧。不想要躲避球场了,用锤子砸投手即可

2025/04/23 · Bny

YN311-快速孵化高鸟蛋(游戏中1小时孵出小高鸟)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三一一.快速孵化高鸟蛋(游戏中1小时孵出小高鸟) 用MT管理器打开游戏目录/assets/DLC0002/scripts/tuning.lua文件,将SMALLBIRD_HATCH_TIME = total_day_time * 3, -- must be content for this amount of cumulative time to hatch替换为以下内容: SMALLBIRD_HATCH_TIME = seg_time*1, 即可在游戏中1小时孵出小高鸟

2025/04/23 · Bny