98 lines
2.5 KiB
C#
98 lines
2.5 KiB
C#
public abstract class EntityCoreSDX : EntityAlive
|
|
{
|
|
public override void Init(int _entityClass)
|
|
{
|
|
base.Init(_entityClass);
|
|
this.emodel.SetVisible(false, false);
|
|
}
|
|
|
|
public override void InitFromPrefab(int _entityClass)
|
|
{
|
|
base.InitFromPrefab(_entityClass);
|
|
this.emodel.SetVisible(false, false);
|
|
}
|
|
|
|
public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
|
|
{
|
|
bool bVisible = this.ticksUntilVisible <= 0 && _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
|
|
this.emodel.SetVisible(bVisible, false);
|
|
}
|
|
|
|
public override void PostInit()
|
|
{
|
|
base.PostInit();
|
|
if (!this.isEntityRemote)
|
|
{
|
|
this.IsBloodMoon = this.world.aiDirector.BloodMoonComponent.BloodMoonActive;
|
|
}
|
|
}
|
|
|
|
public override bool IsDrawMapIcon()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override Vector3 GetMapIconScale()
|
|
{
|
|
return new Vector3(0.75f, 0.75f, 1f);
|
|
}
|
|
|
|
public override bool IsSavedToFile()
|
|
{
|
|
return (base.GetSpawnerSource() != EnumSpawnerSource.Dynamic || this.IsDead()) && base.IsSavedToFile();
|
|
}
|
|
|
|
public override bool canDespawn()
|
|
{
|
|
return (!this.IsHordeZombie || this.world.GetPlayers().Count == 0) && base.canDespawn();
|
|
}
|
|
|
|
public override void OnUpdateLive()
|
|
{
|
|
try
|
|
{
|
|
base.OnUpdateLive();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Out("EntityCoreSDX-OnUpdateLive ERROR: " + ex.Message);
|
|
}
|
|
if (this.ticksUntilVisible > 0)
|
|
{
|
|
this.ticksUntilVisible--;
|
|
}
|
|
}
|
|
|
|
public override bool isRadiationSensitive()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public override bool isDetailedHeadBodyColliders()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override void OnEntityTargeted(EntityAlive target)
|
|
{
|
|
base.OnEntityTargeted(target);
|
|
if (!this.isEntityRemote && base.GetSpawnerSource() != EnumSpawnerSource.Dynamic && target is EntityPlayer)
|
|
{
|
|
this.world.aiDirector.NotifyIntentToAttack(this, target as EntityPlayer);
|
|
}
|
|
}
|
|
|
|
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale)
|
|
{
|
|
return base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale);
|
|
}
|
|
|
|
public override bool isGameMessageOnDeath()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public bool IsHordeZombie;
|
|
private int ticksUntilVisible = 2;
|
|
}
|