Ejemplo n.º 1
0
        bool SystemTurretPlacementRequest(IArea currentArea, Player player, int turretID, ref float xPos, ref float yPos, out string resultMessage)
        {
            if (currentArea.AreaType != AreaTypes.System)
            {
                resultMessage = "Not in a system.";//Client shouldn't ever see this...
                return(false);
            }

            PSystem system = ((PSystem)(currentArea));


            if (!currentArea.CanAddStructure(player, StructureTypes.LaserTurret, xPos, yPos, out resultMessage))
            {
                return(false);
            }
            else if (player.GetActiveShip().Cargo.IsCargoInHolds(turretID) != StatefulCargoTypes.LaserTurret)
            {
                resultMessage = "Turret not found in ship cargo.";
                return(false);
            }
            else if (!system.GetValidStructurePosition(StructureStatManager.GetStats(StructureTypes.LaserTurret), ref xPos, ref yPos))
            {
                resultMessage = "Invalid structure position.";
                return(false);
            }


            resultMessage = "Success";
            return(true);
        }
Ejemplo n.º 2
0
        bool MinePlacementRequest(IArea currentArea, Player player, int mineID, ref float xPos, ref float yPos, out string resultMessage)
        {
            if (currentArea.AreaType != AreaTypes.System && currentArea.AreaType != AreaTypes.Planet)
            {
                resultMessage = "Not in area where mines can be placed.";//Client shouldn't ever see this...
                return(false);
            }


            if (!currentArea.CanAddStructure(player, StructureTypes.Mine, xPos, yPos, out resultMessage))
            {
                return(false);
            }
            else if (player.GetActiveShip().Cargo.IsCargoInHolds(mineID) != StatefulCargoTypes.DefensiveMine)
            {
                resultMessage = "Mine not found in ship cargo.";
                return(false);
            }
            else if (!currentArea.GetValidStructurePosition(StructureStatManager.GetStats(StructureTypes.Mine), ref xPos, ref yPos))
            {
                resultMessage = "Invalid structure position.";
                return(false);
            }


            resultMessage = "Success";
            return(true);
        }
Ejemplo n.º 3
0
        bool PlanetTurretPlacementRequest(IArea currentArea, Player player, int turretID, ref float xPos, ref float yPos, out string resultMessage)
        {
            if (currentArea.AreaType != AreaTypes.Planet)
            {
                resultMessage = "Not on a planet.";//Client shouldn't ever see this...
                return(false);
            }

            Planet planet = ((Planet)(currentArea));

            if (planet.IsColonized && planet.GetOwner() != player && !player.GetTeamIDs().Overlaps(planet.GetOwner().GetTeamIDs()))
            {
                resultMessage = "Cannot place turrets on unallied planets.";
                return(false);
            }
            else if (!currentArea.CanAddStructure(player, StructureTypes.LaserTurret, xPos, yPos, out resultMessage))
            {
                return(false);
            }
            else if (player.GetActiveShip().Cargo.IsCargoInHolds(turretID) != StatefulCargoTypes.LaserTurret)
            {
                resultMessage = "Turret not found in ship cargo.";
                return(false);
            }
            else if (!(planet.GetValidStructurePosition(StructureStatManager.GetStats(StructureTypes.LaserTurret), ref xPos, ref yPos)))
            {
                resultMessage = "Invalid structure position.";
                return(false);
            }


            resultMessage = "Success";
            return(true);
        }