forked from Mirrors/openclonk
Objects: Added money goal for GoldRush
parent
2078e47558
commit
bf5a441244
|
@ -2,6 +2,7 @@
|
|||
Icon=15
|
||||
Title=Goldmine
|
||||
Version=5,0,0,0
|
||||
MaxPlayer=3
|
||||
Difficulty=10
|
||||
|
||||
[Definitions]
|
||||
|
@ -11,25 +12,25 @@ Definition1=Objects.ocd
|
|||
Rules=Rule_EnergyNeed=1;Rule_TeamAccount=1;
|
||||
|
||||
[Player1]
|
||||
Wealth=80
|
||||
Wealth=10
|
||||
Crew=Clonk=2
|
||||
Knowledge=Idol=1;WoodenCabin=1;Foundry=1;SteamEngine=1;ToolsWorkshop=1;WindGenerator=1;Flagpole=1;Sawmill=1;Pickaxe=1;Axe=1;Hammer=1;Shovel=1;
|
||||
HomeBaseMaterial=Shovel=2;Pickaxe=2;Axe=2;Hammer=2;Dynamite=10;Loam=10;Wood=20;Metal=10;Clonk=2;CableLorry=2;CableLorryReel=5;
|
||||
|
||||
[Player2]
|
||||
Wealth=80
|
||||
Wealth=10
|
||||
Crew=Clonk=2
|
||||
Knowledge=Idol=1;WoodenCabin=1;Foundry=1;SteamEngine=1;ToolsWorkshop=1;WindGenerator=1;Flagpole=1;Sawmill=1;Pickaxe=1;Axe=1;Hammer=1;Shovel=1;
|
||||
HomeBaseMaterial=Shovel=2;Pickaxe=2;Axe=2;Hammer=2;Dynamite=10;Loam=10;Wood=20;Metal=10;Clonk=2;CableLorry=2;CableLorryReel=5;
|
||||
|
||||
[Player3]
|
||||
Wealth=80
|
||||
Wealth=10
|
||||
Crew=Clonk=2
|
||||
Knowledge=Idol=1;WoodenCabin=1;Foundry=1;SteamEngine=1;ToolsWorkshop=1;WindGenerator=1;Flagpole=1;Sawmill=1;Pickaxe=1;Axe=1;Hammer=1;Shovel=1;
|
||||
HomeBaseMaterial=Shovel=2;Pickaxe=2;Axe=2;Hammer=2;Dynamite=10;Loam=10;Wood=20;Metal=10;Clonk=2;CableLorry=2;CableLorryReel=5;
|
||||
|
||||
[Player4]
|
||||
Wealth=80
|
||||
Wealth=10
|
||||
Crew=Clonk=2
|
||||
Knowledge=Idol=1;WoodenCabin=1;Foundry=1;SteamEngine=1;ToolsWorkshop=1;WindGenerator=1;Flagpole=1;Sawmill=1;Pickaxe=1;Axe=1;Hammer=1;Shovel=1;
|
||||
HomeBaseMaterial=Shovel=2;Pickaxe=2;Axe=2;Hammer=2;Dynamite=10;Loam=10;Wood=20;Metal=10;Clonk=2;CableLorry=2;CableLorryReel=5;
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
protected func Initialize()
|
||||
{
|
||||
// Goal: Resource extraction, set to gold mining.
|
||||
var goal = CreateObject(Goal_ResourceExtraction);
|
||||
goal->SetResource("Gold");
|
||||
var goal = CreateObject(Goal_Wealth);
|
||||
goal->SetWealthGoal(400);
|
||||
|
||||
// Place some trees.
|
||||
for (var i = 0; i < 12 + Random(4); i++)
|
||||
|
@ -25,6 +25,7 @@ protected func Initialize()
|
|||
time->SetCycleSpeed(12);
|
||||
|
||||
// Create a small settlement to test stuff.
|
||||
/*
|
||||
var foundry = CreateConstruction(Foundry, 300, FindHeight(300), NO_OWNER, 100, true);
|
||||
foundry->CreateContents(Coal,3);
|
||||
foundry->CreateContents(Ore,3);
|
||||
|
@ -47,6 +48,7 @@ protected func Initialize()
|
|||
lorry->CreateContents(Metal, 4);
|
||||
lorry->CreateContents(Dynamite, 3);
|
||||
lorry->CreateContents(Loam, 3);
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,13 +62,18 @@ private func FindHeight(int x)
|
|||
|
||||
protected func InitializePlayer(int plr)
|
||||
{
|
||||
// first player gets the base
|
||||
// first player gets the base to test.
|
||||
/*
|
||||
var flagpole = FindObject(Find_ID(Flagpole));
|
||||
if (flagpole && !GetPlayerName(flagpole->GetOwner()))
|
||||
flagpole->SetOwner(plr);
|
||||
*/
|
||||
|
||||
// Disable FoW for development reasons.
|
||||
SetFoW(false, plr);
|
||||
// Increase wealth goal per player.
|
||||
var goal = FindObject(Find_ID(Goal_Wealth));
|
||||
if (goal)
|
||||
goal->SetWealthGoal(300 + 100 * Min(GetPlayerCount(), 3));
|
||||
|
||||
// Move clonks to location and give them a shovel.
|
||||
var index = 0, crew;
|
||||
while (crew = GetCrew(plr, index))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Icon=1
|
||||
Title=IronPeak
|
||||
Version=5,0,0,0
|
||||
MaxPlayer=6
|
||||
Difficulty=20
|
||||
|
||||
[Definitions]
|
||||
|
|
|
@ -153,8 +153,6 @@ global func FxSnowStormTimer(object target, proplist effect)
|
|||
|
||||
protected func InitializePlayer(int plr)
|
||||
{
|
||||
// Disable FoW for development reasons.
|
||||
SetFoW(false, plr);
|
||||
// Move clonks to location and give them a shovel.
|
||||
var index = 0, crew;
|
||||
while (crew = GetCrew(plr, index))
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[DefCore]
|
||||
id=Goal_Wealth
|
||||
Version=5,2,0,1
|
||||
Category=C4D_StaticBack|C4D_Goal
|
||||
Picture=0,0,128,128
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -0,0 +1,85 @@
|
|||
/*--
|
||||
Wealth
|
||||
Author: Maikel
|
||||
|
||||
Each player much reach the specified wealth to complete the goal.
|
||||
--*/
|
||||
|
||||
|
||||
#include Library_Goal
|
||||
|
||||
local wealth_goal;
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
wealth_goal = 0;
|
||||
return inherited(...);
|
||||
}
|
||||
|
||||
/*-- Wealth goal --*/
|
||||
|
||||
public func SetWealthGoal(int wealth)
|
||||
{
|
||||
wealth_goal = Max(0, wealth);
|
||||
return;
|
||||
}
|
||||
|
||||
public func GetWealthGoal()
|
||||
{
|
||||
return wealth_goal;
|
||||
}
|
||||
|
||||
/*-- Goal interface --*/
|
||||
|
||||
// The goal is fulfilled if all players have the specfied wealth.
|
||||
public func IsFulfilled()
|
||||
{
|
||||
for (var i = 0; i < GetPlayerCount(); i++)
|
||||
{
|
||||
var plr = GetPlayerByIndex(i);
|
||||
if (GetWealth(plr) < GetWealthGoal())
|
||||
return false;
|
||||
}
|
||||
// Goal fulfilled.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Shows or hides a message window with information.
|
||||
public func Activate(int plr)
|
||||
{
|
||||
// If goal message open -> hide it.
|
||||
if (GetEffect("GoalMessage", this))
|
||||
{
|
||||
CustomMessage("", nil, plr, nil, nil, nil, nil, nil, MSG_HCenter);
|
||||
RemoveEffect("GoalMessage", this);
|
||||
return;
|
||||
}
|
||||
// Otherwise open a new message.
|
||||
AddEffect("GoalMessage", this, 100, 0, this);
|
||||
var message;
|
||||
if (IsFulfilled())
|
||||
message = Format("@$MsgGoalFulfilled$", GetWealthGoal());
|
||||
else
|
||||
message = Format("@$MsgGoalUnfulfilled$", GetWealth(plr), GetWealthGoal());
|
||||
|
||||
CustomMessage(message, nil, plr, 0, 16 + 64, 0xffffff, GUI_MenuDeco, this, MSG_HCenter);
|
||||
return;
|
||||
}
|
||||
|
||||
protected func FxGoalMessageStart() {}
|
||||
|
||||
public func GetShortDescription(int plr)
|
||||
{
|
||||
// Show acquired wealth compared to goal.
|
||||
var wealth = GetWealth(plr);
|
||||
var goal = GetWealthGoal();
|
||||
var clr = RGB(255, 0, 0);
|
||||
if (wealth > goal)
|
||||
clr = RGB(0, 255, 0);
|
||||
var msg = Format("<c %x>%d</c>{{%i}}", clr, goal, GUI_Wealth);
|
||||
return msg;
|
||||
}
|
||||
|
||||
/*-- Proplist --*/
|
||||
|
||||
local Name = "$Name$";
|
|
@ -0,0 +1,5 @@
|
|||
Name=Geldpunkte
|
||||
|
||||
#Goal window
|
||||
MsgGoalFulfilled=%d Geldpunkte errreicht!
|
||||
MsgGoalUnfulfilled=Erst %d Geldpunkte von %d erreicht.
|
|
@ -0,0 +1,5 @@
|
|||
Name=Money points
|
||||
|
||||
#Goal window
|
||||
MsgGoalFulfilled=%d wealth points reached!
|
||||
MsgGoalUnfulfilled=Only %d wealth points of %d reached.
|
Loading…
Reference in New Issue