第350页:小诊所
展开三百.小诊所(用毛皮铺盖种小诊所,可买药、住院、做手术)
用记事本打开游戏目录\data\DLC0001\scripts\prefabs\bedroll_furry.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function createhospital(inst)
local pt = inst:GetPosition()
local nurse = SpawnPrefab("bedroll_furry")
nurse.Transform:SetPosition(pt.x, pt.y, pt.z)
nurse.AnimState:SetBank("wilson")
nurse.AnimState:SetBuild("wendy")
nurse.AnimState:OverrideSymbol("swap_body", "armor_sweatervest", "swap_body")
nurse.AnimState:Hide("ARM_carry")
nurse.AnimState:Show("ARM_normal")
nurse.Transform:SetFourFaced()
nurse.AnimState:PlayAnimation("idle")
nurse:RemoveComponent("inventoryitem")
nurse:RemoveComponent("finiteuses")
nurse:RemoveComponent("fuel")
nurse:RemoveComponent("sleepingbag")
nurse:RemoveComponent("deployable")
MakeLargeBurnable(nurse)
MakeLargePropagator(nurse)
nurse:AddTag("nurse")
local light = nurse.entity:AddLight()
light:SetFalloff(1)
light:SetIntensity(.8)
light:SetRadius(5)
light:SetColour(180/255, 195/255, 50/255)
light:Enable(true)
nurse:AddComponent("trader")
nurse.components.trader:SetAcceptTest(function(nurse, item)
if GetPlayer().components.inventory:Has("goldnugget", 5) then
if item.prefab == "goldnugget" then
return true
end
end
return false
end )
nurse.components.trader.onaccept = function(nurse, giver, item)
GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
GetPlayer().components.playercontroller:Enable(false)
nurse.AnimState:OverrideSymbol("swap_object", "swap_hammer", "swap_hammer")
nurse.AnimState:Hide("ARM_normal")
nurse.AnimState:Show("ARM_carry")
nurse.task = nurse:DoPeriodicTask(1, function(nurse)
nurse.Transform:SetRotation(GetPlayer().Transform:GetRotation() - 180)
nurse.AnimState:PlayAnimation("pickaxe_pre")
nurse.AnimState:PlayAnimation("pickaxe_loop", false)
GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/rock_break")
GetPlayer().sg:GoToState("hit")
end )
nurse:DoTaskInTime(5, function()
TheFrontEnd:Fade(false,1)
if nurse.task then nurse.task:Cancel() nurse.task = nil end
nurse.Transform:SetRotation(0)
nurse:DoTaskInTime(1, function()
nurse.AnimState:Hide("ARM_carry")
nurse.AnimState:Show("ARM_normal")
nurse.AnimState:PlayAnimation("idle_onemanband1_loop",true)
nurse:DoTaskInTime(3, function() nurse.AnimState:PlayAnimation("idle") end )
TheFrontEnd:Fade(true,1)
GetPlayer().components.health:DoDelta(GetPlayer().components.health.maxhealth)
if GetPlayer():HasTag("poisoning") or GetPlayer():HasTag("fever") then
if GetPlayer():HasTag("poisoning") then GetPlayer():RemoveTag("poisoning") end
if GetPlayer():HasTag("fever") then GetPlayer():RemoveTag("fever") end
if GetPlayer().poison then GetPlayer().poison:Cancel() GetPlayer().poison = nil end
if GetPlayer().fever then GetPlayer().fever:Cancel() GetPlayer().fever = nil end
GetPlayer().AnimState:SetMultColour(255/255,255/255,255/255,1)
GetPlayer().components.locomotor.walkspeed = TUNING.WILSON_WALK_SPEED
GetPlayer().components.locomotor.runspeed = TUNING.WILSON_RUN_SPEED
GetPlayer().components.combat:SetAttackPeriod(TUNING.WILSON_ATTACK_PERIOD)
end
GetPlayer().sg:GoToState("wakeup")
GetPlayer().components.playercontroller:Enable(true)
end )
end )
end
local medicinebox = SpawnPrefab("bedroll_furry")
medicinebox.Transform:SetPosition(pt.x+1.2, 0, pt.z-1.2)
medicinebox.AnimState:SetBank("icebox")
medicinebox.AnimState:SetBuild("ice_box")
medicinebox.AnimState:PlayAnimation("closed")
medicinebox.Transform:SetScale(0.5, 0.5, 0.5)
medicinebox:RemoveComponent("inventoryitem")
medicinebox:RemoveComponent("finiteuses")
medicinebox:RemoveComponent("fuel")
medicinebox:RemoveComponent("sleepingbag")
medicinebox:RemoveComponent("deployable")
MakeLargeBurnable(medicinebox)
MakeLargePropagator(medicinebox)
medicinebox:AddTag("goodbye")
medicinebox:AddComponent("trader")
medicinebox.components.trader:SetAcceptTest(function(medicinebox, item)
if GetPlayer().components.inventory:Has("goldnugget", 5) then
if item.prefab == "goldnugget" then
return true
end
end
return false
end )
medicinebox.components.trader.onaccept = function(medicinebox, giver, item)
GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
local medicine = SpawnPrefab("bedroll_furry")
medicine.AnimState:SetBank("carrot")
medicine.AnimState:SetBuild("carrot")
medicine.AnimState:PlayAnimation("cooked")
medicine.components.inventoryitem:ChangeImageName("carrot_cooked")
medicine:RemoveComponent("finiteuses")
medicine:RemoveComponent("fuel")
medicine:RemoveComponent("sleepingbag")
medicine:RemoveComponent("burnable")
medicine:RemoveComponent("propagator")
medicine:RemoveComponent("deployable")
medicine:AddComponent("edible")
medicine.components.edible.healthvalue = GetPlayer().components.health.maxhealth *0.5
medicine.components.edible.hungervalue = 0
medicine.components.edible.sanityvalue = GetPlayer().components.sanity.max *0.5
medicine.components.edible.foodtype = "VEGGIE"
medicine:AddTag("medicine")
GetPlayer().components.inventory:GiveItem(medicine)
end
local hospital = SpawnPrefab("bedroll_furry")
hospital.Transform:SetPosition(pt.x-2, 0, pt.z-2)
hospital.AnimState:SetBank("tent")
hospital.AnimState:SetBuild("tent")
hospital.AnimState:PlayAnimation("idle", true)
hospital.Transform:SetScale(1.2, 1.2, 1.2)
hospital:RemoveComponent("inventoryitem")
hospital:RemoveComponent("finiteuses")
hospital:RemoveComponent("fuel")
hospital:RemoveComponent("sleepingbag")
hospital:RemoveComponent("deployable")
MakeLargeBurnable(hospital)
MakeLargePropagator(hospital)
hospital:AddTag("goodbye")
hospital:AddComponent("trader")
hospital.components.trader:SetAcceptTest(function(hospital, item)
if GetPlayer().components.inventory:Has("goldnugget", 5) then
if item.prefab == "goldnugget" then
return true
end
end
return false
end )
hospital.components.trader.onaccept = function(hospital, giver, item)
GetPlayer().components.inventory:ConsumeByName("goldnugget", 4)
GetPlayer().components.playercontroller:Enable(false)
TheFrontEnd:Fade(false,1)
hospital:DoTaskInTime(2, function()
TheFrontEnd:Fade(true,1)
GetPlayer().components.sanity:DoDelta(GetPlayer().components.sanity.max)
GetPlayer().components.playercontroller:Enable(true)
end )
end
end
local function OnDeploy (inst, pt)
createhospital(inst)
inst:Remove()
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
if inst:HasTag("goodbye") then
data.goodbye = true
end
if inst:HasTag("nurse") then
data.nurse = true
end
if inst:HasTag("medicine") then
data.medicine = true
end
end
local function onload(inst, data)
if data and data.goodbye then
inst:Remove()
end
if data and data.nurse then
createhospital(inst)
inst:Remove()
end
if data and data.medicine then
inst.AnimState:SetBank("carrot")
inst.AnimState:SetBuild("carrot")
inst.AnimState:PlayAnimation("cooked")
inst.components.inventoryitem:ChangeImageName("carrot_cooked")
inst:RemoveComponent("finiteuses")
inst:RemoveComponent("fuel")
inst:RemoveComponent("sleepingbag")
inst:RemoveComponent("burnable")
inst:RemoveComponent("propagator")
inst:RemoveComponent("deployable")
inst:AddComponent("edible")
inst.components.edible.healthvalue = GetPlayer().components.health.maxhealth *0.5
inst.components.edible.hungervalue = 0
inst.components.edible.sanityvalue = GetPlayer().components.sanity.max *0.5
inst.components.edible.foodtype = "VEGGIE"
inst:AddTag("medicine")
end
end
inst.OnSave = onsave
inst.OnLoad = onload
即可用毛皮铺盖种小诊所,给护士5个黄金(拿着黄金对护士点鼠标左键),会为你麻醉并做手术,将生命值恢复到最大,如果同时修改了“小病小灾”,也可治愈感冒和食物中毒。给帐篷5个黄金可以住院,将脑值恢复到最大。给左侧的药箱5个黄金,可以买一份药,吃了可补一半的生命和脑值。不想要小诊所时,烧掉即可。毛皮铺盖在生存选项(画着绳套)下,用1个草席卷、2个兔人尾巴制造
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏