- function UIFax:choice(choice,additionalInfo)
- .......
- -- VIP may choose to visit anyway if he is refused too often
- elseif (self.ui.hospital.vip_declined > 2 and vip_ignores_refusal == 2) and choice == "refuse_vip" then
- self.ui.hospital.num_vips = self.ui.hospital.num_vips + 1
- self.ui.app.world:spawnVIP(additionalInfo.name) <------------ CRASH
- self.ui.hospital.vip_declined = 0
- elseif choice == "refuse_vip" then
- self.ui.app.world:nextVip() -- don't start an inspection
- self.ui.hospital.vip_declined = self.ui.hospital.vip_declined + 1
- elseif choice == "accept_vip" then
- self.ui.hospital.num_vips = self.ui.hospital.num_vips + 1
- self.ui.app.world:spawnVIP(additionalInfo.name) <------------- but this is the same call for accepting
- -- Removes the Message, executing a choice if given, else just deletes it
- --!param choice_number (number) if given, removes the message by executing this choice.
- function UIMessage:removeMessage(choice_number)
- if choice_number then
- if not self.fax then
- self.fax = UIFax(self.ui, self) -- NB: just create, don't add to ui
- end
- self.fax:choice(self.message.choices[choice_number].choice) <---- Caller of the CRASH
- else
- Function creating the invitation
- Both choices have the "additionalInfo" field.
- -- Creates VIP and sends a FAX to query the user.
- function Hospital:createVip()
- local vipName = _S.vip_names[math.random(1,10)]
- local message = {
- {text = _S.fax.vip_visit_query.vip_name:format(vipName)},
- choices = {{text = _S.fax.vip_visit_query.choices.invite, choice = "accept_vip", additionalInfo = {name=vipName}},
- {text = _S.fax.vip_visit_query.choices.refuse, choice = "refuse_vip", additionalInfo = {name=vipName}}}
- }
- -- auto-refuse after 20 days
- self.world.ui.bottom_panel:queueMessage("personality", message, nil, 24*20, 2)
- end