From b5943ff60b60483e4c7e965a2828d6f5ed2df8df Mon Sep 17 00:00:00 2001 From: silvernexus Date: Tue, 20 Oct 2020 18:37:10 +0000 Subject: [PATCH] Fix handling in autojail when a player is killed by starvation. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@21519 282e977c-c81d-0410-88c4-b93c2d0d6712 --- ChangeLog | 1 + python/events/death/autojail.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index fdd396966..1bb76e7ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2020-10-20 Daniel Hawkins * scorn/houses/tannery: Fix flagstone tile in entrance area that doesn't prevent casting. * maps/python/quests/QuestAdvance.py: Bail when no player is provided. Avoids a core dump from the attempt to run the script in some scenarios. + * maps/python/events/death/autojail.py: Handle player deaths without a killer (e.g. from starvation) 2020-10-12 Daniel Hawkins * pup_land/begin/adv: Utilize the randomized item generation for the creator arch rather than separate diff --git a/python/events/death/autojail.py b/python/events/death/autojail.py index cffe2d747..5483a69ad 100644 --- a/python/events/death/autojail.py +++ b/python/events/death/autojail.py @@ -1,7 +1,7 @@ # # This module will automaticall arrest players killing other players, # provided the option was activated by a DM through 'autojail 1'. -# Note the settings defaults to 0 and isn't kept during server resets. +# Note the settings defaults to 0 and isn't kept during server resets. import Crossfire @@ -9,6 +9,11 @@ import Crossfire def check_autojail(): killer = Crossfire.WhoIsActivator() + # If a player dies by starvation, there is no killer. + # Bail if that is the case. + if killer is None: + return + if killer.Type != Crossfire.Type.PLAYER or killer.DungeonMaster: return