Jump to content

There is a typo in prefabs/wurt.lua


Hekkaryk
  • Fixed

In method UpdateStats in line 37 - variable defined before this line is not currenthealth but current_health:

local function UpdateStats(inst, maxhealth, maxhunger, maxsanity)
    local current_health = inst.components.health.currenthealth
    local current_hunger = inst.components.hunger.current
    local current_sanity = inst.components.sanity.current

    inst.components.health:SetMaxHealth(maxhealth)
    inst.components.hunger:SetMax(maxhunger)
    inst.components.sanity:SetMax(maxsanity)

    if current_health > inst.components.health.maxhealth then
        currenthealth = inst.components.health.maxhealth
    end

    if current_hunger > inst.components.hunger.max then
        current_hunger = inst.components.hunger.max
    end

    if current_sanity > inst.components.sanity.max then
        current_sanity = inst.components.sanity.max
    end

    inst.components.health.currenthealth = current_health
    inst.components.health:ForceUpdateHUD(true)

    inst.components.hunger.current = current_hunger
    inst.components.hunger:DoDelta(0)
    
    inst.components.sanity.current = current_sanity
    inst.components.sanity:DoDelta(0)
end

 

This cause following error to be raised every time UpdateStats is called by any Wurt player:

Quote

[00:07:20]: 
COROUTINE 118666 SCRIPT CRASH:
[string "scripts/prefabs/wurt.lua"]:37: assign to undeclared variable 'currenthealth'
LUA ERROR stack traceback:
        =[C] in function 'error'
        scripts/strict.lua(14,1)
        scripts/prefabs/wurt.lua(37,1) in function 'UpdateStats'
        scripts/prefabs/wurt.lua(72,1) in function 'RoyalDowngrade'
        scripts/prefabs/wurt.lua(228,1) in function 'fn'
        scripts/entityscript.lua(1040,1) in function 'PushEvent'
        scripts/components/mermkingmanager.lua(56,1) in function 'fn'
        scripts/entityscript.lua(1040,1) in function 'PushEvent'
        scripts/entityscript.lua(1348,1) in function 'Remove'
        scripts/simutil.lua(358,1)

 


Steps to Reproduce
1. Play Wurt



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

Note: this bug results in a server crash (because of course it does) :|

As a way around I've fixed scripts.zip at our server :)

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...