コード例 #1
0
        public override void Initialize(ICoreAPI api, JsonObject properties)
        {
            base.Initialize(api, properties);

            capi = api as ICoreClientAPI;

            switch (ownFacing.Code)
            {
            case "north":
            case "south":
                AxisSign = new int[] { 0, 0, -1 };
                break;

            case "east":
            case "west":
                AxisSign = new int[] { -1, 0, 0 };
                break;
            }

            if (api.Side == EnumAppSide.Server)
            {
                partitionUtil = Api.ModLoader.GetModSystem <EntityPartitioning>();
            }
            if (Api.Side == EnumAppSide.Client)
            {
                updateShape(api.World);
            }
        }
コード例 #2
0
        public override void Initialize(EntityProperties properties, ICoreAPI api, long InChunkIndex3d)
        {
            base.Initialize(properties, api, InChunkIndex3d);

            msLaunch = World.ElapsedMilliseconds;

            collisionTestBox = CollisionBox.Clone().OmniGrowBy(0.05f);

            if (api.Side == EnumAppSide.Server)
            {
                GetBehavior <EntityBehaviorPassivePhysics>().OnPhysicsTickCallback = onPhysicsTickCallback;

                ep = api.ModLoader.GetModSystem <EntityPartitioning>();
            }
        }
コード例 #3
0
        public override void LoadConfig(JsonObject taskConfig, JsonObject aiConfig)
        {
            //Modified
            base.LoadConfig(taskConfig, aiConfig);

            entityUtil = entity.Api.ModLoader.GetModSystem <EntityPartitioning>();

            //this.damage = taskConfig["damage"].AsFloat(2) * entity.Stats.GetBlended("rangedWeaponsDamage"); ;
            this.burstCooldownMs  = taskConfig["burstCooldownMs"].AsInt(100);
            this.burstSize        = taskConfig["burstSize"].AsInt(1);
            this.projectileCount  = taskConfig["projectileCount"].AsInt(1);
            this.damagePlayerAtMs = taskConfig["damagePlayerAtMs"].AsInt(500);

            this.minDist      = taskConfig["minDist"].AsFloat(2f);
            this.minVerDist   = taskConfig["minVerDist"].AsFloat(0f);
            this.maxDist      = taskConfig["maxDist"].AsFloat(20f);
            this.maxVerDist   = taskConfig["maxVerDist"].AsFloat(10f);
            this.spreadAngle  = taskConfig["spreadAngle"].AsFloat(0f);
            this.shotVelocity = taskConfig["shotVelocity"].AsFloat(1f);

            this.bodyPitch   = taskConfig["bodyPitch"].AsBool(false);
            this.fireThrough = taskConfig["fireThrough"].AsBool(false);

            if (taskConfig["entityCodes"] != null)
            {
                string[] codes = taskConfig["entityCodes"].AsArray <string>(new string[] { "player" });

                List <string> exact      = new List <string>();
                List <string> beginswith = new List <string>();

                for (int i = 0; i < codes.Length; i++)
                {
                    string code = codes[i];
                    if (code.EndsWith("*"))
                    {
                        beginswith.Add(code.Substring(0, code.Length - 1));
                    }
                    else
                    {
                        exact.Add(code);
                    }
                }

                seekEntityCodesExact      = exact.ToArray();
                seekEntityCodesBeginsWith = beginswith.ToArray();
            }
        }
コード例 #4
0
 public AiTaskRefuel(EntityAgent entity) : base(entity)
 {
     entityUtil = entity.Api.ModLoader.GetModSystem <EntityPartitioning>();
 }
コード例 #5
0
        public override void LoadConfig(JsonObject taskConfig, JsonObject aiConfig)
        {
            partitionUtil = entity.Api.ModLoader.GetModSystem <EntityPartitioning>();

            base.LoadConfig(taskConfig, aiConfig);


            if (taskConfig["leapAnimation"].Exists)
            {
                leapAnimationCode = taskConfig["leapAnimation"].AsString(null);
            }

            if (taskConfig["leapChance"].Exists)
            {
                leapChance = taskConfig["leapChance"].AsFloat(1);
            }

            if (taskConfig["leapHeightMul"].Exists)
            {
                leapHeightMul = taskConfig["leapHeightMul"].AsFloat(1);
            }

            if (taskConfig["movespeed"] != null)
            {
                moveSpeed = taskConfig["movespeed"].AsFloat(0.02f);
            }

            if (taskConfig["seekingRange"] != null)
            {
                seekingRange = taskConfig["seekingRange"].AsFloat(25);
            }

            if (taskConfig["belowTempSeekingRange"] != null)
            {
                belowTempSeekingRange = taskConfig["belowTempSeekingRange"].AsFloat(25);
            }

            if (taskConfig["belowTempThreshold"] != null)
            {
                belowTempThreshold = taskConfig["belowTempThreshold"].AsFloat(-999);
            }



            if (taskConfig["maxFollowTime"] != null)
            {
                maxFollowTime = taskConfig["maxFollowTime"].AsFloat(60);
            }

            if (taskConfig["alarmHerd"] != null)
            {
                alarmHerd = taskConfig["alarmHerd"].AsBool(false);
            }

            if (taskConfig["leapAtTarget"] != null)
            {
                leapAtTarget = taskConfig["leapAtTarget"].AsBool(false);
            }

            if (taskConfig["entityCodes"] != null)
            {
                string[] codes = taskConfig["entityCodes"].AsArray <string>(new string[] { "player" });

                List <string> exact      = new List <string>();
                List <string> beginswith = new List <string>();

                for (int i = 0; i < codes.Length; i++)
                {
                    string code = codes[i];
                    if (code.EndsWith("*"))
                    {
                        beginswith.Add(code.Substring(0, code.Length - 1));
                    }
                    else
                    {
                        exact.Add(code);
                    }
                }

                seekEntityCodesExact      = exact.ToArray();
                seekEntityCodesBeginsWith = beginswith.ToArray();
            }
        }