Talk:Lost soul colliding with items



Just above the if given in the example in this article, there is another if in the same function with code that checks when the lost soul slams into things. I have been able to fix it by putting the code that stops the lost soul inside another if that checks if the health of the target is above 0. This seems to work, but is it a good fix?

   // check for skulls slamming into things
   if (tmthing->flags & MF_SKULLFLY)
       damage = ((P_Random()%8)+1)*tmthing->info->damage;
       P_DamageMobj (thing, tmthing, tmthing, damage);
       if (thing->health <= 0)    // Added this if to fix the bug. The code inside the if was already there. 
           tmthing->flags &= ~MF_SKULLFLY;
           tmthing->momx = tmthing->momy = tmthing->momz = 0;
           P_SetMobjState (tmthing, tmthing->info->spawnstate);
           return false;		// stop moving

I don't know how other ports fix this, but my code works. The lost soul doesn't destroy things on the ground when it passes over them when it charges and it still continue to fly after it charged at its target, but the target died before it hit it. It is also not blocked by corpses. I didn't do "extended testing", so I prefer to get the approval from other source port developers before I may do changes to this article. BTW, you can also fix it by removing the if that I added and the code that was inside it, but the lost soul will fly through the player's body when it kills him (which looks cool, but in vanilla the lost soul stopped). --Axdoomer (talk) 00:23, 16 March 2017 (CDT)