Skip to content

Commit

Permalink
Merge pull request #31 from daid/master
Browse files Browse the repository at this point in the history
merge 19/09
  • Loading branch information
tdelc authored Sep 18, 2016
2 parents 0498950 + 02a6e1a commit 4547184
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 14 deletions.
10 changes: 10 additions & 0 deletions scripts/scenario_07_quick_basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ function init()
--If we have a GM started scenario.
scenario_started = false
if getScenarioVariation() == "GM Start" then
target_practice_drone = CpuShip():setFaction("Ghosts"):setTemplate("MT52 Hornet"):setTypeName("Target practice")
target_practice_drone:setScannedByFaction("Human Navy", true)
target_practice_drone:setImpulseMaxSpeed(60)
target_practice_drone:setBeamWeapon(0, 0, 0, 0.0, 0, 0)
x, y = 2500, 3500
target_practice_drone:setPosition(x, y):orderDefendLocation(x, y)
addGMFunction("Start", function()
startScenario()
removeGMFunction("Start")
Expand All @@ -246,6 +252,10 @@ function startScenario()
else
enemy_group_count = 3
end

if target_practice_drone ~= nil and target_practice_drone:isValid() then
target_practice_drone:destroy()
end

-- If not in the Empty variation, spawn the corresponding number of random
-- enemy waves at distributed random headings and semi-random distances
Expand Down
7 changes: 4 additions & 3 deletions scripts/shipTemplates_Frigates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ template:setShields(50, 40)
template:setSpeed(60, 10, 10)
template:setBeamWeapon(0, 90, -15, 1200, 8, 6)
template:setBeamWeapon(1, 90, 15, 1200, 8, 6)
template:setTubes(2, 10.0)
template:setTubes(2, 60.0)
template:setWeaponStorage("HVLI", 20)
template:setWeaponStorage("Homing", 6)
template:setTubeDirection(0, -1)
template:setTubeDirection(1, 1)

variation = template:copy("Phobos M3"):setModel("AtlasHeavyFighterRed")
variation:setDescription([[The Phobos M3 is one of the most common variants of the Phobos T3. It adds a mine-laying tube, but the extra storage required for the mines slows this ship down slightly.]])
variation:setTubes(3, 10.0)
variation:setTubes(3, 60.0)
variation:setWeaponStorage("Mine", 6)
variation:setSpeed(55, 10, 10)
variation:weaponTubeDisallowMissle(0, "Mine"):weaponTubeDisallowMissle(1, "Mine")
Expand All @@ -38,6 +38,7 @@ variation:setShields(100, 100)
variation:setHull(200)
variation:setSpeed(80, 10, 20)
variation:setCombatManeuver(400, 250)
variation:setTubes(3, 10.0)
variation:setWeaponStorage("Homing", 10)
variation:setWeaponStorage("Nuke", 2)
variation:setWeaponStorage("Mine", 4)
Expand Down Expand Up @@ -100,7 +101,7 @@ template:setDescription([[A light artillery cruiser, the Piranha F12 is the smal
template:setHull(70)
template:setShields(30, 30)
template:setSpeed(40, 6, 8)
template:setTubes(6, 12.0)
template:setTubes(6, 15.0)
template:setWeaponStorage("HVLI", 20)
template:setWeaponStorage("Homing", 6)
template:setTubeDirection(0, -90):setWeaponTubeExclusiveFor(0, "HVLI")
Expand Down
2 changes: 2 additions & 0 deletions src/factionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ PVector<FactionInfo> factionInfo;

FactionInfo::FactionInfo()
{
if (game_server) { LOG(ERROR) << "FactionInfo objects can not be created during a scenario right now."; destroy(); return; }

foreach(FactionInfo, i, factionInfo)
i->states.push_back(FVF_Neutral);
factionInfo.push_back(this);
Expand Down
5 changes: 4 additions & 1 deletion src/gui/gui2_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ void GuiButton::onMouseUp(sf::Vector2f position)
{
soundManager->playSound("button.wav");
if (func)
func();
{
func_t f = func;
f();
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/gui/gui2_entrylist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ void GuiEntryList::callback()
{
if (func)
{
func_t f = func;
if (selection_index >= 0 && selection_index < (int)entries.size())
func(selection_index, entries[selection_index].value);
f(selection_index, entries[selection_index].value);
else
func(selection_index, "");
f(selection_index, "");
}
}
5 changes: 4 additions & 1 deletion src/gui/gui2_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ void GuiSlider::onMouseDrag(sf::Vector2f position)
{
value = new_value;
if (func)
func(value);
{
func_t f = func;
f(value);
}
}
}

Expand Down
23 changes: 19 additions & 4 deletions src/gui/gui2_textentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ bool GuiTextEntry::onKey(sf::Event::KeyEvent key, int unicode)
{
text = text.substr(0, -1);
if (func)
func(text);
{
func_t f = func;
f(text);
}
return true;
}
if (key.code == sf::Keyboard::Return)
{
if (enter_func)
enter_func(text);
{
func_t f = enter_func;
f(text);
}
return true;
}
if (key.code == sf::Keyboard::V && key.control)
{
Expand All @@ -47,14 +55,21 @@ bool GuiTextEntry::onKey(sf::Event::KeyEvent key, int unicode)
text += string(char(unicode));
}
if (func)
func(text);
{
func_t f = func;
f(text);
}
return true;
}
if (unicode > 31 && unicode < 128)
{
text += string(char(unicode));
if (func)
func(text);
{
func_t f = func;
f(text);
}
return true;
}
return true;
}
Expand Down
5 changes: 4 additions & 1 deletion src/gui/gui2_togglebutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ void GuiToggleButton::onClick()
{
setValue(!value);
if (toggle_func)
toggle_func(value);
{
func_t f = toggle_func;
f(value);
}
}
2 changes: 2 additions & 0 deletions src/screens/crew4/operationsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ OperationScreen::OperationScreen(GuiContainer* owner)
}
});
delete_waypoint_button->setPosition(-270, -120, ABottomRight)->setSize(200, 50);

mode = TargetSelection;

new ShipsLog(this);
(new GuiCommsOverlay(this))->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax);
Expand Down
4 changes: 2 additions & 2 deletions src/shipTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ string getSystemName(ESystem system)
case SYS_Impulse: return "Impulse Engines";
case SYS_Warp: return "Warp Drive";
case SYS_JumpDrive: return "Jump Drive";
case SYS_FrontShield: return "Front Shields";
case SYS_RearShield: return "Rear Shields";
case SYS_FrontShield: return "Front Shield Generator";
case SYS_RearShield: return "Rear Shield Generator";
default:
return "UNKNOWN";
}
Expand Down
8 changes: 8 additions & 0 deletions src/spaceObjects/playerSpaceship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,14 @@ void PlayerSpaceship::drawOnGMRadar(sf::RenderTarget& window, sf::Vector2f posit
radar_radius.setOutlineColor(sf::Color(255, 255, 255, 64));
radar_radius.setOutlineThickness(3.0);
window.draw(radar_radius);

sf::CircleShape short_radar_radius(5000 * scale);
short_radar_radius.setOrigin(5000 * scale, 5000 * scale);
short_radar_radius.setPosition(position);
short_radar_radius.setFillColor(sf::Color::Transparent);
short_radar_radius.setOutlineColor(sf::Color(255, 255, 255, 64));
short_radar_radius.setOutlineThickness(3.0);
window.draw(short_radar_radius);
}
}

Expand Down

0 comments on commit 4547184

Please sign in to comment.