Translate some untranslated strings, refs #3665.

Add a chat message if the control-all units cheat was used, refs #2676.

This was SVN commit r17796.
This commit is contained in:
elexis 2016-02-23 17:29:39 +00:00
parent df42b9caba
commit 2b0c40d7b2
2 changed files with 47 additions and 37 deletions

View File

@ -12,10 +12,7 @@ function Cheat(input)
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
if (!cmpPlayer.GetCheatsEnabled())
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "Cheats are disabled in this match" });
return;
}
switch(input.action)
{
@ -57,16 +54,15 @@ function Cheat(input)
Engine.PostMessage(playerEnt, MT_PlayerDefeated, { "playerId": input.parameter });
return;
case "createunits":
if (!input.selected[0])
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "You need to select a building that trains units." });
return;
}
var cmpProductionQueue = Engine.QueryInterface(input.selected[0], IID_ProductionQueue);
var cmpProductionQueue = inputt.selected.length && Engine.QueryInterface(input.selected[0], IID_ProductionQueue);
if (!cmpProductionQueue)
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "You need to select a building that trains units." });
cmpGuiInterface.PushNotification({
"type": "text",
"players": [input.player],
"message": markForTranslation("You need to select a building that trains units."),
"translateMessage": true
});
return;
}
@ -101,12 +97,9 @@ function Cheat(input)
Cheat({ "player": input.player, "action": "researchTechnology", "parameter": parameter, "selected": input.selected });
return;
case "researchTechnology":
// check, if name of technology is given
if (input.parameter.length == 0)
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "You have to enter the name of a technology or select a building and enter the number of the technology (brainiac number [top|paired].)" });
if (!input.parameter.length)
return;
}
var techname = input.parameter;
var cmpTechnologyManager = Engine.QueryInterface(playerEnt, IID_TechnologyManager);
if (!cmpTechnologyManager)
@ -132,10 +125,8 @@ function Cheat(input)
{
var tech = techs[number-1];
if (!tech)
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "You have already researched this technology." });
return;
}
// get name of tech
if (tech.pair)
techname = tech[pair];
@ -143,10 +134,7 @@ function Cheat(input)
techname = tech;
}
else
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "This building only has " + techs.length + " technologies." });
return;
}
}
}
}
@ -154,10 +142,7 @@ function Cheat(input)
// check, if technology exists
var template = cmpTechnologyManager.GetTechnologyTemplate(techname);
if (!template)
{
cmpGuiInterface.PushNotification({ "type": "chat", "players": [input.player], "message": "Technology \"" + techname + "\" does not exist" });
return;
}
// check, if technology is already researched
if (!cmpTechnologyManager.IsTechnologyResearched(techname))

View File

@ -105,6 +105,13 @@ var g_Commands = {
"control-all": function(player, cmd, data)
{
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({
"type": "aichat",
"players": [player],
"message": markForTranslation("(Cheat - control all units)")
});
data.cmpPlayer.SetControlAllUnits(cmd.flag);
},
@ -531,9 +538,13 @@ var g_Commands = {
"promote": function(player, cmd, data)
{
// No need to do checks here since this is a cheat anyway
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({"type": "chat", "players": [player], "message": "(Cheat - promoted units)"});
cmpGuiInterface.PushNotification({
"type": "aichat",
"players": [player],
"message": markForTranslation("(Cheat - promoted units)"),
"translateMessage": true
});
for (let ent of cmd.entities)
{
@ -673,10 +684,13 @@ var g_Commands = {
*/
function notifyUnloadFailure(player, garrisonHolder)
{
var cmpPlayer = QueryPlayerIDInterface(player, IID_Player);
var notification = {"players": [cmpPlayer.GetPlayerID()], "message": "Unable to ungarrison unit(s)" };
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGUIInterface.PushNotification(notification);
cmpGUIInterface.PushNotification({
"type": "text",
"players": [player],
"message": markForTranslation("Unable to ungarrison unit(s)"),
"translateMessage": true
});
}
/**
@ -684,10 +698,13 @@ function notifyUnloadFailure(player, garrisonHolder)
*/
function notifyBackToWorkFailure(player)
{
var cmpPlayer = QueryPlayerIDInterface(player, IID_Player);
var notification = {"players": [cmpPlayer.GetPlayerID()], "message": "Some unit(s) can't go back to work" };
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGUIInterface.PushNotification(notification);
cmpGUIInterface.PushNotification({
"type": "text",
"players": [player],
"message": markForTranslation("Some unit(s) can't go back to work"),
"translateMessage": true
});
}
/**
@ -695,10 +712,13 @@ function notifyBackToWorkFailure(player)
*/
function notifyAlertFailure(player)
{
var cmpPlayer = QueryPlayerIDInterface(player, IID_Player);
var notification = {"players": [cmpPlayer.GetPlayerID()], "message": "You can't raise the alert to a higher level !" };
var cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGUIInterface.PushNotification(notification);
cmpGUIInterface.PushNotification({
"type": "text",
"players": [player],
"message": "You can't raise the alert to a higher level !",
"translateMessage": true
});
}
/**
@ -935,7 +955,12 @@ function TryConstructBuilding(player, cmpPlayer, controlAllUnits, cmd)
warn("Invalid command: required technology check failed for player "+player+": "+uneval(cmd));
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
cmpGuiInterface.PushNotification({ "players": [player], "message": markForTranslation("The building's technology requirements are not met."), "translateMessage": true });
cmpGuiInterface.PushNotification({
"type": "text",
"players": [player],
"message": markForTranslation("The building's technology requirements are not met."),
"translateMessage": true
});
// Remove the foundation because the construction was aborted
cmpPosition.MoveOutOfWorld();