游民星空 > 攻略秘籍 > 攻略 > 正文

饥荒 全人物解锁及主角自动回血等实用修改教程

2015-01-21 11:28:46 来源:互联网 作者:易宁 我要投稿

第250页:小油灯

展开

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

  1.用记事本打开游戏目录\data\DLC0001\scripts\prefabs\log.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:

  inst:AddComponent("cookable")

  inst.components.cookable.product = "charcoal"

  2.用记事本打开游戏目录\data\DLC0001\scripts\prefabs\spidergland.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:

  local colours=

  {

  {198/255,43/255,43/255},

  {79/255,153/255,68/255},

  {35/255,105/255,235/255},

  {233/255,208/255,69/255},

  {109/255,50/255,163/255},

  {222/255,126/255,39/255},

  }

  local function OnDeploy (inst, pt)

  local lamp = SpawnPrefab("spidergland")

  lamp.Transform:SetPosition(pt.x, pt.y, pt.z)

  lamp.AnimState:SetBank("trinkets")

  lamp.AnimState:SetBuild("trinkets")

  lamp.AnimState:PlayAnimation(tostring(2))

  lamp.components.inventoryitem:ChangeImageName("trinket_2")

  lamp.entity:AddSoundEmitter()

  lamp.Transform:SetScale(1.2,1.2,1.2)

  lamp.colour_idx = math.random(#colours)

  lamp.AnimState:SetMultColour(colours[lamp.colour_idx][1],colours[lamp.colour_idx][2],colours[lamp.colour_idx][3],1)

  lamp:RemoveComponent("stackable")

  lamp:RemoveComponent("tradable")

  lamp:RemoveComponent("healer")

  lamp:RemoveComponent("burnable")

  lamp:RemoveComponent("propagator")

  lamp:RemoveComponent("deployable")

  lamp:RemoveTag("cattoy")

  lamp:AddComponent("cooker")

  lamp:AddComponent("burnable")

  lamp.components.burnable:SetFXLevel(3)

  lamp.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.5,0) )

  lamp.components.burnable:Ignite(true)

  lamp.components.inventoryitem:SetOnDroppedFn(function() lamp.components.burnable:Ignite(true) lamp:AddTag("ontheground") end )

  lamp.components.inventoryitem:SetOnPickupFn(function() lamp.components.burnable:Extinguish() lamp:RemoveTag("ontheground") end )

  lamp.components.inventoryitem:SetOnPutInInventoryFn(function() lamp.components.burnable:Extinguish() lamp:RemoveTag("ontheground") end )

  lamp:ListenForEvent("onignite", function()

  if not lamp.components.cooker then lamp:AddComponent("cooker") end

  end )

  lamp:ListenForEvent("onextinguish", function()

  lamp.SoundEmitter:PlaySound("dontstarve/common/fireOut")

  if lamp.components.cooker then lamp:RemoveComponent("cooker") end

  end )

  lamp:AddComponent("workable")

  lamp.components.workable:SetWorkAction(ACTIONS.HAMMER)

  lamp.components.workable:SetWorkLeft(3)

  lamp.components.workable:SetOnFinishCallback(function(lamp)

  SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(lamp.Transform:GetWorldPosition())

  lamp:Remove()

  end )

  lamp:AddTag("ontheground")

  lamp:AddTag("light")

  lamp:AddTag("lamps")

  inst.components.stackable:Get():Remove()

  end

  inst:AddComponent("deployable")

  inst.components.deployable.ondeploy = OnDeploy

  local function onsave(inst, data)

  if inst:HasTag("lamps") then

  data.lamps = true

  end

  if inst:HasTag("ontheground") then

  data.ontheground = true

  end

  data.colour_idx = inst.colour_idx

  end

  local function onload(inst, data)

  if data and data.lamps then

  inst.AnimState:SetBank("trinkets")

  inst.AnimState:SetBuild("trinkets")

  inst.AnimState:PlayAnimation(tostring(2))

  inst.components.inventoryitem:ChangeImageName("trinket_2")

  inst.entity:AddSoundEmitter()

  inst.Transform:SetScale(1.2,1.2,1.2)

  inst.colour_idx = math.random(#colours)

  inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)

  inst:RemoveComponent("stackable")

  inst:RemoveComponent("tradable")

  inst:RemoveComponent("healer")

  inst:RemoveComponent("burnable")

  inst:RemoveComponent("propagator")

  inst:RemoveComponent("deployable")

  inst:RemoveTag("cattoy")

  inst:AddComponent("burnable")

  inst.components.burnable:SetFXLevel(3)

  inst.components.burnable:AddBurnFX("campfirefire", Vector3(0,0.5,0) )

  inst.components.inventoryitem:SetOnDroppedFn(function() inst.components.burnable:Ignite(true) inst:AddTag("ontheground") end )

  inst.components.inventoryitem:SetOnPickupFn(function() inst.components.burnable:Extinguish() inst:RemoveTag("ontheground") end )

  inst.components.inventoryitem:SetOnPutInInventoryFn(function() inst.components.burnable:Extinguish() inst:RemoveTag("ontheground") end )

  inst:ListenForEvent("onignite", function()

  if not inst.components.cooker then inst:AddComponent("cooker") end

  end )

  inst:ListenForEvent("onextinguish", function()

  inst.SoundEmitter:PlaySound("dontstarve/common/fireOut")

  if inst.components.cooker then inst:RemoveComponent("cooker") end

  end )

  inst:AddComponent("workable")

  inst.components.workable:SetWorkAction(ACTIONS.HAMMER)

  inst.components.workable:SetWorkLeft(3)

  inst.components.workable:SetOnFinishCallback(function(inst)

  SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(inst.Transform:GetWorldPosition())

  inst:Remove()

  end )

  inst:AddTag("light")

  inst:AddTag("lamps")

  end

  if data and data.ontheground then

  inst.components.burnable:Ignite(true)

  inst:AddComponent("cooker")

  inst:AddTag("ontheground")

  end

  if data and data.colour_idx then

  inst.colour_idx = math.min(#colours, data.colour_idx)

  inst.AnimState:SetMultColour(colours[inst.colour_idx][1],colours[inst.colour_idx][2],colours[inst.colour_idx][3],1)

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  即可用蜘蛛腺体种小油灯(颜色随机),无须任何燃料,放在地上自动点燃,拿起来自动熄灭。拿着木头对油灯按鼠标左键,可将木头烧成炭。也可烤食物、取暖、照明,出行必备。不想要小油灯时,用锤子砸掉即可

更多相关内容请关注:饥荒专区

责任编辑:Shy夏夏

上一页 241 242 243 244 245 246 247 248 249 250 251 下一页
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

文章内容导航
游民星空APP
随手浏览游戏攻略
code
攻略合集
单机游戏下载
休闲娱乐
综合热点资讯
游民星空联运游戏