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

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

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

第311页:智能路灯

展开

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

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

  local function makestreetlight(inst)

  local pt = inst:GetPosition()

  local streetlight = SpawnPrefab("blueamulet")

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

  streetlight.AnimState:SetBank("nightstick")

  streetlight.AnimState:SetBuild("nightstick")

  streetlight.AnimState:PlayAnimation("idle")

  streetlight.Transform:SetScale(1.5, 1.5, 1.5)

  streetlight.AnimState:SetMultColour(255/255,255/255,0/255,1)

  MakeObstaclePhysics(streetlight, .5 )

  streetlight:RemoveComponent("equippable")

  streetlight:RemoveComponent("inventoryitem")

  streetlight:RemoveComponent("heater")

  streetlight:RemoveComponent("fueled")

  streetlight:RemoveComponent("deployable")

  streetlight:AddComponent("named")

  streetlight.components.named:SetName("Street Light")

  streetlight:AddComponent("workable")

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

  streetlight.components.workable:SetWorkLeft(3)

  streetlight.components.workable:SetOnFinishCallback(function(streetlight, worker)

  SpawnPrefab("collapse_big").Transform:SetPosition(streetlight.Transform:GetWorldPosition())

  GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")

  local pos = Vector3(streetlight.Transform:GetWorldPosition())

  local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 2)

  for k,v in pairs(ents) do

  if v:HasTag("bulbs") then

  v:Remove()

  end

  end

  streetlight:Remove()

  end )

  streetlight:AddTag("streetlights")

  local bulb = SpawnPrefab("blueamulet")

  bulb.AnimState:SetBank("bulb")

  bulb.AnimState:SetBuild("bulb")

  bulb.AnimState:PlayAnimation("idle")

  bulb.Transform:SetScale(1.6, 1.6, 1.6)

  bulb.Physics:SetActive(false)

  bulb:RemoveComponent("equippable")

  bulb:RemoveComponent("inventoryitem")

  bulb:RemoveComponent("heater")

  bulb:RemoveComponent("fueled")

  bulb:RemoveComponent("deployable")

  bulb.persists = false

  bulb:AddComponent("named")

  bulb.components.named:SetName("Street Light")

  bulb.entity:AddSoundEmitter()

  local light = bulb.entity:AddLight()

  light:SetFalloff(1)

  light:SetIntensity(.8)

  light:SetRadius(10)

  light:SetColour(255/255,255/255,255/255)

  light:Enable(false)

  local follower = bulb.entity:AddFollower()

  follower:FollowSymbol( streetlight.GUID, "swap_object", 15, -160, 0.1 )

  bulb:AddComponent("machine")

  bulb.components.machine.turnonfn = function()

  bulb.SoundEmitter:PlaySound("dontstarve/wilson/lantern_on")

  bulb.AnimState:SetBloomEffectHandle("shaders/anim.ksh")

  bulb.Light:Enable(true)

  end

  bulb.components.machine.turnofffn = function()

  bulb.SoundEmitter:PlaySound("dontstarve/wilson/lantern_off")

  bulb.AnimState:SetBloomEffectHandle( "" )

  bulb.Light:Enable(false)

  end

  bulb:ListenForEvent( "daytime", function() bulb.components.machine:TurnOff() end , GetWorld() )

  bulb:ListenForEvent( "dusktime", function() bulb.components.machine:TurnOn() end , GetWorld() )

  bulb:AddTag("lightningrod")

  bulb:AddTag("bulbs")

  if not GetClock():IsDay() then

  bulb.components.machine:TurnOn()

  else

  bulb.components.machine:TurnOff()

  end

  end

  local function OnDeploy (inst, pt)

  makestreetlight(inst)

  inst:Remove()

  end

  inst:AddComponent("deployable")

  inst.components.deployable.ondeploy = OnDeploy

  local function onsave(inst, data)

  if inst:HasTag("streetlights") then

  data.streetlights = true

  end

  end

  local function onload(inst, data)

  if data and data.streetlights then

  makestreetlight(inst)

  inst:Remove()

  end

  end

  inst.OnSave = onsave

  inst.OnLoad = onload

  即可用蓝色护身符种智能路灯,夜晚自动点亮,白天自动熄灭。鼠标右键点灯泡,可手动开关。智能路灯靠太阳能和闪电做能源,无须手动充能,靠近可防雷击。不想要智能路灯了,用锤子砸掉即可。蓝色护身符在魔法选项(画着红骷髅)下,用3个黄金、1个蓝宝石制造

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

责任编辑:Shy夏夏

上一页 311 312 313 314 315 316 317 318 319 320 321 下一页
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

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