模组文件免费下载和使用,谨防上当受骗。

YN296-企鹅养殖场(用蜂巢种企鹅养殖场,买小企鹅,养大后卖出赚黄金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二九六.企鹅养殖场(用蜂巢种企鹅养殖场,买小企鹅,养大后卖出赚黄金) 用MT管理器打开游戏目录/assets/scripts/prefabs/honeycomb.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function penguinshop(inst) local pt = inst:GetPosition() local peddler = SpawnPrefab("honeycomb") peddler.Transform:SetPosition(pt.x, pt.y, pt.z) peddler.AnimState:SetBank("wilson") peddler.AnimState:SetBuild("willow") peddler.AnimState:OverrideSymbol("swap_hat", "hat_straw", "swap_hat") peddler.AnimState:Show("HAT") peddler.AnimState:Show("HAT_HAIR") peddler.AnimState:Hide("HAIR_NOHAT") peddler.AnimState:Hide("HAIR") peddler.AnimState:OverrideSymbol("swap_body", "armor_grass", "swap_body") peddler.AnimState:Hide("ARM_carry") peddler.AnimState:Show("ARM_normal") peddler.Transform:SetFourFaced() peddler.AnimState:PlayAnimation("idle") peddler:AddTag("peddler") peddler:RemoveComponent("stackable") peddler:RemoveComponent("tradable") peddler:RemoveComponent("inventoryitem") local light = peddler.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(10) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) MakeLargeBurnable(peddler) MakeLargePropagator(peddler) peddler.components.inspectable.getstatus = function(peddler) peddler.AnimState:PlayAnimation("give") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/get_gold") local pos = Vector3(peddler.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10) for k,v in pairs(ents) do if v:HasTag("penguin_2") then for k = 1, 20 do SpawnPrefab("goldnugget").Transform:SetPosition(v.Transform:GetWorldPosition()) end v:Remove() end end end peddler:AddComponent("trader") peddler.components.trader:SetAcceptTest(function(peddler, item) if GetPlayer().components.inventory:Has("goldnugget", 10) then if item.prefab == "goldnugget" then return true end end return false end ) peddler.components.trader.onaccept = function(peddler, giver, item) peddler.AnimState:PlayAnimation("give") GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") GetPlayer().components.inventory:ConsumeByName("goldnugget", 9) local penguin = SpawnPrefab("honeycomb") penguin.Transform:SetPosition(pt.x+3.1, 0, pt.z+3.1) penguin.AnimState:SetBank("penguin") penguin.AnimState:SetBuild("penguin_build") penguin.Transform:SetFourFaced() penguin.AnimState:PlayAnimation("idle_loop", true) penguin.AnimState:SetBloomEffectHandle("shaders/anim.ksh") penguin.entity:AddSoundEmitter() local minimap = penguin.entity:AddMiniMapEntity() minimap:SetIcon( "penguin.png" ) MakeCharacterPhysics(penguin, 50, .5) penguin:AddComponent("follower") penguin.components.follower:SetLeader(GetPlayer()) local brain = require "brains/abigailbrain" penguin:SetBrain(brain) penguin:AddComponent("locomotor") penguin.components.locomotor.walkspeed = 0.75 penguin.components.locomotor.directdrive = false penguin:SetStateGraph("SGpenguin") penguin:AddComponent("combat") penguin.components.combat.hiteffectsymbol = "body" penguin.components.combat:SetAttackPeriod(1) penguin.components.combat:SetRange(2.5) penguin.components.combat:SetDefaultDamage(1) penguin:ListenForEvent("attacked", function(penguin, data) penguin.components.combat:SetTarget(data.attacker) end ) penguin:AddComponent("health") penguin.components.health:SetMaxHealth(50) penguin.Transform:SetScale(0.7, 0.7, 0.7) penguin:RemoveComponent("stackable") penguin:RemoveComponent("tradable") penguin:RemoveComponent("inventoryitem") penguin:AddTag("retinue") penguin:AddTag("penguin_1") penguin:AddComponent("lootdropper") penguin.components.lootdropper:SetLoot({"smallmeat", "smallmeat"}) penguin.components.inspectable.getstatus = function(penguin) if not penguin:HasTag("retinue") then local brain = require "brains/abigailbrain" penguin:SetBrain(brain) penguin.components.follower:SetLeader(GetPlayer()) penguin.AnimState:SetBloomEffectHandle("shaders/anim.ksh") penguin:AddTag("retinue") else local brain = require "brains/leifbrain" penguin:SetBrain(brain) penguin.components.follower:SetLeader(nil) penguin.AnimState:SetBloomEffectHandle("") penguin:RemoveTag("retinue") end end penguin:DoTaskInTime(math.random(480,560), function() if not penguin:HasTag("penguin_2") then penguin.AnimState:PlayAnimation("taunt") penguin.Transform:SetScale(1, 1, 1) penguin:AddTag("penguin_2") penguin.components.lootdropper:SetLoot({"meat", "meat", "drumstick", "drumstick"}) end end ) penguin:DoPeriodicTask(math.random(120,180), function() if penguin:HasTag("penguin_2") then SpawnPrefab("bird_egg").Transform:SetPosition(penguin.Transform:GetWorldPosition()) end end) end local ice = SpawnPrefab("honeycomb") ice.Transform:SetPosition(pt.x+1, 0, pt.z+1) ice.AnimState:SetBank("penguin_ice") ice.AnimState:SetBuild("penguin_ice") ice.AnimState:PlayAnimation("idle") ice.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) ice.AnimState:SetLayer( LAYER_BACKGROUND ) ice.AnimState:SetSortOrder( 1 ) ice.Transform:SetRotation( 225 ) ice:RemoveComponent("stackable") ice:RemoveComponent("tradable") ice:RemoveComponent("inventoryitem") ice:AddTag("goodbye") ice:AddTag("NOCLICK") MakeLargeBurnable(ice) MakeLargePropagator(ice) local model1 = SpawnPrefab("honeycomb") model1.Transform:SetPosition(pt.x+2-1, 0, pt.z-2-1) model1.AnimState:SetBank("penguin") model1.AnimState:SetBuild("penguin_build") model1.Transform:SetFourFaced() model1.AnimState:PlayAnimation("idle_loop", true) model1.Transform:SetRotation( 270 ) model1.Transform:SetScale(2, 2, 2) model1:RemoveComponent("stackable") model1:RemoveComponent("tradable") model1:RemoveComponent("inventoryitem") model1.AnimState:SetBloomEffectHandle("shaders/anim.ksh") model1:AddTag("goodbye") MakeLargeBurnable(model1) MakeLargePropagator(model1) local model2 = SpawnPrefab("honeycomb") model2.Transform:SetPosition(pt.x-2-1, 0, pt.z+2-1) model2.AnimState:SetBank("penguin") model2.AnimState:SetBuild("penguin_build") model2.Transform:SetFourFaced() model2.AnimState:PlayAnimation("idle_loop", true) model2.Transform:SetRotation( 90 ) model2.Transform:SetScale(2, 2, 2) model2:RemoveComponent("stackable") model2:RemoveComponent("tradable") model2:RemoveComponent("inventoryitem") model2.AnimState:SetBloomEffectHandle("shaders/anim.ksh") model2:AddTag("goodbye") MakeLargeBurnable(model2) MakeLargePropagator(model2) end local function OnDeploy (inst, pt) penguinshop(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("peddler") then data.peddler = true end if inst:HasTag("goodbye") then data.goodbye = true end if inst:HasTag("penguin_1") then data.penguin_1 = true end if inst:HasTag("penguin_2") then data.penguin_2 = true end if inst:HasTag("retinue") then data.retinue = true end end local function onload(inst, data) if data and data.peddler then penguinshop(inst) inst:Remove() end if data and data.goodbye then inst:Remove() end if data and data.penguin_1 then inst.AnimState:SetBank("penguin") inst.AnimState:SetBuild("penguin_build") inst.Transform:SetFourFaced() inst.AnimState:PlayAnimation("idle_loop", true) inst.entity:AddSoundEmitter() local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon( "penguin.png" ) MakeCharacterPhysics(inst, 50, .5) inst:AddComponent("follower") inst.components.follower:SetLeader(nil) local brain = require "brains/leifbrain" inst:SetBrain(brain) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 0.75 inst.components.locomotor.directdrive = false inst:SetStateGraph("SGpenguin") inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "body" inst.components.combat:SetAttackPeriod(1) inst.components.combat:SetRange(2.5) inst.components.combat:SetDefaultDamage(1) inst:ListenForEvent("attacked", function(inst, data) inst.components.combat:SetTarget(data.attacker) end ) inst:AddComponent("health") inst.components.health:SetMaxHealth(50) inst.Transform:SetScale(0.7, 0.7, 0.7) inst:RemoveComponent("stackable") inst:RemoveComponent("tradable") inst:RemoveComponent("inventoryitem") inst:AddTag("penguin_1") inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"smallmeat", "smallmeat"}) inst.components.inspectable.getstatus = function(inst) if not inst:HasTag("retinue") then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("retinue") else local brain = require "brains/leifbrain" inst:SetBrain(brain) inst.components.follower:SetLeader(nil) inst.AnimState:SetBloomEffectHandle("") inst:RemoveTag("retinue") end end inst:DoTaskInTime(math.random(480,560), function() if not inst:HasTag("penguin_2") then inst.AnimState:PlayAnimation("taunt") inst.Transform:SetScale(1, 1, 1) inst:AddTag("penguin_2") inst.components.lootdropper:SetLoot({"meat", "meat", "drumstick", "drumstick"}) end end ) inst:DoPeriodicTask(math.random(120,180), function() if inst:HasTag("penguin_2") then SpawnPrefab("bird_egg").Transform:SetPosition(inst.Transform:GetWorldPosition()) end end) end if data and data.penguin_2 then inst.Transform:SetScale(1, 1, 1) inst:AddTag("penguin_2") inst.components.lootdropper:SetLoot({"meat", "meat", "drumstick", "drumstick"}) end if data and data.retinue then local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst.components.follower:SetLeader(GetPlayer()) inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") inst:AddTag("retinue") end end inst.OnSave = onsave inst.OnLoad = onload 即可用蜂巢种企鹅养殖场(手里拿着1个蜂巢对地面点鼠标右键,如果拿着多个蜂巢,则不会种出来),拿着黄金对老板点鼠标左键,可以购买小企鹅,每只10个黄金。小企鹅会跟着你,鼠标左键点企鹅可停止跟随,再点则继续跟随(手里不要拿武器,以免误杀)。把它们带到你建造的企鹅圈,圈养起来吧,如果有淘气的企鹅啄墙,把它带离墙边即可。1-2天后,小企鹅长成大企鹅,并会下蛋,你可以继续养它们获得企鹅蛋,也可以带它们去企鹅养殖场,让它们停在冰面上,鼠标左键点老板,即可卖掉冰面上的大企鹅,收购价每只20个黄金。保护好你的企鹅群,从此作一个快乐的养鹅人吧。如果企鹅走失,可以打开小地图查找,将显示企鹅图标。杀掉小企鹅,会掉2个小肉(修改过“巨型超市”则增加掉落1-2个黄金),杀掉大企鹅会掉2个大肉和2个企鹅腿。不想要企鹅养殖场时烧掉即可

2025/04/23 · Bny

YN297-临时工市场(用噩梦花瓣种临时工市场,雇临时工帮你采摘、收获、砍树、开矿)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二九七.临时工市场(用噩梦花瓣种临时工市场,雇临时工帮你采摘、收获、砍树、开矿) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/petals_evil.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function createworker(inst) local pt = inst:GetPosition() local shopsign = SpawnPrefab("petals_evil") shopsign.Transform:SetPosition(pt.x, pt.y, pt.z) shopsign.AnimState:SetBank("sign_home") shopsign.AnimState:SetBuild("sign_home") shopsign.AnimState:PlayAnimation("idle") shopsign.Transform:SetScale(2, 2, 2) shopsign:AddTag("shopsign") shopsign:RemoveComponent("stackable") shopsign:RemoveComponent("tradable") shopsign:RemoveComponent("fuel") shopsign:RemoveComponent("inventoryitem") shopsign:RemoveComponent("edible") shopsign:RemoveComponent("perishable") shopsign:RemoveComponent("burnable") shopsign:RemoveComponent("propagator") shopsign:RemoveComponent("deployable") MakeLargeBurnable(shopsign) MakeLargePropagator(shopsign) local light = shopsign.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(5) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) shopsign:DoPeriodicTask(6, function(shopsign) shopsign.AnimState:SetBloomEffectHandle("shaders/anim.ksh") shopsign:DoTaskInTime(3, function() shopsign.AnimState:SetBloomEffectHandle("") end ) end ) shopsign.components.inspectable.getstatus = function(shopsign) local pos = Vector3(shopsign.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("workerman") then v:Remove() end end local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local worker1 = SpawnPrefab("petals_evil") worker1.Transform:SetPosition(pt.x+1+3, 0, pt.z+1-3) worker1.AnimState:SetBank("wilson") worker1.buildname = names[math.random(#names)] worker1.AnimState:SetBuild(worker1.buildname) worker1.Transform:SetFourFaced() worker1.AnimState:OverrideSymbol("swap_hat", "hat_bee", "swap_hat") worker1.AnimState:Show("HAT") worker1.AnimState:Show("HAT_HAIR") worker1.AnimState:Hide("HAIR_NOHAT") worker1.AnimState:Hide("HAIR") worker1.AnimState:Show("ARM_normal") worker1.AnimState:Hide("ARM_carry") worker1.AnimState:PlayAnimation("idle") local minimap = worker1.entity:AddMiniMapEntity() minimap:SetIcon( "mushroom_tree_med.png" ) local sound = worker1.entity:AddSoundEmitter() local shadow = worker1.entity:AddDynamicShadow() MakeCharacterPhysics(worker1, 75, .5) shadow:SetSize( 1.3, .6 ) worker1:AddComponent("health") worker1.components.health:SetMaxHealth(1000) worker1.components.health:SetInvincible(true) worker1.components.health.nofadeout = true worker1:AddComponent("combat") worker1:AddComponent("follower") worker1:AddComponent("knownlocations") worker1:AddComponent("locomotor") worker1.components.locomotor.walkspeed = 5 worker1.components.locomotor.runspeed = 12 worker1:SetStateGraph("SGshadowwaxwell") worker1:RemoveComponent("stackable") worker1:RemoveComponent("tradable") worker1:RemoveComponent("fuel") worker1:RemoveComponent("inventoryitem") worker1:RemoveComponent("edible") worker1:RemoveComponent("perishable") worker1:RemoveComponent("burnable") worker1:RemoveComponent("propagator") worker1:RemoveComponent("deployable") MakeLargeBurnable(worker1) MakeLargePropagator(worker1) worker1:AddTag("workerman") worker1:AddComponent("trader") worker1.components.trader:SetAcceptTest(function(worker1, item) if GetPlayer().components.inventory:Has("goldnugget", 20) then if item.prefab == "goldnugget" then return true end end return false end ) worker1.components.trader.onaccept = function(worker1, giver, item) worker1:AddTag("myworker") worker1:RemoveTag("workerman") worker1:RemoveComponent("burnable") worker1:RemoveComponent("propagator") GetPlayer().components.inventory:ConsumeByName("goldnugget", 19) worker1.task1 = worker1:DoPeriodicTask(0.5, function(worker1) local target = FindEntity(worker1, 10, function(guy) return guy.components.pickable and guy.components.pickable:CanBePicked() and guy.prefab ~= "flower" and guy.prefab ~= "red_mushroom" and guy.prefab ~= "green_mushroom" and guy.prefab ~= "blue_mushroom" and guy.prefab ~= "flint" end ) if target then worker1.components.locomotor:Stop() worker1:SetBrain(nil) worker1.components.follower:SetLeader(nil) local pt1 = target:GetPosition() worker1.components.locomotor:GoToPoint(pt1) worker1.task2 = worker1:DoPeriodicTask(.25, function(worker1) local target2 = FindEntity(worker1, 0.8, function(guy) return guy.components.pickable and guy.components.pickable:CanBePicked() and guy.prefab ~= "flower" and guy.prefab ~= "red_mushroom" and guy.prefab ~= "green_mushroom" and guy.prefab ~= "blue_mushroom" and guy.prefab ~= "flint" end ) if target2 then worker1.AnimState:PlayAnimation("pickup") target2.components.pickable:Pick(GetPlayer()) end end ) else worker1.components.follower:SetLeader(GetPlayer()) local brain = require "brains/chesterbrain" worker1:SetBrain(brain) worker1:RestartBrain() if worker1.task2 then worker1.task2:Cancel() worker1.task2 = nil end end end ) end worker1:ListenForEvent( "nighttime", function() worker1:Remove() end, GetWorld()) local worker2 = SpawnPrefab("petals_evil") worker2.Transform:SetPosition(pt.x+1+1, 0, pt.z+1-1) worker2.AnimState:SetBank("wilson") worker2.buildname = names[math.random(#names)] worker2.AnimState:SetBuild(worker2.buildname) worker2.Transform:SetFourFaced() worker2.AnimState:OverrideSymbol("swap_hat", "hat_straw", "swap_hat") worker2.AnimState:Show("HAT") worker2.AnimState:Show("HAT_HAIR") worker2.AnimState:Hide("HAIR_NOHAT") worker2.AnimState:Hide("HAIR") worker2.AnimState:Show("ARM_normal") worker2.AnimState:Hide("ARM_carry") worker2.AnimState:PlayAnimation("idle") local minimap = worker2.entity:AddMiniMapEntity() minimap:SetIcon( "mushroom_tree_med.png" ) local sound = worker2.entity:AddSoundEmitter() local shadow = worker2.entity:AddDynamicShadow() MakeCharacterPhysics(worker2, 75, .5) shadow:SetSize( 1.3, .6 ) worker2:AddComponent("health") worker2.components.health:SetMaxHealth(1000) worker2.components.health:SetInvincible(true) worker2.components.health.nofadeout = true worker2:AddComponent("combat") worker2:AddComponent("follower") worker2:AddComponent("knownlocations") worker2:AddComponent("locomotor") worker2.components.locomotor.walkspeed = 5 worker2.components.locomotor.runspeed = 12 worker2:SetStateGraph("SGshadowwaxwell") worker2:RemoveComponent("stackable") worker2:RemoveComponent("tradable") worker2:RemoveComponent("fuel") worker2:RemoveComponent("inventoryitem") worker2:RemoveComponent("edible") worker2:RemoveComponent("perishable") worker2:RemoveComponent("burnable") worker2:RemoveComponent("propagator") worker2:RemoveComponent("deployable") MakeLargeBurnable(worker2) MakeLargePropagator(worker2) worker2:AddTag("workerman") worker2:AddComponent("trader") worker2.components.trader:SetAcceptTest(function(worker2, item) if GetPlayer().components.inventory:Has("goldnugget", 20) then if item.prefab == "goldnugget" then return true end end return false end ) worker2.components.trader.onaccept = function(worker2, giver, item) worker2:AddTag("myworker") worker2:RemoveTag("workerman") worker2:RemoveComponent("burnable") worker2:RemoveComponent("propagator") GetPlayer().components.inventory:ConsumeByName("goldnugget", 19) worker2.task1 = worker2:DoPeriodicTask(0.5, function(worker2) local target = FindEntity(worker2, 10, function(guy) return guy.components.crop and guy.components.crop.matured end ) if target then worker2.components.locomotor:Stop() worker2:SetBrain(nil) worker2.components.follower:SetLeader(nil) local pt1 = target:GetPosition() worker2.components.locomotor:GoToPoint(pt1) worker2.task2 = worker2:DoPeriodicTask(.25, function(worker2) local target2 = FindEntity(worker2, 0.8, function(guy) return guy.components.crop and guy.components.crop.matured end ) if target2 then worker2.AnimState:PlayAnimation("pickup") target2.components.crop:Harvest(GetPlayer()) end local target3 = FindEntity(worker2, 0.8, function(guy) return guy.components.grower and guy.components.grower:IsEmpty() end ) if target3 then target3.components.grower.cycles_left = target3.components.grower.max_cycles_left end end ) else worker2.components.follower:SetLeader(GetPlayer()) local brain = require "brains/chesterbrain" worker2:SetBrain(brain) worker2:RestartBrain() if worker2.task2 then worker2.task2:Cancel() worker2.task2 = nil end if worker2.task3 then worker2.task3:Cancel() worker2.task3 = nil end end end ) end worker2:ListenForEvent( "nighttime", function() worker2:Remove() end, GetWorld()) local worker3 = SpawnPrefab("petals_evil") worker3.Transform:SetPosition(pt.x+1-1, 0, pt.z+1+1) worker3.AnimState:SetBank("wilson") worker3.buildname = names[math.random(#names)] worker3.AnimState:SetBuild(worker3.buildname) worker3.Transform:SetFourFaced() worker3.AnimState:OverrideSymbol("swap_object", "swap_axe", "swap_axe") worker3.AnimState:Show("ARM_carry") worker3.AnimState:Hide("ARM_normal") worker3.AnimState:PlayAnimation("idle") local minimap = worker3.entity:AddMiniMapEntity() minimap:SetIcon( "mushroom_tree_med.png" ) local sound = worker3.entity:AddSoundEmitter() local shadow = worker3.entity:AddDynamicShadow() MakeCharacterPhysics(worker3, 75, .5) shadow:SetSize( 1.3, .6 ) worker3:AddComponent("health") worker3.components.health:SetMaxHealth(1000) worker3.components.health:SetInvincible(true) worker3.components.health.nofadeout = true worker3:AddComponent("combat") worker3:AddComponent("follower") worker3:AddComponent("knownlocations") worker3:AddComponent("locomotor") worker3.components.locomotor.walkspeed = 5 worker3.components.locomotor.runspeed = 12 worker3:SetStateGraph("SGshadowwaxwell") worker3:RemoveComponent("stackable") worker3:RemoveComponent("tradable") worker3:RemoveComponent("fuel") worker3:RemoveComponent("inventoryitem") worker3:RemoveComponent("edible") worker3:RemoveComponent("perishable") worker3:RemoveComponent("burnable") worker3:RemoveComponent("propagator") worker3:RemoveComponent("deployable") MakeLargeBurnable(worker3) MakeLargePropagator(worker3) worker3:AddTag("workerman") worker3:AddComponent("trader") worker3.components.trader:SetAcceptTest(function(worker3, item) if GetPlayer().components.inventory:Has("goldnugget", 20) then if item.prefab == "goldnugget" then return true end end return false end ) worker3.components.trader.onaccept = function(worker3, giver, item) worker3:AddTag("myworker") worker3:RemoveTag("workerman") worker3:RemoveComponent("burnable") worker3:RemoveComponent("propagator") GetPlayer().components.inventory:ConsumeByName("goldnugget", 19) worker3.task1 = worker3:DoPeriodicTask(0.5, function(worker3) local target = FindEntity(worker3, 15, function(guy) return guy:HasTag("tree") and guy.components.workable and guy.components.workable.workleft > 0 end ) if target then worker3.components.locomotor:Stop() worker3:SetBrain(nil) worker3.components.follower:SetLeader(nil) local pt1 = target:GetPosition() worker3.components.locomotor:GoToPoint(pt1) worker3.task2 = worker3:DoPeriodicTask(.25, function(worker3) local target2 = FindEntity(worker3, 2, function(guy) return guy:HasTag("tree") and guy.components.workable and guy.components.workable.workleft > 0 end ) if target2 then worker3.AnimState:PlayAnimation("pickup") target2.components.workable:Destroy(worker3) end end ) else worker3.components.follower:SetLeader(GetPlayer()) local brain = require "brains/chesterbrain" worker3:SetBrain(brain) worker3:RestartBrain() if worker3.task2 then worker3.task2:Cancel() worker3.task2 = nil end end end ) end worker3:ListenForEvent( "nighttime", function() worker3:Remove() end, GetWorld()) local worker4 = SpawnPrefab("petals_evil") worker4.Transform:SetPosition(pt.x+1-3, 0, pt.z+1+3) worker4.AnimState:SetBank("wilson") worker4.buildname = names[math.random(#names)] worker4.AnimState:SetBuild(worker4.buildname) worker4.Transform:SetFourFaced() worker4.AnimState:OverrideSymbol("swap_hat", "hat_miner", "swap_hat") worker4.AnimState:Show("HAT") worker4.AnimState:Show("HAT_HAIR") worker4.AnimState:Hide("HAIR_NOHAT") worker4.AnimState:Hide("HAIR") worker4.AnimState:OverrideSymbol("swap_object", "swap_pickaxe", "swap_pickaxe") worker4.AnimState:Show("ARM_carry") worker4.AnimState:Hide("ARM_normal") worker4.AnimState:PlayAnimation("idle") local minimap = worker4.entity:AddMiniMapEntity() minimap:SetIcon( "mushroom_tree_med.png" ) local sound = worker4.entity:AddSoundEmitter() local shadow = worker4.entity:AddDynamicShadow() MakeCharacterPhysics(worker4, 75, .5) shadow:SetSize( 1.3, .6 ) worker4:AddComponent("health") worker4.components.health:SetMaxHealth(1000) worker4.components.health:SetInvincible(true) worker4.components.health.nofadeout = true worker4:AddComponent("combat") worker4:AddComponent("follower") worker4:AddComponent("knownlocations") worker4:AddComponent("locomotor") worker4.components.locomotor.walkspeed = 5 worker4.components.locomotor.runspeed = 12 worker4:SetStateGraph("SGshadowwaxwell") worker4:RemoveComponent("stackable") worker4:RemoveComponent("tradable") worker4:RemoveComponent("fuel") worker4:RemoveComponent("inventoryitem") worker4:RemoveComponent("edible") worker4:RemoveComponent("perishable") worker4:RemoveComponent("burnable") worker4:RemoveComponent("propagator") worker4:RemoveComponent("deployable") MakeLargeBurnable(worker4) MakeLargePropagator(worker4) worker4:AddTag("workerman") worker4:AddComponent("trader") worker4.components.trader:SetAcceptTest(function(worker4, item) if GetPlayer().components.inventory:Has("goldnugget", 20) then if item.prefab == "goldnugget" then return true end end return false end ) worker4.components.trader.onaccept = function(worker4, giver, item) worker4:AddTag("myworker") worker4:RemoveTag("workerman") worker4:RemoveComponent("burnable") worker4:RemoveComponent("propagator") GetPlayer().components.inventory:ConsumeByName("goldnugget", 19) worker4.task1 = worker4:DoPeriodicTask(0.5, function(worker4) local target = FindEntity(worker4, 15, function(guy) return guy.prefab == "rock1" or guy.prefab == "rock2" or guy.prefab == "rock_flintless" or guy.prefab == "rock_flintless_med" or guy.prefab == "rock_flintless_low" or guy.prefab == "rock_ice" end ) if target then worker4.components.locomotor:Stop() worker4:SetBrain(nil) worker4.components.follower:SetLeader(nil) local pt1 = target:GetPosition() worker4.components.locomotor:GoToPoint(pt1) worker4.task2 = worker4:DoPeriodicTask(.25, function(worker4) local target2 = FindEntity(worker4, 2, function(guy) return guy.prefab == "rock1" or guy.prefab == "rock2" or guy.prefab == "rock_flintless" or guy.prefab == "rock_flintless_med" or guy.prefab == "rock_flintless_low" or guy.prefab == "rock_ice" end ) if target2 then worker4.AnimState:PlayAnimation("pickup") target2.components.workable:Destroy(worker4) end end ) else worker4.components.follower:SetLeader(GetPlayer()) local brain = require "brains/chesterbrain" worker4:SetBrain(brain) worker4:RestartBrain() if worker4.task2 then worker4.task2:Cancel() worker4.task2 = nil end end end ) end worker4:ListenForEvent( "nighttime", function() worker4:Remove() end, GetWorld()) end local shopsign1 = SpawnPrefab("petals_evil") shopsign1.Transform:SetPosition(pt.x+2+3, 0, pt.z+2-3) shopsign1.AnimState:SetBank("sign_home") shopsign1.AnimState:SetBuild("sign_home") shopsign1.AnimState:PlayAnimation("idle") shopsign1.Transform:SetScale(0.5, 0.5, 0.5) shopsign1:RemoveComponent("stackable") shopsign1:RemoveComponent("tradable") shopsign1:RemoveComponent("fuel") shopsign1:RemoveComponent("inventoryitem") shopsign1:RemoveComponent("edible") shopsign1:RemoveComponent("perishable") shopsign1:RemoveComponent("burnable") shopsign1:RemoveComponent("propagator") shopsign1:RemoveComponent("deployable") MakeLargeBurnable(shopsign1) MakeLargePropagator(shopsign1) shopsign1:AddTag("goodbye") local shopsign2 = SpawnPrefab("petals_evil") shopsign2.Transform:SetPosition(pt.x+2+1, 0, pt.z+2-1) shopsign2.AnimState:SetBank("sign_home") shopsign2.AnimState:SetBuild("sign_home") shopsign2.AnimState:PlayAnimation("idle") shopsign2.Transform:SetScale(0.5, 0.5, 0.5) shopsign2:RemoveComponent("stackable") shopsign2:RemoveComponent("tradable") shopsign2:RemoveComponent("fuel") shopsign2:RemoveComponent("inventoryitem") shopsign2:RemoveComponent("edible") shopsign2:RemoveComponent("perishable") shopsign2:RemoveComponent("burnable") shopsign2:RemoveComponent("propagator") shopsign2:RemoveComponent("deployable") MakeLargeBurnable(shopsign2) MakeLargePropagator(shopsign2) shopsign2:AddTag("goodbye") local shopsign3 = SpawnPrefab("petals_evil") shopsign3.Transform:SetPosition(pt.x+2-1, 0, pt.z+2+1) shopsign3.AnimState:SetBank("sign_home") shopsign3.AnimState:SetBuild("sign_home") shopsign3.AnimState:PlayAnimation("idle") shopsign3.Transform:SetScale(0.5, 0.5, 0.5) shopsign3:RemoveComponent("stackable") shopsign3:RemoveComponent("tradable") shopsign3:RemoveComponent("fuel") shopsign3:RemoveComponent("inventoryitem") shopsign3:RemoveComponent("edible") shopsign3:RemoveComponent("perishable") shopsign3:RemoveComponent("burnable") shopsign3:RemoveComponent("propagator") shopsign3:RemoveComponent("deployable") MakeLargeBurnable(shopsign3) MakeLargePropagator(shopsign3) shopsign3:AddTag("goodbye") local shopsign4 = SpawnPrefab("petals_evil") shopsign4.Transform:SetPosition(pt.x+2-3, 0, pt.z+2+3) shopsign4.AnimState:SetBank("sign_home") shopsign4.AnimState:SetBuild("sign_home") shopsign4.AnimState:PlayAnimation("idle") shopsign4.Transform:SetScale(0.5, 0.5, 0.5) shopsign4:RemoveComponent("stackable") shopsign4:RemoveComponent("tradable") shopsign4:RemoveComponent("fuel") shopsign4:RemoveComponent("inventoryitem") shopsign4:RemoveComponent("edible") shopsign4:RemoveComponent("perishable") shopsign4:RemoveComponent("burnable") shopsign4:RemoveComponent("propagator") shopsign4:RemoveComponent("deployable") MakeLargeBurnable(shopsign4) MakeLargePropagator(shopsign4) shopsign4:AddTag("goodbye") end local function OnDeploy (inst, pt) createworker(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("shopsign") then data.shopsign = true end if inst:HasTag("workerman") then data.workerman = true end if inst:HasTag("myworker") then data.myworker = true end if inst:HasTag("goodbye") then data.goodbye = true end end local function onload(inst, data) if data and data.shopsign then createworker(inst) inst:Remove() end if data and data.workerman then inst:Remove() end if data and data.myworker then inst:Remove() end if data and data.goodbye then inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可用噩梦花瓣种临时工市场(拿着1个噩梦花瓣对地面点鼠标右键,如果拿着多个噩梦花瓣,则不会种出来),鼠标左键点击大招牌,会有4种临时工来应聘,从左到右分别是采摘工(采摘植物)、农民(收获农田并施肥)、伐木工(砍树)、矿工(开矿),想雇佣什么工种,就拿着黄金对他点鼠标左键,每人每天20个黄金。再次点大招牌,可以换不同的应聘人员供你选择。雇佣临时工后,他会跟随你,把他带到工作场所,会自动开始干活,干完后继续跟随。可打开小地图查询临时工的位置,显示为红色蘑菇树的图标。临时工会在每天黑夜来临时下班,想让你花费的工资更值得,就尽可能早点雇佣他们。如果想提早解雇临时工,就存档退出再读档,他们就被遣散了。不想要临时工市场时,烧掉即可

2025/04/23 · Bny

YN298-我的果汁店(用治疗药膏种果汁店,自己制作果汁,顾客上门购买)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二九八.我的果汁店(用治疗药膏种果汁店,自己制作果汁,顾客上门购买) 用MT管理器打开游戏目录/assets/scripts/prefabs/healingsalve.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function itemtest(inst, item, slot) if item.prefab == "cave_banana" or item.prefab == "pomegranate" or item.prefab == "dragonfruit" then return true end return false end local slotpos = { Vector3(0,32+4,0), Vector3(0,-(32+4),0), Vector3(0,-(64+32+8+4),0)} local widgetbuttoninfo = { text = "Start", position = Vector3(0, -165, 0), fn = function(inst) if inst:HasTag("juicer") and inst.components.container:Has("cave_banana", 1) and inst.components.container:Has("pomegranate", 1) and inst.components.container:Has("dragonfruit", 1) then inst.components.container:ConsumeByName("cave_banana", 1) inst.components.container:ConsumeByName("pomegranate", 1) inst.components.container:ConsumeByName("dragonfruit", 1) GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") local sweets = SpawnPrefab("healingsalve") sweets.AnimState:SetBank("food") sweets.AnimState:SetBuild("cook_pot_food") sweets.AnimState:PlayAnimation("fruitmedley", false) sweets:RemoveComponent("stackable") sweets:RemoveComponent("deployable") sweets.components.healer:SetHealthAmount(TUNING.HEALING_SUPERHUGE) sweets.components.inventoryitem:ChangeImageName("fruitmedley") sweets.Transform:SetScale(1.2, 1.2, 1.2) sweets:AddTag("sweets") GetPlayer().components.inventory:GiveItem(sweets) end end } inst:AddComponent("container") inst.components.container.widgetbuttoninfo = widgetbuttoninfo 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 local function sweetshop(inst) local pt = inst:GetPosition() local shop = SpawnPrefab("healingsalve") shop.Transform:SetPosition(pt.x, pt.y, pt.z) shop.AnimState:SetBank("rabbithouse") shop.AnimState:SetBuild("rabbit_house") shop.AnimState:PlayAnimation("idle", true) shop.Transform:SetScale(0.8, 0.8, 0.8) shop:RemoveComponent("stackable") shop:RemoveComponent("inventoryitem") shop:RemoveComponent("healer") shop:RemoveComponent("deployable") local light = shop.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(5) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) MakeLargeBurnable(shop) MakeLargePropagator(shop) shop:AddTag("shop") shop:DoPeriodicTask(2, function(shop) shop.AnimState:SetBloomEffectHandle("shaders/anim.ksh") shop:DoTaskInTime(1, function() shop.AnimState:SetBloomEffectHandle("") end ) end ) shop:AddComponent("trader") shop.components.trader:SetAcceptTest(function(shop, item) if item.prefab == "goldnugget" then return true end return false end ) shop.components.trader.onaccept = function(shop, giver, item) local names = {"cave_banana","pomegranate","dragonfruit"} local name = names[math.random(#names)] local veggie = SpawnPrefab(name) if item.prefab == "goldnugget" then giver.components.inventory:GiveItem(veggie) end end local counter = SpawnPrefab("healingsalve") counter.Transform:SetPosition(pt.x+2+1.8, 0, pt.z+2-1.8) counter.AnimState:SetBank("winter_meter") counter.AnimState:SetBuild("winter_meter") counter.AnimState:SetPercent("meter", 0) counter.Transform:SetScale(1.2, 1.2, 1.2) counter.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) counter.AnimState:SetLayer( LAYER_BACKGROUND ) counter.AnimState:SetSortOrder( 1 ) counter.Transform:SetRotation( 135 ) counter.AnimState:SetMultColour(255/255,255/255,255/255,0) counter:RemoveComponent("stackable") counter:RemoveComponent("inventoryitem") counter:RemoveComponent("healer") counter:RemoveComponent("deployable") MakeLargeBurnable(counter) MakeLargePropagator(counter) counter:AddTag("NOCLICK") counter:AddTag("goodbye") local juicer = SpawnPrefab("healingsalve") juicer.Transform:SetPosition(pt.x+1-2, 0, pt.z+1+2) juicer.AnimState:SetBank("researchlab2") juicer.AnimState:SetBuild("researchlab2") juicer.AnimState:PlayAnimation("idle") juicer.Transform:SetScale(0.8, 0.8, 0.8) juicer.AnimState:SetMultColour(255/255,105/255,0/255,1) juicer:RemoveComponent("stackable") juicer:RemoveComponent("inventoryitem") juicer:RemoveComponent("healer") juicer:RemoveComponent("deployable") juicer.components.container.canbeopened = true MakeLargeBurnable(juicer) MakeLargePropagator(juicer) juicer:AddTag("juicer") juicer:AddTag("goodbye") local sweetsign = SpawnPrefab("healingsalve") sweetsign.Transform:SetPosition(pt.x+1+2, 0, pt.z+1-2) sweetsign.AnimState:SetBank("sign_home") sweetsign.AnimState:SetBuild("sign_home") sweetsign.AnimState:PlayAnimation("idle") sweetsign.Transform:SetScale(0.8, 0.8, 0.8) sweetsign.AnimState:SetMultColour(255/255,0/255,0/255,1) MakeLargeBurnable(sweetsign) MakeLargePropagator(sweetsign) sweetsign:AddTag("goodbye") sweetsign:RemoveComponent("stackable") sweetsign:RemoveComponent("inventoryitem") sweetsign:RemoveComponent("healer") sweetsign:RemoveComponent("deployable") sweetsign:ListenForEvent( "nighttime", function() sweetsign:RemoveTag("openshop") GetPlayer().SoundEmitter:KillSound("beavermusic") sweetsign.AnimState:SetMultColour(255/255,0/255,0/255,1) local pos = Vector3(sweetsign.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("customers") then v:Remove() end end end, GetWorld()) sweetsign.components.inspectable.getstatus = function(sweetsign) if not sweetsign:HasTag("openshop") then local target0 = FindEntity(sweetsign, 10, function(guy) return guy:HasTag("sweets") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld() end ) if target0 then sweetsign:AddTag("openshop") GetPlayer().SoundEmitter:PlaySound("dontstarve/music/music_hoedown", "beavermusic") sweetsign.AnimState:SetMultColour(0/255,255/255,0/255,1) for k = 1, math.random(8,16) do local pt1 = sweetsign:GetPosition() local customer = SpawnPrefab("healingsalve") customer.Transform:SetPosition(pt1.x+(math.random(30)-math.random(30)), 0, pt1.z+(math.random(30)-math.random(30))) customer.AnimState:SetBank("wilson") local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = names[math.random(#names)] customer.AnimState:SetBuild(buildname) local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter"} local hat = hats[math.random(#hats)] customer.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood"} local armor = armors[math.random(#armors)] customer.AnimState:OverrideSymbol("swap_body", armor, "swap_body") customer.AnimState:Show("HAT") customer.AnimState:Show("HAT_HAIR") customer.AnimState:Hide("HAIR_NOHAT") customer.AnimState:Hide("HAIR") customer.AnimState:Hide("ARM_carry") customer.AnimState:Show("ARM_normal") customer.AnimState:PlayAnimation("idle") customer.Transform:SetFourFaced() local sound = customer.entity:AddSoundEmitter() local shadow = customer.entity:AddDynamicShadow() shadow:SetSize( 1.3, .6 ) customer:RemoveComponent("stackable") customer:RemoveComponent("inventoryitem") customer:RemoveComponent("healer") customer:RemoveComponent("deployable") customer:AddComponent("locomotor") customer.components.locomotor.walkspeed = 4 customer.components.locomotor.runspeed = 8 customer:SetStateGraph("SGshadowwaxwell") local brain = require "brains/frogbrain" customer:SetBrain(brain) customer:AddComponent("health") customer.components.health:SetMaxHealth(1000) customer.components.health:SetInvincible(true) customer.components.health.nofadeout = true customer:AddComponent("combat") customer:AddComponent("knownlocations") customer:AddTag("customers") customer:AddTag("goodbye") customer.task1 = customer:DoPeriodicTask(3, function(customer) if math.random() < 0.1 then local target = FindEntity(customer, 100, function(guy) return guy:HasTag("sweets") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld() end ) if target then customer.components.locomotor:Stop() customer:SetBrain(nil) customer.components.locomotor:GoToEntity(target) customer.task2 = customer:DoPeriodicTask(.25, function(customer) local target2 = FindEntity(customer, 1, function(guy) return guy:HasTag("sweets") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld() end ) if target2 then customer.AnimState:PlayAnimation("pickup") for k = 1, 6 do SpawnPrefab("goldnugget").Transform:SetPosition(target2.Transform:GetWorldPosition()) end target2:Remove() local brain = require "brains/frogbrain" customer:SetBrain(brain) customer:RestartBrain() if customer.task2 then customer.task2:Cancel() customer.task2 = nil end end end ) customer:DoTaskInTime(8, function(customer) local brain = require "brains/frogbrain" customer:SetBrain(brain) customer:RestartBrain() if customer.task2 then customer.task2:Cancel() customer.task2 = nil end end ) else local brain = require "brains/frogbrain" customer:SetBrain(brain) customer:RestartBrain() if customer.task2 then customer.task2:Cancel() customer.task2 = nil end end end end ) end end else sweetsign:RemoveTag("openshop") GetPlayer().SoundEmitter:KillSound("beavermusic") sweetsign.AnimState:SetMultColour(255/255,0/255,0/255,1) local pos = Vector3(sweetsign.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) for k,v in pairs(ents) do if v:HasTag("customers") then v:Remove() end end end end end local function OnDeploy (inst, pt) sweetshop(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("shop") then data.shop = true end if inst:HasTag("goodbye") then data.goodbye = true end if inst:HasTag("sweets") then data.sweets = true end end local function onload(inst, data) if data and data.shop then sweetshop(inst) inst:Remove() end if data and data.goodbye then inst:Remove() end if data and data.sweets then inst.AnimState:SetBank("food") inst.AnimState:SetBuild("cook_pot_food") inst.AnimState:PlayAnimation("fruitmedley", false) inst:RemoveComponent("stackable") inst:RemoveComponent("deployable") inst.components.healer:SetHealthAmount(TUNING.HEALING_SUPERHUGE) inst.components.inventoryitem:ChangeImageName("fruitmedley") inst.Transform:SetScale(1.2, 1.2, 1.2) inst:AddTag("sweets") end end inst.OnSave = onsave inst.OnLoad = onload 即可用治疗药膏种我的果汁店(手里拿着1个治疗药膏对地面点鼠标右键,如果拿着多个治疗药膏,则不会种出来),拿着黄金对库房(大胡萝卜)点鼠标左键,可以购入果汁原料,分别是火龙果、香蕉、石榴,每个水果1个黄金,当然你也可以用自己种的水果。将三种水果放入右边的榨汁机(拿着水果对榨汁机点鼠标左键),然后按Start按钮,将开始榨汁,榨完后果汁自动装入主角物品栏。将果汁放在柜台上(地上半透明的长方形),点左边的牌子就可以开张了(柜台上没有果汁则无法开张),会有顾客上门购买,每份售价6个黄金。想打烊,就再次点击牌子即可。黑夜来临时会自动打烊,回家休息吧,当然你也可以再次点牌子开张,但夜里的顾客都昏昏欲睡。出售的果汁自己也可以喝(在物品栏里对果汁点鼠标右键),可大幅补充生命值。不想要果汁店时,烧掉即可,记得先打烊哦。治疗药膏在生存选项(画着绳套)下,用2个灰、1个石头、1个蜘蛛腺体制造

2025/04/23 · Bny

YN299-跳蚤市场(用木炭种跳蚤市场摊位,上百种商品30秒刷新一次,全场一律3个黄金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 二九九.跳蚤市场(用木炭种跳蚤市场摊位,上百种商品30秒刷新一次,全场一律3个黄金) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/charcoal.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function createfleashop(inst) local pt = inst:GetPosition() local seller = SpawnPrefab("charcoal") seller.Transform:SetPosition(pt.x, pt.y, pt.z) seller.AnimState:SetBank("wilson") local buildnames = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"} local buildname = buildnames[math.random(#buildnames)] seller.AnimState:SetBuild(buildname) local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"} local hat = hats[math.random(#hats)] seller.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"} local armor = armors[math.random(#armors)] seller.AnimState:OverrideSymbol("swap_body", armor, "swap_body") seller.AnimState:Show("HAT") seller.AnimState:Show("HAT_HAIR") seller.AnimState:Hide("HAIR_NOHAT") seller.AnimState:Hide("HAIR") seller.AnimState:Hide("ARM_carry") seller.AnimState:Show("ARM_normal") seller.AnimState:PlayAnimation("idle") seller.Transform:SetFourFaced() seller:RemoveComponent("stackable") seller:RemoveComponent("fuel") seller:RemoveComponent("inventoryitem") seller:RemoveComponent("burnable") seller:RemoveComponent("propagator") seller:RemoveComponent("deployable") seller:RemoveComponent("bait") seller:RemoveTag("molebait") seller:AddComponent("talker") seller:AddComponent("workable") seller.components.workable:SetWorkAction(ACTIONS.HAMMER) seller.components.workable:SetWorkLeft(3) seller.components.workable:SetOnFinishCallback(function(seller) SpawnPrefab("collapse_big").Transform:SetPosition(seller.Transform:GetWorldPosition()) GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") local pos = Vector3(seller.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 6) for k,v in pairs(ents) do if v:HasTag("commodity") then v:Remove() end if v:HasTag("fleas") then v:Remove() end end seller:Remove() end ) seller:AddTag("sellers") local flea = SpawnPrefab("charcoal") flea.Transform:SetPosition(pt.x+2.8+1.2, 0, pt.z-2.8+1.2) flea.AnimState:SetBank("winter_meter") flea.AnimState:SetBuild("winter_meter") flea.AnimState:SetPercent("meter", 0) flea.Transform:SetScale(1.5, 1.5, 1.5) flea.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround ) flea.AnimState:SetLayer( LAYER_BACKGROUND ) flea.AnimState:SetSortOrder( 1 ) flea.Transform:SetRotation( 135 ) flea.AnimState:SetMultColour(255/255,255/255,255/255,0) flea:RemoveComponent("stackable") flea:RemoveComponent("fuel") flea:RemoveComponent("inventoryitem") flea:RemoveComponent("burnable") flea:RemoveComponent("propagator") flea:RemoveComponent("deployable") flea:RemoveComponent("bait") flea:RemoveTag("molebait") flea:AddTag("NOCLICK") flea:AddTag("fleas") local light = flea.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(5) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) for k = 0,4 do local names = {"amulet","blueamulet","purpleamulet","orangeamulet","greenamulet","yellowamulet","armorgrass","armormarble","armorruins","armor_sanity","armorslurper","armorsnurtleshell","armorwood","axe","goldenaxe","multitool_axe_pickaxe","bandage","batbat","bedroll_furry","bedroll_straw","trunkvest_summer","blowdart_sleep","blowdart_fire","blowdart_pipe","boomerang","bugnet","butter","cane","compass","deerclops_eyeball","diviningrod","eyeturret_item","fishingrod","gunpowder","hambat","hammer","footballhat","strawhat","tophat","flowerhat","beefalohat","featherhat","beehat","walrushat","earmuffshat","winterhat","minerhat","spiderhat","bushhat","slurtlehat","ruinshat","healingsalve","heatrock","nightsword","lantern","panflute","pickaxe","goldenpickaxe","pitchfork","razor","ruins_bat","shovel","goldenshovel","spear","icestaff","firestaff","telestaff","orangestaff","greenstaff","yellowstaff","sweatervest","teleportato_ring","teleportato_box","teleportato_crank","teleportato_potato","tentaclespike","torch","trunkvest_winter","umbrella","fertilizer","bell","spear_wathgrithr","grass_umbrella","rainhat","icehat","watermelonhat","catcoonhat","wathgrithrhat","raincoat","molehat","armordragonfly","beargervest","featherfan","staff_tornado","nightstick","eyebrellahat","reflectivevest","hawaiianshirt"} local name = names[math.random(#names)] local commodity = SpawnPrefab(name) commodity.Transform:SetPosition(pt.x+2+1.3-k*1, 0, pt.z-2+1.3+k*1) commodity.components.inventoryitem.canbepickedup = false commodity.persists = false commodity:AddComponent("trader") commodity.components.trader:SetAcceptTest(function(commodity, item) if GetPlayer().components.inventory:Has("goldnugget", 3) then if item.prefab == "goldnugget" then return true end end return false end ) commodity.components.trader.onaccept = function(commodity, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 2) commodity.components.inventoryitem.canbepickedup = true commodity:RemoveTag("commodity") GetPlayer().components.inventory:GiveItem(commodity) commodity:RemoveComponent("trader") commodity.persists = true end commodity:AddTag("commodity") end seller:DoPeriodicTask(30, function(seller) seller.components.talker:Say("everythings, 3 golds", 5, false) seller.AnimState:PlayAnimation("give") local pos = Vector3(seller.Transform:GetWorldPosition()) local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 6) for k,v in pairs(ents) do if v:HasTag("commodity") then v:Remove() end end for k = 0,4 do local names = {"amulet","blueamulet","purpleamulet","orangeamulet","greenamulet","yellowamulet","armorgrass","armormarble","armorruins","armor_sanity","armorslurper","armorsnurtleshell","armorwood","axe","goldenaxe","multitool_axe_pickaxe","bandage","batbat","bedroll_furry","bedroll_straw","trunkvest_summer","blowdart_sleep","blowdart_fire","blowdart_pipe","boomerang","bugnet","butter","cane","compass","deerclops_eyeball","diviningrod","eyeturret_item","fishingrod","gunpowder","hambat","hammer","footballhat","strawhat","tophat","flowerhat","beefalohat","featherhat","beehat","walrushat","earmuffshat","winterhat","minerhat","spiderhat","bushhat","slurtlehat","ruinshat","healingsalve","heatrock","nightsword","lantern","panflute","pickaxe","goldenpickaxe","pitchfork","razor","ruins_bat","shovel","goldenshovel","spear","icestaff","firestaff","telestaff","orangestaff","greenstaff","yellowstaff","sweatervest","teleportato_ring","teleportato_box","teleportato_crank","teleportato_potato","tentaclespike","torch","trunkvest_winter","umbrella","fertilizer","bell","spear_wathgrithr","grass_umbrella","rainhat","icehat","watermelonhat","catcoonhat","wathgrithrhat","raincoat","molehat","armordragonfly","beargervest","featherfan","staff_tornado","nightstick","eyebrellahat","reflectivevest","hawaiianshirt"} local name = names[math.random(#names)] local commodity = SpawnPrefab(name) commodity.Transform:SetPosition(pt.x+2+1.3-k*1, 0, pt.z-2+1.3+k*1) commodity.components.inventoryitem.canbepickedup = false commodity.persists = false commodity:AddTag("commodity") commodity:AddComponent("trader") commodity.components.trader:SetAcceptTest(function(commodity, item) if GetPlayer().components.inventory:Has("goldnugget", 3) then if item.prefab == "goldnugget" then return true end end return false end ) commodity.components.trader.onaccept = function(commodity, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 2) commodity.components.inventoryitem.canbepickedup = true commodity:RemoveTag("commodity") GetPlayer().components.inventory:GiveItem(commodity) commodity:RemoveComponent("trader") commodity.persists = true end end end) end local function OnDeploy (inst, pt) createfleashop(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("sellers") then data.sellers = true end if inst:HasTag("fleas") then data.fleas = true end end local function onload(inst, data) if data and data.sellers then createfleashop(inst) inst:Remove() end if data and data.fleas then inst:Remove() end end inst.OnSave = onsave inst.OnLoad = onload 即可拿着1个木炭对空地点鼠标右键,种出跳蚤市场的摊位(手里拿多个木炭不会种出来),每30秒展示5种商品,看上哪件,就拿着黄金对那件商品点鼠标左键购买,全场一律3个黄金。店主为随机人物,可以种多个跳蚤市场摊位,形成商品一条街(摊位间不要太近,否则影响展示商品)。不想要跳蚤市场时,用锤子砸店主即可(暴力拆迁)

2025/04/23 · Bny

YN300-小诊所(用毛皮铺盖种小诊所,可买药、住院、做手术)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三00.小诊所(用毛皮铺盖种小诊所,可买药、住院、做手术) 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/bedroll_furry.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local function createhospital(inst) local pt = inst:GetPosition() local nurse = SpawnPrefab("bedroll_furry") nurse.Transform:SetPosition(pt.x, pt.y, pt.z) nurse.AnimState:SetBank("wilson") nurse.AnimState:SetBuild("wendy") nurse.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body") nurse.AnimState:Hide("ARM_carry") nurse.AnimState:Show("ARM_normal") nurse.Transform:SetFourFaced() nurse.AnimState:PlayAnimation("idle") nurse:RemoveComponent("inventoryitem") nurse:RemoveComponent("finiteuses") nurse:RemoveComponent("fuel") nurse:RemoveComponent("sleepingbag") nurse:RemoveComponent("deployable") MakeLargeBurnable(nurse) MakeLargePropagator(nurse) nurse:AddTag("nurse") local light = nurse.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(5) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) nurse:AddComponent("trader") nurse.components.trader:SetAcceptTest(function(nurse, item) if GetPlayer().components.inventory:Has("goldnugget", 5) then if item.prefab == "goldnugget" then return true end end return false end ) nurse.components.trader.onaccept = function(nurse, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 4) GetPlayer().components.playercontroller:Enable(false) nurse.AnimState:OverrideSymbol("swap_object", "swap_hammer", "swap_hammer") nurse.AnimState:Hide("ARM_normal") nurse.AnimState:Show("ARM_carry") nurse.task = nurse:DoPeriodicTask(1, function(nurse) nurse.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180) nurse.AnimState:PlayAnimation("pickaxe_pre") nurse.AnimState:PlayAnimation("pickaxe_loop", false) GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break") GetPlayer().sg:GoToState("hit") end ) nurse:DoTaskInTime(5, function() TheFrontEnd:Fade(false,1) if nurse.task then nurse.task:Cancel() nurse.task = nil end nurse.Transform:SetRotation(0) nurse:DoTaskInTime(1, function() nurse.AnimState:Hide("ARM_carry") nurse.AnimState:Show("ARM_normal") nurse.AnimState:PlayAnimation("idle_onemanband1_loop",true) nurse:DoTaskInTime(3, function() nurse.AnimState:PlayAnimation("idle") end ) TheFrontEnd:Fade(true,1) GetPlayer().components.health:DoDelta(GetPlayer().components.health.maxhealth) if GetPlayer():HasTag("poisoning") or GetPlayer():HasTag("fever") then if GetPlayer():HasTag("poisoning") then GetPlayer():RemoveTag("poisoning") end if GetPlayer():HasTag("fever") then GetPlayer():RemoveTag("fever") end if GetPlayer().poison then GetPlayer().poison:Cancel() GetPlayer().poison = nil end if GetPlayer().fever then GetPlayer().fever:Cancel() GetPlayer().fever = nil end GetPlayer().AnimState:SetMultColour(255/255,255/255,255/255,1) GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED GetPlayer().components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD) end GetPlayer().sg:GoToState("wakeup") GetPlayer().components.playercontroller:Enable(true) end ) end ) end local medicinebox = SpawnPrefab("bedroll_furry") medicinebox.Transform:SetPosition(pt.x+1.2, 0, pt.z-1.2) medicinebox.AnimState:SetBank("icebox") medicinebox.AnimState:SetBuild("ice_box") medicinebox.AnimState:PlayAnimation("closed") medicinebox.Transform:SetScale(0.5, 0.5, 0.5) medicinebox:RemoveComponent("inventoryitem") medicinebox:RemoveComponent("finiteuses") medicinebox:RemoveComponent("fuel") medicinebox:RemoveComponent("sleepingbag") medicinebox:RemoveComponent("deployable") MakeLargeBurnable(medicinebox) MakeLargePropagator(medicinebox) medicinebox:AddTag("goodbye") medicinebox:AddComponent("trader") medicinebox.components.trader:SetAcceptTest(function(medicinebox, item) if GetPlayer().components.inventory:Has("goldnugget", 5) then if item.prefab == "goldnugget" then return true end end return false end ) medicinebox.components.trader.onaccept = function(medicinebox, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 4) local medicine = SpawnPrefab("bedroll_furry") medicine.AnimState:SetBank("carrot") medicine.AnimState:SetBuild("carrot") medicine.AnimState:PlayAnimation("cooked") medicine.components.inventoryitem:ChangeImageName("carrot_cooked") medicine:RemoveComponent("finiteuses") medicine:RemoveComponent("fuel") medicine:RemoveComponent("sleepingbag") medicine:RemoveComponent("burnable") medicine:RemoveComponent("propagator") medicine:RemoveComponent("deployable") medicine:AddComponent("edible") medicine.components.edible.healthvalue = GetPlayer().components.health.maxhealth *0.5 medicine.components.edible.hungervalue = 0 medicine.components.edible.sanityvalue = GetPlayer().components.sanity.max *0.5 medicine.components.edible.foodtype = "VEGGIE" medicine:AddTag("medicine") GetPlayer().components.inventory:GiveItem(medicine) end local hospital = SpawnPrefab("bedroll_furry") hospital.Transform:SetPosition(pt.x-2, 0, pt.z-2) hospital.AnimState:SetBank("tent") hospital.AnimState:SetBuild("tent") hospital.AnimState:PlayAnimation("idle", true) hospital.Transform:SetScale(1.2, 1.2, 1.2) hospital:RemoveComponent("inventoryitem") hospital:RemoveComponent("finiteuses") hospital:RemoveComponent("fuel") hospital:RemoveComponent("sleepingbag") hospital:RemoveComponent("deployable") MakeLargeBurnable(hospital) MakeLargePropagator(hospital) hospital:AddTag("goodbye") hospital:AddComponent("trader") hospital.components.trader:SetAcceptTest(function(hospital, item) if GetPlayer().components.inventory:Has("goldnugget", 5) then if item.prefab == "goldnugget" then return true end end return false end ) hospital.components.trader.onaccept = function(hospital, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 4) GetPlayer().components.playercontroller:Enable(false) TheFrontEnd:Fade(false,1) hospital:DoTaskInTime(2, function() TheFrontEnd:Fade(true,1) GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max) GetPlayer().components.playercontroller:Enable(true) end ) end end local function OnDeploy (inst, pt) createhospital(inst) inst:Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("goodbye") then data.goodbye = true end if inst:HasTag("nurse") then data.nurse = true end if inst:HasTag("medicine") then data.medicine = true end end local function onload(inst, data) if data and data.goodbye then inst:Remove() end if data and data.nurse then createhospital(inst) inst:Remove() end if data and data.medicine then inst.AnimState:SetBank("carrot") inst.AnimState:SetBuild("carrot") inst.AnimState:PlayAnimation("cooked") inst.components.inventoryitem:ChangeImageName("carrot_cooked") inst:RemoveComponent("finiteuses") inst:RemoveComponent("fuel") inst:RemoveComponent("sleepingbag") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") inst:AddComponent("edible") inst.components.edible.healthvalue = GetPlayer().components.health.maxhealth *0.5 inst.components.edible.hungervalue = 0 inst.components.edible.sanityvalue = GetPlayer().components.sanity.max *0.5 inst.components.edible.foodtype = "VEGGIE" inst:AddTag("medicine") end end inst.OnSave = onsave inst.OnLoad = onload 即可用毛皮铺盖种小诊所,给护士5个黄金(拿着黄金对护士点鼠标左键),会为你麻醉并做手术,将生命值恢复到最大,如果同时修改了“小病小灾”,也可治愈感冒和食物中毒。给帐篷5个黄金可以住院,将脑值恢复到最大。给左侧的药箱5个黄金,可以买一份药,吃了可补一半的生命和脑值。不想要小诊所时,烧掉即可。毛皮铺盖在生存选项(画着绳套)下,用1个草席卷、2个兔人尾巴制造

2025/04/23 · Bny

YN301-斗蜘蛛(用啜食者皮种斗蜘蛛场,购买迷你蜘蛛与庄家PK,赢奖金)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 三0一.斗蜘蛛(用啜食者皮种斗蜘蛛场,购买迷你蜘蛛与庄家PK,赢奖金) 用MT管理器打开游戏目录/assets/scripts/prefabs/slurperpelt.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: local colours= { {198/255,43/255,43/255}, {79/255,153/255,68/255}, {35/255,105/255,235/255}, {233/255,208/255,69/255}, {109/255,50/255,163/255}, {222/255,126/255,39/255}, } local function boxing(inst) local pt = inst:GetPosition() local boxer = SpawnPrefab("slurper_pelt") boxer.Transform:SetPosition(pt.x, pt.y, pt.z) boxer.AnimState:SetBank("wilson") boxer.AnimState:SetBuild("wes") boxer.AnimState:OverrideSymbol("swap_hat", "hat_top", "swap_hat") boxer.AnimState:Show("HAT") boxer.AnimState:Show("HAT_HAIR") boxer.AnimState:Hide("HAIR_NOHAT") boxer.AnimState:Hide("HAIR") boxer.AnimState:Hide("ARM_carry") boxer.AnimState:Show("ARM_normal") boxer.Transform:SetFourFaced() boxer.AnimState:PlayAnimation("idle") boxer:RemoveComponent("stackable") boxer:RemoveComponent("tradable") boxer:RemoveComponent("inventoryitem") boxer:RemoveComponent("edible") boxer:RemoveComponent("deployable") MakeLargeBurnable(boxer) MakeLargePropagator(boxer) boxer:AddTag("boxer") boxer:AddComponent("trader") boxer.components.trader:SetAcceptTest(function(boxer, item) if GetPlayer().components.inventory:Has("goldnugget", 100) then if item.prefab == "goldnugget" then return true end end return false end ) boxer.components.trader.onaccept = function(boxer, giver, item) GetPlayer().components.inventory:ConsumeByName("goldnugget", 99) boxer.AnimState:PlayAnimation("give") local cricket = SpawnPrefab("slurper_pelt") cricket.Transform:SetPosition(pt.x+1.5, 0, pt.z+1.5) cricket.AnimState:SetBank("spider_queen") cricket.AnimState:SetBuild("spider_queen_build") cricket.AnimState:PlayAnimation("idle", true) cricket.Transform:SetFourFaced() cricket.entity:AddSoundEmitter() cricket.Transform:SetScale(0.3, 0.3, 0.3) cricket.colour_idx = math.random(#colours) cricket.AnimState:SetMultColour(colours[cricket.colour_idx][1],colours[cricket.colour_idx][2],colours[cricket.colour_idx][3],1) cricket.components.inventoryitem:ChangeImageName("spidereggsack") cricket:RemoveComponent("stackable") cricket:RemoveComponent("tradable") cricket:RemoveComponent("edible") cricket:RemoveComponent("burnable") cricket:RemoveComponent("propagator") cricket:RemoveComponent("deployable") local brain = require "brains/abigailbrain" cricket:SetBrain(brain) cricket:AddComponent("lootdropper") cricket.components.lootdropper:SetLoot({"silk"}) cricket:AddComponent("locomotor") cricket.components.locomotor.walkspeed = 5 cricket.components.locomotor.runspeed = 8 cricket:SetStateGraph("SGspiderqueen") cricket:AddComponent("follower") cricket.components.follower:SetLeader(GetPlayer()) cricket.health_num = math.random(100,300) cricket.damage_num = math.random(20,50) cricket:AddComponent("health") cricket.components.health:SetMaxHealth(cricket.health_num) cricket:AddComponent("trader") cricket.components.trader:SetAcceptTest(function(cricket, item) if item.prefab == "smallmeat" then return cricket.components.health:GetPercent() < 1 end return false end ) cricket.components.trader.onaccept = function(cricket, giver, item) cricket.components.health:DoDelta(300) end cricket:AddComponent("combat") cricket.components.combat:SetRetargetFunction(1, function(cricket) if not cricket.components.health:IsDead() then return FindEntity(cricket, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy:HasTag("cricket") or guy:HasTag("cricket0") end end ) end end ) cricket.components.combat:SetKeepTargetFunction(function(cricket, target) return target and target:IsValid() end ) cricket.components.combat:SetAttackPeriod(2) cricket.components.combat:SetRange(1, 2) cricket.components.combat:SetDefaultDamage(cricket.damage_num) cricket:AddTag("cricket") end boxer.components.inspectable.getstatus = function(boxer) if not boxer:HasTag("startgame") then if GetPlayer().components.inventory:Has("goldnugget", 100) then local target0 = FindEntity(boxer, 30, function(guy) return guy:HasTag("cricket") and guy.components.inventoryitem and not guy.components.inventoryitem:IsHeld() end ) if target0 then boxer:AddTag("startgame") boxer.AnimState:PlayAnimation("give") GetPlayer().components.playercontroller:Enable(false) TheCamera:SetTarget(target0) target0:RemoveComponent("inventoryitem") boxer.task = boxer:DoPeriodicTask(1, function(boxer) if target0.components.health:IsDead() then if boxer.task then boxer.task:Cancel() boxer.task = nil end GetPlayer().components.inventory:ConsumeByName("goldnugget", 100) TheCamera:SetTarget(GetPlayer()) GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") boxer.AnimState:PlayAnimation("idle_onemanband1_loop",true) boxer:DoTaskInTime(2, function() boxer.AnimState:PlayAnimation("idle") local target1 = FindEntity(boxer, 30, function(guy) return guy:HasTag("cricket0") end ) if target1 then target1:Remove() end boxer:RemoveTag("startgame") GetPlayer().components.playercontroller:Enable(true) end ) end end ) local cricket0 = SpawnPrefab("slurper_pelt") cricket0.Transform:SetPosition(pt.x+1.5, 0, pt.z+1.5) cricket0.AnimState:SetBank("spider_queen") cricket0.AnimState:SetBuild("spider_queen_build") cricket0.AnimState:PlayAnimation("idle", true) cricket0.Transform:SetFourFaced() cricket0.entity:AddSoundEmitter() cricket0.Transform:SetScale(0.3, 0.3, 0.3) cricket0:RemoveComponent("stackable") cricket0:RemoveComponent("tradable") cricket0:RemoveComponent("inventoryitem") cricket0:RemoveComponent("edible") cricket0:RemoveComponent("burnable") cricket0:RemoveComponent("propagator") cricket0:RemoveComponent("deployable") local brain = require "brains/abigailbrain" cricket0:SetBrain(brain) cricket0:AddComponent("lootdropper") cricket0.components.lootdropper:SetLoot({"silk"}) cricket0:AddComponent("locomotor") cricket0.components.locomotor.walkspeed = 5 cricket0.components.locomotor.runspeed = 8 cricket0:SetStateGraph("SGspiderqueen") cricket0:AddComponent("follower") cricket0.components.follower:SetLeader(boxer) cricket0:AddComponent("health") cricket0.components.health:SetMaxHealth(math.random(110,330)) cricket0:AddComponent("combat") cricket0.components.combat:SetRetargetFunction(1, function(cricket0) if not cricket0.components.health:IsDead() then return FindEntity(cricket0, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy:HasTag("cricket") end end ) end end ) cricket0.components.combat:SetKeepTargetFunction(function(cricket0, target) return target and target:IsValid() end ) cricket0.components.combat:SetAttackPeriod(2) cricket0.components.combat:SetRange(1, 2) cricket0.components.combat:SetDefaultDamage(math.random(22,55)) cricket0:ListenForEvent("death", function() boxer.AnimState:PlayAnimation("give") if boxer.task then boxer.task:Cancel() boxer.task = nil end for k = 1, 100 do local goldnugget = SpawnPrefab("goldnugget") GetPlayer().components.inventory:GiveItem(goldnugget) end boxer:RemoveTag("startgame") GetPlayer().components.playercontroller:Enable(true) TheCamera:SetTarget(GetPlayer()) target0:AddComponent("inventoryitem") target0.components.inventoryitem:ChangeImageName("spidereggsack") end ) cricket0:AddTag("cricket0") cricket0:AddTag("goodbye") end end end end local advert = SpawnPrefab("slurper_pelt") advert.Transform:SetPosition(pt.x-2, 0, pt.z-2) advert.AnimState:SetBank("barrel") advert.AnimState:SetBuild("monkey_barrel") advert.AnimState:PlayAnimation("idle", true) advert.Transform:SetScale(1.5, 1.5, 1.5) advert:RemoveComponent("stackable") advert:RemoveComponent("tradable") advert:RemoveComponent("inventoryitem") advert:RemoveComponent("edible") advert:RemoveComponent("deployable") MakeLargeBurnable(advert) MakeLargePropagator(advert) advert:AddTag("lightningrod") local light = advert.entity:AddLight() light:SetFalloff(1) light:SetIntensity(.8) light:SetRadius(10) light:SetColour(180/255, 195/255, 50/255) light:Enable(true) advert:DoPeriodicTask(6, function(advert) advert.AnimState:SetBloomEffectHandle("shaders/anim.ksh") advert:DoTaskInTime(3, function(advert) advert.AnimState:SetBloomEffectHandle("") end ) end ) advert:AddTag("goodbye") end local function OnDeploy (inst, pt) boxing(inst) inst.components.stackable:Get():Remove() end inst:AddComponent("deployable") inst.components.deployable.ondeploy = OnDeploy local function onsave(inst, data) if inst:HasTag("goodbye") then data.goodbye = true end if inst:HasTag("boxer") then data.boxer = true end if inst:HasTag("cricket") then data.cricket = true end data.colour_idx = inst.colour_idx data.health_num = inst.health_num data.damage_num = inst.damage_num end local function onload(inst, data) if data and data.goodbye then inst:Remove() end if data and data.boxer then boxing(inst) inst:Remove() end if data and data.cricket then inst.AnimState:SetBank("spider_queen") inst.AnimState:SetBuild("spider_queen_build") inst.AnimState:PlayAnimation("idle", true) inst.Transform:SetFourFaced() inst.entity:AddSoundEmitter() inst.Transform:SetScale(0.3, 0.3, 0.3) inst.colour_idx = math.random(#colours) inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) inst.components.inventoryitem:ChangeImageName("spidereggsack") inst:RemoveComponent("stackable") inst:RemoveComponent("tradable") inst:RemoveComponent("edible") inst:RemoveComponent("burnable") inst:RemoveComponent("propagator") inst:RemoveComponent("deployable") local brain = require "brains/abigailbrain" inst:SetBrain(brain) inst:AddComponent("lootdropper") inst.components.lootdropper:SetLoot({"silk"}) inst:AddComponent("locomotor") inst.components.locomotor.walkspeed = 5 inst.components.locomotor.runspeed = 8 inst:SetStateGraph("SGspiderqueen") inst:AddComponent("follower") inst.components.follower:SetLeader(GetPlayer()) inst.health_num = math.random(100,300) inst.damage_num = math.random(20,50) inst:AddComponent("health") inst.components.health:SetMaxHealth(inst.health_num) inst:AddComponent("trader") inst.components.trader:SetAcceptTest(function(inst, item) if item.prefab == "smallmeat" then return inst.components.health:GetPercent() < 1 end return false end ) inst.components.trader.onaccept = function(inst, giver, item) inst.components.health:DoDelta(300) end inst:AddComponent("combat") inst.components.combat:SetRetargetFunction(1, function(inst) if not inst.components.health:IsDead() then return FindEntity(inst, 20, function(guy) if guy.components.health and not guy.components.health:IsDead() then return guy:HasTag("cricket") or guy:HasTag("cricket0") end end ) end end ) inst.components.combat:SetKeepTargetFunction(function(inst, target) return target and target:IsValid() end ) inst.components.combat:SetAttackPeriod(2) inst.components.combat:SetRange(1, 2) inst.components.combat:SetDefaultDamage(inst.damage_num) inst:AddTag("cricket") end if data and data.colour_idx then inst.colour_idx = math.min(#colours, data.colour_idx) inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) end if data and data.health_num then inst.health_num = data.health_num inst.components.health:SetMaxHealth(inst.health_num) inst.components.health:DoDelta(inst.components.health.maxhealth) end if data and data.damage_num then inst.damage_num = data.damage_num inst.components.combat:SetDefaultDamage(inst.damage_num) end end inst.OnSave = onsave inst.OnLoad = onload 即可用啜食者皮种斗蜘蛛场(拿着1个啜食者皮对地面点鼠标右键,如果拿着多个啜食者皮,则不会种出来),给庄家100个黄金(拿着黄金对庄家点鼠标左键),可购买迷你蜘蛛,鼠标左键点蜘蛛,可将其放入物品栏,显示为蜘蛛卵的图标。如果想与庄家比赛,主角身上至少有100个黄金,将自己的一只蜘蛛放在庄家面前,鼠标左键点庄家,庄家会拿出另一只蜘蛛与你的蜘蛛PK。如果你赢了,将赢得100个黄金的奖金,如果输了就输掉100个黄金,并损失掉自己的蜘蛛。为防止作弊,比赛中主角操作将暂停,比赛结束后恢复。每只迷你蜘蛛的血量、攻击力都不同,如果你买到厉害的蜘蛛,一定要用心呵护,因为它就是你的摇钱树,给蜘蛛喂一块小肉(拿着小肉对蜘蛛点鼠标左键),可以为其补满血。你也可以多买几只蜘蛛,内部PK,挑选出好的品种,再与庄家对赌,会增大你的胜率。不想要斗蜘蛛场了,烧掉即可。啜食者皮可以打啜食者获得,也可在“巨型超市”中,花1-3个黄金购得

2025/04/23 · Bny

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