forked from Mirrors/openclonk
Added GetDescription to all goals
This will be used by the new HUD on the controls branch.Controls
parent
4346da8e4e
commit
9a862835bb
|
@ -38,6 +38,11 @@ public func IsFulfilled()
|
|||
return false;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
return this.Description;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
MessageWindow(this.Description, byplr);
|
||||
|
|
|
@ -26,6 +26,16 @@ public func IsFulfilled()
|
|||
return GetMaterial(basin_x, basin_y) == Material("Acid");
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnfulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,16 @@ public func IsFulfilled()
|
|||
return false;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnFulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
if (IsFulfilled())
|
||||
|
|
|
@ -29,6 +29,16 @@ public func IsFulfilled()
|
|||
return !victim->GetAlive();
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnFulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
if (IsFulfilled())
|
||||
|
|
|
@ -25,6 +25,16 @@ public func IsFulfilled()
|
|||
return statue && !statue->IsBroken();
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnfulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,16 @@ public func IsFulfilled()
|
|||
return target->IsPowerAvailable(target->GetNeededPower());
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnFulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,16 @@ public func IsFulfilled()
|
|||
return true;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnFulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
if (IsFulfilled())
|
||||
|
|
|
@ -18,6 +18,16 @@ public func IsFulfilled()
|
|||
return ObjectCount(Find_ID(Plane));
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnFulfilled$";
|
||||
return message;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
if (IsFulfilled())
|
||||
|
|
|
@ -146,6 +146,21 @@ public func IsFulfilled()
|
|||
return false;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var flags = GetScoreGoal() - score_list[GetPlayerTeam(plr)];
|
||||
if (IsFulfilled())
|
||||
return "$MsgGoalFulfilled$";
|
||||
else
|
||||
{
|
||||
var msg = "$MsgGoalCaptureTheFlag$";
|
||||
if (flags == 1)
|
||||
return Format("%s %s", msg, "$MsgGoalUnfulfilled1$");
|
||||
else
|
||||
return Format("%s %s", msg, Format("$MsgGoalUnfulfilledX$", flags));
|
||||
}
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
var flags = GetScoreGoal() - score_list[GetPlayerTeam(byplr)];
|
||||
|
|
|
@ -105,6 +105,27 @@ public func IsFulfilled()
|
|||
return true;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
if(IsFulfilled())
|
||||
{
|
||||
if (GetKillCount(plr) >= maxkills)
|
||||
return "$MsgVictory$";
|
||||
}
|
||||
else
|
||||
{
|
||||
var score = GetRelativeScore(plr);
|
||||
if (score.kills > 0)
|
||||
return Format("$MsgAhead$", score.kills, GetPlayerName(score.best));
|
||||
else if (score.kills < 0)
|
||||
return Format("$MsgBehind$", -score.kills, GetPlayerName(score.best));
|
||||
else if (score.best == plr)
|
||||
return Format("$MsgYouAreBest$", score.kills);
|
||||
else
|
||||
return Format("$MsgEqual$", GetPlayerName(score.best));
|
||||
}
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
if(IsFulfilled())
|
||||
|
|
|
@ -109,6 +109,17 @@ private func CoveredByFlag(int x, int y)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Return the description of this goal.
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (GetExpansionArea() >= GetExpansionGoal() || GetExpansionGoal() == 0)
|
||||
message = Format("$MsgGoalFulfilled$");
|
||||
else
|
||||
message = Format("$MsgGoalUnFulfilled$", 100 * GetExpansionArea() / GetExpansionGoal());
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
@ -122,7 +133,7 @@ public func Activate(int plr)
|
|||
// Otherwise open a new message.
|
||||
AddEffect("GoalMessage", this, 100, 0, this);
|
||||
var message;
|
||||
if (GetExpansionArea() >= GetExpansionGoal())
|
||||
if (GetExpansionArea() >= GetExpansionGoal() || GetExpansionGoal() == 0)
|
||||
message = Format("@$MsgGoalFulfilled$");
|
||||
else
|
||||
message = Format("@$MsgGoalUnFulfilled$", 100 * GetExpansionArea() / GetExpansionGoal());
|
||||
|
@ -136,7 +147,9 @@ protected func FxGoalMessageStart() {}
|
|||
public func GetShortDescription(int plr)
|
||||
{
|
||||
// Show expansion percentage.
|
||||
var perc = Min(100, 100 * GetExpansionArea() / GetExpansionGoal());
|
||||
var perc = 0;
|
||||
if (GetExpansionGoal())
|
||||
perc = Min(100, 100 * GetExpansionArea() / GetExpansionGoal());
|
||||
var clr = RGB(255, 0, 0);
|
||||
if (perc >= 100)
|
||||
clr = RGB(0, 255, 0);
|
||||
|
|
|
@ -211,6 +211,21 @@ private func CheckForWinner()
|
|||
return;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var teams=GetTeamPoints();
|
||||
var lines=[];
|
||||
|
||||
for(var i=0;i<GetLength(teams);++i)
|
||||
{
|
||||
lines[GetLength(lines)]=Format("%s: %d", teams[i]["player_names"], teams[i]["points"] );
|
||||
}
|
||||
|
||||
var msg=Format("$MsgGoalDesc$", GetPointLimit());
|
||||
for(var i=0;i<GetLength(lines);++i)
|
||||
msg=Format("%s|%s", msg, lines[i]);
|
||||
return msg;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
|
|
|
@ -55,6 +55,29 @@ public func IsFulfilled()
|
|||
return true;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
// Count enemy players.
|
||||
var hostile_count;
|
||||
for (var i = 0; i < GetPlayerCount(); i++)
|
||||
{
|
||||
var byplr = GetPlayerByIndex(i);
|
||||
if (byplr == plr)
|
||||
continue;
|
||||
if (Hostile(byplr, plr) )
|
||||
hostile_count++;
|
||||
}
|
||||
|
||||
var message;
|
||||
|
||||
// Output
|
||||
if (!hostile_count)
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = Format("$MsgGoalUnfulfilled$", hostile_count);
|
||||
return message;
|
||||
}
|
||||
|
||||
public func Activate(int byplr)
|
||||
{
|
||||
// Count enemy players.
|
||||
|
|
|
@ -210,6 +210,33 @@ public func IsFulfilled()
|
|||
return finished;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var team = GetPlayerTeam(plr);
|
||||
var msg;
|
||||
if (finished)
|
||||
{
|
||||
if (team)
|
||||
{
|
||||
if (IsWinner(plr))
|
||||
msg = "$MsgParkourWonTeam$";
|
||||
else
|
||||
msg = "$MsgParkourLostTeam$";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWinner(plr))
|
||||
msg = "$MsgParkourWon$";
|
||||
else
|
||||
msg = "$MsgParkourLost$";
|
||||
}
|
||||
}
|
||||
else
|
||||
msg = Format("$MsgParkour$", cp_count);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
public func Activate(int plr)
|
||||
{
|
||||
var team = GetPlayerTeam(plr);
|
||||
|
|
|
@ -67,6 +67,32 @@ public func IsFulfilled()
|
|||
return true;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
{
|
||||
message = "$MsgGoalFulfilled$";
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "$MsgGoalExtraction$";
|
||||
for (var i = 0; i < GetLength(resource_list); i++)
|
||||
{
|
||||
var mat = resource_list[i];
|
||||
var tol = tolerance_list[i];
|
||||
var mat_cnt = GetMaterialCount(Material(mat));
|
||||
var res_id = GetMaterialVal("Blast2Object", "Material", Material(mat));
|
||||
var res_cnt = ObjectCount(Find_ID(res_id));
|
||||
var blast_ratio = GetMaterialVal("Blast2ObjectRatio", "Material", Material(mat));
|
||||
var add_msg = Format("$MsgGoalResource$", res_id, Max(0, (mat_cnt - (2*tol+1) * blast_ratio / 2) / blast_ratio), res_cnt);
|
||||
message = Format("%s%s", message, add_msg);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -65,6 +65,19 @@ public func IsFulfilled()
|
|||
return true;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = "$MsgGoalUnfulfilled$";
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,11 @@ public func Fulfill()
|
|||
return;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
return this.Description;
|
||||
}
|
||||
|
||||
/*-- Proplist --*/
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
Name=Scriptziel
|
||||
|
||||
Description=Script goal description: please change me
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
Name=Script goal
|
||||
Description=Script goal description: please change me
|
|
@ -48,6 +48,17 @@ public func IsFulfilled()
|
|||
return (gems_to_sell<=0);
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = "$MsgGoalFulfilled$";
|
||||
else
|
||||
message = Format("$MsgGoalUnfulfilled$", gems_to_sell);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,17 @@ public func IsFulfilled()
|
|||
return true;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = Format("$MsgGoalFulfilled$", GetWealthGoal());
|
||||
else
|
||||
message = Format("$MsgGoalUnfulfilled$", GetWealth(plr), GetWealthGoal());
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
|
|
|
@ -122,8 +122,15 @@ public func SetMissionAccess(string str_password)
|
|||
|
||||
// Base implementations to be overloaded by goal objects
|
||||
|
||||
// Overload: return whether the goal has been fulfilled.
|
||||
public func IsFulfilled() { return true; }
|
||||
|
||||
// Overload: return the current description for this goal.
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
return "WARNING: GetDescription(int plr) not overloaded by goal";
|
||||
}
|
||||
|
||||
protected func Activate(plr)
|
||||
{
|
||||
if (IsFulfilled())
|
||||
|
|
|
@ -26,6 +26,11 @@ public func IsFulfilled()
|
|||
return false;
|
||||
}
|
||||
|
||||
public func GetDescription(int plr)
|
||||
{
|
||||
return this.Description;
|
||||
}
|
||||
|
||||
public func CreateGoalFlag(int x, int y)
|
||||
{
|
||||
flag = CreateObject(TutorialFlag, 0, 0, NO_OWNER);
|
||||
|
|
Loading…
Reference in New Issue