Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo, docks and drones #593

Closed
wants to merge 14 commits into from
Closed
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ thumbs.db
*.swp

options.ini


.vscode
*.html
logs
*.log
*.log
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project(EmptyEpsilon)
cmake_minimum_required(VERSION 2.8.12)


option(ENABLE_CRASH_LOGGER "Enable the drmingw crash logging facilities" OFF)
message(STATUS "ENABLE_CRASH_LOGGER is " ${ENABLE_CRASH_LOGGER})

Expand Down Expand Up @@ -75,6 +76,8 @@ endif()
set(EXECUTABLE_NAME "EmptyEpsilon")
set(SOURCES
src/main.cpp
src/cargo.cpp
src/shipCargo.cpp
src/threatLevelEstimate.cpp
src/preferenceManager.cpp
src/pathPlanner.cpp
Expand All @@ -94,6 +97,7 @@ set(SOURCES
src/gameStateLogger.cpp
src/shipTemplate.cpp
src/beamTemplate.cpp
src/tractorBeamTemplate.cpp
src/missileWeaponData.cpp
src/factionInfo.cpp
src/mesh.cpp
Expand Down Expand Up @@ -123,6 +127,7 @@ set(SOURCES
src/screens/crew6/weaponsScreen.cpp
src/screens/crew6/helmsScreen.cpp
src/screens/crew1/singlePilotScreen.cpp
src/screens/crew1/singlePilotView.cpp
src/screens/extra/damcon.cpp
src/screens/extra/powerManagement.cpp
src/screens/extra/databaseScreen.cpp
Expand All @@ -132,6 +137,8 @@ set(SOURCES
src/screens/gm/globalMessageEntryView.cpp
src/screens/gm/chatDialog.cpp
src/screens/gm/tweak.cpp
src/screens/extra/droneOperatorScreen.cpp
src/screens/extra/dockMasterScreen.cpp
src/screenComponents/aimLock.cpp
src/screenComponents/alertOverlay.cpp
src/screenComponents/helpOverlay.cpp
Expand Down Expand Up @@ -229,7 +236,9 @@ set(SOURCES
src/spaceObjects/planet.cpp
src/spaceObjects/zone.cpp
src/spaceObjects/spaceshipParts/beamWeapon.cpp
src/spaceObjects/spaceshipParts/tractorBeam.cpp
src/spaceObjects/spaceshipParts/weaponTube.cpp
src/spaceObjects/spaceshipParts/dock.cpp
src/ai/fighterAI.cpp
src/ai/ai.cpp
src/ai/aiFactory.cpp
Expand Down
Empty file.
Binary file added resources/gui/icons/heat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion scripts/shipTemplates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Each sub-file defines it's own set of ship classes.

These are:
* Stations: For different kinds of space stations, from tiny to huge.
* Starfighters: Smallest ships in the game.
* Drones: Smallest ships in the game. docked inside other ships.
* Starfighters: Small ships. fast and simple.
* Frigates: Medium sized ships. Operate on a small crew.
* Covette: Large, slower, less maneuverable ships.
* Dreadnaught: Huge things. Everything in here is really really big, and generally really really deadly.
Expand All @@ -13,6 +14,7 @@ Player ships are in general large frigates to small corvette class
--]]
require("shipTemplates_Stations.lua")
---[[Until these are ready, they are disabled
require("shipTemplates_Drones.lua")
require("shipTemplates_StarFighters.lua")
require("shipTemplates_Frigates.lua")
require("shipTemplates_Corvette.lua")
Expand Down
14 changes: 11 additions & 3 deletions scripts/shipTemplates_Corvette.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ They come in 3 different subclasses:

template = ShipTemplate():setName("Atlantis X23"):setClass("Corvette", "Destroyer"):setModel("battleship_destroyer_1_upgraded")
template:setDescription([[The Atlantis X23 is the smallest model of destroyer, and its combination of frigate-like size and corvette-like power makes it an excellent escort ship when defending larger ships against multiple smaller enemies. Because the Atlantis X23 is fitted with a jump drive, it can also serve as an intersystem patrol craft.]])
template:setDockClasses("Drone")
template:setRadarTrace("radar_dread.png")
template:setHull(100)
template:setShields(200, 200, 200, 200)
Expand All @@ -29,9 +30,16 @@ template:setTubeDirection(0, -90)
template:setTubeDirection(1, -90)
template:setTubeDirection(2, 90)
template:setTubeDirection(3, 90)
template:setDocks(6, 2, 2, 2)
template:addDrones("L3 Mouse", 4)
template:addDrones("L3 Cat", 2)
template:addDrones("H9 Owl", 1)
template:addDrones("M19 Rino", 1)
template:setTractorBeam(200000, 100)

variation = template:copy("Atlantis"):setType("playership")
variation:setDescription([[A refitted Atlantis X23 for more general tasks. The large shield system has been replaced with an advanced combat maneuvering systems and improved impulse engines. Its missile loadout is also more diverse. Mistaking the modified Atlantis for an Atlantis X23 would be a deadly mistake.]])
template:setDockClasses("Drone")
variation:setShields(200, 200)
variation:setHull(250)
variation:setSpeed(90, 10, 20)
Expand All @@ -48,14 +56,14 @@ variation:setTubeDirection(4, 180):setWeaponTubeExclusiveFor(4, "Mine")

variation:addRoomSystem(1, 0, 2, 1, "Maneuver");
variation:addRoomSystem(1, 1, 2, 1, "BeamWeapons");
variation:addRoom(2, 2, 2, 1);
variation:addRoomSystem(2, 2, 2, 1, "Drones");

variation:addRoomSystem(0, 3, 1, 2, "RearShield");
variation:addRoomSystem(1, 3, 2, 2, "Reactor");
variation:addRoomSystem(3, 3, 2, 2, "Warp");
variation:addRoomSystem(5, 3, 1, 2, "JumpDrive");
variation:addRoom(6, 3, 2, 1);
variation:addRoom(6, 4, 2, 1);
variation:addRoomSystem(6, 4, 2, 1, "Docks");
variation:addRoomSystem(8, 3, 1, 2, "FrontShield");

variation:addRoom(2, 5, 2, 1);
Expand Down Expand Up @@ -108,7 +116,7 @@ template:setRadarTrace("radartrace_smallstation.png")
template:setHull(150)
template:setShields(120, 120, 120, 120, 120, 120)
template:setSpeed(0, 0.5, 0)
template:setDockClasses("Starfighter", "Frigate")
template:setDockClasses("Starfighter", "Frigate", "Drone")
-- Arc, Dir, Range, CycleTime, Dmg
template:setBeam(0, 30, 0, 4000.0, 1.5, 20)
template:setBeam(1, 30, 60, 4000.0, 1.5, 20)
Expand Down
2 changes: 2 additions & 0 deletions scripts/shipTemplates_Dreadnaught.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Due to the enormous cost of this dreadnaught, only the richest star systems are

This machine's primary tactic is to jump into an unsuspecting enemy system and destroy everything before they know what hit them. It's effective and destructive, but extremely expensive.]])
template:setJumpDrive(true)
template:setDockClasses("Drone")
-- template:setJumpDrive(true)
template:setTubes(16, 3.0)
template:setWeaponStorage("Homing", 1000)
for n=0,15 do
Expand Down
62 changes: 62 additions & 0 deletions scripts/shipTemplates_Drones.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
--[[ Drones
bada bip, bada bop, whaddaya know?
----------------------------------------------------------]]
template = ShipTemplate():setName("L3 Mouse"):setType("drone"):setClass("Drone", "Beamer"):setModel("LaserCorvetteBlue")
template:setHasReactor(false)
template:setRadarTrace("radar_fighter.png")
template:setDescription([[beams attack drone]])
template:setEnergyStorage(200)
template:setHull(30)
-- template:setShields(20)
template:setSpeed(100, 50, 40)
template:setCombatManeuver(400, 250)
template:setDefaultAI('fighter')
-- Arc, Dir, Range, CycleTime, Dmg
template:setBeam(0, 30, 0, 700.0, 4.0, 2)
template:setJumpDrive(false)
template:setWarpSpeed(-1)
template:setRepairCrewCount(0)

template = ShipTemplate():setName("L3 Cat"):setType("drone"):setClass("Drone", "Swoosher"):setModel("MissileCorvetteBlue")
template:setHasReactor(false)
template:setRadarTrace("radar_fighter.png")
template:setDescription([[HVLI attack drone]])
template:setEnergyStorage(200)
template:setHull(30)
-- template:setShields(20)
template:setSpeed(100, 50, 40)
template:setCombatManeuver(400, 250)
template:setDefaultAI('fighter')
template:setTubes(1, 15.0)
template:setWeaponStorage("HVLI", 4)
template:setJumpDrive(false)
template:setWarpSpeed(-1)
template:setRepairCrewCount(0)

template = ShipTemplate():setName("H9 Owl"):setType("drone"):setClass("Drone", "Swoosher"):setModel("AdlerLongRangeScoutBlue")
template:setHasReactor(false)
template:setRadarTrace("radar_fighter.png")
template:setDescription([[Long range scout]])
template:setEnergyStorage(1000)
template:setHull(50)
template:setSpeed(100, 50, 40)
template:setCombatManeuver(400, 250)
template:setDefaultAI('fighter')
template:setJumpDrive(false)
template:setWarpSpeed(-1)
template:setRepairCrewCount(0)

template = ShipTemplate():setName("M19 Rino"):setType("drone"):setClass("Drone", "Swoosher"):setModel("LindwurmFighterYellow")
template:setHasReactor(false)
template:setRadarTrace("radar_fighter.png")
template:setDescription([[Mine layer]])
template:setEnergyStorage(300)
template:setHull(150)
template:setSpeed(40, 50, 20)
template:setCombatManeuver(400, 250)
template:setTubes(1, 15.0)
template:setWeaponStorage("Mine", 1)
template:setDefaultAI('fighter')
template:setJumpDrive(false)
template:setWarpSpeed(-1)
template:setRepairCrewCount(0)
6 changes: 6 additions & 0 deletions scripts/shipTemplates_Frigates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ They are divided in 3 different sub-classes:
----------------------------------------------------------]]
template = ShipTemplate():setName("Phobos T3"):setClass("Frigate", "Cruiser"):setModel("AtlasHeavyFighterYellow")
template:setDescription([[The Phobos T3, just like the Atlantis, is the workhorse of almost any navy. It's extremely easy to modify, which makes retro-fitting this ship a breeze. Its basic stats aren't impressive, but due to its modular nature, it's fairly easy to produce in large quantities.]])
template:setDockClasses("Drone")
template:setHull(70)
template:setShields(50, 40)
template:setSpeed(60, 10, 10)
Expand Down Expand Up @@ -80,6 +81,7 @@ variation:addDoor(8, 4, false);

template = ShipTemplate():setName("Nirvana R5"):setClass("Frigate", "Cruiser: Anti-fighter"):setModel("small_frigate_5") -- TODO: Better 3D model selection
template:setDescription([[The Nirvana R5 is an anti-fighter cruiser. It has several rapid-firing, low-damage point-defense weapons to quickly take out starfighters.]])
template:setDockClasses("Drone")
template:setBeamWeapon(0, 90, -15, 1200, 3, 1)
template:setBeamWeapon(1, 90, 15, 1200, 3, 1)
template:setBeamWeapon(2, 90, 50, 1200, 3, 1)
Expand Down Expand Up @@ -159,6 +161,7 @@ template:addDoor( 5, 1, false)

template = ShipTemplate():setName("Piranha F12"):setClass("Frigate", "Cruiser: Light Artillery"):setModel("HeavyCorvetteRed")
template:setDescription([[A light artillery cruiser, the Piranha F12 is the smallest ship to exclusively fire from broadside weapon tubes.]])
template:setDockClasses("Drone")
template:setHull(70)
template:setShields(30, 30)
template:setSpeed(40, 6, 8)
Expand Down Expand Up @@ -245,6 +248,7 @@ variation:addDoor(7, 3, false)
--Cruiser: strike craft (fast in/out)
template = ShipTemplate():setName("Stalker Q7"):setClass("Frigate", "Cruiser: Strike ship"):setModel("small_frigate_3")
template:setDescription([[The Stalker is a strike ship designed to swoop into battle, deal damage quickly, and get out fast. The Q7 model is fitted with a warp drive.]])
template:setDockClasses("Drone")
template:setHull(50)
template:setShields(80, 30, 30, 30)
template:setSpeed(70, 12, 12)
Expand All @@ -259,6 +263,7 @@ variation:setJumpDrive(true)

template = ShipTemplate():setName("Ranus U"):setClass("Frigate", "Cruiser: Sniper"):setModel("MissileCorvetteGreen")
template:setDescription([[The Ranus U sniper is built to deal a large amounts of damage quickly and from a distance before escaping. It's the only basic frigate that carries nuclear weapons, even though it's also the smallest of all frigate-class ships.]])
template:setDockClasses("Drone")
template:setHull(30)
template:setShields(30, 5, 5)
template:setSpeed(50, 6, 20)
Expand All @@ -272,6 +277,7 @@ template:setWeaponStorage("Nuke", 2)
template = ShipTemplate():setName("Flavia"):setClass("Frigate", "Light transport"):setModel("LightCorvetteGrey")
template:setRadarTrace("radar_tug.png")
template:setDescription([[Popular among traders and smugglers, the Flavia is a small cargo and passenger transport. It's cheaper than a freighter for small loads and short distances, and is often used to carry high-value cargo discreetly.]])
template:setDockClasses("Drone")
template:setHull(50)
template:setShields(50, 50)
template:setSpeed(30, 8, 10)
Expand Down
17 changes: 17 additions & 0 deletions src/cargo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "cargo.h"

Cargo::Cargo(string multiplayerClassIdentifier) : MultiplayerObject(multiplayerClassIdentifier), energy_level(0), heat(0)
{
registerMemberReplication(&heat);
registerMemberReplication(&energy_level);
}

Cargo::Entries Cargo::getEntries()
{
Cargo::Entries result;
result.push_back(std::make_tuple("gui/icons/energy", "energy", int(energy_level)));
result.push_back(std::make_tuple("gui/icons/heat", "heat", string(heat, 2)));
result.push_back(std::make_tuple("gui/icons/hull", "health", string(int(100 * getHealth() / getMaxHealth())) + "%"));

return result;
}
37 changes: 37 additions & 0 deletions src/cargo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef CARGO_H
#define CARGO_H

#include "P.h"
#include "engine.h"
class Cargo;
#include "spaceObjects/spaceshipParts/dock.h"

class ModelData;

class Cargo : public MultiplayerObject
{
public:
typedef std::vector<std::tuple<string, string, string>> Entries;

private:
float heat;
float energy_level;

public:
Cargo(string multiplayerClassIdentifier);

virtual Entries getEntries();
virtual float getEnergy() { return energy_level; }
virtual void setEnergy(float amount) { this->energy_level = amount; }
virtual float getHeat() { return heat; }
virtual void setHeat(float amount) { this->heat = amount; }
virtual float getHealth() = 0;
virtual void addHealth(float amount) = 0;

virtual float getMinEnergy() { return 0; }
virtual float getMaxEnergy() = 0;
virtual float getMaxHealth() = 0;
virtual P<ModelData> getModel() = 0;
virtual bool onLaunch(Dock &source) = 0;
};
#endif //CARGO_H
6 changes: 6 additions & 0 deletions src/gameStateLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ void GameStateLogger::writeShipEntry(JSONGenerator& json, P<SpaceShip> ship)
{
config.endArray();
}
JSONGenerator beam = json.createDict("tractor_beam");
beam.write("arc", ship->tractor_beam.getArc());
beam.write("direction", ship->tractor_beam.getDirection());
beam.write("range", ship->tractor_beam.getRange());
beam.write("dragPerSecond", ship->tractor_beam.getDragPerSecond());
beam.write("max_area", ship->tractor_beam.getMaxArea());
}
if (has_beam_weapons)
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/gui2_entrylist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GuiEntryList* GuiEntryList::setOptions(std::vector<string> options)

GuiEntryList* GuiEntryList::setOptions(std::vector<string> options, std::vector<string> values)
{
entries.clear();
for(unsigned int n=0; n<options.size(); n++)
{
if (n < values.size())
Expand Down
7 changes: 6 additions & 1 deletion src/gui/gui2_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "gui2_overlay.h"

GuiOverlay::GuiOverlay(GuiContainer* owner, string id, sf::Color color)
: GuiElement(owner, id), color(color)
: GuiElement(owner, id), color(color), blocking(false)
{
texture_mode = TM_None;
setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax);
Expand Down Expand Up @@ -67,3 +67,8 @@ GuiOverlay* GuiOverlay::setTextureNone()
this->texture_mode = TM_None;
return this;
}

bool GuiOverlay::onMouseDown(sf::Vector2f position)
{
return blocking;
}
4 changes: 4 additions & 0 deletions src/gui/gui2_overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ class GuiOverlay : public GuiElement
TM_Centered
} texture_mode;
string texture;
bool blocking;
public:
GuiOverlay(GuiContainer* owner, string id, sf::Color color);

virtual void onDraw(sf::RenderTarget& window);

GuiOverlay* setColor(sf::Color color);
GuiOverlay* setBlocking(bool blocking){ this->blocking = blocking; return this;}
GuiOverlay* setAlpha(int alpha);
GuiOverlay* setTextureCenter(string texture);
GuiOverlay* setTextureTiled(string texture);
GuiOverlay* setTextureNone();
virtual bool onMouseDown(sf::Vector2f position);

};

#endif//GUI2_OVERLAY_H
6 changes: 4 additions & 2 deletions src/menus/shipSelectionScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void ShipSelectionScreen::update(float delta)
for(int n = 0; n < GameGlobalInfo::max_player_ships; n++)
{
P<PlayerSpaceship> ship = gameGlobalInfo->getPlayerShip(n);
if (ship)
if (ship && ship->ship_template && ship->ship_template->getType() != ShipTemplate::TemplateType::Drone)
{
string ship_name = ship->getFaction() + " " + ship->getTypeName() + " " + ship->getCallSign();
// If a player ship isn't in already in the list, add it.
Expand All @@ -326,7 +326,7 @@ void ShipSelectionScreen::update(float delta)
if (ship->hasPlayerAtPosition(ECrewPosition(n)))
ship_position_count += 1;
}
player_ship_list->setEntryName(n, ship_name + " (" + string(ship_position_count) + ")");
player_ship_list->setEntryName(player_ship_list->indexByValue(string(n)), ship_name + " (" + string(ship_position_count) + ")");
}else{
if (player_ship_list->indexByValue(string(n)) != -1)
player_ship_list->removeEntry(player_ship_list->indexByValue(string(n)));
Expand Down Expand Up @@ -434,6 +434,8 @@ void ShipSelectionScreen::updateCrewTypeOptions()
crew_position_button[damageControl]->show();
crew_position_button[powerManagement]->show();
crew_position_button[databaseView]->show();
crew_position_button[dronePilot]->show();
crew_position_button[dockMaster]->show();
break;
case 3:
main_screen_button->hide();
Expand Down
Loading