sandbox: more scenario options and better map generation

master
Maikel de Vries 2018-03-11 17:02:04 +01:00
parent 29a1a21526
commit 0e535f880e
15 changed files with 978 additions and 230 deletions

View File

@ -1,6 +1,6 @@
Sandkasten
Eine Karte zum Unfug treiben, ohne wenn und aber. Hier kannst du dich nach Lust und Laune austoben und kannst hier alles ausprobieren, was du möchtest.
In dieser Runde kannst du mit allen Objekten im Spiel experimentieren. Einfach nur Spaß haben!
Folgende Werkzeuge stehen dir hier zur Verfügung:

View File

@ -1,6 +1,6 @@
Sandbox
A scenario to play around with all the cool stuff.
In this round you can experiment with all objects in the game. Just have fun!
The following tools can be used:

View File

@ -2,56 +2,137 @@
Sandbox
Map drawing for sandbox scenario.
@author K_Pone
@author K_Pone, Maikel
*/
func InitializeMap(proplist map)
#include Library_Map
// Called be the engine: draw the complete map here.
public func InitializeMap(proplist map)
{
if (!MapGenPreset) MapGenPreset = "FlatLand"; // For the initial map on scenario start
// Initialize the map settings from scenario parameters. If a map is created in god mode
// these settings are already up to date.
InitMapSettings();
// These were set in the MapGen UI
Resize(MapGenSizeWidth ?? 80, MapGenSizeHeight ?? 50);
// Resize the map.
Resize(Settings_MapWdt, Settings_MapHgt);
if (MapGenPreset == "FlatLand")
{
Draw("Earth", { Algo = MAPALGO_Rect, X = 0, Y = MapGenSizeHeight / 2, Wdt = MapGenSizeWidth, Hgt = MapGenSizeHeight / 2 + 1 } );
}
else if (MapGenPreset == "Skylands")
{
var islands =
{
Algo = MAPALGO_Turbulence,
Op = { Algo=MAPALGO_RndChecker, Wdt=5, Hgt=2, Ratio = 10 }
};
Draw("Earth", islands);
}
else if (MapGenPreset == "Caves")
{
Draw("Earth", { Algo = MAPALGO_Rect, X = 0, Y = 0, Wdt = MapGenSizeWidth, Hgt = MapGenSizeHeight } );
for (var i = 0; i < 3; i++)
{
var tunnels =
{
Algo = MAPALGO_Polygon,
X = [Random(MapGenSizeWidth),Random(MapGenSizeWidth)],
Y = [Random(MapGenSizeHeight),Random(MapGenSizeHeight)],
Wdt = Random(10) + 3,
Empty = true,
Open = true
};
Draw("Tunnel", tunnels);
}
}
// Draw empty map according to type setting.
if (Settings_MapType == CSETTING_MapType_Empty)
return true;
// Create the main surface: a rectangle with some turbulence on top.
var height = [9 * map.Hgt / 20, 9 * map.Hgt / 20, 11 * map.Hgt / 20][Settings_MapType - 1];
var amplitude = [[0, 10], [0, 18], [0, 40]][Settings_MapType - 1];
var scale = [[0, 10], [0, 16], [0, 24]][Settings_MapType - 1];
var rect = {X = 0, Y = height, Wdt = map.Wdt, Hgt = map.Hgt - height};
var surface = {Algo = MAPALGO_Rect, X = rect.X, Y = rect.Y, Wdt = rect.Wdt, Hgt = 8 * rect.Hgt / 6};
surface = {Algo = MAPALGO_Turbulence, Iterations = 4, Amplitude = amplitude, Scale = scale, Seed = Random(65536), Op = surface};
// Draw materials inside the main surface.
DrawMaterials(rect, surface);
// Draw some sky islands.
for (var x = RandomX(30, 60); x < map.Wdt - 30; x += RandomX(45, 85))
DrawSkyIsland(map, x, RandomX(32, 52), RandomX(20, 30), RandomX(18, 24));
// Return true to tell the engine a map has been successfully created.
return true;
}
global func PostMapGen()
// Draws materials on the given surface.
public func DrawMaterials(proplist rect, proplist surface)
{
// This is called after the map is generated. Should be used to place environment objects.
}
var mask;
var x = rect.X;
var y = rect.Y;
var wdt = rect.Wdt;
var hgt = rect.Hgt;
// Earth forms the basis.
Draw("Earth", surface);
// A bit of different types of earth all around the surface.
DrawMaterialSlab("Earth-earth", surface, y, hgt, 4, 12);
DrawMaterialSlab("Earth-earth_root", surface, y, hgt, 2, 16);
DrawMaterialSlab("Earth-earth_spongy", surface, y, hgt, 2, 16);
DrawMaterialSlab("Earth-earth", surface, y, hgt, 4, 12);
// Basic materials.
DrawMaterialSlab("Rock", surface, y, hgt, 2, 8);
DrawMaterialSlab("Tunnel", surface, y, hgt, 6, 3);
DrawMaterialSlab("Ore", surface, y + hgt / 6, hgt / 2, 8, 10);
DrawMaterialSlab("Coal", surface, y + hgt / 7, hgt / 2, 8, 10);
DrawMaterialSlab("Firestone", surface, y + hgt / 6, hgt / 2, 6, 6);
DrawMaterialSlab("Tunnel", surface, y + hgt / 7, hgt / 4, 12, 8);
DrawMaterialSlab("Tunnel", surface, y + 2 * hgt / 3, hgt / 4, 8, 12);
DrawMaterialSlab("Water", surface, y + hgt / 3, hgt / 3, 8, 10);
// Valuable materials in the bottom layer.
DrawMaterialSlab("Firestone", surface, y + 3 * hgt / 5, 2 * hgt / 5, 6, 2);
DrawMaterialSlab("Rock", surface, y + 3 * hgt / 5, 2 * hgt / 5, 6, 14);
DrawMaterialSlab("Granite", surface, y + 3 * hgt / 5, 2 * hgt / 5, 6, 12);
DrawMaterialSlab("Tunnel", surface, y + 3 * hgt / 5, 2 * hgt / 5, 10, 8);
DrawMaterialSlab("Gold", surface, y + 2 * hgt / 3, hgt / 4, 3, 6);
DrawMaterialSlab("Gold", surface, y + 3 * hgt / 4, hgt / 4, 6, 6);
DrawMaterialSlab("Ruby", surface, y + 4 * hgt / 5, hgt / 5, 6, 4);
DrawMaterialSlab("Amethyst", surface, y + 4 * hgt / 5, hgt / 5, 6, 4);
// Draw the surface layer according to map type.
var border_height = [4, 6, 12][Settings_MapType - 1];
var border = {Algo = MAPALGO_Border, Top = border_height, Op = surface};
Draw("Earth", border);
var rnd_checker = {Algo = MAPALGO_RndChecker, Ratio = 30, Wdt = 2, Hgt = 2};
var rnd_border = {Algo = MAPALGO_And, Op = [border, rnd_checker]};
Draw(["Sand", "Rock", "Granite"][Settings_MapType - 1], rnd_border);
Draw(["Earth-earth_root", "Rock-rock_smooth", "Rock"][Settings_MapType - 1], rnd_border);
if (Settings_MapType == CSETTING_MapType_MapTypeMountains)
Draw("Everrock", rnd_border);
return;
}
public func DrawSkyIsland(proplist map, int x, int y, int wdt, int hgt)
{
// An island is just an ellipse with turbulence.
var island = {Algo = MAPALGO_Ellipsis, X = x, Y = y, Wdt = wdt / 2, Hgt = hgt / 2};
island = {Algo = MAPALGO_Turbulence, Iterations = 4, Amplitude = [8, 18], Seed = Random(65536), Op = island};
Draw("Earth", island);
// Overlay a set of materials inside the island.
DrawMaterial("Earth-earth_root", island, 4, 30);
DrawMaterial("Earth-earth", island, 3, 30);
DrawMaterial("Tunnel", island, 3, 10);
for (var mat in ["Coal", "Ore", "Firestone"])
{
DrawMaterial(mat, island, 4, 12);
DrawMaterial(mat, island, 6, 6);
}
// Draw a top border out of sand and top soil.
var sand_border = {Algo = MAPALGO_And, Op = [{Algo = MAPALGO_Border, Op = island, Top = [-1,2]}, {Algo = MAPALGO_RndChecker, Ratio = 50, Wdt = 4, Hgt = 3}]};
var topsoil_border = {Algo = MAPALGO_And, Op = [{Algo = MAPALGO_Border, Op = island, Top = [-1,3]}, {Algo = MAPALGO_RndChecker, Ratio = 40, Wdt = 4, Hgt = 2}]};
Draw(["Sand", "Rock", "Granite"][Settings_MapType - 1], sand_border);
Draw(["Earth-earth_root", "Rock-rock_smooth", "Rock"][Settings_MapType - 1], topsoil_border);
// Draw a bottom border out of granite and rock (or everrock on insane).
var granite_border = {Algo = MAPALGO_Border, Op = island, Bottom = [-2,3]};
Draw(["Rock", "Granite", "Everrock"][Random(3)], granite_border);
var rock_border = {Algo = MAPALGO_RndChecker, Ratio = 20, Wdt = 2, Hgt = 2};
Draw(["Granite", "Rock", "Granite"][Random(3)], {Algo = MAPALGO_And, Op = [granite_border, rock_border]});
Draw(["Granite", "Rock", "Granite"][Random(3)], {Algo = MAPALGO_And, Op = [granite_border, rock_border]});
return;
}
/*-- Helper Functions --*/
public func DrawMaterialSlab(string mat, proplist mask, int y, int hgt, int spec_size, int ratio)
{
var slab = {Algo = MAPALGO_Rect, X = this.X, Y = y, Wdt = this.Wdt, Hgt = hgt};
slab = {Algo = MAPALGO_Turbulence, Iterations = 4, Op = slab};
slab = {Algo = MAPALGO_And, Op = [slab, mask]};
DrawMaterial(mat, slab, spec_size, ratio);
return;
}

View File

@ -0,0 +1,123 @@
[ParameterDef]
Name=$MapSize$
Description=$DescMapSize$
ID=MapSize
Default=4
[Options]
[Option]
Name=$MapSizeNarrowSmall$
Value=0
[Option]
Name=$MapSizeNarrowNormal$
Value=1
[Option]
Name=$MapSizeNarrowLarge$
Value=2
[Option]
Name=$MapSizeBasicSmall$
Value=3
[Option]
Name=$MapSizeBasicNormal$
Value=4
[Option]
Name=$MapSizeBasicLarge$
Value=5
[Option]
Name=$MapSizeWideSmall$
Value=6
[Option]
Name=$MapSizeWideNormal$
Value=7
[Option]
Name=$MapSizeWideLarge$
Value=8
[ParameterDef]
Name=$MapType$
Description=$DescMapType$
ID=MapType
Default=1
[Options]
[Option]
Name=$MapTypeEmpty$
Value=0
[Option]
Name=$MapTypeFlatland$
Value=1
[Option]
Name=$MapTypeHills$
Value=2
[Option]
Name=$MapTypeMountains$
Value=3
[ParameterDef]
Name=$MapClimate$
Description=$DescMapClimate$
ID=MapClimate
Default=0
[Options]
[Option]
Name=$MapClimateTemperate$
Value=0
#[Option]
#Name=$MapClimateCold$
#Value=1
[ParameterDef]
Name=$Goal$
Description=$DescGoal$
ID=Goal
Default=1
[Options]
[Option]
Name=$NoGoal$
Value=0
[Option]
Name=$GoalMining$
Value=1
[Option]
Name=$GoalExpansion$
Value=2
[ParameterDef]
Name=$GodMode$
Description=$DescGodMode$
ID=GodMode
Default=2
[Options]
[Option]
Name=$GodModeOff$
Value=0
[Option]
Name=$GodModeHost$
Value=1
[Option]
Name=$GodModeAll$
Value=2

View File

@ -1,11 +1,18 @@
[Head]
Title=Sandbox
Icon=17
Title=Sandbox
Version=8,0
Difficulty=100
[Definitions]
Definition1=Objects.ocd
Definition2=Decoration.ocd/Misc.ocd/SprayCan.ocd
[Landscape]
Sky=Clouds2
SkyScrollMode=2
Secret=false
[Weather]
Climate=0
YearSpeed=0
Wind=0,100,-100,100

View File

@ -1,35 +1,76 @@
/**
Sandbox
Author: K-Pone
Sandbox
In this round the player can test all items, but also play a settlement round in
a large landscape with many elements.
@author K-Pone, Maikel
*/
/*-- Scenario --*/
public func Initialize()
{
if (!MapGenSizeWidth) MapGenSizeWidth = 80;
if (!MapGenSizeHeight) MapGenSizeHeight = 50;
if (!MapGenPreset) MapGenPreset = "FlatLand";
InitRound();
InitGodModeMessageBoard();
return;
}
public func InitRound()
{
InitGameSettings();
return;
}
/*-- Player --*/
public func InitializePlayer(int plr)
{
var crew = GetCrew(plr);
crew->ShowSandboxUI();
crew->CreateContents(GodsHand);
crew->CreateContents(DevilsHand);
crew->CreateContents(SprayCan);
crew->CreateContents(Teleporter);
GiveAllKnowledge();
crew.MaxContentsCount = 8;
InitPlayerSettings(plr);
GiveAllKnowledge(plr);
GiveSettlementTools(plr);
GiveBaseMaterials(plr);
MovePlayerCrew(plr);
return;
}
public func GiveAllKnowledge()
public func GiveAllKnowledge(int plr)
{
var i, id;
while (id = GetDefinition(i++))
{
SetPlrKnowledge(nil, id);
}
var index, def;
while (def = GetDefinition(index++))
SetPlrKnowledge(plr, def);
return;
}
public func GiveSettlementTools(int plr)
{
var crew = GetCrew(plr);
// Give all tools needed to build up a settlement.
crew->CreateContents(Shovel);
crew->CreateContents(Hammer);
crew->CreateContents(Axe);
crew->CreateContents(Pickaxe);
crew->CreateContents(DynamiteBox);
return;
}
public func GiveBaseMaterials(int plr)
{
SetWealth(plr, 250);
SetBaseMaterial(plr, Clonk, 10);
SetBaseProduction(plr, Clonk, 2);
SetBaseMaterial(plr, Bread, 10);
SetBaseProduction(plr, Bread, 2);
return;
}
public func MovePlayerCrew(int plr)
{
// Move the crew of the player to a nice position on the map.
var pos = FindLocation(Loc_Sky(), Loc_Space(20, CNAT_Top), Loc_Wall(CNAT_Bottom));
if (pos)
{
var crew = GetCrew(plr);
crew->SetPosition(pos.x, pos.y - 11);
}
return;
}

View File

@ -0,0 +1,36 @@
# Scenario options
MapSize=Map size
DescMapSize=Select the shape and the size of the map.
MapSizeBasicSmall=Small
MapSizeBasicNormal=Normal
MapSizeBasicLarge=Large
MapSizeWideSmall=Wide and small
MapSizeWideNormal=Wide and normal
MapSizeWideLarge=Wide and large
MapSizeNarrowSmall=Narrow and small
MapSizeNarrowNormal=Narrow and normal
MapSizeNarrowLarge=Narrow and large
MapType=Map type
DescMapType=The type of map, determines landscape and materials.
MapTypeEmpty=Empty (draw the map yourself in god mode).
MapTypeFlatland=Flat lands.
MapTypeHills=Hilly terrain.
MapTypeMountains=Large mountains.
MapClimate=Map climate
DescMapClimate=The climate on the map.
MapClimateTemperate=Temperate.
MapClimateCold=Cold/Snowy/Icy.
Goal=Goal
DescGoal=Choose a goal.
NoGoal=No goals.
GoalWealth=Gain wealth.
GoalExpansion=Base expansion.
GodMode=God mode
DescGodMode=Enable god mode for host or all players.
GodModeOff=No god mode.
GodModeHost=Host has god mode.
GodModeAll=Everyone has god mode.

View File

@ -0,0 +1,36 @@
# Scenario options
MapSize=Map size
DescMapSize=Select the shape and the size of the map.
MapSizeBasicSmall=Small
MapSizeBasicNormal=Normal
MapSizeBasicLarge=Large
MapSizeWideSmall=Wide and small
MapSizeWideNormal=Wide and normal
MapSizeWideLarge=Wide and large
MapSizeNarrowSmall=Narrow and small
MapSizeNarrowNormal=Narrow and normal
MapSizeNarrowLarge=Narrow and large
MapType=Map type
DescMapType=The type of map, determines landscape and materials.
MapTypeEmpty=Empty (draw the map yourself in god mode).
MapTypeFlatland=Flat lands.
MapTypeHills=Hilly terrain.
MapTypeMountains=Large mountains.
MapClimate=Map climate
DescMapClimate=The climate on the map.
MapClimateTemperate=Temperate.
MapClimateCold=Cold/Snowy/Icy.
Goal=Goal
DescGoal=Choose a goal.
NoGoal=No goals.
GoalMining=Mine all valuables.
GoalExpansion=Base expansion.
GodMode=God mode
DescGodMode=Enable god mode for host or all players.
GodModeOff=No god mode.
GodModeHost=Host has god mode.
GodModeAll=Everyone has god mode.

View File

@ -8,14 +8,16 @@ local idGuiHudOS_catselect = 100;
local idGuiHudOS_objectselect = 101;
local idGuiHudOS_switchspawndest = 102;
protected func Death(int killed_by)
public func Death(int killed_by)
{
HideSandboxUI();
return _inherited(killed_by, ...);
}
func ShowSandboxUI()
public func ShowSandboxUI()
{
var object_spawn_key = GetPlayerControlAssignment(GetOwner(), CON_TutorialGuide, true, true);
var SandboxUI =
{
Player = GetOwner(),
@ -38,6 +40,9 @@ func ShowSandboxUI()
Symbol = Hammer,
Tooltip = "$TooltipObjectspawn$",
Text = Format("<c dddd00>[%s]</c>", object_spawn_key),
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = RGBa(128, 128, 128, 128), Hover = RGBa(128, 255, 128, 128) },
OnMouseIn = GuiAction_SetTag("Hover"),
@ -121,7 +126,7 @@ func ShowSandboxUI()
Right = "20em",
Bottom = "3.5em",
BackgroundColor = RGBa(96,96,96,96),
Tooltip = "$GodsHandDisplayTT$",
Tooltip = "$TooltipGodsHand$",
icon =
{
@ -151,7 +156,7 @@ func ShowSandboxUI()
return idHudSandbox;
}
func UpdateGodsHandDisplay()
public func UpdateGodsHandDisplay()
{
var update =
{
@ -172,7 +177,7 @@ func UpdateGodsHandDisplay()
GuiUpdate(update, idHudSandbox);
}
func HideSandboxUI()
public func HideSandboxUI()
{
if (idHudSandbox)
{
@ -181,27 +186,27 @@ func HideSandboxUI()
}
}
func BtnObjectSpawnClick()
public func BtnObjectSpawnClick()
{
ShowObjectSpawnUI();
}
func BtnLandscapeBrushClick()
public func BtnLandscapeBrushClick()
{
ShowMaterialBrushUI();
}
func BtnMarkerClick()
public func BtnMarkerClick()
{
ShowMarkerUI();
}
func BtnMapGenClick()
public func BtnMapGenClick()
{
ShowMapGenUI();
}
func BtnTweaksClick()
public func BtnTweaksClick()
{
ShowTweaksUI();
}
@ -216,7 +221,7 @@ local ObjectSpawnMenuOpts =
Priority = 2,
Caption = "$OSCatProductionResources$",
Icon = Ore,
Items = [Rock, Ore, Coal, Firestone, Nugget, Metal, Wood, Moss, Ruby, Amethyst, GoldBar, Firestone, Ice]
Items = [Rock, Ore, Coal, Firestone, Nugget, Metal, Wood, Moss, Ruby, Amethyst, Diamond, GoldBar, Ice, Snow, Cloth, Loam, CottonSeed]
},
Foodstuff =
@ -224,7 +229,7 @@ local ObjectSpawnMenuOpts =
Priority = 3,
Caption = "$OSCatFoodstuff$",
Icon = Bread,
Items = [Bread, Mushroom, CookedMushroom, Sproutberry, Coconut]
Items = [Flour, Bread, Mushroom, CookedMushroom, Sproutberry, Coconut]
},
Liquids =
@ -240,7 +245,7 @@ local ObjectSpawnMenuOpts =
Priority = 5,
Caption = "$OSCatTools$",
Icon = Hammer,
Items = [Hammer, Shovel, Axe, Pickaxe, Sickle, TeleGlove, Torch, WallKit, Ropeladder, Ropebridge, GrappleBow, Balloon, Boompack, WindBag, Lantern, Bucket, Barrel, MetalBarrel, Pipe, Crate, Dynamite, DynamiteBox, Lorry]
Items = [Hammer, Shovel, Axe, Pickaxe, Sickle, TeleGlove, Torch, WallKit, Ropeladder, Ropebridge, GrappleBow, Balloon, Boompack, WindBag, Lantern, Bucket, Barrel, MetalBarrel, Pipe, Crate, Dynamite, DynamiteBox, DivingHelmet, Lorry]
},
Weapons =
@ -264,7 +269,7 @@ local ObjectSpawnMenuOpts =
Priority = 8,
Caption = "$OSCatVehicles$",
Icon = Airship,
Items = [Airship, Airplane]
Items = [Lorry, Catapult, Cannon, Locomotive, Airship, Airplane]
},
Animals =
@ -292,7 +297,7 @@ local ObjectSpawnMenuOpts =
}
};
func ShowObjectSpawnUI()
public func ShowObjectSpawnUI()
{
var SpawnUI =
{
@ -414,9 +419,9 @@ func ShowObjectSpawnUI()
return idHudOS;
}
func HideObjectSpawnUI()
public func HideObjectSpawnUI()
{
if (idHudOS)
if (idHudOS != nil)
{
GuiClose(idHudOS);
MenuClosed();
@ -424,25 +429,25 @@ func HideObjectSpawnUI()
}
}
func GetObjectSpawnDest()
public func GetObjectSpawnDest()
{
if (ObjectSpawnTarget == 1) return "$OSTargetClonk$";
if (ObjectSpawnTarget == 2) return "$OSTargetGodsHand$";
}
func GetObjectSpawnDestSymbol()
public func GetObjectSpawnDestSymbol()
{
if (ObjectSpawnTarget == 1) return Clonk;
if (ObjectSpawnTarget == 2) return GodsHand;
}
func GetObjectSpawnDestTooltip()
public func GetObjectSpawnDestTooltip()
{
if (ObjectSpawnTarget == 1) return "$OSTargetClonkTT$";
if (ObjectSpawnTarget == 2) return "$OSTargetGodsHandTT$";
}
func SwitchObjectSpawnDest()
public func SwitchObjectSpawnDest()
{
ObjectSpawnTarget++;
if (ObjectSpawnTarget > 2) ObjectSpawnTarget = 1;
@ -480,7 +485,7 @@ func SwitchObjectSpawnDest()
GuiUpdate(update, idHudOS);
}
func ObjectSpawnSelectCat(data, int player, int ID, int subwindowID, object target)
public func ObjectSpawnSelectCat(data, int player, int ID, int subwindowID, object target)
{
GuiClose(idHudOS, idGuiHudOS_objectselect);
var objectselect =
@ -535,7 +540,7 @@ func ObjectSpawnSelectCat(data, int player, int ID, int subwindowID, object targ
GuiUpdate(objectselect, idHudOS, idGuiHudOS_objectselect);
}
func ObjectSpawnSelectObject(data, int player, int ID, int subwindowID, object target)
public func ObjectSpawnSelectObject(data, int player, int ID, int subwindowID, object target)
{
var clonk = GetCursor(player);
var obj = data[0];
@ -550,25 +555,25 @@ func ObjectSpawnSelectObject(data, int player, int ID, int subwindowID, object t
return;
}
var spawnlocation = 2; // 1 = Inventory, 2 = Outside, 3 = Outside Above
// Normal objects can spawn in Inventory
// Normal objects can spawn in inventory.
if (obj->GetCategory() & C4D_Object)
spawnlocation = 1;
{
clonk->Collect(clonk->CreateObject(obj));
}
// Livings spawn outside the clonk
if (obj->GetCategory() & C4D_Living)
spawnlocation = 2;
else if (obj->GetCategory() & C4D_Living)
{
clonk->CreateObject(obj);
}
// Vehicles spawn above to avoid being stuck
if (obj->GetCategory() & C4D_Vehicle)
spawnlocation = 3;
//if (spawnlocation == 1) clonk->CreateContents(obj);
if (spawnlocation == 1) clonk->Collect(CreateObject(obj));
if (spawnlocation == 2) clonk->CreateObject(obj);
if (spawnlocation == 3) clonk->CreateObjectAbove(obj, 0, 0);
else if (obj->GetCategory() & C4D_Vehicle)
{
clonk->CreateObjectAbove(obj, 0, 0);
}
else
{
clonk->CreateObject(obj);
}
}
else if (ObjectSpawnTarget == 2)
{
@ -577,9 +582,6 @@ func ObjectSpawnSelectObject(data, int player, int ID, int subwindowID, object t
HideObjectSpawnUI();
UpdateGodsHandDisplay();
}
// TODO: Prüfung wo das Objekt erzeugt werden soll (Inventar/Aussen)
// TODO: Prüfen, was mit dem ausgewählten Objekt passieren soll (Spawn/Hand of god)
}
local SelectedBrushMaterial = "Earth-earth";
@ -633,7 +635,7 @@ local idGuiHudMB_MatBgSelect = 301;
local idGuiHudMB_SizeSelect = 302;
local idGuiHudMB_ModeSelect = 303;
func ShowMaterialBrushUI()
public func ShowMaterialBrushUI()
{
var bgBrush = { Std = 0, Hover = RGBa(128,128,192,128) };
var bgQuad = bgBrush;
@ -1002,7 +1004,7 @@ func ShowMaterialBrushUI()
return idHudMB;
}
func HideMaterialBrushUI()
public func HideMaterialBrushUI()
{
if (idHudMB)
{
@ -1012,7 +1014,7 @@ func HideMaterialBrushUI()
}
}
func SelectBrushMaterial(data)
public func SelectBrushMaterial(data)
{
SelectedBrushMaterial = data;
@ -1074,7 +1076,7 @@ func SelectBrushMaterial(data)
GuiUpdate(update, idHudMB);
}
func SelectBrushBackgroundMaterial(data)
public func SelectBrushBackgroundMaterial(data)
{
SelectedBrushBgMaterial = data;
@ -1136,7 +1138,7 @@ func SelectBrushBackgroundMaterial(data)
GuiUpdate(update, idHudMB);
}
func BrushSizeChange(valuechange)
public func BrushSizeChange(valuechange)
{
SelectedBrushSize += valuechange;
if (SelectedBrushSize < 1) SelectedBrushSize = 1;
@ -1161,7 +1163,7 @@ func BrushSizeChange(valuechange)
GuiUpdate(update, idHudMB);
}
func SelectBrushMode(data)
public func SelectBrushMode(data)
{
SelectedBrushMode = data;
@ -1206,7 +1208,7 @@ func SelectBrushMode(data)
local idHudTW;
func ShowTweaksUI()
public func ShowTweaksUI()
{
var TweaksUI =
{
@ -1425,7 +1427,17 @@ func ShowTweaksUI()
return idHudTW;
}
func HideTweaksUI()
public func TweaksUI_SetInvincibility(bool newValue)
{
if (newValue)
Log("$TweakInvincible_Activated$", this->GetName());
else
Log("$TweakInvincible_Deactivated$", this->GetName());
return this->SetInvincibility(newValue);
}
public func HideTweaksUI()
{
if (idHudTW)
{
@ -1437,52 +1449,70 @@ func HideTweaksUI()
local idHudMG;
static MapGenSizeWidth;
static MapGenSizeHeight;
static MapGenPreset;
static MapGenTreesAmount;
local idGuiHudMG_SizeSelectWidth = 400;
local idGuiHudMG_SizeSelectHeight = 401;
local idGuiHudMG_TypePresetList = 402;
local idGuiHudMG_TypeGoal = 403;
local MapGenTypePresetOpts =
{
// Custom =
// {
// Priority = 1,
// Caption = "$MapGenTPCustom$",
// Icon = Hammer,
// Value = "Custom"
// },
FlatLand =
Empty =
{
Priority = 1,
Caption = "$MapGenTPEmpty$",
Icon = Earth,
Value = CSETTING_MapType_Empty
},
Flatland =
{
Priority = 2,
Caption = "$MapGenTPFlatLand$",
Caption = "$MapGenTPFlatland$",
Icon = Earth,
Value = "FlatLand"
Value = CSETTING_MapType_MapTypeFlatland
},
Skylands =
Hills =
{
Priority = 3,
Caption = "$MapGenTPSkylands$",
Icon = Earth,
Value = "Skylands"
},
Caves =
Caption = "$MapGenTPHills$",
Icon = Shovel,
Value = CSETTING_MapType_MapTypeHills
},
Mountains =
{
Priority = 4,
Caption = "$MapGenTPCaves$",
Icon = Earth,
Value = "Caves"
Caption = "$MapGenTPMountains$",
Icon = Rock,
Value = CSETTING_MapType_MapTypeMountains
}
};
func ShowMapGenUI()
local MapGenGoalPresetOpts =
{
NoGoal =
{
Priority = 1,
Caption = "$MapGenGoalNone$",
Icon = Goal_Tutorial,
Value = CSETTING_Goal_Tutorial
},
Mining =
{
Priority = 2,
Caption = "$MapGenGoalMining$",
Icon = Goal_ResourceExtraction,
Value = CSETTING_Goal_Mining
},
Expansion =
{
Priority = 3,
Caption = "$MapGenGoalExpansion$",
Icon = Goal_Expansion,
Value = CSETTING_Goal_Expansion
}
};
public func ShowMapGenUI()
{
var MapGenUI =
{
@ -1519,14 +1549,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Minus",
Text = "10",
Text = "50",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", -10),
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", -50),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1537,14 +1567,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Minus",
Text = "1",
Text = "5",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", -1),
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", -5),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1553,7 +1583,7 @@ func ShowMapGenUI()
{
Priority = 3,
Style = GUI_TextHCenter | GUI_TextVCenter,
Text = Format("<c ffff00>%d</c>", MapGenSizeWidth),
Text = Format("<c ffff00>%d</c>", Settings_MapWdt),
Right = "4em",
Bottom = "2em",
@ -1565,14 +1595,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Plus",
Text = "1",
Text = "5",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", 1),
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", 5),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1583,14 +1613,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Plus",
Text = "10",
Text = "50",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", 10),
OnClick = GuiAction_Call(this, "MapGenSizeWidthChange", 50),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1621,14 +1651,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Minus",
Text = "10",
Text = "50",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", -10),
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", -50),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1639,14 +1669,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Minus",
Text = "1",
Text = "5",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", -1),
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", -5),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1655,7 +1685,7 @@ func ShowMapGenUI()
{
Priority = 3,
Style = GUI_TextHCenter | GUI_TextVCenter,
Text = Format("<c ffff00>%d</c>", MapGenSizeHeight),
Text = Format("<c ffff00>%d</c>", Settings_MapHgt),
Right = "4em",
Bottom = "2em",
@ -1667,14 +1697,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Plus",
Text = "1",
Text = "5",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", 1),
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", 5),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1685,14 +1715,14 @@ func ShowMapGenUI()
Symbol = Icon_Number,
GraphicsName = "Plus",
Text = "10",
Text = "50",
Style = GUI_TextBottom | GUI_TextRight,
BackgroundColor = { Std = 0, Hover = RGBa(128,128,192,128) },
Right = "2em",
Bottom = "2em",
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", 10),
OnClick = GuiAction_Call(this, "MapGenSizeHeightChange", 50),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
},
@ -1715,6 +1745,24 @@ func ShowMapGenUI()
{
ID = idGuiHudMG_TypePresetList,
}
},
OptGoal =
{
Priority = 4,
Bottom = "2em",
Style = GUI_FitChildren,
Caption =
{
Text = "$MapGenGoal$",
Right = "12em",
},
Selection =
{
ID = idGuiHudMG_TypeGoal,
}
}
},
@ -1739,6 +1787,8 @@ func ShowMapGenUI()
UpdateMapGenPresetOptionList();
UpdateMapGenGoalOptionList();
return idHudMG;
}
@ -1779,7 +1829,8 @@ func UpdateMapGenPresetOptionList()
var entry = MapGenTypePresetOpts[property];
var bgcolor = { Std = 0, Hover = RGBa(128,128,192,128) };
if (MapGenPreset == entry.Value) bgcolor = { Std = RGBa(128,192,128,128), Hover = RGBa(128,128,192,128) };
if (Settings_MapType == entry.Value)
bgcolor = { Std = RGBa(128,192,128,128), Hover = RGBa(128,128,192,128) };
var subentry =
{
@ -1809,24 +1860,86 @@ func UpdateMapGenPresetOptionList()
GuiAddSubwindow(subentry, update.OptionList.OptPreset.Selection);
}
GuiUpdate(update, idHudMG);
GuiUpdate(update, idHudMG);
}
func MapGenSelectPreset(data)
func UpdateMapGenGoalOptionList()
{
GuiClose(idHudMG, idGuiHudMG_TypeGoal);
var update =
{
OptionList =
{
OptGoal =
{
Selection =
{
ID = idGuiHudMG_TypeGoal,
Left = "12em",
Style = GUI_GridLayout | GUI_FitChildren,
}
}
}
};
GuiUpdate(update, idHudMG);
for (var property in GetProperties(MapGenGoalPresetOpts))
{
var entry = MapGenGoalPresetOpts[property];
var bgcolor = { Std = 0, Hover = RGBa(128,128,192,128) };
if (Settings_Goal == entry.Value)
bgcolor = { Std = RGBa(128,192,128,128), Hover = RGBa(128,128,192,128) };
var subentry =
{
Right = "10em",
Bottom = "2em",
Priority = entry.Priority,
BackgroundColor = bgcolor,
icon =
{
Symbol = entry.Icon,
Right = "2em",
},
text =
{
Text = entry.Caption,
Left = "2.5em",
Style = GUI_TextVCenter,
},
OnClick = GuiAction_Call(this, "MapGenSelectGoal", entry.Value),
OnMouseIn = GuiAction_SetTag("Hover"),
OnMouseOut = GuiAction_SetTag("Std"),
};
GuiAddSubwindow(subentry, update.OptionList.OptGoal.Selection);
}
GuiUpdate(update, idHudMG);
}
public func MapGenSelectPreset(int data)
{
MapGenPreset = data;
Settings_MapType = data;
UpdateMapGenPresetOptionList();
}
func MapGenSizeWidthChange(valuechange)
public func MapGenSelectGoal(int data)
{
MapGenSizeWidth += valuechange;
if (MapGenSizeWidth < 1) MapGenSizeWidth = 1;
if (MapGenSizeWidth > 1000) MapGenSizeWidth = 1000;
var update =
Settings_Goal = data;
UpdateMapGenGoalOptionList();
}
public func MapGenSizeWidthChange(int change)
{
Settings_MapWdt = BoundBy(Settings_MapWdt + change, CSETTING_MapSize_Min, CSETTING_MapSize_Max);
var update =
{
OptionList =
{
@ -1836,22 +1949,18 @@ func MapGenSizeWidthChange(valuechange)
{
Value =
{
Text = Format("<c ffff00>%d</c>", MapGenSizeWidth)
Text = Format("<c ffff00>%d</c>", Settings_MapWdt)
}
}
}
}
};
};
GuiUpdate(update, idHudMG);
}
func MapGenSizeHeightChange(valuechange)
public func MapGenSizeHeightChange(int change)
{
MapGenSizeHeight += valuechange;
if (MapGenSizeHeight < 1) MapGenSizeHeight = 1;
if (MapGenSizeHeight > 1000) MapGenSizeHeight = 1000;
Settings_MapHgt = BoundBy(Settings_MapHgt + change, CSETTING_MapSize_Min, CSETTING_MapSize_Max);
var update =
{
OptionList =
@ -1862,7 +1971,7 @@ func MapGenSizeHeightChange(valuechange)
{
Value =
{
Text = Format("<c ffff00>%d</c>", MapGenSizeHeight)
Text = Format("<c ffff00>%d</c>", Settings_MapHgt)
}
}
}
@ -1872,7 +1981,7 @@ func MapGenSizeHeightChange(valuechange)
GuiUpdate(update, idHudMG);
}
func MakeNewMap()
public func MakeNewMap()
{
var clonks = [];
for (var clonk in FindObjects(Find_OCF(OCF_CrewMember)))
@ -1897,6 +2006,8 @@ func MakeNewMap()
LoadScenarioSection("main");
GameCall("InitRound");
for (var clonk in clonks)
{
clonk->SetObjectStatus(C4OS_NORMAL);
@ -1905,21 +2016,16 @@ func MakeNewMap()
clonk->Unstick(20);
}
for(var i = 0; i < GetPlayerCount(); i++)
{
GameCall("InitializePlayer", GetPlayerByIndex(i));
}
// Things to do after the Clonks have respawned on new map
PostMapGen();
for (var plr in GetPlayers())
GameCall("InitializePlayer", plr);
return;
}
local idHudMK;
local idGuiHudMK_MarkerList = 610;
func ShowMarkerUI()
public func ShowMarkerUI()
{
var MarkerUI =
{
@ -1960,7 +2066,7 @@ func ShowMarkerUI()
return idHudMK;
}
func HideMarkerUI()
public func HideMarkerUI()
{
if (idHudMK)
{
@ -1970,7 +2076,7 @@ func HideMarkerUI()
}
}
func UpdateMarkerList()
public func UpdateMarkerList()
{
if (!idHudMK) return;
@ -2095,7 +2201,7 @@ func UpdateMarkerList()
GuiUpdate(update, idHudMK, idGuiHudMK_MarkerList);
}
func PlaceNewMarker()
public func PlaceNewMarker()
{
var newindex = GetNextFreeMarkerIndex(GetOwner());
@ -2117,13 +2223,13 @@ func PlaceNewMarker()
}
}
func RemoveMarker(marker)
public func RemoveMarker(marker)
{
marker->RemoveObject();
UpdateMarkerList();
}
func GoToMarker(marker)
public func GoToMarker(marker)
{
this->SetPosition(marker->GetX(), marker->GetY());
this->Sound("Warp");

View File

@ -0,0 +1,94 @@
// God mode functions.
global func InitGodModeMessageBoard()
{
AddMsgBoardCmd("godmode", "SetGodMode(%player%, \"%s\")");
return;
}
global func SetGodMode(int plr, string mode)
{
if (!IsFirstPlayer(plr))
return CustomMessage("$MessageBoardOnlyHost$", nil, plr);
if (mode == "off")
{
Settings_GodMode = CSETTING_GodMode_Off;
SetGodModeOff();
CustomMessage("$MessageBoardModeOff$", nil, plr);
return;
}
if (mode == "host")
{
Settings_GodMode = CSETTING_GodMode_Host;
SetGodModeHost();
CustomMessage("$MessageBoardModeHost$", nil, plr);
return;
}
if (mode == "all")
{
Settings_GodMode = CSETTING_GodMode_All;
SetGodModeAll();
CustomMessage("$MessageBoardModeAll$", nil, plr);
return;
}
CustomMessage("$MessageBoardInvalidPar$", nil, plr);
return;
}
global func SetGodModeOff()
{
for (var plr in GetPlayers(C4PT_User))
TakeGodMode(plr);
return;
}
global func SetGodModeHost()
{
for (var plr in GetPlayers(C4PT_User))
{
if (IsFirstPlayer(plr))
GiveGodMode(plr);
else
TakeGodMode(plr);
}
return;
}
global func SetGodModeAll()
{
for (var plr in GetPlayers(C4PT_User))
GiveGodMode(plr);
return;
}
global func GiveGodMode(int plr)
{
var crew = GetCrew(plr);
if (crew.has_god_mode_enabled)
return;
crew.has_god_mode_enabled = true;
// Give the player the god mode UI.
crew->ShowSandboxUI();
// Give the player the god mode tools.
crew.MaxContentsCount = 9;
crew->CreateContents(GodsHand);
crew->CreateContents(DevilsHand);
crew->CreateContents(SprayCan);
crew->CreateContents(Teleporter);
return;
}
global func TakeGodMode(int plr)
{
var crew = GetCrew(plr);
if (!crew.has_god_mode_enabled)
return;
crew.has_god_mode_enabled = false;
// Remove the god mode UI.
crew->HideSandboxUI();
// Remove god mode items from crew.
RemoveAll(Find_Container(crew), Find_Or(Find_ID(GodsHand), Find_ID(DevilsHand), Find_ID(SprayCan), Find_ID(Teleporter)));
crew.MaxContentsCount = 5;
return;
}

View File

@ -0,0 +1,15 @@
// Menu keys for the god mode menus.
global func PlayerControl(int plr, int ctrl, id spec_id, int x, int y, int strength, bool repeat, int status)
{
var cursor = GetCursor(plr);
if (ctrl == CON_TutorialGuide)
{
if (cursor->GetMenu() && cursor->GetMenu().ID == cursor.idHudOS)
cursor->HideObjectSpawnUI();
else
cursor->ShowObjectSpawnUI();
return;
}
return _inherited(plr, ctrl, spec_id, x, y, strength, repeat, status, ...);
}

View File

@ -0,0 +1,189 @@
// Takes care of all settings for creating a map and initializing a player.
static Settings_MapWdt;
static Settings_MapHgt;
static Settings_MapType;
static Settings_MapClimate;
static Settings_Goal;
static Settings_GodMode;
static const CSETTING_MapSize_Min = 50;
static const CSETTING_MapSize_Max = 800;
static const CSETTING_MapType_Empty = 0;
static const CSETTING_MapType_MapTypeFlatland = 1;
static const CSETTING_MapType_MapTypeHills = 2;
static const CSETTING_MapType_MapTypeMountains = 3;
static const CSETTING_MapClimate_Temperate = 0;
static const CSETTING_MapClimate_Cold = 1;
static const CSETTING_Goal_Tutorial = 0;
static const CSETTING_Goal_Mining = 1;
static const CSETTING_Goal_Expansion = 2;
static const CSETTING_GodMode_Off = 0;
static const CSETTING_GodMode_Host = 1;
static const CSETTING_GodMode_All = 2;
global func InitMapSettings()
{
if (Settings_MapWdt == nil || Settings_MapHgt == nil)
{
// Load map size from scenario parameters.
// The shape of the map can be narrow[1:3], basic[4:3] or wide[3:1].
// The size of the map can be small, normal, large.
var size = 25 * ((SCENPAR_MapSize % 3) + 2);
var shape = [[2, 6], [4, 3], [6, 2]][SCENPAR_MapSize / 3];
Settings_MapWdt = size * shape[0];
Settings_MapHgt = size * shape[1];
}
if (Settings_MapType == nil)
{
Settings_MapType = SCENPAR_MapType;
}
if (Settings_MapClimate == nil)
{
Settings_MapClimate = SCENPAR_MapClimate;
}
return;
}
global func InitGameSettings()
{
InitGameGoals();
InitGameRules();
InitGameVegetation();
InitGameEnvironment();
InitGameAnimals();
return;
}
global func InitGameGoals()
{
if (Settings_Goal == nil)
Settings_Goal = SCENPAR_Goal;
// Create goal according to settings.
if (Settings_Goal == CSETTING_Goal_Tutorial)
{
var goal = CreateObject(Goal_Tutorial);
goal.Name = "$MsgGoalName$";
goal.Description = "$MsgGoalDescription$";
}
else if (Settings_Goal == CSETTING_Goal_Mining)
{
var goal = CreateObject(Goal_ResourceExtraction);
goal->SetResource("Gold");
goal->SetResource("Ruby");
goal->SetResource("Amethyst");
}
else if (Settings_Goal == CSETTING_Goal_Expansion)
{
var goal = CreateObject(Goal_Expansion);
goal->SetExpansionGoal(600);
}
return;
}
global func InitGameRules()
{
// Rules: team account and buying at flagpole.
CreateObject(Rule_TeamAccount);
CreateObject(Rule_BuyAtFlagpole);
// Allow for base respawns.
var relaunch_rule = GetRelaunchRule();
relaunch_rule->SetInventoryTransfer(false);
relaunch_rule->SetLastClonkRespawn(true);
relaunch_rule->SetFreeCrew(false);
relaunch_rule->SetAllowPlayerRestart(true);
relaunch_rule->SetBaseRespawn(true);
relaunch_rule->SetRespawnDelay(0);
// Show wealth in HUD.
GUI_Controller->ShowWealth();
return;
}
global func InitGameVegetation()
{
var wdt = LandscapeWidth();
var hgt = LandscapeHeight();
var map_area_size = wdt * hgt / 20000;
var map_surface_size = wdt / 50;
// Place some vegetation.
Grass->Place(100);
Flower->Place(map_surface_size / 3);
Mushroom->Place(map_surface_size / 3);
Fern->Place(map_surface_size / 3);
Cotton->Place(map_surface_size / 2);
Wheat->Place(map_surface_size / 2);
Vine->Place(map_surface_size / 4);
Branch->Place(map_surface_size / 4);
Trunk->Place(map_surface_size / 6);
// Place some trees.
Tree_Deciduous->Place(map_surface_size);
Tree_Coniferous2->Place(map_surface_size);
LargeCaveMushroom->Place(map_surface_size / 2, nil, { terraform = false });
// Some objects in the earth.
PlaceObjects(Rock, map_area_size, "Earth");
PlaceObjects(Firestone, map_area_size, "Earth");
PlaceObjects(Loam, map_area_size, "Earth");
Diamond->Place(map_surface_size / 3, Rectangle(0, 0, wdt, hgt / 3), {cluster_size = 1});
return;
}
global func InitGameEnvironment()
{
var wdt = LandscapeWidth();
var hgt = LandscapeHeight();
var map_area_size = wdt * hgt / 20000;
var map_surface_size = wdt / 50;
SetSkyParallax(0, 20, 20);
// Time of days and celestials.
var time = CreateObject(Time);
time->SetTime(60 * 12);
time->SetCycleSpeed(20);
// Some dark clouds which rain few ashes.
Cloud->Place(map_surface_size / 4);
Cloud->SetPrecipitation("Water", 10);
return;
}
global func InitGameAnimals()
{
var wdt = LandscapeWidth();
var hgt = LandscapeHeight();
var map_area_size = wdt * hgt / 20000;
var map_surface_size = wdt / 50;
Wipf->Place(map_surface_size / 5, Rectangle(0, 0, wdt, 2 * hgt / 3));
Bat->Place(map_area_size / 5, Rectangle(0, 2 * hgt / 3, wdt, hgt / 3));
Mosquito->Place(map_surface_size / 10);
Zaphive->Place(map_surface_size / 10);
Butterfly->Place(map_surface_size / 5);
return;
}
global func InitPlayerSettings(int plr)
{
if (Settings_GodMode == nil)
Settings_GodMode = SCENPAR_GodMode;
if (Settings_GodMode == CSETTING_GodMode_All || (Settings_GodMode == CSETTING_GodMode_Host && IsFirstPlayer(plr)))
GiveGodMode(plr);
return;
}
global func IsFirstPlayer(int plr)
{
var lowest_plr = 10**6;
for (var check_plr in GetPlayers(C4PT_User))
lowest_plr = Min(lowest_plr, check_plr);
return plr == lowest_plr;
}

View File

@ -3,7 +3,7 @@ TooltipLandscapeBrush=Landschaft zeichnen
TooltipMarker=Marker
TooltipMapGen=Kartengenerator
TooltipTweaks=Cheats und anderes tolles Zeugs
GodsHandDisplayTT=Dieses Objekt wird mit der Hand Gottes platziert (zum Ändern \"Objekte erzeugen\" aufrufen und \"Hand Gottes\" als Ziel auswählen)
TooltipGodsHand=Dieses Objekt wird mit der Hand Gottes platziert (zum Ändern \"Objekte erzeugen\" aufrufen und \"Hand Gottes\" als Ziel auswählen).
OSCatProductionResources=Rohstoffe
OSCatFoodstuff=Nahrungsmittel
@ -20,8 +20,8 @@ OSHintTarget=Tipp! Du kannst hiermit einstellen, wo du Objekte erzeugen möchtes
OSTargetClonk=Ziel: Clonk/Inventar
OSTargetGodsHand=Ziel: Hand Gottes
OSTargetClonkTT=Das Objekt wird (wenn möglich) im Inventar des Clonks erzeugt
OSTargetGodsHandTT=Das Objekt kann mit der Hand Gottes erzeugt werden
OSTargetClonkTT=Das Objekt wird (wenn möglich) im Inventar des Clonks erzeugt.
OSTargetGodsHandTT=Das Objekt kann mit der Hand Gottes erzeugt werden.
MatEarth=Erde
MatEarthSpongy=Erde (Schwammig)
@ -74,11 +74,16 @@ MapGenButtonGenerate=Karte generieren!
MapGenSizeWidth=Kartenbreite
MapGenSizeHeight=Kartenhöhe
MapGenMapType=Kartentyp
MapGenGoal=Spielziel
MapGenTPCustom=Anpassen
MapGenTPFlatLand=Flachland
MapGenTPSkylands=Himmelsinseln
MapGenTPCaves=Höhlen
MapGenTPEmpty=Leer
MapGenTPFlatland=Flachland
MapGenTPHills=Hügeln
MapGenTPMountains=Berge
MapGenGoalNone=Kein Spielziel
MapGenGoalMining=Bergbau
MapGenGoalExpansion=Ausbreitung
TweakInvincible=Unverwundbarkeit (Gott-Modus)
OptActivate=Aktivieren
@ -91,3 +96,14 @@ OptSkin1=Abenteurer
OptSkin2=Steampunk
OptSkin3=Alchemist
OptSkin4=Farmer
# Goal
MsgGoalName=Sandkasten
MsgGoalDescription=You did not select any goal, so you can just experiment and have fun! The host can enable and disable god mode by the message board command /godmode off/host/all.
# Message board
MessageBoardOnlyHost=Only the host can change god mode settings.
MessageBoardModeOff=God mode is now off.
MessageBoardModeHost=The host has now god mode.
MessageBoardModeAll=All players now have god mode.
MessageBoardInvalidPar=Wrong parameter, valid is /godmode off/host/all.

View File

@ -3,7 +3,7 @@ TooltipLandscapeBrush=Draw landscape
TooltipMarker=Marker
TooltipMapGen=Map generator
TooltipTweaks=Cheats and other cool stuff
GodsHandDisplayTT=Dieses Objekt wird mit der Hand Gottes platziert (zum Ändern \"Objekte erzeugen\" aufrufen und \"Hand Gottes\" als Ziel auswählen)
TooltipGodsHand=This object will be place with God's hand (to change select a different object in the menu).
OSCatProductionResources=Resources
OSCatFoodstuff=Nutrition
@ -16,12 +16,12 @@ OSCatAnimals=Animals
OSCatPlants=Plants
OSCatGodTools=God's tools
OSHintTarget=Tipp! Du kannst hiermit einstellen, wo du Objekte erzeugen möchtest. Stelle dies auf \"Hand Gottes\" um auszuwählen, welches Objekt du mit der Hand Gottes erzeugen möchtest.
OSHintTarget=Hint! You can select here where to create the objects. Set to \"God's hand\" to select which object you want to create with God's hand.
OSTargetClonk=Ziel: Clonk/Inventar
OSTargetGodsHand=Ziel: Hand Gottes
OSTargetClonkTT=Das Objekt wird (wenn möglich) im Inventar des Clonks erzeugt
OSTargetGodsHandTT=Das Objekt kann mit der Hand Gottes erzeugt werden
OSTargetClonk=Target: Clonk/Inventory
OSTargetGodsHand=Target: God's hand
OSTargetClonkTT=The object will be placed into the clonks inventory if possible.
OSTargetGodsHandTT=The object can now be placed with God's hand.
MatEarth=Earth
MatEarthSpongy=Earth (spongy)
@ -74,13 +74,18 @@ MapGenButtonGenerate=Generate map!
MapGenSizeWidth=map width
MapGenSizeHeight=map height
MapGenMapType=map type
MapGenGoal=game goal
MapGenTPCustom=Modify
MapGenTPFlatLand=Flatland
MapGenTPSkylands=Skylands
MapGenTPCaves=Caves
MapGenTPEmpty=Empty
MapGenTPFlatland=Flatland
MapGenTPHills=Hills
MapGenTPMountains=Mountains
TweakInvincible=Invincibility (Gott-Modus)
MapGenGoalNone=No goal
MapGenGoalMining=Mining
MapGenGoalExpansion=Expansion
TweakInvincible=Invincibility (God-Mode)
OptActivate=Activate
OptDeactivate=Deactivate
TweakInvincible_Activated=%s is now invincible
@ -91,3 +96,14 @@ OptSkin1=Adventurere
OptSkin2=Steampunk
OptSkin3=Alchemist
OptSkin4=Farmer
# Goal
MsgGoalName=Sandbox
MsgGoalDescription=You did not select any goal, so you can just experiment and have fun! The host can enable and disable god mode by the message board command /godmode off/host/all.
# Message board
MessageBoardOnlyHost=Only the host can change god mode settings.
MessageBoardModeOff=God mode is now off.
MessageBoardModeHost=The host has now god mode.
MessageBoardModeAll=All players now have god mode.
MessageBoardInvalidPar=Wrong parameter, valid is /godmode off/host/all.

View File

@ -1,12 +0,0 @@
#appendto Clonk
func TweaksUI_SetInvincibility(newValue)
{
if (newValue == true)
Log("$TweakInvincible_Activated$", this->GetName());
else
Log("$TweakInvincible_Deactivated$", this->GetName());
return this->SetInvincibility(newValue);
}