private WorldRayHitInfo GetHitInfo(out float damageScale)
    {
        EntityMoveHelper moveHelper = this.theEntity.moveHelper;

        damageScale = moveHelper.DamageScale + this.damageBoostPercent;
        return(moveHelper.HitInfo);
    }
        public static bool Prefix(EntityMoveHelper __instance)
        {
            if (EntityUtilities.IsHuman(__instance.entity.entityId))
            {
                return(false);
            }

            return(true);
        }
        public static bool Prefix(ref EntityMoveHelper __instance, bool calcYaw, float distance = 0f, float heightDiff = 0)
        {
            //Debug.Log("Start Jump");
            if (heightDiff == 1.4f)
            {
                EntityUtilities.Stop(__instance.entity.entityId);
                return(false);
            }

            return(true);
        }
    public override void Update()
    {
        EntityMoveHelper moveHelper = this.theEntity.moveHelper;

        if (this.attackDelay > 0)
        {
            this.attackDelay--;
        }
        if (this.attackDelay <= 0)
        {
            this.AttackBlock();
        }
    }
Example #5
0
    public override void Update()
    {
        this.time += 0.05f;
        if (!EntityUtilities.CheckProperty(this.theEntity.entityId, "PathingBlocks"))
        {
            return;
        }

        EntityMoveHelper moveHelper = this.theEntity.moveHelper;

        //If we are close, be done with it.
        float dist = Vector3.Distance(this.position, this.theEntity.position);

        if (dist < 0.1f)
        {
            DisplayLog("I am within 1f of the block: " + dist);
            BlockValue block = GameManager.Instance.World.GetBlock(new Vector3i(this.position));
            if (block.type != BlockValue.Air.type || block.Block.GetBlockName() != "PathingCube")
            {
                DisplayLog("I am close enough to this block: " + block.Block.GetBlockName());
//                if (block.Block.GetBlockName() == "bedroll")
//                {
//                    Debug.Log("At a bedroll");
//                    if (this.theEntity.emodel != null && this.theEntity.emodel.avatarController != null)
//                    {
//                        DisplayLog("Turning into crawler");
//                        int sleeperPose = (int)this.theEntity.rand.RandomRange(0, 9);
//                        this.theEntity.emodel.avatarController.TriggerSleeperPose(sleeperPose);
//                       // this.theEntity.emodel.avatarController.TurnIntoCrawler(true);
////                        this.theEntity.emodel.avatarController.GetAnimator().enabled =false;
//                    }

//                }
                moveHelper.Stop();
                this.theEntity.navigator.clearPath();
                this.time = 40f;
                return;
            }
        }

        //Check if we are blocked, which may indicate that we are at a door that we want to open.
        //if (moveHelper.IsBlocked && moveHelper.BlockedTime > 0.09)
        //{
        //    DisplayLog("I am blocked, and I've been blocked for more than 0.010 seconds. I cannot keep going.");
        //    moveHelper.Stop();
        //    this.time = 40f;
        //    return;
        //}
    }
        public static bool Prefix(EntityMoveHelper __instance, ref float heightDiff, EntityAlive ___entity)
        {
            float JumpHeight = EntityUtilities.GetFloatValue(___entity.entityId, "JumpHeight");

            if (JumpHeight == -1f)
            {
                return(true);
            }

            if (JumpHeight == 0f)
            {
                return(true);
            }

            // These are the values set in the EntityMoveHelper's update. They are filtered here so that the EAI Task Swim and Leap will be unaffected.
            //   if ( heightDiff > 1.1f && heightDiff < 1.5f)
            heightDiff = JumpHeight;

            return(true);
        }
    public override void Update()
    {
        this.time += 0.05f;
        if (!EntityUtilities.CheckProperty(this.theEntity.entityId, "PathingBlocks"))
        {
            return;
        }

        EntityMoveHelper moveHelper = this.theEntity.moveHelper;

        //If we are close, be done with it. This is to help prevent the NPC from standing on certain workstations that its supposed to path too.
        float dist = Vector3.Distance(this.position, this.theEntity.position);

        if (dist < 2f)
        {
            DisplayLog("I am within 1f of the block: " + dist);
            BlockValue block = GameManager.Instance.World.GetBlock(new Vector3i(this.position));
            if (block.type != BlockValue.Air.type || block.Block.GetBlockName() != "PathingCube")
            {
                DisplayLog("I am close enough to this block: " + block.Block.GetBlockName());
                // Test code here
                //                if (block.Block.GetBlockName() == "bedroll")
                //                {
                //                    Debug.Log("At a bedroll");
                //                    if (this.theEntity.emodel != null && this.theEntity.emodel.avatarController != null)
                //                    {
                //                        DisplayLog("Turning into crawler");
                //                        int sleeperPose = (int)this.theEntity.rand.RandomRange(0, 9);
                //                        this.theEntity.emodel.avatarController.TriggerSleeperPose(sleeperPose);
                //                       // this.theEntity.emodel.avatarController.TurnIntoCrawler(true);
                ////                        this.theEntity.emodel.avatarController.GetAnimator().enabled =false;
                //                    }
                //                }

                // Call the stop, and set the to 40, which kills the task.
                //  EntityUtilities.Stop(this.theEntity.entityId);
                this.time = 90f;
                return;
            }
        }
    }
 public static void Postfix(ref EntityMoveHelper __instance, ref EntityAlive ___entity)
 {
     ___entity.speedForward = 0f;
 }
 public static void Postfix(ref EntityMoveHelper __instance)
 {
     __instance.entity.speedForward = 0f;
 }