private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo info)
{
if (entity is BuildingBlock)
{
var block = entity as BuildingBlock;
Message(info.InitiatorPlayer,block.ShortPrefabName);
}
if (entity.OwnerID != info.InitiatorPlayer.userID)
{
if (entity.ShortPrefabName.ToLower().Contains("foundations"))
{
Message(info.InitiatorPlayer, entity.ShortPrefabName);
}
}
}I tried to use the OnEntityTakeDamage event to get whether the short name of the foundation contains the field "foundations" to judge, but it doesn't seem to work when I use it.
Neither of the above two judgments gave the proper response. How can I correct it?