Esempio n. 1
0
 public BCMLot(BCMLot lot)
 {
     Prefab     = lot.Prefab;
     Township   = lot.Township;
     Type       = lot.Type;
     InstanceId = lot.InstanceId;
     Position   = lot.Position;
     Rotation   = lot.Rotation;
     LotType    = lot.LotType;
 }
Esempio n. 2
0
 public BCMLot(RWG2.HubCell.Lot lot, BCMLotType type)
 {
     Prefab     = lot.PrefabName;
     Township   = lot.Township.ToString();
     Type       = lot.Type.ToString();
     InstanceId = lot.PrefabInstance.id;
     Position   = new BCMVector3(lot.PrefabSpawnPos);
     Rotation   = lot.RoadDirection;
     LotType    = type.ToString();
 }
Esempio n. 3
0
        private void LogPosition(BCMVector3 p, int r)
        {
            if (p.Equals(last))
            {
                return;
            }

            var ts = $"{DateTime.UtcNow:yyyy-MM-dd_HH_mm_ss.fffZ}";

            if (!LogDataCache.ContainsKey(ts))
            {
                LogDataCache.Add(ts, new LogData(new BCMVector4(p, r), "M"));
            }
            last = p;
        }
Esempio n. 4
0
        private static void RemoveEntity(int entityId, IDictionary <string, int> count = null)
        {
            var world = GameManager.Instance.World;

            if (world == null)
            {
                return;
            }

            if (!world.Entities.dict.ContainsKey(entityId))
            {
                if (!Options.ContainsKey("all"))
                {
                    SendOutput($"Invalid entityId, entity not found: {entityId}");
                }

                return;
            }

            var e = world.Entities.dict[entityId];

            switch (e)
            {
            case null:
                if (!Options.ContainsKey("all"))
                {
                    SendOutput($"Invalid entity, entity not found: {entityId}");
                }
                return;

            case EntityPlayer _:
                if (!Options.ContainsKey("all"))
                {
                    SendOutput("You can't remove a player!");
                }
                return;

            case EntityMinibike _:
                if (!Options.ContainsKey("minibike"))
                {
                    SendOutput("Minibike not removed, use /minibike to remove minibikes");

                    return;
                }
                break;
            }

            world.RemoveEntity(entityId, EnumRemoveEntityReason.Despawned);

            var entityClass = EntityClass.list[e.entityClass];

            if (Options.ContainsKey("all") || Options.ContainsKey("istype") || Options.ContainsKey("type") || Options.ContainsKey("minibike"))
            {
                if (count == null)
                {
                    return;
                }

                if (count.ContainsKey($"{e.GetType()}:{entityClass.entityClassName}"))
                {
                    count[$"{e.GetType()}:{entityClass.entityClassName}"]++;
                }
                else
                {
                    count.Add($"{e.GetType()}:{entityClass.entityClassName}", 1);
                }
            }
            else
            {
                var pos = new BCMVector3(e.position);
                SendOutput($"Entity Removed: {e.GetType()}:{(entityClass != null ? entityClass.entityClassName : "")} @{pos}");
            }
        }
Esempio n. 5
0
 public BCMTileEntity(Vector3i pos, TileEntity te)
 {
     Type = te.GetTileEntityType().ToString();
     Pos  = new BCMVector3(pos);
 }