Upload from upload_mods.ps1
This commit is contained in:
168
Scripts/Entities/EntityEnemyAnimalRebirth.cs
Normal file
168
Scripts/Entities/EntityEnemyAnimalRebirth.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
public class EntityEnemyAnimalRebirth : EntityEnemy
|
||||
{
|
||||
public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale = 1f)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0");
|
||||
EnumDamageSource source = _damageSource.GetSource();
|
||||
if (_damageSource.IsIgnoreConsecutiveDamages() && source != EnumDamageSource.Internal)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0a");
|
||||
if (this.damageSourceTimeouts.ContainsKey(source) && GameTimer.Instance.ticks - this.damageSourceTimeouts[source] < 30UL)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 0b");
|
||||
return 0;
|
||||
}
|
||||
this.damageSourceTimeouts[source] = GameTimer.Instance.ticks;
|
||||
}
|
||||
EntityAlive entityAlive = this.world.GetEntity(_damageSource.getEntityId()) as EntityAlive;
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1");
|
||||
if (!this.FriendlyFireCheck(entityAlive))
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 1a");
|
||||
return 0;
|
||||
}
|
||||
bool flag = _damageSource.GetDamageType() == EnumDamageTypes.Heat;
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2");
|
||||
if (!flag && entityAlive is EntityMeleeCyborgRebirth && this is EntityEnemyAnimalRebirth)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2a");
|
||||
return 0;
|
||||
}
|
||||
if (this.IsGodMode.Value)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 2b");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool flagSuicide = _damageSource.GetDamageType() == EnumDamageTypes.Suicide;
|
||||
//var myRelationship = FactionManager.Instance.GetRelationshipTier(this, entityAlive);
|
||||
|
||||
bool shouldAttack = RebirthUtilities.VerifyFactionStanding(this, entityAlive, true);
|
||||
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3");
|
||||
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Love*/)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3a");
|
||||
return 0;
|
||||
}
|
||||
if (!flagSuicide && !shouldAttack/*myRelationship == FactionManager.Relationship.Like*/)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3b");
|
||||
return 0;
|
||||
}
|
||||
if (entityAlive != null)
|
||||
{
|
||||
if (!flagSuicide && !shouldAttack /*myRelationship == FactionManager.Relationship.Neutral*/ && (this.entityClass == entityAlive.entityClass))
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 3c");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4");
|
||||
if (!this.IsDead() && entityAlive)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4a");
|
||||
float value = EffectManager.GetValue(PassiveEffects.DamageBonus, null, 0f, entityAlive, null, new FastTags<TagGroup.Global>(), true, true, true, true, true, 1);
|
||||
if (value > 0f)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 4b");
|
||||
_damageSource.DamageMultiplier = value;
|
||||
_damageSource.BonusDamageType = EnumDamageBonusType.Sneak;
|
||||
}
|
||||
}
|
||||
DamageResponse damageResponse = this.damageEntityLocal(_damageSource, _strength, _criticalHit, _impulseScale);
|
||||
NetPackage package = NetPackageManager.GetPackage<NetPackageDamageEntity>().Setup(this.entityId, damageResponse);
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5");
|
||||
if (this.world.IsRemote())
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5a");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(package, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5b");
|
||||
int excludePlayer = -1;
|
||||
if (!flag && _damageSource.CreatorEntityId != -2)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5c");
|
||||
excludePlayer = _damageSource.getEntityId();
|
||||
if (_damageSource.CreatorEntityId != -1)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5d");
|
||||
Entity entity = this.world.GetEntity(_damageSource.CreatorEntityId);
|
||||
if (entity && !entity.isEntityRemote)
|
||||
{
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 5e");
|
||||
excludePlayer = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.world.entityDistributer.SendPacketToTrackedPlayersAndTrackedEntity(this.entityId, excludePlayer, package);
|
||||
}
|
||||
//Log.Out("EntityMeleeCyborgRebirth-DamageEntity 6");
|
||||
return damageResponse.ModStrength;
|
||||
}
|
||||
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
if (!(bool)(UnityEngine.Object)this.ModelTransform)
|
||||
return;
|
||||
this.animator = this.ModelTransform.GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
public override Color GetMapIconColor() => new Color(1f, 0.8235294f, 0.34117648f);
|
||||
|
||||
public override void playStepSound(string stepSound)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool isGameMessageOnDeath() => false;
|
||||
|
||||
/*public override void OnUpdateLive()
|
||||
{
|
||||
RebirthUtilities.CheckSleeperActivated(this);
|
||||
base.OnUpdateLive();
|
||||
}*/
|
||||
|
||||
/*public override void VisiblityCheck(float _distanceSqr, bool _masterIsZooming)
|
||||
{
|
||||
bool bVisible = _distanceSqr < (float)(_masterIsZooming ? 14400 : 8100);
|
||||
this.emodel.SetVisible(bVisible, false);
|
||||
}*/
|
||||
|
||||
public override bool CanDamageEntity(int _sourceEntityId)
|
||||
{
|
||||
Entity entity = this.world.GetEntity(_sourceEntityId);
|
||||
//Log.Out("ME: class=" + this.entityClass + ", entity=" + this.entityName);
|
||||
//Log.Out("THEM: class=" + entity.entityClass + ", entity=" + entity.name);
|
||||
bool cCanDamageEntity = !entity || entity.entityClass != this.entityClass;
|
||||
//Log.Out("EntityEnemyAnimalRebirth-CanDamageEntity: " + cCanDamageEntity);
|
||||
return cCanDamageEntity;
|
||||
}
|
||||
|
||||
|
||||
public override void updateTasks()
|
||||
{
|
||||
if ((this.Buffs.HasBuff("buffShocked") || RebirthUtilities.HasBuffLike(this, "FuriousRamsayRangedStun")) && !this.HasAnyTags(FastTags<TagGroup.Global>.Parse("ally")))
|
||||
{
|
||||
this.motion = this.rand.RandomOnUnitSphere * -0.075f;
|
||||
this.motion.y = this.motion.y + -0.060000002f;
|
||||
if (this.animator)
|
||||
{
|
||||
this.animator.enabled = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.animator)
|
||||
this.animator.enabled = true;
|
||||
base.updateTasks();
|
||||
}
|
||||
}
|
||||
|
||||
private Animator animator;
|
||||
}
|
||||
Reference in New Issue
Block a user