Fixed crash when tossing plushie while cacodemon is spawned.
This commit is contained in:
parent
68f110a010
commit
1ba3f0673f
@ -253,21 +253,25 @@ class KiriCacodemonPlushie : HDWeapon {
|
||||
{
|
||||
// Refuse to feed active monsters.
|
||||
if(invoker.spawned_creature || invoker.spawned_spawnball) {
|
||||
invoker.owner.A_Log(
|
||||
String.format(
|
||||
"Cannot feed blood to %s when they're not in their plushie!",
|
||||
invoker.getMonsterName()),
|
||||
true);
|
||||
if(invoker.owner) {
|
||||
invoker.owner.A_Log(
|
||||
String.format(
|
||||
"Cannot feed blood to %s when they're not in their plushie!",
|
||||
invoker.getMonsterName()),
|
||||
true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Refuse to feed monsters that don't need any more.
|
||||
if(invoker.getMonsterHealth() == invoker.getMonsterMaxHealth()) {
|
||||
invoker.owner.A_Log(
|
||||
String.format(
|
||||
"%s doesn't need any more food for now.",
|
||||
invoker.getMonsterName()),
|
||||
true);
|
||||
if(invoker.owner) {
|
||||
invoker.owner.A_Log(
|
||||
String.format(
|
||||
"%s doesn't need any more food for now.",
|
||||
invoker.getMonsterName()),
|
||||
true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -457,9 +461,12 @@ class KiriCacodemonPlushie : HDWeapon {
|
||||
if(spawned_creature) {
|
||||
spawned_creature.A_SpawnItemEx("TeleFog");
|
||||
spawned_creature.destroy();
|
||||
owner.A_Log(
|
||||
String.format("%s has returned to the plushie.", getMonsterName()),
|
||||
true);
|
||||
|
||||
if(owner) {
|
||||
owner.A_Log(
|
||||
String.format("%s has returned to the plushie.", getMonsterName()),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust help text because the context changed. Now we can
|
||||
@ -527,7 +534,9 @@ class KiriCacodemonPlushie : HDWeapon {
|
||||
if(fainted_monster_despawn_countdown ==
|
||||
KIRI_CACOPLUSHIE_FAINTED_MONSTER_COOLDOWN)
|
||||
{
|
||||
owner.A_Log(String.format("%s has fainted!", getMonsterName()), true);
|
||||
if(owner) {
|
||||
owner.A_Log(String.format("%s has fainted!", getMonsterName()), true);
|
||||
}
|
||||
}
|
||||
|
||||
// After some number of frames, actually despawn the
|
||||
@ -549,11 +558,13 @@ class KiriCacodemonPlushie : HDWeapon {
|
||||
// Shields were totally broken. Extremely low chance
|
||||
// to restore shields each frame.
|
||||
if(frandom(0, 100) < 0.1) {
|
||||
owner.A_Log(
|
||||
String.format(
|
||||
"%s's shields have started charging.",
|
||||
getMonsterName()),
|
||||
true);
|
||||
if(owner) {
|
||||
owner.A_Log(
|
||||
String.format(
|
||||
"%s's shields have started charging.",
|
||||
getMonsterName()),
|
||||
true);
|
||||
}
|
||||
setMonsterShield(0);
|
||||
}
|
||||
|
||||
@ -587,11 +598,13 @@ class KiriCacodemonPlushie : HDWeapon {
|
||||
// spawn.
|
||||
if(invoker.getMonsterFainted())
|
||||
{
|
||||
invoker.owner.A_Log(
|
||||
String.format(
|
||||
"%s has fainted and cannot manifest yet.",
|
||||
invoker.getMonsterName()),
|
||||
true);
|
||||
if(invoker.owner) {
|
||||
invoker.owner.A_Log(
|
||||
String.format(
|
||||
"%s has fainted and cannot manifest yet.",
|
||||
invoker.getMonsterName()),
|
||||
true);
|
||||
}
|
||||
|
||||
spawn_ball.A_SpawnItemEx("TeleFog");
|
||||
|
||||
@ -754,9 +767,11 @@ class KiriCacodemonPlushie : HDWeapon {
|
||||
} else {
|
||||
|
||||
// Tell the player we failed.
|
||||
invoker.owner.A_Log(
|
||||
String.format("Failed to summon %s: Not enough room.", invoker.getMonsterName()),
|
||||
true);
|
||||
if(invoker.owner) {
|
||||
invoker.owner.A_Log(
|
||||
String.format("Failed to summon %s: Not enough room.", invoker.getMonsterName()),
|
||||
true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user