Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MakePlayerCharacter = require "prefabs/player_common"
- local assets = {
- Asset( "ANIM", "anim/player_basic.zip" ),
- Asset( "ANIM", "anim/player_idles_shiver.zip" ),
- Asset( "ANIM", "anim/player_actions.zip" ),
- Asset( "ANIM", "anim/player_actions_axe.zip" ),
- Asset( "ANIM", "anim/player_actions_pickaxe.zip" ),
- Asset( "ANIM", "anim/player_actions_shovel.zip" ),
- Asset( "ANIM", "anim/player_actions_blowdart.zip" ),
- Asset( "ANIM", "anim/player_actions_eat.zip" ),
- Asset( "ANIM", "anim/player_actions_item.zip" ),
- Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ),
- Asset( "ANIM", "anim/player_actions_bugnet.zip" ),
- Asset( "ANIM", "anim/player_actions_fishing.zip" ),
- Asset( "ANIM", "anim/player_actions_boomerang.zip" ),
- Asset( "ANIM", "anim/player_bush_hat.zip" ),
- Asset( "ANIM", "anim/player_attacks.zip" ),
- Asset( "ANIM", "anim/player_idles.zip" ),
- Asset( "ANIM", "anim/player_rebirth.zip" ),
- Asset( "ANIM", "anim/player_jump.zip" ),
- Asset( "ANIM", "anim/player_amulet_resurrect.zip" ),
- Asset( "ANIM", "anim/player_teleport.zip" ),
- Asset( "ANIM", "anim/wilson_fx.zip" ),
- Asset( "ANIM", "anim/player_one_man_band.zip" ),
- Asset( "ANIM", "anim/shadow_hands.zip" ),
- Asset( "SOUND", "sound/sfx.fsb" ),
- Asset( "SOUND", "sound/wilson.fsb" ),
- Asset( "ANIM", "anim/beard.zip" ),
- Asset( "ANIM", "anim/heather.zip" ),
- Asset( "ANIM", "anim/ghost_heather_build.zip" ),
- }
- local prefabs = {}
- local start_inv = {
- -- Custom starting items
- }
- -- This initializes for both clients and the host
- local common_postinit = function(inst)
- -- Minimap icon
- inst.MiniMapEntity:SetIcon( "heather.tex" )
- end
- local function updatestats(inst)
- local old_strength = inst.strength
- if inst.components.hunger.current < 2 and inst.strength ~= "starving" then
- inst.strength = "starving"
- inst.components.talker:Say("My body lacks the energy to repair itself.")
- elseif inst.strength == "starving" and inst.components.hunger.current > 2 then
- inst.components.talker:Say("I have power again!")
- inst.strength = "notstarving"
- end
- if inst.strength ~= "starving" then
- if inst.strength == "minregen" then
- if inst.components.health.currenthealth <= 90 then
- inst.strength = "medregen"
- inst.components.talker:Say("I should be back to normal in no time.")
- end
- elseif inst.strength == "medregen" then
- if inst.components.health.currenthealth <= 60 then
- inst.strength = "moreregen"
- inst.components.talker:Say("Tissues are repairing incredibly fast now!")
- end
- elseif inst.strength == "maxregen" then
- if inst.components.health.currenthealth >= 30 then
- inst.strength = "moreregen"
- inst.components.talker:Say("Tissue repair is beginning to slow.")
- end
- elseif inst.strength == "moreregen" then
- if inst.components.health.currenthealth >= 60 then
- inst.strength = "medregen"
- inst.components.talker:Say("Cell reproductive rates down to manageable levels.")
- elseif inst.components.health.currenthealth < 30 and inst.strength ~= "maxregen" then
- inst.strength = "maxregen"
- inst.components.talker:Say("Metabolic rates have spiked!")
- end
- elseif inst.components.health.currenthealth > 90 and inst.strength ~= "minregen" then
- inst.strength = "minregen"
- inst.components.talker:Say("Cells replicating as normal.")
- end
- end
- if inst.strength ~= old_strength then
- if inst.strength == "starving" then
- inst.components.health:StopRegen()
- inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1)
- inst.components.combat.damagemultiplier = 0.75
- local Temperature = Class(function(self, inst)
- self.inherentinsulation = 0
- end)
- elseif inst.strength == "minregen" or inst.strength == "notstarving" then
- inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 1.5)
- inst.components.health:StartRegen(1, 2)
- inst.components.combat.damagemultiplier = 1
- local Temperature = Class(function(self, inst)
- self.inherentinsulation = 0
- end)
- elseif inst.strength == "medregen" then
- inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 3)
- inst.components.health:StartRegen(1, 1)
- inst.components.combat.damagemultiplier = 1.25
- local Temperature = Class(function(self, inst)
- self.inherentinsulation = TUNING.INSULATION_TINY
- end)
- elseif inst.strength == "moreregen" then
- inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 4.5)
- inst.components.health:StartRegen(2.5, 1)
- inst.components.combat.damagemultiplier = 1.5
- inst.components.sanity.dapperness = (-TUNING.DAPPERNESS_MED)
- local Temperature = Class(function(self, inst)
- self.inherentinsulation = TUNING.INSULATION_MED
- end)
- elseif inst.strength == "maxregen" then
- inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 6)
- inst.components.health:StartRegen(5, 1)
- inst.components.combat.damagemultiplier = 2
- inst.components.sanity.dapperness = (-TUNING.DAPPERNESS_HUGE)
- local Temperature = Class(function(self, inst)
- self.inherentinsulation = TUNING.INSULATION_LARGE
- end)
- end
- -- print (inst.strength)
- -- old_strength = inst.strength
- end
- end
- local function onhealthchange(inst, data)
- updatestats(inst)
- end
- local function onnewstate(inst)
- if inst._wasnomorph ~= inst.sg:HasStateTag("nomorph") then
- inst._wasnomorph = not inst._wasnomorph
- if not inst._wasnomorph then
- onhealthchange(inst)
- end
- end
- end
- local function onbecamehuman(inst)
- if inst._wasnomorph == nil then
- inst.strength = "minregen"
- inst._wasnomorph = inst.sg:HasStateTag("nomorph")
- inst.talksoundoverride = nil
- inst.hurtsoundoverride = nil
- inst:ListenForEvent("healthdelta", onhealthchange)
- inst:ListenForEvent("newstate", onnewstate)
- onhealthchange(inst, nil, true)
- end
- end
- local function onbecameghost(inst)
- if inst._wasnomorph ~= nil then
- inst.strength = "minregen"
- inst._wasnomorph = nil
- inst.talksoundoverride = nil
- inst.hurtsoundoverride = nil
- inst:RemoveEventCallback("healthdelta", onhealthchange)
- inst:RemoveEventCallback("newstate", onnewstate)
- end
- end
- local function onload(inst)
- inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman)
- inst:ListenForEvent("ms_becameghost", onbecameghost)
- if inst:HasTag("playerghost") then
- onbecameghost(inst)
- else
- onbecamehuman(inst)
- end
- end
- -- This initializes for the host only
- local master_postinit = function(inst)
- -- choose which sounds this character will play
- inst.soundsname = "wendy"
- -- Stats
- inst.strength = "minregen"
- inst.components.health:SetMaxHealth(120)
- inst.components.health:StartRegen(1, 2)
- inst.components.hunger:SetMax(200)
- inst.components.sanity:SetMax(200)
- inst.components.combat.damagemultiplier = 1
- inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 1.5)
- inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 1.5)
- inst:ListenForEvent("healthdelta", onhealthchange)
- inst:ListenForEvent("hungerdelta", updatestats)
- inst.OnLoad = onload
- inst.OnNewSpawn = onload
- end
- return MakePlayerCharacter("heather", prefabs, assets, common_postinit, master_postinit, start_inv)
Advertisement
Add Comment
Please, Sign In to add comment