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