[分享]饥荒联机版,支持局域网联机。

YN230-五彩木箱(找东西直接看木箱颜色,木箱可搬动)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三0.五彩木箱(找东西直接看木箱颜色,木箱可搬动) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/treasurechest.lua文件,将下列内容: 5 6 inst.OnSave = onsave 7 inst.OnLoad = onload 8 9 替换为: 10 11local colours= 12{ 13 {198/255,43/255,43/255}, 14 {79/255,153/255,68/255}, 15 {35/255,105/255,235/255}, 16 {233/255,208/255,69/255}, 17 {109/255,50/255,163/255}, 18 {222/255,126/255,39/255}, 19} 20local function onequip(inst, owner) 21 owner.AnimState:OverrideSymbol("swap_body", "swap_backpack", "swap_body") 22end 23local function onunequip(inst, owner) 24 owner.AnimState:ClearOverrideSymbol("swap_body") 25end 26local function turnon(inst) 27 inst.components.machine.ison = true 28 if inst.prefab == "treasurechest" then 29 inst:AddComponent("inventoryitem") 30 end 31end 32local function turnoff(inst) 33 inst.components.machine.ison = false 34 if inst.prefab == "treasurechest" then 35 inst:RemoveComponent("inventoryitem") 36 end 37end 38local function onsave2(inst, data) 39 data.num = inst.balloon_num 40 data.colour_idx = inst.colour_idx 41end 42local function onload2(inst, data) 43 if data then 44 if data.num then 45 inst.balloon_num = data.num 46 inst.AnimState:OverrideSymbol("swap_balloon", "balloon_shapes", "balloon_" .. tostring(inst.balloon_num)) 47 end 48 if data.colour_idx then 49 inst.colour_idx = math.min(#colours, data.colour_idx) 50 inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) 51 end 52 end 53end 54 inst:AddComponent("machine") 55 inst.components.machine.turnonfn = turnon 56 inst.components.machine.turnofffn = turnoff 57 inst:AddComponent("equippable") 58 inst.components.equippable:SetOnEquip( onequip ) 59 inst.components.equippable:SetOnUnequip( onunequip ) 60 inst.colour_idx = math.random(#colours) 61 inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) 62 inst.OnSave = onsave2 63 inst.OnLoad = onload2 64 65 即可使木箱具备不同颜色,找东西直接看颜色,再也不用翻箱倒柜了。木箱可搬动,对地上的木箱按鼠标右键,可拿起木箱。将木箱放在地上后,对其按鼠标右键,可以锁定在地上

2025/04/23 · Bny

YN231-随笔涂鸦(用蓝魔杖为物品涂上色彩)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三一.随笔涂鸦(用蓝魔杖为物品涂上色彩) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/staff.lua文件,在local inst = commonfn("blue")的下一行插入以下内容: 5 6local function cancreatecolour(staff, caster, target, pos) 7 return true 8end 9local function createcolour(staff, target, pos) 10 local caster = staff.components.inventoryitem.owner 11 if caster.components.sanity then 12 caster.components.sanity:DoDelta(5) 13 end 14 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}, } 15 inst.colour_idx = math.random(#colours) 16 target.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1) 17end 18 inst:AddComponent("spellcaster") 19 inst.components.spellcaster:SetSpellFn(createcolour) 20 inst.components.spellcaster:SetSpellTestFn(cancreatecolour) 21 inst.components.spellcaster.canuseontargets = true 22 inst.components.spellcaster.canusefrominventory = false 23 24 即可用蓝魔杖右键点任何物品,为其涂上随机色彩,存档退出后消失。每涂鸦一次补脑5点。将你涂好的缤纷世界截下图片,给朋友秀秀吧

2025/04/23 · Bny

YN232-移动垃圾桶(狗箱增加删除物品按钮作垃圾桶)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三二.移动垃圾桶(狗箱增加删除物品按钮作垃圾桶) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/chester.lua文件,在inst:AddComponent("container")的下一行插入以下内容: 5 6local widgetbuttoninfo = { 7 text = "Delete", 8 position = Vector3(0, -195, 0), 9 fn = function(inst) 10 inst.components.container:DestroyContents() 11 inst.SoundEmitter:PlaySound("dontstarve/common/destroy_stone") 12 end } 13 inst.components.container.widgetbuttoninfo = widgetbuttoninfo 14 15 即可在切斯特狗箱的格子下方增加一个Delete按钮,将不想要的物品放入狗箱,按下Delete按钮即可清除掉,让游戏不会因垃圾太多而越来越卡。不按钮的话,照常可以储存物品。千万不要把骨眼放入狗箱清除掉哦

2025/04/23 · Bny

YN233-垃圾洞(用饥饿腰带种垃圾洞,不想要的物品可扔进去销毁,夜晚自燃,白天熄灭)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三三.垃圾洞(用饥饿腰带种垃圾洞,不想要的物品可扔进去销毁,夜晚自燃,白天熄灭) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/armor_slurper.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function wastehole(inst) 7 local pt = inst:GetPosition() 8 local wastehole = SpawnPrefab("armorslurper") 9 wastehole.Transform:SetPosition(pt.x, pt.y, pt.z) 10 wastehole.AnimState:SetBank("tentaclepillar") 11 wastehole.AnimState:SetBuild("tentacle_pillar") 12 wastehole.AnimState:PlayAnimation("idle_hole",true) 13 wastehole.Transform:SetScale(0.5, 0.5, 0.5) 14 wastehole.entity:AddSoundEmitter() 15 MakeObstaclePhysics(wastehole, .5) 16 wastehole:RemoveComponent("inventoryitem") 17 wastehole:RemoveComponent("equippable") 18 wastehole:RemoveComponent("fueled") 19 wastehole:RemoveComponent("deployable") 20 wastehole:RemoveTag("fur") 21 wastehole:RemoveTag("ruins") 22 local minimap = wastehole.entity:AddMiniMapEntity() 23 minimap:SetIcon( "firepit.png" ) 24 wastehole:AddComponent("burnable") 25 wastehole.components.burnable:SetFXLevel(5) 26 wastehole.components.burnable:AddBurnFX("character_fire", Vector3(0,1.5,0) ) 27 wastehole:ListenForEvent("onignite", function() 28 wastehole:AddComponent("heater") 29 wastehole.components.heater.heat = 50 30 end ) 31 wastehole:ListenForEvent("onextinguish", function() 32 wastehole.SoundEmitter:PlaySound("dontstarve/common/fireOut") 33 if wastehole.components.heater then wastehole:RemoveComponent("heater") end 34 end ) 35 wastehole:ListenForEvent( "daytime", function() wastehole.components.burnable:Extinguish() end , GetWorld()) 36 wastehole:ListenForEvent( "dusktime", function() wastehole.components.burnable:Ignite(true) end , GetWorld()) 37 wastehole:ListenForEvent( "nighttime", function() wastehole.components.burnable:Ignite(true) end , GetWorld()) 38 if GetClock():IsDay() then 39 wastehole.components.burnable:Extinguish() 40 else 41 wastehole.components.burnable:Ignite(true) 42 end 43 wastehole:AddComponent("workable") 44 wastehole.components.workable:SetWorkAction(ACTIONS.HAMMER) 45 wastehole.components.workable:SetWorkLeft(3) 46 wastehole.components.workable:SetOnFinishCallback(function(wastehole) 47 SpawnPrefab("collapse_big").Transform:SetPosition(wastehole.Transform:GetWorldPosition()) 48 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 49 wastehole:Remove() 50 end ) 51 local slotpos = { Vector3(0,-75,0)} 52 wastehole:AddComponent("container") 53 wastehole.components.container:SetNumSlots(#slotpos) 54 wastehole.components.container.widgetslotpos = slotpos 55 wastehole.components.container.widgetpos = Vector3(0,600,0) 56 wastehole.components.container.side_align_tip = 160 57 wastehole.components.container.itemtestfn = function(wastehole, item, slot) 58 if item.prefab == "teleportato_ring" or item.prefab == "teleportato_box" or item.prefab == "teleportato_crank" or item.prefab == "teleportato_potato" or item.prefab == "chester_eyebone" or item.prefab == "abigail_flower" or item.prefab == "lucy" or item.prefab == "balloons_empty" or item.prefab == "lighter" or item.prefab == "waxwelljournal" then 59 return false 60 end 61 return true 62 end 63 wastehole:DoPeriodicTask(0.25, function(wastehole) 64 if not wastehole.components.container:IsEmpty() then 65 wastehole.components.container:DestroyContents() 66 wastehole.SoundEmitter:PlaySound("dontstarve/common/destroy_stone") 67 local pt0 = wastehole:GetPosition() 68 SpawnPrefab("collapse_small").Transform:SetPosition(pt0.x, 1, pt0.z) 69 end 70 end ) 71 wastehole:AddTag("wastehole") 72end 73local function OnDeploy (inst, pt) 74 wastehole(inst) 75 inst:Remove() 76end 77 inst:AddComponent("deployable") 78 inst.components.deployable.ondeploy = OnDeploy 79local function onsave(inst, data) 80 if inst:HasTag("wastehole") then 81 data.wastehole = true 82 end 83end 84local function onload(inst, data) 85 if data and data.wastehole then 86 wastehole(inst) 87 inst:Remove() 88 end 89end 90 inst.OnSave = onsave 91 inst.OnLoad = onload 92 93 即可用饥饿腰带种垃圾洞,除重要物品外(如露西斧子等),任何不想要的物品都可以扔进去销毁(拿着物品对垃圾洞点鼠标左键),再也不用发愁垃圾越来越多了。垃圾洞里有沼气,在夜晚时会自燃,白天熄灭,可用于照明和取暖,但不能用来烤食物。垃圾洞在小地图上显示为石头营火的图标,不想要垃圾洞时,用锤子砸毁即可。饥饿腰带在魔法选项(画着红骷髅)下,用6个啜食者皮、2个绳子、2个噩梦燃料制造

2025/04/23 · Bny

YN234-生物传送机(探矿杖左键点生物,右键传送到任意地点)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三四.生物传送机(探矿杖左键点生物,右键传送到任意地点) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/diviningrod.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function onattack(inst, owner, target) 7 SpawnPrefab("lightning_rod_fx").Transform:SetPosition(target.Transform:GetWorldPosition()) 8 target:AddTag("send") 9end 10local function canteleport(inst) 11 return true 12end 13local function teleport(inst) 14 local player = GetPlayer() 15 local range = 3000 16 local pos = Vector3(player.Transform:GetWorldPosition()) 17 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range) 18 for k,v in pairs(ents) do 19 if v:HasTag("send") then 20 v.Transform:SetPosition(TheInput:GetWorldPosition():Get()) 21 v:RemoveTag("send") 22 end 23 end 24end 25 inst:AddComponent("spellcaster") 26 inst.components.spellcaster:SetSpellFn(teleport) 27 inst.components.spellcaster:SetSpellTestFn(canteleport) 28 inst.components.spellcaster.canusefrominventory = false 29 inst.components.spellcaster.canuseonpoint = true 30 inst:AddComponent("weapon") 31 inst.components.weapon:SetDamage(0) 32 inst.components.weapon:SetRange(30, 35) 33 inst.components.weapon:SetOnAttack(onattack) 34 inst.components.weapon:SetProjectile("bishop_charge") 35 36 即可在装备探矿杖时,用鼠标左键点生物(几个都可以),无论走到地图何处,装备探矿杖用鼠标右键点地面,都可将选中的生物传送过来。生物传送机可让群体性动物落单,让不会相遇的动物碰面,调离守护某处的敌人等。探矿杖在科学选项(画着原子)下,用1个树枝、4个噩梦燃料、1个齿轮制造

2025/04/23 · Bny

YN235-极速快递(拿着背包对地面点右键,将它传送回家)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三五.极速快递(拿着背包对地面点右键,将它传送回家) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/backpack.lua文件,将inst.components.inventoryitem.cangoincontainer = false替换为以下内容: 5 6 inst.components.inventoryitem.cangoincontainer = true 7local function OnDeploy (inst, pt) 8 SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) 9 local pos = Vector3(inst.Transform:GetWorldPosition()) 10 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 3000) 11 for k,v in pairs(ents) do 12 if v.prefab == "firepit" then 13 inst.Transform:SetPosition(v.Transform:GetWorldPosition()) 14 end 15 end 16end 17 inst:AddComponent("deployable") 18 inst.components.deployable.ondeploy = OnDeploy 19 inst:AddTag("fridge") 20 21 即可将拿不下的东西放在普通背包里,拿着背包对地面点鼠标右键,会自动传送到石头营火旁,再多的战利品都可以快递回家。背包同时具备冷藏功能,里面的食物可以长久保鲜。快递只在同一地层服务(不能从地下传送到地面),为保证快递投送准确,请在同一地层只保留一处石头营火(多处的话将随机投送)。如果之前修改过“同时携带多个背包”,就查找不到inst.components.inventoryitem.cangoincontainer = false这句,将inst.components.inventoryitem.cangoincontainer = true替换为下面的内容即可

2025/04/23 · Bny

YN236-帽子戏法(高礼帽放在地上随机变出几十种宝物)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三六.帽子戏法(高礼帽放在地上随机变出几十种宝物) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/hats.lua文件,在inst.components.fueled:InitializeFuelLevel(TUNING.TOPHAT_PERISHTIME)的下一行插入以下内容: 5 6local function ondropped(inst) 7 local names = 8{"bedroll_furry","gunpowder","panflute","onemanband","armor_sanity","nightsword","batbat","armorslurper","amulet","blueamulet","purpleamulet","firestaff","icestaff","telestaff","blowdart_sleep","blowdart_fire","blowdart_pipe","featherhat","cane","trunkvest_summer","trunkvest_winter","nightmare_timepiece","orangeamulet","yellowamulet","greenamulet","orangestaff","yellowstaff","greenstaff","ruinshat","armorruins","ruins_bat","eyeturret_item","trunk_summer","trunk_winter","deerclops_eyeball","gears","nightmarefuel","livinglog","marble","minotaurhorn","krampus_sack","butter","tallbirdegg","honeyham","dragonpie","taffy","mandrakesoup","perogies","waffles","turkeydinner","honeynuggets","wormlight","beefalo","perd","koalefant_summer","koalefant_winter","lureplantbulb","slurtlehat","armorsnurtleshell","bonestew","butterflymuffin","frogglebunwich","pumpkincookie","baconeggs","fruitmedley","fishtacos","fishsticks","stuffedeggplant","meatballs","jammypreserves","bandage","healingsalve","spider_warrior","tentacle","monkey","killerbee","worm"} 9 inst.name = names[math.random(#names)] 10 SpawnPrefab(inst.name).Transform:SetPosition(inst.Transform:GetWorldPosition()) 11 SpawnPrefab("collapse_small").Transform:SetPosition(inst.Transform:GetWorldPosition()) 12end 13 inst:ListenForEvent("ondropped", ondropped) 14 15 即可将高礼帽放在地上,随机变出几十种宝物,也有一定几率变出怪物哦,试试你的手气吧。高礼帽在穿戴选项(画着帽子)下,用6个蛛丝制造

2025/04/23 · Bny

YN237-节日礼花(点燃荧光果放礼花)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三七.节日礼花(点燃荧光果放礼花) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/lightbulb.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容: 5 6local function OnIgniteFn(inst) 7 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/blackpowder_explo") 8 inst:DoTaskInTime(1.5, function() inst.Physics:SetMotorVelOverride(0,42,0) end) 9end 10local function OnExplodeFn(inst) 11 GetPlayer().components.sanity:DoDelta(5) 12 inst:StartThread(function() 13 for k = 1,3 do 14 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 15 TheCamera:Shake("FULL", 0.3, 0.02, .5, 40) 16 Sleep(.1) 17 end 18 end) 19end 20 inst:AddComponent("explosive") 21 inst.components.explosive:SetOnExplodeFn(OnExplodeFn) 22 inst.components.explosive:SetOnIgniteFn(OnIgniteFn) 23 24 即可用火炬点燃放在地上的荧光果,荧光果会飞上天空爆炸,每放一颗补5点脑,为你的节日增加一点气氛吧。在地洞里放礼花可以引起地震。如果想连续燃放,就将荧光果摆成一排(距离要近一些),点燃一个,其他就会陆续被点燃

2025/04/23 · Bny

YN238-璀璨流星雨(给远古盔甲10个黄金或荧光果,为你下场流星雨)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三八.璀璨流星雨(给远古盔甲10个黄金或荧光果,为你下场流星雨) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/armor_ruins.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function ShouldAcceptItem(inst, item) 7 if GetPlayer().components.inventory:Has("goldnugget", 10) then 8 if item.prefab == "goldnugget" then 9 return true 10 end 11 end 12 if GetPlayer().components.inventory:Has("lightbulb", 10) then 13 if item.prefab == "lightbulb" then 14 return true 15 end 16 end 17 return false 18end 19local function OnGetItemFromPlayer(inst, giver, item) 20 if item.prefab == "goldnugget" then 21 giver.components.inventory:ConsumeByName("goldnugget", 9) 22 elseif item.prefab == "lightbulb" then 23 giver.components.inventory:ConsumeByName("lightbulb", 9) 24 end 25 local bullet = SpawnPrefab("trinket_5") 26 bullet.Transform:SetPosition(inst.Transform:GetWorldPosition()) 27 bullet.components.inventoryitem.canbepickedup = false 28 bullet.Physics:SetMotorVelOverride(0,20,0) 29 giver.components.sanity:DoDelta(10) 30 GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo") 31 inst:DoTaskInTime(1, function() bullet:Remove() end ) 32 inst:DoTaskInTime(1.5, function() 33 inst:StartThread(function() 34 for k = 1, 200 do 35 local pt = Vector3(GetPlayer().Transform:GetWorldPosition()) 36 local rain = SpawnPrefab("lightbulb") 37 rain:RemoveComponent("edible") 38 rain.components.inventoryitem.canbepickedup = false 39 if item.prefab == "goldnugget" then 40 rain.AnimState:SetMultColour(math.random(255)/255,math.random(255)/255,math.random(255)/255,1) 41 end 42 rain.Transform:SetPosition(pt.x+(math.random(30)-math.random(30)), 20, pt.z+(math.random(30)-math.random(30))) 43 inst:DoTaskInTime(5, function() 44 local pt2 = rain:GetPosition() 45 SpawnPrefab("explode_small").Transform:SetPosition(pt2.x, 0, pt2.z) 46 rain:Remove() 47 end) 48 Sleep(0.2) 49 end 50 end) 51 end) 52end 53 inst:AddComponent("trader") 54 inst.components.trader.onaccept = OnGetItemFromPlayer 55 inst.components.trader:SetAcceptTest(ShouldAcceptItem) 56 57 即可拿着黄金或荧光果,对放在地上的远古盔甲点鼠标左键,将向空中发射火箭,打下漫天的流星雨。每次发射消耗10个黄金或荧光果,身上数量不足时无法发射。如果给远古盔甲的是黄金,则下彩色流星雨,如果给的是荧光果则下白色流星雨。可以连续发射,但不要连续次数太多,除非你的计算机硬件足够坚强。每场流星雨可补脑10点。另外穿着远古盔甲,拿黄金或荧光果对装备格点鼠标右键,同样可以发射。远古盔甲在远古选项(画着远古祭坛)下,用6个铥矿石、4个噩梦燃料制造,制造时需要靠近远古祭坛

2025/04/23 · Bny

YN239-高尔夫球(用蜗牛壳碎片种高尔夫球,锤子作球杆,将球打进兔子洞吧)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二三九.高尔夫球(用蜗牛壳碎片种高尔夫球,锤子作球杆,将球打进兔子洞吧) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/slurtle_shellpieces.lua文件,在inst:AddComponent("inventoryitem")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local golf = SpawnPrefab("slurtle_shellpieces") 8 golf.Transform:SetPosition(pt.x, pt.y, pt.z) 9 golf.AnimState:SetBank("bulb") 10 golf.AnimState:SetBuild("bulb") 11 golf.AnimState:PlayAnimation("idle") 12 golf.Transform:SetScale(0.8, 0.8, 0.8) 13 golf.components.inventoryitem.canbepickedup = false 14 MakeSmallBurnable(golf) 15 golf:AddComponent("perishable") 16 golf.components.perishable:SetPerishTime(TUNING.PERISH_ONE_DAY) 17 golf.components.perishable:StartPerishing() 18 golf.components.perishable.onperishreplacement = "ash" 19 golf:AddComponent("workable") 20 golf.components.workable:SetWorkAction(ACTIONS.HAMMER) 21 golf.components.workable:SetWorkLeft(10) 22 golf.components.workable:SetOnFinishCallback(function(golf) 23 SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(golf.Transform:GetWorldPosition()) 24 golf:Remove() 25 end ) 26 golf.components.workable:SetOnWorkCallback(function(golf) 27 local pt2 = Vector3(golf.Transform:GetWorldPosition()) 28 local pos = Vector3(GetPlayer().Transform:GetWorldPosition()) 29 golf.Physics:SetMotorVelOverride((pt2.x-pos.x)*13,0,(pt2.z-pos.z)*13) 30 golf:DoTaskInTime(0.2, function() golf.Physics:ClearMotorVelOverride() end ) 31 GetPlayer().components.sanity:DoDelta(5) 32 end ) 33 golf:DoPeriodicTask(.05, function(golf) 34 local pos2 = Vector3(golf.Transform:GetWorldPosition()) 35 local ents = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 0.5) 36 for k,v in pairs(ents) do 37 if v.prefab == "rabbithole" then 38 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/use_axe_tree") 39 golf:Remove() 40 GetPlayer().components.sanity:DoDelta(50) 41 end 42 end 43 end ) 44 golf:AddTag("golfs") 45 inst.components.stackable:Get():Remove() 46end 47 inst:AddComponent("deployable") 48 inst.components.deployable.ondeploy = OnDeploy 49local function onsave(inst, data) 50 if inst:HasTag("golfs") then 51 data.golfs = true 52 end 53end 54local function onload(inst, data) 55 if data and data.golfs then 56 inst.AnimState:SetBank("bulb") 57 inst.AnimState:SetBuild("bulb") 58 inst.AnimState:PlayAnimation("idle") 59 inst.Transform:SetScale(0.8, 0.8, 0.8) 60 inst.components.inventoryitem.canbepickedup = false 61 MakeSmallBurnable(inst) 62 inst:AddComponent("perishable") 63 inst.components.perishable:SetPerishTime(TUNING.PERISH_ONE_DAY) 64 inst.components.perishable:StartPerishing() 65 inst.components.perishable.onperishreplacement = "ash" 66 inst:AddComponent("workable") 67 inst.components.workable:SetWorkAction(ACTIONS.HAMMER) 68 inst.components.workable:SetWorkLeft(10) 69 inst.components.workable:SetOnFinishCallback(function(inst) 70 SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition()) 71 inst:Remove() 72 end ) 73 inst.components.workable:SetOnWorkCallback(function(inst) 74 local pt2 = Vector3(inst.Transform:GetWorldPosition()) 75 local pos = Vector3(GetPlayer().Transform:GetWorldPosition()) 76 inst.Physics:SetMotorVelOverride((pt2.x-pos.x)*13,0,(pt2.z-pos.z)*13) 77 inst:DoTaskInTime(0.2, function() inst.Physics:ClearMotorVelOverride() end ) 78 GetPlayer().components.sanity:DoDelta(5) 79 end ) 80 inst:DoPeriodicTask(.05, function(inst) 81 local pos2 = Vector3(inst.Transform:GetWorldPosition()) 82 local ents = TheSim:FindEntities(pos2.x,pos2.y,pos2.z, 0.5) 83 for k,v in pairs(ents) do 84 if v.prefab == "rabbithole" then 85 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/use_axe_tree") 86 inst:Remove() 87 GetPlayer().components.sanity:DoDelta(50) 88 end 89 end 90 end ) 91 inst:AddTag("golfs") 92 end 93end 94 inst.OnSave = onsave 95 inst.OnLoad = onload 96 97 即可用蜗牛壳碎片种高尔夫球(请种在兔子洞附近),装备锤子对高尔夫球按一下鼠标右键(注意不要按住不放)可以击球。主角站得离球越近,击球的力量越小;站得越远,击球的力量越大。每次挥杆奖励5点脑,将球打入兔子洞奖励50点脑(进洞的球会被兔子拿走,再玩请重新种球)。球能准确入洞的诀窍在于,人、球、洞三点成一线。每个高尔夫球可以击打10次,如果10杆都没有进洞,说明你的技术太烂了,再种一个球重来吧。不想要高尔夫球时,烧掉即可,不会引燃周边物品,如果球打得太远找不到了,1天后会自动降解为灰烬,不会污染环境。蜗牛壳碎片可以通过打蜗牛龟和蜗牛窝得到,如果你同时修改了“巨型超市”,也可以花1-2个黄金购得

2025/04/23 · Bny