Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fracture clinic onTick nill value in 'casebook' #2501

Open
JamesWP opened this issue Feb 20, 2024 · 3 comments
Open

[Bug] Fracture clinic onTick nill value in 'casebook' #2501

JamesWP opened this issue Feb 20, 2024 · 3 comments

Comments

@JamesWP
Copy link

JamesWP commented Feb 20, 2024

Describe the issue

Welcome to CorsixTH v0.67!

Checking for CorsixTH updates...
You are running the latest version of CorsixTH.
An error has occurred!
Almost anything can be the cause, but the detailed information below can help the developers find the source of the error.
Running: The timer handler.
A stack trace is included below, and the handler has been disconnected.
Lua\hospital.lua:1383: attempt to index a nil value (local 'casebook')
stack traceback:
        Lua\hospital.lua:1383: in method 'receiveMoneyForTreatment'
        Lua\room.lua:178: in method 'dealtWithPatient'
        Lua\rooms\fracture_clinic.lua:74: in field 'after_use'
        Lua\humanoid_actions\multi_use_object.lua:313: in local 'timer_function'
        Lua\entity.lua:216: in method 'tick'
        Lua\world.lua:1074: in method 'onTick'
        Lua\app.lua:1202: in function <Lua\app.lua:1199>
        (...tail calls...)
        Lua\app.lua:1102: in function <Lua\app.lua:1097>

Warning: No event handler for timer

Fracture clinic had two nurses, not sure if related
image

Steps to Reproduce

  1. Load save game attached to this ticket

Expected Behaviour

No crashes

Save Game

No

CorsixTH Version

0.67

Operating System

Windows 11

Theme Hospital Version

CD

Gamelog.txt

Gamelog generated on 2024-02-20 22:24:06
Compiled with api_version: 2684, arch: x64, audio: true, os: windows
SDL renderer: direct3d
Lua 5.4 run with api version: 2684, game version: v0.67, savegame version: 180
Created game with savegame version 180.
Savegame version is 180 (v0.67), originally it was 180 (v0.67).
Warning: Trying to remove nonexistent room build callback (function: 000002481D77A180) from humanoid (table: 000002480DAA5930).
Warning: Trying to remove nonexistent room remove callback (function: 0000024828AF24B0) from humanoid (table: 000002480DAA5930).
Warning: Trying to remove nonexistent staff callback (function: 000002481D7796A0) from humanoid (table: 000002480DAA5930).
Warning: Trying to remove nonexistent room build callback (function: 000002481D7951E0) from humanoid (table: 000002480D7E15C0).
Warning: Trying to remove nonexistent room remove callback (function: 000002482777F370) from humanoid (table: 000002480D7E15C0).
Warning: Trying to remove nonexistent staff callback (function: 000002481D794EE0) from humanoid (table: 000002480D7E15C0).
Warning: Trying to remove nonexistent room build callback (function: 000002482A4C49E0) from humanoid (table: 000002480DF81EF0).
Warning: Trying to remove nonexistent room remove callback (function: 000002482B0262B0) from humanoid (table: 000002480DF81EF0).
Warning: Trying to remove nonexistent staff callback (function: 000002482A4C4920) from humanoid (table: 000002480DF81EF0).
Warning: Trying to remove nonexistent room build callback (function: 000002482A4C9FC0) from humanoid (table: 000002480D894E30).
Warning: Trying to remove nonexistent room remove callback (function: 000002482A4F8370) from humanoid (table: 000002480D894E30).
Warning: Trying to remove nonexistent staff callback (function: 000002482A4C97E0) from humanoid (table: 000002480D894E30).
Warning: Trying to remove nonexistent room build callback (function: 000002482A52A080) from humanoid (table: 00000248274E1B60).
Warning: Trying to remove nonexistent room remove callback (function: 000002482C675AA0) from humanoid (table: 00000248274E1B60).
Warning: Trying to remove nonexistent staff callback (function: 000002482A52A7A0) from humanoid (table: 00000248274E1B60).
Warning: Trying to remove nonexistent room build callback (function: 000002482A4C72C0) from humanoid (table: 000002482771DE20).
Warning: Trying to remove nonexistent room remove callback (function: 000002482B5DD400) from humanoid (table: 000002482771DE20).
Warning: Trying to remove nonexistent staff callback (function: 000002482A4C7200) from humanoid (table: 000002482771DE20).
Warning: Trying to remove nonexistent room build callback (function: 000002482A566000) from humanoid (table: 000002480D874F30).
Warning: Trying to remove nonexistent room remove callback (function: 000002482B14AB10) from humanoid (table: 000002480D874F30).
Warning: Trying to remove nonexistent staff callback (function: 000002482A565A60) from humanoid (table: 000002480D874F30).
Warning: Trying to remove nonexistent room build callback (function: 000002482A561200) from humanoid (table: 0000024828D79AB0).
Warning: Trying to remove nonexistent room remove callback (function: 000002482D9D0700) from humanoid (table: 0000024828D79AB0).
Warning: Trying to remove nonexistent staff callback (function: 000002482A562880) from humanoid (table: 0000024828D79AB0).
Warning: Trying to remove nonexistent room build callback (function: 0000024827D855B0) from humanoid (table: 000002482747E9D0).
Warning: Trying to remove nonexistent room remove callback (function: 000002482C8E4620) from humanoid (table: 000002482747E9D0).
Warning: Trying to remove nonexistent staff callback (function: 0000024827D84B30) from humanoid (table: 000002482747E9D0).
Error in timer handler: 
Lua\hospital.lua:1383: attempt to index a nil value (local 'casebook')
stack traceback:
	Lua\hospital.lua:1383: in method 'receiveMoneyForTreatment'
	Lua\room.lua:178: in method 'dealtWithPatient'
	Lua\rooms\fracture_clinic.lua:74: in field 'after_use'
	Lua\humanoid_actions\multi_use_object.lua:313: in local 'timer_function'
	Lua\entity.lua:216: in method 'tick'
	Lua\world.lua:1074: in method 'onTick'
	Lua\app.lua:1202: in function <Lua\app.lua:1199>
	(...tail calls...)
	Lua\app.lua:1102: in function <Lua\app.lua:1097>

Additional Information

No response

@JamesWP JamesWP added the bug issue type label Feb 20, 2024
@tobylane
Copy link
Member

Do you have any saves, maybe autosaves? Ideally from before this patient entered the room.

The patient is probably attempting to pay the second nurse, after they were treated by, and paid, the first nurse.

@lewri
Copy link
Member

lewri commented Feb 21, 2024

A treated patient still returns a disease_id.
This would generally mean the disease was undiscovered.

function Hospital:receiveMoneyForTreatment(patient)
if not self.world.free_build_mode then
local disease_id = patient:getTreatmentDiseaseId()
if disease_id == nil then return end
local casebook = self.disease_casebook[disease_id]
local reason

Example (diagnostic steps override this return but in this case we're treating):

-----------------------------------
Clicked on:
humanoid - class: Standard Male Patient
Warmth: 0.287   Happiness: 1.000   Fatigue: 0.000  Thirst: 0.411  Toilet_Need: 0.590   Health: 1.000   Service Quality: 0.000
Actions: [walk - going to 7:1   must_happen, spawn   must_happen]
-----------------------------------
Loading UserFunction... [[ print(_:getTreatmentDiseaseId()) ]]
Executing UserFunction...
heaped_piles

Edit2: I wonder if it tried to do diag_fractured_bones
I can replicate such a thing with a debug patient. It also causes a 'ghost' nurse to spawn like the image.
Edit3: It causes diag_fracture_clinic

@lewri lewri added the P3 Medium Priority label Feb 24, 2024
@lewri
Copy link
Member

lewri commented Mar 3, 2024

@JamesWP did you have a savegame or autosave just before this error?

Edit: To be fair even a save with the crash it may benefit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants