forked from Mirrors/openclonk
Goal icons added to Krakatoa and Chine (#1142).
parent
f6d0ccff2e
commit
4443298b6d
|
@ -32,6 +32,11 @@ public func GetDescription(int plr)
|
|||
return this.Description;
|
||||
}
|
||||
|
||||
public func GetPictureDefinition()
|
||||
{
|
||||
return this.Picture ?? this;
|
||||
}
|
||||
|
||||
/*-- Proplist --*/
|
||||
local Name = "$Name$";
|
||||
local Description = "$Description$";
|
||||
|
|
|
@ -75,11 +75,22 @@ public func OnGoalUpdate(object goal)
|
|||
|
||||
return _inherited(goal, ...);
|
||||
}
|
||||
var goal_picture_def;
|
||||
var update_req = goal_gui_menu.Symbol != goal->GetID();
|
||||
if (goal->~GetPictureDefinition())
|
||||
{
|
||||
goal_picture_def = goal->GetPictureDefinition();
|
||||
update_req = goal_gui_menu.Symbol != goal_picture_def;
|
||||
}
|
||||
|
||||
// Only update if something has changed.
|
||||
if (goal_gui_menu.Symbol != goal->GetID() || goal_gui_menu.GraphicsName != goal->GetGraphics() || goal_gui_menu.text.Text != goal->~GetShortDescription(GetOwner()))
|
||||
if (update_req || goal_gui_menu.GraphicsName != goal->GetGraphics() || goal_gui_menu.text.Text != goal->~GetShortDescription(GetOwner()))
|
||||
{
|
||||
goal_gui_menu.text.Text = goal->~GetShortDescription(GetOwner());
|
||||
goal_gui_menu.Symbol = goal->GetID();
|
||||
if (goal_picture_def)
|
||||
goal_gui_menu.Symbol = goal_picture_def;
|
||||
else
|
||||
goal_gui_menu.Symbol = goal->GetID();
|
||||
goal_gui_menu.GraphicsName = goal->GetGraphics();
|
||||
|
||||
goal_gui_menu.Player = GetOwner();
|
||||
|
@ -180,6 +191,7 @@ private func GoalSubMenu(object goal, int nr, int size)
|
|||
if (size == nil)
|
||||
size = 4;
|
||||
|
||||
var symbol = goal->~GetPictureDefinition() ?? goal->GetID();
|
||||
// Create the goal submenu with id counting upwards from 2.
|
||||
var prop_goal =
|
||||
{
|
||||
|
@ -189,7 +201,7 @@ private func GoalSubMenu(object goal, int nr, int size)
|
|||
Right = Format("0%%+%dem", (nr + 1) * size),
|
||||
Top = "0%",
|
||||
Bottom = Format("0%%+%dem", size),
|
||||
Symbol = goal->GetID(),
|
||||
Symbol = symbol,
|
||||
GraphicsName = goal->GetGraphics(),
|
||||
BackgroundColor = {Std = 0, Hover = 0x50ffffff},
|
||||
OnMouseIn = [GuiAction_SetTag("Hover"), GuiAction_Call(this, "OnGoalGUIHover", goal)],
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[DefCore]
|
||||
id=Chine_GoalIcon
|
||||
Version=7,0
|
||||
Category=C4D_StaticBack
|
||||
Picture=0,0,128,128
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -14,7 +14,7 @@ protected func Initialize()
|
|||
// Rules: team account and buying at flagpole.
|
||||
CreateObject(Rule_TeamAccount);
|
||||
CreateObject(Rule_BuyAtFlagpole);
|
||||
|
||||
|
||||
// Goal: transport the cannon to the top of the chine.
|
||||
var cannon = CreateObjectAbove(Cannon, 96 + RandomX(-12, 12), LandscapeHeight() - 92);
|
||||
var keg = cannon->CreateContents(PowderKeg);
|
||||
|
@ -23,14 +23,15 @@ protected func Initialize()
|
|||
var cannon_goal = CreateObject(Goal_Script);
|
||||
cannon_goal.Name = "$GoalName$";
|
||||
cannon_goal.Description = "$GoalDesc$";
|
||||
cannon_goal.Picture = Chine_GoalIcon;
|
||||
// Add an effect to check whether the goal is fulfilled.
|
||||
AddEffect("GoalCheck", nil, 100, 2, nil);
|
||||
|
||||
|
||||
// Initialize different parts of the scenario.
|
||||
InitEnvironment(SCENPAR_MapSize, SCENPAR_Difficulty);
|
||||
InitVegetation(SCENPAR_MapSize, SCENPAR_Difficulty);
|
||||
InitAnimals(SCENPAR_Difficulty);
|
||||
InitMaterial(4 - SCENPAR_Difficulty);
|
||||
InitMaterial(4 - SCENPAR_Difficulty);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[DefCore]
|
||||
id=Krakatoa_GoalIcon
|
||||
Version=7,0
|
||||
Category=C4D_StaticBack
|
||||
Picture=0,0,128,128
|
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
|
@ -23,6 +23,7 @@ protected func Initialize()
|
|||
// Set goal name and description.
|
||||
goal.Name = "$GoalName$";
|
||||
goal.Description = Format("$GoalDesc$", effect.barcnt);
|
||||
goal.Picture = Krakatoa_GoalIcon;
|
||||
|
||||
// Some rules.
|
||||
CreateObject(Rule_TeamAccount);
|
||||
|
|
Loading…
Reference in New Issue