Skip to content

Commit

Permalink
Merge pull request #14 from daid/master
Browse files Browse the repository at this point in the history
Work around some small possible issues in the tutorial. Add button in…
  • Loading branch information
tdelc committed Jun 20, 2016
2 parents d2a55ba + 728e34c commit 2db66fa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
6 changes: 3 additions & 3 deletions scripts/tutorial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ end)

addToSequence(weaponsTutorial, [[This is the weapons screen.
As the weapons officer, you are responsible for targeting beam weapons, loading and firing missile weapons, and controlling your shields.]])
addToSequence(weaponsTutorial, function() prev_object = CpuShip():setFaction("Kraylor"):setTemplate("Phobos T3"):setPosition(700, 0):setRotation(0):orderIdle():setScanned(true) end)
addToSequence(weaponsTutorial, function() prev_object = CpuShip():setFaction("Kraylor"):setTemplate("MT52 Hornet"):setPosition(700, 0):setRotation(0):orderIdle():setScanned(true) end)
addToSequence(weaponsTutorial, [[Your most fundamental task is to target your ship's weapons.
Your beam weapons only fire at your selected target, and homing missiles travel toward your selected target.
Expand All @@ -210,7 +210,7 @@ addToSequence(weaponsTutorial, [[Good! Notice that your beam weapons did not fir
Next up: shield controls.]])
addToSequence(weaponsTutorial, function() prev_object:destroy() end)
addToSequence(weaponsTutorial, function() prev_object = CpuShip():setFaction("Kraylor"):setTemplate("Phobos T3"):setPosition(-700, 0):setRotation(0):orderAttack(player):setScanned(true) end)
addToSequence(weaponsTutorial, function() prev_object = CpuShip():setFaction("Kraylor"):setTemplate("MT52 Hornet"):setPosition(-700, 0):setRotation(0):orderAttack(player):setScanned(true) end)
addToSequence(weaponsTutorial, [[As you might notice, you are being shot at. Do not worry, you cannot die right now.
You are taking damage, however, so enable your shields to protect yourself.]], function()
Expand Down Expand Up @@ -311,7 +311,7 @@ addToSequence(engineeringTutorial, [[In this top area, you see your damage contr
addToSequence(engineeringTutorial, [[The front shield system is damaged, as indicated by the color of this room's outline.
Select a damage control team from elsewhere on the ship by pressing it, then press on that room to initiate repairs.
(Repairs will take a while.)]], function() return player:getSystemHealth("frontshield") > 0.9 end)
(Repairs will take a while.)]], function() player:commandSetSystemPowerRequest("frontshield", 0.0) return player:getSystemHealth("frontshield") > 0.9 end)
addToSequence(engineeringTutorial, function() tutorial:setMessageToTopPosition() end)
addToSequence(engineeringTutorial, [[Good. Now you know your most important tasks. Next, we'll go over each system's function in detail.
Remember, each system performs better with more power, but performs less well when damaged. Your job is to keep vital systems running as well as you can.]])
Expand Down
20 changes: 16 additions & 4 deletions src/screens/gm/gameMasterScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ GameMasterScreen::GameMasterScreen()
create_button->setPosition(20, -70, ABottomLeft)->setSize(250, 50);

export_button = new GuiButton(this, "EXPORT_BUTTON", "Copy scenario", [this]() {
Clipboard::setClipboard(getScriptExport());
Clipboard::setClipboard(getScriptExport(false));
});
export_button->setTextSize(20)->setPosition(-20, -20, ABottomRight)->setSize(125, 25);

(new GuiButton(this, "EXPORT_BUTTON", "Copy selected", [this]() {
Clipboard::setClipboard(getScriptExport(true));
}))->setTextSize(20)->setPosition(-20, -45, ABottomRight)->setSize(125, 25);

cancel_create_button = new GuiButton(this, "CANCEL_CREATE_BUTTON", "Cancel", [this]() {
create_button->show();
cancel_create_button->hide();
Expand Down Expand Up @@ -439,7 +443,7 @@ void GameMasterScreen::onKey(sf::Keyboard::Key key, int unicode)
}
break;
case sf::Keyboard::F5:
Clipboard::setClipboard(getScriptExport());
Clipboard::setClipboard(getScriptExport(false));
break;

//TODO: This is more generic code and is duplicated.
Expand All @@ -462,10 +466,18 @@ PVector<SpaceObject> GameMasterScreen::getSelection()
return targets.getTargets();
}

string GameMasterScreen::getScriptExport()
string GameMasterScreen::getScriptExport(bool selected_only)
{
string output;
foreach(SpaceObject, obj, space_object_list)
PVector<SpaceObject> objs;
if (selected_only)
{
objs = targets.getTargets();
}else{
objs = space_object_list;
}

foreach(SpaceObject, obj, objs)
{
string line = obj->getExportLine();
if (line == "")
Expand Down
2 changes: 1 addition & 1 deletion src/screens/gm/gameMasterScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class GameMasterScreen : public GuiCanvas, public Updatable

PVector<SpaceObject> getSelection();

string getScriptExport();
string getScriptExport(bool selected_only);
};

class GuiGlobalMessageEntry : public GuiOverlay
Expand Down
2 changes: 1 addition & 1 deletion src/spaceObjects/artifact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Artifact::Artifact()

setRotation(random(0, 360));

current_model_data_name = "artifact" + string(random(1, 8));
current_model_data_name = "artifact" + string(irandom(1, 8));
model_data_name = current_model_data_name;
model_info.setData(current_model_data_name);

Expand Down

0 comments on commit 2db66fa

Please sign in to comment.