第109页:主角可夜视
展开一零九.主角可夜视(按键盘H键开关夜视功能)
用记事本打开游戏目录\data\DLC0001\scripts\prefabs\player_common.lua文件,在inst:AddComponent("playeractionpicker")的下一行插入以下内容:
local function lightson(inst)
inst.components.machine.ison = true
inst.Light:Enable(true)
end
local function lightsoff(inst)
inst.components.machine.ison = false
inst.Light:Enable(false)
end
local light = inst.entity:AddLight()
light:SetFalloff(1)
light:SetIntensity(.8)
light:SetRadius(10)
light:Enable(false)
light:SetColour(0/255, 255/255, 0/255)
inst:AddComponent("machine")
inst.components.machine.turnonfn = lightson
inst.components.machine.turnofffn = lightsoff
TheInput:AddKeyUpHandler(KEY_H, function() if inst.components.machine:IsOn() then inst.components.machine:TurnOff() else inst.components.machine:TurnOn() end end )
即可在游戏中按键盘H键开关主角夜视功能,不再需要火炬、矿工灯
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏