Upload from upload_mods.ps1

This commit is contained in:
Nathaniel Cosford
2025-06-04 16:44:53 +09:30
commit f1fbbe67bb
1722 changed files with 165268 additions and 0 deletions

View File

@@ -0,0 +1,182 @@
using System.Collections.Generic;
using System.Threading.Tasks;
public class EAIBreakBlockZombieRebirth : EAIBase
{
public override void Init(EntityAlive _theEntity)
{
base.Init(_theEntity);
this.MutexBits = 8;
this.executeDelay = 0.15f;
}
public override bool CanExecute()
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute START");
EntityMoveHelper moveHelper = this.theEntity.moveHelper;
if ((this.theEntity.Jumping && !moveHelper.IsDestroyArea) || this.theEntity.bodyDamage.CurrentStun != EnumEntityStunType.None)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 1");
return false;
}
if (moveHelper.BlockedTime > 0.35f && moveHelper.CanBreakBlocks)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 2");
if (moveHelper.HitInfo != null)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 3");
Vector3i blockPos = moveHelper.HitInfo.hit.blockPos;
if (this.theEntity.world.GetBlock(blockPos).isair)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 4");
return false;
}
var block = GameManager.Instance.World.GetBlock(blockPos);
bool bHasTags = Block.list[block.type].HasTag(BlockTags.Door);
bool bIsOpen = !BlockDoor.IsDoorOpen(block.meta);
/*Log.Out("EAIBreakBlockZombieRebirth-CanExecute block.meta: " + block.meta);
Log.Out("EAIBreakBlockZombieRebirth-CanExecute bHasTags: " + bHasTags);
Log.Out("EAIBreakBlockZombieRebirth-CanExecute bIsOpen: " + bIsOpen);*/
bool isHatch = block.Block.GetBlockName().Contains("Hatch");
bool isDoorOpen = BlockDoor.IsDoorOpen(block.meta);
if (Block.list[block.type].HasTag(BlockTags.Door) &&
(!isDoorOpen || (isHatch && isDoorOpen))
)
{
/*Log.Out("EAIBreakBlockZombieRebirth-CanExecute rotation.x: " + block.Block.shape.GetRotation(block).x);
Log.Out("EAIBreakBlockZombieRebirth-CanExecute rotation.y: " + block.Block.shape.GetRotation(block).y);
Log.Out("EAIBreakBlockZombieRebirth-CanExecute rotation.z: " + block.Block.shape.GetRotation(block).z);*/
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute IS DOOR AND IS CLOSED");
if (GameManager.Instance.World.GetTileEntity(0, blockPos) is TileEntitySecureDoor tileEntitySecureDoor)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 5");
if (!tileEntitySecureDoor.IsLocked())
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute DOOR IS NOT LOCKED");
var chunk = this.theEntity.world.GetChunkFromWorldPos(blockPos) as Chunk;
if (tileEntitySecureDoor != null)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 6");
float flCanOpenDoors = this.theEntity.Buffs.GetCustomVar("$varFuriousRamsayOpenDoors");
if (flCanOpenDoors == 1)
{
if ((isHatch && isDoorOpen) || (!isHatch && !isDoorOpen))
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 7");
tileEntitySecureDoor.SetLocked(false);
/*
todo fix
block.Block.OnBlockActivated(this.theEntity.world, chunk.ClrIdx, blockPos, block, theEntity);
*/
Task task = Task.Delay(2000);
return false;
}
}
}
}
}
}
}
float num = moveHelper.CalcBlockedDistanceSq();
float num2 = this.theEntity.m_characterController.GetRadius() + 0.6f;
if (num <= num2 * num2)
{
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute 8");
return true;
}
}
//Log.Out("EAIBreakBlockZombieRebirth-CanExecute END");
return false;
}
public override void Start()
{
this.attackDelay = 1;
Vector3i blockPos = this.theEntity.moveHelper.HitInfo.hit.blockPos;
Block block = this.theEntity.world.GetBlock(blockPos).Block;
if (block.HasTag(BlockTags.Door) || block.HasTag(BlockTags.ClosetDoor))
{
this.theEntity.IsBreakingDoors = true;
}
}
public override bool Continue()
{
return this.theEntity.bodyDamage.CurrentStun == EnumEntityStunType.None && this.theEntity.onGround && this.CanExecute();
}
public override void Update()
{
EntityMoveHelper moveHelper = this.theEntity.moveHelper;
if (this.attackDelay > 0)
{
this.attackDelay--;
}
if (this.attackDelay <= 0)
{
this.AttackBlock();
}
}
public override void Reset()
{
this.theEntity.IsBreakingBlocks = false;
this.theEntity.IsBreakingDoors = false;
}
private void AttackBlock()
{
this.theEntity.SetLookPosition(Vector3.zero);
ItemActionAttackData itemActionAttackData = this.theEntity.inventory.holdingItemData.actionData[0] as ItemActionAttackData;
if (itemActionAttackData == null)
{
return;
}
this.damageBoostPercent = 0f;
Bounds bb;
bb = new Bounds(this.theEntity.position, new Vector3(1.7f, 1.5f, 1.7f));
this.theEntity.world.GetEntitiesInBounds(typeof(EntityZombie), bb, this.allies);
for (int i = this.allies.Count - 1; i >= 0; i--)
{
if ((EntityZombie)this.allies[i] != this.theEntity)
{
this.damageBoostPercent += 0.2f;
}
}
this.allies.Clear();
if (this.theEntity.Attack(false))
{
this.theEntity.IsBreakingBlocks = true;
float num = 0.25f + base.RandomFloat * 0.8f;
if (this.theEntity.moveHelper.IsUnreachableAbove)
{
num *= 0.5f;
}
this.attackDelay = (int)((num + 0.75f) * 20f);
itemActionAttackData.hitDelegate = new ItemActionAttackData.HitDelegate(this.GetHitInfo);
this.theEntity.Attack(true);
}
}
private WorldRayHitInfo GetHitInfo(out float damageScale)
{
EntityMoveHelper moveHelper = this.theEntity.moveHelper;
damageScale = moveHelper.DamageScale + this.damageBoostPercent;
return moveHelper.HitInfo;
}
private const float cDamageBoostPerAlly = 0.2f;
private int attackDelay;
private float damageBoostPercent;
private List<Entity> allies = new List<Entity>();
}