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

YN260-奶报箱(用苔藓种奶报箱,放入黄金,每天清晨送来报纸和5瓶牛奶,读报纸可补脑)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六0.奶报箱(用苔藓种奶报箱,放入黄金,每天清晨送来报纸和5瓶牛奶,读报纸可补脑) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/cutlichen.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function itemtest(inst, item, slot) 7 if item.prefab == "goldnugget" or item.prefab == "goatmilk" or item.prefab == "cutlichen" then 8 return true 9 end 10 return false 11end 12local slotpos = { Vector3(0,32+4,0), Vector3(0,-(32+4),0), Vector3(0,-(64+32+8+4),0)} 13local widgetbuttoninfo = { 14 text = "Buy", 15 position = Vector3(0, 95, 0), 16 fn = function(inst) 17 if inst:HasTag("milkcartons") and inst.components.container:Has("goldnugget", 1) then 18 inst.components.container:ConsumeByName("goldnugget", 1) 19 GetPlayer().SoundEmitter:PlaySound("dontstarve/HUD/research_available") 20 local newspaper = SpawnPrefab("cutlichen") 21 newspaper.AnimState:SetBank("blueprint") 22 newspaper.AnimState:SetBuild("blueprint") 23 newspaper.AnimState:PlayAnimation("idle") 24 newspaper.components.inventoryitem:ChangeImageName("blueprint") 25 newspaper.Transform:SetScale(1.2, 1.2, 1.2) 26 newspaper:AddComponent("named") 27 newspaper.components.named:SetName("Newspaper") 28 newspaper:RemoveComponent("stackable") 29 newspaper:RemoveComponent("edible") 30 newspaper:RemoveComponent("perishable") 31 newspaper:RemoveComponent("container") 32 newspaper:RemoveComponent("deployable") 33 newspaper.components.inspectable.getstatus = function(newspaper) 34 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing") 35 GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max) 36 newspaper:Remove() 37 end 38 newspaper:AddTag("newspapers") 39 GetPlayer().components.inventory:GiveItem(newspaper) 40 end 41 end } 42local function OnDeploy (inst, pt) 43 local milkcarton = SpawnPrefab("cutlichen") 44 milkcarton.Transform:SetPosition(pt.x, pt.y, pt.z) 45 milkcarton.AnimState:SetBank("icebox") 46 milkcarton.AnimState:SetBuild("ice_box") 47 milkcarton.AnimState:PlayAnimation("closed") 48 milkcarton.Transform:SetScale(0.6, 0.6, 0.6) 49 milkcarton.AnimState:SetMultColour(0/255,185/255,255/255,1) 50 milkcarton:AddComponent("named") 51 milkcarton.components.named:SetName("Milk carton") 52 milkcarton:RemoveComponent("stackable") 53 milkcarton:RemoveComponent("inventoryitem") 54 milkcarton:RemoveComponent("edible") 55 milkcarton:RemoveComponent("perishable") 56 milkcarton:RemoveComponent("deployable") 57 milkcarton.components.container.canbeopened = true 58 milkcarton:AddComponent("workable") 59 milkcarton.components.workable:SetWorkAction(ACTIONS.HAMMER) 60 milkcarton.components.workable:SetWorkLeft(3) 61 milkcarton.components.workable:SetOnFinishCallback(function(milkcarton) 62 SpawnPrefab("collapse_big").Transform:SetPosition(milkcarton.Transform:GetWorldPosition()) 63 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 64 milkcarton:Remove() 65 end ) 66 milkcarton:ListenForEvent( "daytime", function() 67 if milkcarton.components.container:Has("goldnugget", 5) then 68 milkcarton.components.container:ConsumeByName("goldnugget", 5) 69 for k = 1, 5 do 70 local goatmilk = SpawnPrefab("goatmilk") 71 milkcarton.components.container:GiveItem(goatmilk) 72 end 73 local newspaper = SpawnPrefab("cutlichen") 74 newspaper.AnimState:SetBank("blueprint") 75 newspaper.AnimState:SetBuild("blueprint") 76 newspaper.AnimState:PlayAnimation("idle") 77 newspaper.components.inventoryitem:ChangeImageName("blueprint") 78 newspaper.Transform:SetScale(1.2, 1.2, 1.2) 79 newspaper:AddComponent("named") 80 newspaper.components.named:SetName("Newspaper") 81 newspaper:RemoveComponent("stackable") 82 newspaper:RemoveComponent("edible") 83 newspaper:RemoveComponent("perishable") 84 newspaper:RemoveComponent("container") 85 newspaper:RemoveComponent("deployable") 86 newspaper.components.inspectable.getstatus = function(newspaper) 87 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing") 88 GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max) 89 newspaper:Remove() 90 end 91 newspaper:AddTag("newspapers") 92 milkcarton.components.container:GiveItem(newspaper) 93 end 94 end, GetWorld()) 95 milkcarton:AddTag("milkcartons") 96 inst.components.stackable:Get():Remove() 97end 98 inst:AddComponent("deployable") 99 inst.components.deployable.ondeploy = OnDeploy 100 inst.components.deployable.min_spacing = 1 101 inst:AddComponent("container") 102 inst.components.container.widgetbuttoninfo = widgetbuttoninfo 103 inst.components.container:SetNumSlots(#slotpos) 104 inst.components.container.widgetslotpos = slotpos 105 inst.components.container.widgetpos = Vector3(0,150,0) 106 inst.components.container.side_align_tip = 160 107 inst.components.container.canbeopened = false 108 inst.components.container.onopenfn = function(inst) inst.AnimState:PlayAnimation("open") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end 109 inst.components.container.onclosefn = function(inst) inst.AnimState:PlayAnimation("close") GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") end 110 inst.components.container.itemtestfn = itemtest 111 inst:AddTag("fridge") 112local function onsave(inst, data) 113 if inst:HasTag("milkcartons") then 114 data.milkcartons = true 115 end 116 if inst:HasTag("newspapers") then 117 data.newspapers = true 118 end 119end 120local function onload(inst, data) 121 if data and data.milkcartons then 122 inst.AnimState:SetBank("icebox") 123 inst.AnimState:SetBuild("ice_box") 124 inst.AnimState:PlayAnimation("closed") 125 inst.Transform:SetScale(0.6, 0.6, 0.6) 126 inst.AnimState:SetMultColour(0/255,185/255,255/255,1) 127 inst:AddComponent("named") 128 inst.components.named:SetName("Milk carton") 129 inst:RemoveComponent("stackable") 130 inst:RemoveComponent("inventoryitem") 131 inst:RemoveComponent("edible") 132 inst:RemoveComponent("perishable") 133 inst:RemoveComponent("deployable") 134 inst.components.container.canbeopened = true 135 inst:AddComponent("workable") 136 inst.components.workable:SetWorkAction(ACTIONS.HAMMER) 137 inst.components.workable:SetWorkLeft(3) 138 inst.components.workable:SetOnFinishCallback(function(inst) 139 SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) 140 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 141 inst:Remove() 142 end ) 143 inst:ListenForEvent( "daytime", function() 144 if inst.components.container:Has("goldnugget", 5) then 145 inst.components.container:ConsumeByName("goldnugget", 5) 146 for k = 1, 5 do 147 local goatmilk = SpawnPrefab("goatmilk") 148 inst.components.container:GiveItem(goatmilk) 149 end 150 local newspaper = SpawnPrefab("cutlichen") 151 newspaper.AnimState:SetBank("blueprint") 152 newspaper.AnimState:SetBuild("blueprint") 153 newspaper.AnimState:PlayAnimation("idle") 154 newspaper.components.inventoryitem:ChangeImageName("blueprint") 155 newspaper.Transform:SetScale(1.2, 1.2, 1.2) 156 newspaper:AddComponent("named") 157 newspaper.components.named:SetName("Newspaper") 158 newspaper:RemoveComponent("stackable") 159 newspaper:RemoveComponent("edible") 160 newspaper:RemoveComponent("perishable") 161 newspaper:RemoveComponent("container") 162 newspaper:RemoveComponent("deployable") 163 newspaper.components.inspectable.getstatus = function(newspaper) 164 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing") 165 GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max) 166 newspaper:Remove() 167 end 168 newspaper:AddTag("newspapers") 169 inst.components.container:GiveItem(newspaper) 170 end 171 end, GetWorld()) 172 inst:AddTag("milkcartons") 173 end 174 if data and data.newspapers then 175 inst.AnimState:SetBank("blueprint") 176 inst.AnimState:SetBuild("blueprint") 177 inst.AnimState:PlayAnimation("idle") 178 inst.components.inventoryitem:ChangeImageName("blueprint") 179 inst.Transform:SetScale(1.2, 1.2, 1.2) 180 inst:AddComponent("named") 181 inst.components.named:SetName("Newspaper") 182 inst:RemoveComponent("stackable") 183 inst:RemoveComponent("edible") 184 inst:RemoveComponent("perishable") 185 inst:RemoveComponent("container") 186 inst:RemoveComponent("deployable") 187 inst.components.inspectable.getstatus = function(inst) 188 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_clothing") 189 GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max) 190 inst:Remove() 191 end 192 inst:AddTag("newspapers") 193 end 194end 195 inst.OnSave = onsave 196 inst.OnLoad = onload 197 198 即可用苔藓种奶报箱,鼠标左键点奶报箱可打开格子,在格子中放入黄金(订奶预付款,最少5个黄金),第二天清晨将送来5瓶牛奶,并免费赠送一份报纸,同时扣除5个黄金。将报纸放入物品栏,对其点鼠标右键可读报,将补满脑值。如果格子中有黄金,点格子上方的“Buy”按钮,可以额外购买报纸,每份1个黄金。如果每天想多订牛奶和报纸,就多种几个奶报箱吧。不想要奶报箱了,用锤子砸毁即可。苔藓可在洞穴中采到。不要与“用苔藓种苔藓(苔藓可移植)”一同修改

2025/04/23 · Bny

YN261-智能路灯(用蓝色护身符种智能路灯,夜晚自动点亮,白天熄灭,可手动开关、防雷击)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六一.智能路灯(用蓝色护身符种智能路灯,夜晚自动点亮,白天熄灭,可手动开关、防雷击) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/amulet.lua文件,在inst.AnimState:PlayAnimation("blueamulet")的下一行插入以下内容: 5 6local function makestreetlight(inst) 7 local pt = inst:GetPosition() 8 local streetlight = SpawnPrefab("blueamulet") 9 streetlight.Transform:SetPosition(pt.x, pt.y, pt.z) 10 streetlight.AnimState:SetBank("nightstick") 11 streetlight.AnimState:SetBuild("nightstick") 12 streetlight.AnimState:PlayAnimation("idle") 13 streetlight.Transform:SetScale(1.5, 1.5, 1.5) 14 streetlight.AnimState:SetMultColour(255/255,255/255,0/255,1) 15 MakeObstaclePhysics(streetlight, .5 ) 16 streetlight:RemoveComponent("equippable") 17 streetlight:RemoveComponent("inventoryitem") 18 streetlight:RemoveComponent("heater") 19 streetlight:RemoveComponent("fueled") 20 streetlight:RemoveComponent("deployable") 21 streetlight:AddComponent("named") 22 streetlight.components.named:SetName("Street Light") 23 streetlight:AddComponent("workable") 24 streetlight.components.workable:SetWorkAction(ACTIONS.HAMMER) 25 streetlight.components.workable:SetWorkLeft(3) 26 streetlight.components.workable:SetOnFinishCallback(function(streetlight, worker) 27 SpawnPrefab("collapse_big").Transform:SetPosition(streetlight.Transform:GetWorldPosition()) 28 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 29 local pos = Vector3(streetlight.Transform:GetWorldPosition()) 30 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2) 31 for k,v in pairs(ents) do 32 if v:HasTag("bulbs") then 33 v:Remove() 34 end 35 end 36 streetlight:Remove() 37 end ) 38 streetlight:AddTag("streetlights") 39 local bulb = SpawnPrefab("blueamulet") 40 bulb.AnimState:SetBank("bulb") 41 bulb.AnimState:SetBuild("bulb") 42 bulb.AnimState:PlayAnimation("idle") 43 bulb.Transform:SetScale(1.6, 1.6, 1.6) 44 bulb.Physics:SetActive(false) 45 bulb:RemoveComponent("equippable") 46 bulb:RemoveComponent("inventoryitem") 47 bulb:RemoveComponent("heater") 48 bulb:RemoveComponent("fueled") 49 bulb:RemoveComponent("deployable") 50 bulb.persists = false 51 bulb:AddComponent("named") 52 bulb.components.named:SetName("Street Light") 53 bulb.entity:AddSoundEmitter() 54 local light = bulb.entity:AddLight() 55 light:SetFalloff(1) 56 light:SetIntensity(.8) 57 light:SetRadius(10) 58 light:SetColour(255/255,255/255,255/255) 59 light:Enable(false) 60 local follower = bulb.entity:AddFollower() 61 follower:FollowSymbol( streetlight.GUID, "swap_object", 15, -160, 0.1 ) 62 bulb:AddComponent("machine") 63 bulb.components.machine.turnonfn = function() 64 bulb.SoundEmitter:PlaySound("dontstarve/wilson/lantern_on") 65 bulb.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 66 bulb.Light:Enable(true) 67 end 68 bulb.components.machine.turnofffn = function() 69 bulb.SoundEmitter:PlaySound("dontstarve/wilson/lantern_off") 70 bulb.AnimState:SetBloomEffectHandle( "" ) 71 bulb.Light:Enable(false) 72 end 73 bulb:ListenForEvent( "daytime", function() bulb.components.machine:TurnOff() end , GetWorld() ) 74 bulb:ListenForEvent( "dusktime", function() bulb.components.machine:TurnOn() end , GetWorld() ) 75 bulb:AddTag("lightningrod") 76 bulb:AddTag("bulbs") 77 if not GetClock():IsDay() then 78 bulb.components.machine:TurnOn() 79 else 80 bulb.components.machine:TurnOff() 81 end 82end 83local function OnDeploy (inst, pt) 84 makestreetlight(inst) 85 inst:Remove() 86end 87 inst:AddComponent("deployable") 88 inst.components.deployable.ondeploy = OnDeploy 89local function onsave(inst, data) 90 if inst:HasTag("streetlights") then 91 data.streetlights = true 92 end 93end 94local function onload(inst, data) 95 if data and data.streetlights then 96 makestreetlight(inst) 97 inst:Remove() 98 end 99end 100 inst.OnSave = onsave 101 inst.OnLoad = onload 102 103 即可用蓝色护身符种智能路灯,夜晚自动点亮,白天自动熄灭。鼠标右键点灯泡,可手动开关。智能路灯靠太阳能和闪电做能源,无须手动充能,靠近可防雷击。不想要智能路灯了,用锤子砸掉即可。蓝色护身符在魔法选项(画着红骷髅)下,用3个黄金、1个蓝宝石制造

2025/04/23 · Bny

YN262-传送石(右键点装备的保温石,将主角传送到另一块保温石处)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六二.传送石(右键点装备的保温石,将主角传送到另一块保温石处) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/heatrock.lua文件,在inst:AddComponent("inspectable")下一行插入以下内容: 5 6local function canteleport(inst, caster) 7 return true 8end 9local function teleport(inst) 10 local caster = inst.components.inventoryitem.owner 11 local range = 3000 12 local pos = Vector3(caster.Transform:GetWorldPosition()) 13 local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range) 14 for k,v in pairs(ents) do 15 if v.prefab == "heatrock" and not v.components.inventoryitem:IsHeld() then 16 caster.Transform:SetPosition(v.Transform:GetWorldPosition()) 17 end 18 end 19 return true 20end 21 inst:AddComponent("spellcaster") 22 inst.components.spellcaster:SetSpellFn(teleport) 23 inst.components.spellcaster:SetSpellTestFn(canteleport) 24 inst.components.spellcaster.canusefrominventory = false 25 inst.components.spellcaster.canuseonpoint = true 26 inst:AddComponent("equippable") 27 inst.components.equippable.equipslot = EQUIPSLOTS.HANDS 28 29 即可制造2块保温石,1块扔在要传到的地点(比如家、洞穴出口处等),另1块带在身上,无论走到地图何处,只要装备保温石对空地按鼠标右键,马上传送回扔在地上的保温石处。如果制造3块保温石,将2块扔在不同地点,这2点间将形成虫洞效果,装备保温石对空地按鼠标右键,会在这2点间来回传送

2025/04/23 · Bny

YN263-御风飞翔(装备羽毛飞翔10秒)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六三.御风飞翔(装备羽毛飞翔10秒) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/feathers.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6local function onequip(inst, owner) 7 inst.fire = SpawnPrefab( "feather_"..name ) 8 inst.fire.Physics:SetActive(false) 9 local follower = inst.fire.entity:AddFollower() 10 follower:FollowSymbol( inst.GUID, "swap_object", 0, 60, 0 ) 11 local pt = owner:GetPosition() 12 owner.Transform:SetPosition(pt.x, pt.y+30, pt.z) 13 inst:DoTaskInTime(10, function() 14 local pt = owner:GetPosition() 15 owner.Transform:SetPosition(pt.x, pt.y-30, pt.z) 16 inst:Remove() 17 end) 18end 19local function onunequip(inst, owner) 20 local pt = owner:GetPosition() 21 owner.Transform:SetPosition(pt.x, pt.y-30, pt.z) 22 inst.fire:Remove() 23 inst.fire = nil 24end 25 inst:AddComponent("equippable") 26 inst.components.equippable:SetOnEquip( onequip ) 27 inst.components.equippable:SetOnUnequip( onunequip ) 28 inst.components.equippable.equipslot = EQUIPSLOTS.HEAD 29 inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*5 30 31 即可装备羽毛飞翔10秒,体会饥荒世界从未有过的美妙感觉,洞穴也可飞行。10秒后羽毛被耗尽,想飞就要多捕鸟哦。注意飞行时不要佩戴橙色护身符和带宠物

2025/04/23 · Bny

YN264-风力滑板车(饥荒世界陆上交通工具)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六四.风力滑板车(饥荒世界陆上交通工具) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/umbrella.lua文件, 5 6 1.将下列内容: 7 8local function onequip(inst, owner) 9 owner.AnimState:OverrideSymbol("swap_object", "swap_umbrella", "swap_umbrella") 10 owner.AnimState:Show("ARM_carry") 11 owner.AnimState:Hide("ARM_normal") 12 UpdateSound(inst) 13 14 owner.DynamicShadow:SetSize(2.2, 1.4) 15 16 inst.components.fueled:StartConsuming() 17end 18 19local function onunequip(inst, owner) 20 owner.AnimState:Hide("ARM_carry") 21 owner.AnimState:Show("ARM_normal") 22 UpdateSound(inst) 23 24 owner.DynamicShadow:SetSize(1.3, 0.6) 25 26 inst.components.fueled:StopConsuming() 27end 28 29 替换为: 30 31local function onequip(inst, owner) 32 owner.AnimState:OverrideSymbol("swap_object", "swap_umbrella", "swap_umbrella") 33 owner.AnimState:Show("ARM_carry") 34 owner.AnimState:Hide("ARM_normal") 35 UpdateSound(inst) 36 inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,0,0) end) 37 inst.fire = SpawnPrefab( "telebase" ) 38 inst.fire.Physics:SetActive(false) 39 local follower = inst.fire.entity:AddFollower() 40 follower:FollowSymbol( owner.GUID, "swap_object", -90, 130, 0 ) 41end 42local function onunequip(inst, owner) 43 owner.AnimState:Hide("ARM_carry") 44 owner.AnimState:Show("ARM_normal") 45 UpdateSound(inst) 46 if inst.task then inst.task:Cancel() inst.task = nil end 47 inst.fire:Remove() 48 inst.fire = nil 49end 50 51 52 2.在inst.components.fueled:SetDepletedFn(onperish)的下一行插入inst:AddComponent("blinkstaff") 53 54 即可在装备雨伞时,脚下踩着滑板自动行驶,伞就是你的风帆,卸载雨伞后停下。鼠标左键点地可以控制方向(也可以用键盘W、S、A、D键控制方向),鼠标右键点地可以瞬移(用以跳过障碍),有空儿去兜兜风吧。雨伞在生存选项(画着绳套)下,用6个树枝、1个猪皮、2个蛛丝制造

2025/04/23 · Bny

YN265-动力飞行帽(戴羽毛帽在天空自由飞翔)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六五.动力飞行帽(戴羽毛帽在天空自由飞翔) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/hats.lua文件,将下列内容: 5 6 local function feather_equip(inst, owner) 7 onequip(inst, owner) 8 local ground = GetWorld() 9 if ground and ground.components.birdspawner then 10 ground.components.birdspawner:SetSpawnTimes(TUNING.BIRD_SPAWN_DELAY_FEATHERHAT) 11 ground.components.birdspawner:SetMaxBirds(TUNING.BIRD_SPAWN_MAX_FEATHERHAT) 12 end 13 end 14 local function feather_unequip(inst, owner) 15 onunequip(inst, owner) 16 local ground = GetWorld() 17 if ground and ground.components.birdspawner then 18 ground.components.birdspawner:SetSpawnTimes(TUNING.BIRD_SPAWN_DELAY) 19 ground.components.birdspawner:SetMaxBirds(TUNING.BIRD_SPAWN_MAX) 20 end 21 end 22 local function feather() 23 local inst = simple() 24 25 inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL 26 27 inst.components.equippable:SetOnEquip( feather_equip ) 28 inst.components.equippable:SetOnUnequip( feather_unequip ) 29 30 inst:AddComponent("fueled") 31 inst.components.fueled.fueltype = "USAGE" 32 inst.components.fueled:InitializeFuelLevel(TUNING.FEATHERHAT_PERISHTIME) 33 inst.components.fueled:SetDepletedFn(generic_perish) 34 35 替换为: 36 37local function feather_equip(inst, owner) 38 onequip(inst, owner) 39 local shadow = GetPlayer().entity:AddDynamicShadow() 40 shadow:SetSize( 0, 0 ) 41 inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,10,0) end ) 42 inst:DoTaskInTime(3, function() 43 if inst.task then inst.task:Cancel() inst.task = nil end 44 inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,1,0) end) 45 end ) 46end 47local function feather_unequip(inst, owner) 48 if inst.task then inst.task:Cancel() inst.task = nil end 49 inst.task = inst:DoPeriodicTask(.01, function() owner.Physics:SetMotorVelOverride(20,-10,0) end) 50 inst:DoTaskInTime(3, function() 51 if inst.task then inst.task:Cancel() inst.task = nil end 52 onunequip(inst, owner) 53 local shadow = GetPlayer().entity:AddDynamicShadow() 54 shadow:SetSize( 1.3, .6 ) 55 end) 56end 57local function feather() 58 local inst = simple() 59 inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL 60 inst.components.equippable:SetOnEquip( feather_equip ) 61 inst.components.equippable:SetOnUnequip( feather_unequip ) 62 63 即可在戴羽毛帽时开始起飞,爬升3秒后平飞,用键盘W、S、A、D键控制方向。想降落时卸载羽毛帽即可开始着陆,落地后会滑行一段(按W、S、A、D键可以减少滑行距离)。注意不要在爬升阶段卸载羽毛帽(平飞时再卸载即可),否则在惯性作用下将滑出很长一段距离

2025/04/23 · Bny

YN266-虫洞地铁(虫洞可以搬到任意地点,搭建地铁网络)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六六.虫洞地铁(虫洞可以搬到任意地点,搭建地铁网络) 3 4 用MT管理器打开游戏目录/assets/scripts/prefabs/wormhole.lua文件, 5 6 1.将doer.components.sanity:DoDelta(-TUNING.SANITY_MED)替换为doer.components.sanity:DoDelta(TUNING.SANITY_MED) 7 8 9 2.在inst:AddComponent("inspectable")的下一行插入以下内容: 10 11local function turnon(inst) 12 inst.components.machine.ison = true 13 inst.components.inventoryitem.canbepickedup = true 14end 15local function turnoff(inst) 16 inst.components.machine.ison = false 17 inst.components.inventoryitem.canbepickedup = false 18end 19 inst:AddComponent("equippable") 20 inst:AddComponent("inventoryitem") 21 inst.components.inventoryitem:ChangeImageName("abigail_flower") 22 inst.components.inventoryitem.canbepickedup = false 23 inst:AddComponent("machine") 24 inst.components.machine.turnonfn = turnon 25 inst.components.machine.turnofffn = turnoff 26 27 即可对虫洞按鼠标右键解除锁在地上,再点左键就可以将它捡起(在物品栏里显示为一朵花的图片),到要放置的地点后,将虫洞拿出放在地上,对其点鼠标右键即可再次锁在地上。在家门口摆一排虫洞,将对应的虫洞放在想去的地方,组成自己的虫洞地铁网络吧。另外跳虫洞不但不会降脑,反而会补脑,让你出行的心情更加愉快

2025/04/23 · Bny

YN267-蜘蛛座骑(按键盘PageUP键召唤蜘蛛座骑,按PageDown键取消)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六七.蜘蛛座骑(按键盘PageUP键召唤蜘蛛座骑,按PageDown键取消) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("inventory")的下一行插入以下内容: 5 6TheInput:AddKeyUpHandler(KEY_PAGEUP, function() 7 if inst.task then inst.task:Cancel() inst.task = nil end 8 if inst.task2 then inst.task2:Cancel() inst.task2 = nil end 9 if inst.doll then inst.doll:Remove() inst.doll = nil end 10 inst.components.locomotor:Stop() 11 inst.components.playercontroller:Enable(false) 12 SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) 13 inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/scream_short") 14 inst:DoTaskInTime(0.1, function() 15 inst.AnimState:SetBank("spider_queen") 16 inst.AnimState:SetBuild("spider_queen_build") 17 inst.AnimState:PlayAnimation("idle", true) 18 inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") 19 inst:SetStateGraph("SGspiderqueen") 20 shadow:SetSize( 7, 3 ) 21 inst.components.locomotor.walkspeed = 15 22 inst.components.locomotor.runspeed = 20 23 inst.components.health:SetInvincible(true) 24 inst.components.hunger:Pause() 25 inst.components.combat:SetDefaultDamage(300) 26 inst.components.temperature:SetTemp(20) 27 inst.components.playercontroller:Enable(true) 28 local pt = GetPlayer():GetPosition() 29 inst.doll = SpawnPrefab( "beardhair" ) 30 inst.doll.Transform:SetPosition(pt.x, 3.5, pt.z) 31 inst.doll.Physics:SetActive(false) 32 inst.doll.AnimState:SetBank("wilson") 33 inst.doll.AnimState:SetBuild(name) 34 inst.doll.AnimState:OverrideSymbol("swap_object", "swap_spear", "swap_spear") 35 inst.doll.AnimState:Hide("ARM_normal") 36 inst.doll.AnimState:Show("ARM_carry") 37 inst.doll.Transform:SetFourFaced() 38 inst.doll.AnimState:PlayAnimation("idle") 39 inst.doll:RemoveComponent("burnable") 40 inst.doll:RemoveComponent("propagator") 41 inst.doll:RemoveComponent("inspectable") 42 inst.doll:RemoveComponent("inventoryitem") 43 inst.doll:RemoveComponent("stackable") 44 inst.doll:RemoveComponent("fuel") 45 inst.task = inst:DoPeriodicTask(.05, function() 46 local pt1 = GetPlayer():GetPosition() 47 inst.doll.Transform:SetPosition(pt1.x, 3.5, pt1.z) 48 inst.doll.Transform:SetRotation(GetPlayer().Transform:GetRotation()) 49 end ) 50 inst.task2 = inst:DoPeriodicTask(10, function() 51 inst.doll.AnimState:PlayAnimation("give",true) 52 inst:DoTaskInTime(2.2, function() inst.doll.AnimState:PlayAnimation("idle") end ) 53 end ) 54 end ) 55end ) 56TheInput:AddKeyUpHandler(KEY_PAGEDOWN, function() 57 inst.components.locomotor:Stop() 58 inst.components.playercontroller:Enable(false) 59 SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) 60 inst.SoundEmitter:PlaySound("dontstarve/creatures/spiderqueen/scream_short") 61 inst:DoTaskInTime(0.1, function() 62 inst.AnimState:SetBank("wilson") 63 inst.AnimState:SetBuild(name) 64 inst.AnimState:PlayAnimation("idle") 65 inst.AnimState:SetBloomEffectHandle("") 66 inst:SetStateGraph("SGwilson") 67 shadow:SetSize( 1.3, .6 ) 68 inst.components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED 69 inst.components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED 70 inst.components.health:SetInvincible(false) 71 inst.components.hunger:Resume() 72 inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE) 73 inst.components.temperature:SetTemp(nil) 74 inst.components.playercontroller:Enable(true) 75 if inst.task then inst.task:Cancel() inst.task = nil end 76 if inst.task2 then inst.task2:Cancel() inst.task2 = nil end 77 if inst.doll then inst.doll:Remove() inst.doll = nil end 78 end ) 79end ) 80 81 即可按键盘PageUP键召唤蜘蛛座骑(自动骑在蜘蛛身上),按PageDown键取消座骑。攻击时对敌人按Ctrl + 鼠标左键(也可以按住F键连续还击)。骑在蜘蛛身上时,敌人无法打到主角,所以主角不会掉血

2025/04/23 · Bny

YN268-喷气虫座骑(用夏日背心种喷气虫座骑,左键点虫可骑乘,右键点主角可下来,给草让它原地等待)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六八.喷气虫座骑(用夏日背心种喷气虫座骑,左键点虫可骑乘,右键点主角可下来,给草让它原地等待) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/trunkvest.lua文件,在inst.AnimState:SetBuild("armor_trunkvest_summer")的下一行插入以下内容: 5 6local function OnDeploy (inst, pt) 7 local jet = SpawnPrefab("trunkvest_summer") 8 jet.Transform:SetPosition(pt.x, pt.y, pt.z) 9 jet.AnimState:SetBank("glommer") 10 jet.AnimState:SetBuild("glommer") 11 jet.AnimState:PlayAnimation("idle_loop") 12 jet.Transform:SetFourFaced() 13 jet.entity:AddSoundEmitter() 14 local shadow = jet.entity:AddDynamicShadow() 15 shadow:SetSize( 2, .75 ) 16 local minimap = jet.entity:AddMiniMapEntity() 17 minimap:SetIcon("glommer.png") 18 jet:AddComponent("named") 19 jet.components.named:SetName("Glommer") 20 jet:RemoveComponent("inventoryitem") 21 jet:RemoveComponent("equippable") 22 jet:RemoveComponent("insulator") 23 jet:RemoveComponent("fueled") 24 jet:RemoveComponent("waterproofer") 25 jet:RemoveComponent("deployable") 26 jet:AddComponent("knownlocations") 27 jet:AddComponent("follower") 28 jet.components.follower:SetLeader(GetPlayer()) 29 jet:AddComponent("lootdropper") 30 jet:AddComponent("health") 31 jet.components.health:SetMaxHealth(2000) 32 jet:AddComponent("combat") 33 jet:AddComponent("locomotor") 34 jet.components.locomotor.walkspeed = 15 35 jet:SetStateGraph("SGglommer") 36 local brain = require "brains/chesterbrain" 37 jet:SetBrain(brain) 38 jet:AddComponent("trader") 39 jet.components.trader:SetAcceptTest(function(jet, item) 40 if not jet:HasTag("driving") then 41 if item.prefab == "cutgrass" then 42 return true 43 end 44 end 45 return false 46 end ) 47 jet.components.trader.onaccept = function(jet, giver, item) 48 jet.components.health:DoDelta(2000) 49 if not jet:HasTag("stophere") then 50 jet:AddTag("stophere") 51 jet.components.locomotor:Stop() 52 jet:SetBrain(nil) 53 jet.components.follower:SetLeader(nil) 54 else 55 jet:RemoveTag("stophere") 56 local brain = require "brains/chesterbrain" 57 jet:SetBrain(brain) 58 jet:RestartBrain() 59 jet.components.follower:SetLeader(GetPlayer()) 60 end 61 end 62 jet.components.inspectable.getstatus = function() 63 if not jet:HasTag("driving") then 64 jet:AddTag("driving") 65 jet:RemoveTag("stophere") 66 jet.components.locomotor:Stop() 67 local shadow = jet.entity:AddDynamicShadow() 68 shadow:SetSize( 0, 0 ) 69 jet.Physics:SetActive(false) 70 jet:SetStateGraph("SGshadowwaxwell") 71 jet:SetBrain(nil) 72 jet.components.follower:SetLeader(nil) 73 jet.AnimState:SetBank("wilson") 74 if GetPlayer().prefab == "wilson" then jet.AnimState:SetBuild("wilson") end 75 if GetPlayer().prefab == "wendy" then jet.AnimState:SetBuild("wendy") end 76 if GetPlayer().prefab == "wes" then jet.AnimState:SetBuild("wes") end 77 if GetPlayer().prefab == "wickerbottom" then jet.AnimState:SetBuild("wickerbottom") end 78 if GetPlayer().prefab == "willow" then jet.AnimState:SetBuild("willow") end 79 if GetPlayer().prefab == "wolfgang" then jet.AnimState:SetBuild("wolfgang") end 80 if GetPlayer().prefab == "wx78" then jet.AnimState:SetBuild("wx78") end 81 if GetPlayer().prefab == "woodie" then jet.AnimState:SetBuild("woodie") end 82 if GetPlayer().prefab == "waxwell" then jet.AnimState:SetBuild("waxwell") end 83 if GetPlayer().prefab == "wathgrithr" then jet.AnimState:SetBuild("wathgrithr") end 84 if GetPlayer().prefab == "webber" then jet.AnimState:SetBuild("webber") end 85 jet.AnimState:PlayAnimation("idle") 86 jet.AnimState:Hide("ARM_carry") 87 jet.AnimState:Show("ARM_normal") 88 jet.Transform:SetRotation( 0 ) 89 jet.task = jet:DoPeriodicTask(0.05, function(jet) 90 local pt1 = GetPlayer():GetPosition() 91 jet.Transform:SetPosition(pt1.x, 3.5, pt1.z) 92 jet.Transform:SetRotation(GetPlayer().Transform:GetRotation()) 93 end ) 94 GetPlayer().AnimState:SetBank("glommer") 95 GetPlayer().AnimState:SetBuild("glommer") 96 GetPlayer().AnimState:PlayAnimation("idle_loop") 97 GetPlayer():SetStateGraph("SGglommer") 98 local shadow = GetPlayer().entity:AddDynamicShadow() 99 shadow:SetSize( 2, .75 ) 100 GetPlayer().components.locomotor.walkspeed = 25 101 GetPlayer().components.locomotor.runspeed = 25 102 GetPlayer().components.health:SetInvincible(true) 103 GetPlayer().components.hunger:Pause() 104 GetPlayer().components.temperature:SetTemp(20) 105 GetPlayer().components.playeractionpicker.leftclickoverride = function(target_ent, pos) 106 if GetPlayer().components.combat:CanTarget(target_ent) then 107 return GetPlayer().components.playeractionpicker:SortActionList({ACTIONS.LOOKAT}, target_ent, nil) 108 end 109 end 110 else 111 jet:RemoveTag("driving") 112 local shadow = jet.entity:AddDynamicShadow() 113 shadow:SetSize( 2, .75 ) 114 jet.Physics:SetActive(true) 115 jet.AnimState:SetBank("glommer") 116 jet.AnimState:SetBuild("glommer") 117 jet.AnimState:PlayAnimation("idle_loop") 118 jet:SetStateGraph("SGglommer") 119 local brain = require "brains/chesterbrain" 120 jet:SetBrain(brain) 121 jet:RestartBrain() 122 jet.components.follower:SetLeader(GetPlayer()) 123 if jet.task then jet.task:Cancel() jet.task = nil end 124 local pt1 = GetPlayer():GetPosition() 125 jet.Transform:SetPosition(pt1.x, 0, pt1.z) 126 GetPlayer().AnimState:SetBank("wilson") 127 if GetPlayer().prefab == "wilson" then GetPlayer().AnimState:SetBuild("wilson") end 128 if GetPlayer().prefab == "wendy" then GetPlayer().AnimState:SetBuild("wendy") end 129 if GetPlayer().prefab == "wes" then GetPlayer().AnimState:SetBuild("wes") end 130 if GetPlayer().prefab == "wickerbottom" then GetPlayer().AnimState:SetBuild("wickerbottom") end 131 if GetPlayer().prefab == "willow" then GetPlayer().AnimState:SetBuild("willow") end 132 if GetPlayer().prefab == "wolfgang" then GetPlayer().AnimState:SetBuild("wolfgang") end 133 if GetPlayer().prefab == "wx78" then GetPlayer().AnimState:SetBuild("wx78") end 134 if GetPlayer().prefab == "woodie" then GetPlayer().AnimState:SetBuild("woodie") end 135 if GetPlayer().prefab == "waxwell" then GetPlayer().AnimState:SetBuild("waxwell") end 136 if GetPlayer().prefab == "wathgrithr" then GetPlayer().AnimState:SetBuild("wathgrithr") end 137 if GetPlayer().prefab == "webber" then GetPlayer().AnimState:SetBuild("webber") end 138 GetPlayer().AnimState:PlayAnimation("idle") 139 GetPlayer():SetStateGraph("SGwilson") 140 local shadow = GetPlayer().entity:AddDynamicShadow() 141 shadow:SetSize( 1.3, .6 ) 142 GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED 143 GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED 144 GetPlayer().components.health:SetInvincible(false) 145 GetPlayer().components.hunger:Resume() 146 GetPlayer().components.temperature:SetTemp(nil) 147 GetPlayer().components.playeractionpicker.leftclickoverride = nil 148 end 149 end 150 jet:AddTag("jets") 151 inst:Remove() 152end 153 inst:AddComponent("deployable") 154 inst.components.deployable.ondeploy = OnDeploy 155local function onsave(inst, data) 156 if inst:HasTag("jets") then 157 data.jets = true 158 end 159 if inst:HasTag("stophere") then 160 data.stophere = true 161 end 162end 163local function onload(inst, data) 164 if data and data.jets then 165 inst.AnimState:SetBank("glommer") 166 inst.AnimState:SetBuild("glommer") 167 inst.AnimState:PlayAnimation("idle_loop") 168 inst.Transform:SetFourFaced() 169 inst.entity:AddSoundEmitter() 170 local shadow = inst.entity:AddDynamicShadow() 171 shadow:SetSize( 2, .75 ) 172 local minimap = inst.entity:AddMiniMapEntity() 173 minimap:SetIcon("glommer.png") 174 inst:AddComponent("named") 175 inst.components.named:SetName("Glommer") 176 inst:RemoveComponent("inventoryitem") 177 inst:RemoveComponent("equippable") 178 inst:RemoveComponent("insulator") 179 inst:RemoveComponent("fueled") 180 inst:RemoveComponent("waterproofer") 181 inst:RemoveComponent("deployable") 182 inst:AddComponent("knownlocations") 183 inst:AddComponent("follower") 184 inst.components.follower:SetLeader(GetPlayer()) 185 inst:AddComponent("lootdropper") 186 inst:AddComponent("health") 187 inst.components.health:SetMaxHealth(2000) 188 inst:AddComponent("combat") 189 inst:AddComponent("locomotor") 190 inst.components.locomotor.walkspeed = 15 191 inst:SetStateGraph("SGglommer") 192 local brain = require "brains/chesterbrain" 193 inst:SetBrain(brain) 194 inst:AddComponent("trader") 195 inst.components.trader:SetAcceptTest(function(inst, item) 196 if not inst:HasTag("driving") then 197 if item.prefab == "cutgrass" then 198 return true 199 end 200 end 201 return false 202 end ) 203 inst.components.trader.onaccept = function(inst, giver, item) 204 inst.components.health:DoDelta(2000) 205 if not inst:HasTag("stophere") then 206 inst:AddTag("stophere") 207 inst.components.locomotor:Stop() 208 inst:SetBrain(nil) 209 inst.components.follower:SetLeader(nil) 210 else 211 inst:RemoveTag("stophere") 212 local brain = require "brains/chesterbrain" 213 inst:SetBrain(brain) 214 inst:RestartBrain() 215 inst.components.follower:SetLeader(GetPlayer()) 216 end 217 end 218 inst.components.inspectable.getstatus = function() 219 if not inst:HasTag("driving") then 220 inst:AddTag("driving") 221 inst:RemoveTag("stophere") 222 inst.components.locomotor:Stop() 223 local shadow = inst.entity:AddDynamicShadow() 224 shadow:SetSize( 0, 0 ) 225 inst.Physics:SetActive(false) 226 inst:SetStateGraph("SGshadowwaxwell") 227 inst:SetBrain(nil) 228 inst.components.follower:SetLeader(nil) 229 inst.AnimState:SetBank("wilson") 230 if GetPlayer().prefab == "wilson" then inst.AnimState:SetBuild("wilson") end 231 if GetPlayer().prefab == "wendy" then inst.AnimState:SetBuild("wendy") end 232 if GetPlayer().prefab == "wes" then inst.AnimState:SetBuild("wes") end 233 if GetPlayer().prefab == "wickerbottom" then inst.AnimState:SetBuild("wickerbottom") end 234 if GetPlayer().prefab == "willow" then inst.AnimState:SetBuild("willow") end 235 if GetPlayer().prefab == "wolfgang" then inst.AnimState:SetBuild("wolfgang") end 236 if GetPlayer().prefab == "wx78" then inst.AnimState:SetBuild("wx78") end 237 if GetPlayer().prefab == "woodie" then inst.AnimState:SetBuild("woodie") end 238 if GetPlayer().prefab == "waxwell" then inst.AnimState:SetBuild("waxwell") end 239 if GetPlayer().prefab == "wathgrithr" then inst.AnimState:SetBuild("wathgrithr") end 240 if GetPlayer().prefab == "webber" then inst.AnimState:SetBuild("webber") end 241 inst.AnimState:PlayAnimation("idle") 242 inst.AnimState:Hide("ARM_carry") 243 inst.AnimState:Show("ARM_normal") 244 inst.Transform:SetRotation( 0 ) 245 inst.task = inst:DoPeriodicTask(0.05, function(inst) 246 local pt1 = GetPlayer():GetPosition() 247 inst.Transform:SetPosition(pt1.x, 3.5, pt1.z) 248 inst.Transform:SetRotation(GetPlayer().Transform:GetRotation()) 249 end ) 250 GetPlayer().AnimState:SetBank("glommer") 251 GetPlayer().AnimState:SetBuild("glommer") 252 GetPlayer().AnimState:PlayAnimation("idle_loop") 253 GetPlayer():SetStateGraph("SGglommer") 254 local shadow = GetPlayer().entity:AddDynamicShadow() 255 shadow:SetSize( 2, .75 ) 256 GetPlayer().components.locomotor.walkspeed = 25 257 GetPlayer().components.locomotor.runspeed = 25 258 GetPlayer().components.health:SetInvincible(true) 259 GetPlayer().components.hunger:Pause() 260 GetPlayer().components.temperature:SetTemp(20) 261 GetPlayer().components.playeractionpicker.leftclickoverride = function(target_ent, pos) 262 if GetPlayer().components.combat:CanTarget(target_ent) then 263 return GetPlayer().components.playeractionpicker:SortActionList({ACTIONS.LOOKAT}, target_ent, nil) 264 end 265 end 266 else 267 inst:RemoveTag("driving") 268 local shadow = inst.entity:AddDynamicShadow() 269 shadow:SetSize( 2, .75 ) 270 inst.Physics:SetActive(true) 271 inst.AnimState:SetBank("glommer") 272 inst.AnimState:SetBuild("glommer") 273 inst.AnimState:PlayAnimation("idle_loop") 274 inst:SetStateGraph("SGglommer") 275 local brain = require "brains/chesterbrain" 276 inst:SetBrain(brain) 277 inst:RestartBrain() 278 inst.components.follower:SetLeader(GetPlayer()) 279 if inst.task then inst.task:Cancel() inst.task = nil end 280 local pt1 = GetPlayer():GetPosition() 281 inst.Transform:SetPosition(pt1.x, 0, pt1.z) 282 GetPlayer().AnimState:SetBank("wilson") 283 if GetPlayer().prefab == "wilson" then GetPlayer().AnimState:SetBuild("wilson") end 284 if GetPlayer().prefab == "wendy" then GetPlayer().AnimState:SetBuild("wendy") end 285 if GetPlayer().prefab == "wes" then GetPlayer().AnimState:SetBuild("wes") end 286 if GetPlayer().prefab == "wickerbottom" then GetPlayer().AnimState:SetBuild("wickerbottom") end 287 if GetPlayer().prefab == "willow" then GetPlayer().AnimState:SetBuild("willow") end 288 if GetPlayer().prefab == "wolfgang" then GetPlayer().AnimState:SetBuild("wolfgang") end 289 if GetPlayer().prefab == "wx78" then GetPlayer().AnimState:SetBuild("wx78") end 290 if GetPlayer().prefab == "woodie" then GetPlayer().AnimState:SetBuild("woodie") end 291 if GetPlayer().prefab == "waxwell" then GetPlayer().AnimState:SetBuild("waxwell") end 292 if GetPlayer().prefab == "wathgrithr" then GetPlayer().AnimState:SetBuild("wathgrithr") end 293 if GetPlayer().prefab == "webber" then GetPlayer().AnimState:SetBuild("webber") end 294 GetPlayer().AnimState:PlayAnimation("idle") 295 GetPlayer():SetStateGraph("SGwilson") 296 local shadow = GetPlayer().entity:AddDynamicShadow() 297 shadow:SetSize( 1.3, .6 ) 298 GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED 299 GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED 300 GetPlayer().components.health:SetInvincible(false) 301 GetPlayer().components.hunger:Resume() 302 GetPlayer().components.temperature:SetTemp(nil) 303 GetPlayer().components.playeractionpicker.leftclickoverride = nil 304 end 305 end 306 inst:AddTag("jets") 307 end 308 if data and data.stophere then 309 inst.components.locomotor:Stop() 310 inst:SetBrain(nil) 311 inst.components.follower:SetLeader(nil) 312 inst:AddTag("stophere") 313 end 314end 315 inst.OnSave = onsave 316 inst.OnLoad = onload 317 318 即可用夏日背心种喷气虫座骑,对喷气虫点鼠标左键(手里不要拿武器)可骑乘,对主角按鼠标右键可下来。骑着喷气虫时无法战斗,但遭到攻击时不会受伤(敌人够不到你)。喷气虫会跟随你,喂它一根草(拿着草对它点鼠标左键)可让其停在原地,并同时补血,再给一根草可继续跟随。喷气虫座骑在小地图上显示为格罗门图标,不想要喷气虫座骑了,杀掉即可(按Ctrl + 鼠标左键攻击)。夏日背心在穿戴选项(画着帽子)下,用1个红色象鼻、8个蛛丝制造

2025/04/23 · Bny

YN269-公车站(用草席卷种公车站,买票坐到下一站)

代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。 原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html 1 2二六九.公车站(用草席卷种公车站,买票坐到下一站) 3 4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/bedroll_straw.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容: 5 6 inst.kind = "" 7 inst.soundpath = "dontstarve/creatures/rook/" 8 inst.effortsound = "dontstarve/creatures/rook/steam" 9local function OnDeploy (inst, pt) 10 local busstation = SpawnPrefab("bedroll_straw") 11 busstation.Transform:SetPosition(pt.x, pt.y, pt.z) 12 busstation.AnimState:SetBank("sign_home") 13 busstation.AnimState:SetBuild("sign_home") 14 busstation.AnimState:PlayAnimation("idle") 15 busstation.Transform:SetScale(1.5, 1.5, 1.5) 16 busstation.AnimState:SetMultColour(255/255,105/255,0/255,0.8) 17 local minimap = busstation.entity:AddMiniMapEntity() 18 minimap:SetIcon( "sign.png" ) 19 busstation:RemoveComponent("inventoryitem") 20 busstation:RemoveComponent("stackable") 21 busstation:RemoveComponent("fuel") 22 busstation:RemoveComponent("sleepingbag") 23 busstation:RemoveComponent("burnable") 24 busstation:RemoveComponent("propagator") 25 busstation:RemoveComponent("deployable") 26 busstation:AddTag("busstation") 27 busstation:AddComponent("workable") 28 busstation.components.workable:SetWorkAction(ACTIONS.HAMMER) 29 busstation.components.workable:SetWorkLeft(3) 30 busstation.components.workable:SetOnFinishCallback(function(busstation) 31 SpawnPrefab("collapse_big").Transform:SetPosition(busstation.Transform:GetWorldPosition()) 32 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 33 busstation:Remove() 34 end ) 35 busstation:AddComponent("trader") 36 busstation.components.trader:SetAcceptTest(function(busstation, item) 37 if item.prefab == "goldnugget" then 38 return true 39 end 40 return false 41 end ) 42 busstation.components.trader.onaccept = function(busstation, giver, item) 43 busstation:AddTag("startingpoint") 44 local target = FindEntity(busstation, 3000, function(guy) 45 return guy:HasTag("busstation") and not guy:HasTag("startingpoint") 46 end ) 47 if target then 48 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 49 GetPlayer().components.playercontroller:Enable(false) 50 local pt1 = busstation:GetPosition() 51 local bus = SpawnPrefab("bedroll_straw") 52 bus.Transform:SetPosition(pt1.x+15+2, 0, pt1.z-15+2) 53 bus.AnimState:SetBank("rook") 54 bus.AnimState:SetBuild("rook_build") 55 bus.AnimState:PlayAnimation("idle", true) 56 bus.Transform:SetFourFaced() 57 bus.Transform:SetScale(1.2, 1.2, 1.2) 58 bus.AnimState:SetMultColour(255/255,105/255,0/255,1) 59 local sound = bus.entity:AddSoundEmitter() 60 bus:RemoveComponent("inventoryitem") 61 bus:RemoveComponent("stackable") 62 bus:RemoveComponent("fuel") 63 bus:RemoveComponent("sleepingbag") 64 bus:RemoveComponent("burnable") 65 bus:RemoveComponent("propagator") 66 bus:RemoveComponent("deployable") 67 bus:AddTag("goodbye") 68 bus:AddComponent("locomotor") 69 bus.components.locomotor.walkspeed = 5 70 bus.components.locomotor.runspeed = 10 71 bus:SetStateGraph("SGrook") 72 bus:AddComponent("health") 73 bus.components.health:SetMaxHealth(1000) 74 bus.components.health:SetInvincible(true) 75 bus:AddComponent("combat") 76 bus:AddComponent("follower") 77 bus:AddComponent("knownlocations") 78 bus:DoTaskInTime(1, function() 79 bus.components.locomotor:GoToPoint(Point(pt1.x+2, 0, pt1.z+2)) 80 end ) 81 bus:DoTaskInTime(9, function() 82 GetPlayer():Hide() 83 GetPlayer().components.health:SetInvincible(true) 84 local shadow = GetPlayer().entity:AddDynamicShadow() 85 shadow:SetSize( 0, 0 ) 86 bus.components.locomotor:GoToPoint(Point(pt1.x-15+2, 0, pt1.z+15+2)) 87 end ) 88 GetPlayer():DoTaskInTime(15, function() 89 TheFrontEnd:Fade(false,1) 90 bus:Remove() 91 GetPlayer().Transform:SetPosition(target.Transform:GetWorldPosition()) 92 GetPlayer():DoTaskInTime(2, function() 93 TheFrontEnd:Fade(true,1) 94 busstation:RemoveTag("startingpoint") 95 GetPlayer():Show() 96 GetPlayer().components.health:SetInvincible(false) 97 GetPlayer().components.playercontroller:Enable(true) 98 local shadow = GetPlayer().entity:AddDynamicShadow() 99 shadow:SetSize( 1.3, .6 ) 100 end ) 101 end ) 102 else 103 SpawnPrefab("goldnugget").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition()) 104 busstation:RemoveTag("startingpoint") 105 end 106 end 107 inst.components.stackable:Get():Remove() 108end 109 inst:AddComponent("deployable") 110 inst.components.deployable.ondeploy = OnDeploy 111local function onsave(inst, data) 112 if inst:HasTag("goodbye") then 113 data.goodbye = true 114 end 115 if inst:HasTag("busstation") then 116 data.busstation = true 117 end 118end 119local function onload(inst, data) 120 if data and data.goodbye then 121 inst:Remove() 122 end 123 if data and data.busstation then 124 inst.AnimState:SetBank("sign_home") 125 inst.AnimState:SetBuild("sign_home") 126 inst.AnimState:PlayAnimation("idle") 127 inst.Transform:SetScale(1.5, 1.5, 1.5) 128 inst.AnimState:SetMultColour(255/255,105/255,0/255,0.8) 129 local minimap = inst.entity:AddMiniMapEntity() 130 minimap:SetIcon( "sign.png" ) 131 inst:RemoveComponent("inventoryitem") 132 inst:RemoveComponent("stackable") 133 inst:RemoveComponent("fuel") 134 inst:RemoveComponent("sleepingbag") 135 inst:RemoveComponent("burnable") 136 inst:RemoveComponent("propagator") 137 inst:RemoveComponent("deployable") 138 inst:AddTag("busstation") 139 inst:AddComponent("workable") 140 inst.components.workable:SetWorkAction(ACTIONS.HAMMER) 141 inst.components.workable:SetWorkLeft(3) 142 inst.components.workable:SetOnFinishCallback(function(inst) 143 SpawnPrefab("collapse_big").Transform:SetPosition(inst.Transform:GetWorldPosition()) 144 GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood") 145 inst:Remove() 146 end ) 147 inst:AddComponent("trader") 148 inst.components.trader:SetAcceptTest(function(inst, item) 149 if item.prefab == "goldnugget" then 150 return true 151 end 152 return false 153 end ) 154 inst.components.trader.onaccept = function(inst, giver, item) 155 inst:AddTag("startingpoint") 156 local target = FindEntity(inst, 3000, function(guy) 157 return guy:HasTag("busstation") and not guy:HasTag("startingpoint") 158 end ) 159 if target then 160 GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold") 161 GetPlayer().components.playercontroller:Enable(false) 162 local pt1 = inst:GetPosition() 163 local bus = SpawnPrefab("bedroll_straw") 164 bus.Transform:SetPosition(pt1.x+15+2, 0, pt1.z-15+2) 165 bus.AnimState:SetBank("rook") 166 bus.AnimState:SetBuild("rook_build") 167 bus.AnimState:PlayAnimation("idle", true) 168 bus.Transform:SetFourFaced() 169 bus.Transform:SetScale(1.2, 1.2, 1.2) 170 bus.AnimState:SetMultColour(255/255,105/255,0/255,1) 171 local sound = bus.entity:AddSoundEmitter() 172 bus:RemoveComponent("inventoryitem") 173 bus:RemoveComponent("stackable") 174 bus:RemoveComponent("fuel") 175 bus:RemoveComponent("sleepingbag") 176 bus:RemoveComponent("burnable") 177 bus:RemoveComponent("propagator") 178 bus:RemoveComponent("deployable") 179 bus:AddTag("goodbye") 180 bus:AddComponent("locomotor") 181 bus.components.locomotor.walkspeed = 5 182 bus.components.locomotor.runspeed = 10 183 bus:SetStateGraph("SGrook") 184 bus:AddComponent("health") 185 bus.components.health:SetMaxHealth(1000) 186 bus.components.health:SetInvincible(true) 187 bus:AddComponent("combat") 188 bus:AddComponent("follower") 189 bus:AddComponent("knownlocations") 190 bus:DoTaskInTime(1, function() 191 bus.components.locomotor:GoToPoint(Point(pt1.x+2, 0, pt1.z+2)) 192 end ) 193 bus:DoTaskInTime(9, function() 194 GetPlayer():Hide() 195 GetPlayer().components.health:SetInvincible(true) 196 local shadow = GetPlayer().entity:AddDynamicShadow() 197 shadow:SetSize( 0, 0 ) 198 bus.components.locomotor:GoToPoint(Point(pt1.x-15+2, 0, pt1.z+15+2)) 199 end ) 200 GetPlayer():DoTaskInTime(15, function() 201 TheFrontEnd:Fade(false,1) 202 bus:Remove() 203 GetPlayer().Transform:SetPosition(target.Transform:GetWorldPosition()) 204 GetPlayer():DoTaskInTime(2, function() 205 TheFrontEnd:Fade(true,1) 206 inst:RemoveTag("startingpoint") 207 GetPlayer():Show() 208 GetPlayer().components.health:SetInvincible(false) 209 GetPlayer().components.playercontroller:Enable(true) 210 local shadow = GetPlayer().entity:AddDynamicShadow() 211 shadow:SetSize( 1.3, .6 ) 212 end ) 213 end ) 214 else 215 SpawnPrefab("goldnugget").Transform:SetPosition(GetPlayer().Transform:GetWorldPosition()) 216 inst:RemoveTag("startingpoint") 217 end 218 end 219 end 220end 221 inst.OnSave = onsave 222 inst.OnLoad = onload 223 224 即可在地图的任意两个地点,用草席卷种公车站,给站牌1个黄金(拿着黄金对站牌点鼠标左键),会来公共汽车送你到另一个站牌,方便在两点间快速移动。公车站须种在空旷的地方,以便公共汽车行驶。如果只种了一个公车站,则站牌不会接受你的黄金。公车站在小地图上显示为路牌的图标。不想要公车站时,用锤子砸掉即可。草席卷在生存选项下(画着绳套)下,用6个草、1个绳子制造

2025/04/23 · Bny