aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mundus Build 16-04-2020 No2.exe (renamed from Mundus Build 16-04-2020 No1.exe)bin551424 -> 551936 bytes
-rw-r--r--Mundus/Data/SuperLayers/LI.cs4
-rw-r--r--Mundus/Data/SuperLayers/Mobs/MI.cs1
-rw-r--r--Mundus/Service/Mobs/Controllers/MobMovement.cs51
-rw-r--r--Mundus/Views/Windows/SmallGameWindow.cs2
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs2
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs2
-rw-r--r--Mundus/gtk-gui/gui.stetic4
8 files changed, 42 insertions, 24 deletions
diff --git a/Mundus Build 16-04-2020 No1.exe b/Mundus Build 16-04-2020 No2.exe
index 923b5ce..ab929af 100644
--- a/Mundus Build 16-04-2020 No1.exe
+++ b/Mundus Build 16-04-2020 No2.exe
Binary files differ
diff --git a/Mundus/Data/SuperLayers/LI.cs b/Mundus/Data/SuperLayers/LI.cs
index d112b64..7ef2c2c 100644
--- a/Mundus/Data/SuperLayers/LI.cs
+++ b/Mundus/Data/SuperLayers/LI.cs
@@ -10,5 +10,9 @@
Land = new Land();
Underground = new Underground();
}
+
+ public static ISuperLayer[] AllSuperLayers() {
+ return new ISuperLayer[] { Sky, Land, Underground};
+ }
}
}
diff --git a/Mundus/Data/SuperLayers/Mobs/MI.cs b/Mundus/Data/SuperLayers/Mobs/MI.cs
index c036981..98f85e0 100644
--- a/Mundus/Data/SuperLayers/Mobs/MI.cs
+++ b/Mundus/Data/SuperLayers/Mobs/MI.cs
@@ -14,7 +14,6 @@ namespace Mundus.Data.Superlayers.Mobs {
Player.Inventory.SetNewSizes(screenInvSize);
Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenAxe());
Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenPickaxe());
- Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenShovel());
}
}
}
diff --git a/Mundus/Service/Mobs/Controllers/MobMovement.cs b/Mundus/Service/Mobs/Controllers/MobMovement.cs
index d906e23..dcec506 100644
--- a/Mundus/Service/Mobs/Controllers/MobMovement.cs
+++ b/Mundus/Service/Mobs/Controllers/MobMovement.cs
@@ -1,6 +1,7 @@
using System;
using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
+using Mundus.Data.SuperLayers;
using Mundus.Service.SuperLayers;
using Mundus.Service.Tiles;
@@ -12,21 +13,23 @@ namespace Mundus.Service.Mobs.Controllers {
ChangePosition(MI.Player, yPos, xPos, size);
}
- public static void MoveRandomlyMobsAtPlayerLayer() {
- for(int y = 0; y < MapSizes.CurrSize; y++) {
- for(int x = 0; x < MapSizes.CurrSize; x++) {
- MobTile mob = MI.Player.CurrSuperLayer.GetMobLayerTile(y, x);
+ public static void MoveRandomlyAllMobs() {
+ foreach(var superLayer in LI.AllSuperLayers()) {
+ for (int y = 0; y < MapSizes.CurrSize; y++) {
+ for (int x = 0; x < MapSizes.CurrSize; x++) {
+ MobTile mob = MI.Player.CurrSuperLayer.GetMobLayerTile(y, x);
- if (mob != null) {
- if (mob != MI.Player &&
- rnd.Next(0, mob.RndMovementRate) == 1) {
- int newYPos = rnd.Next(mob.YPos - 1, mob.YPos + 2);
- int newXPos = rnd.Next(mob.XPos - 1, mob.XPos + 2);
+ if (mob != null) {
+ if (mob != MI.Player &&
+ rnd.Next(0, mob.RndMovementRate) == 1) {
+ int newYPos = rnd.Next(mob.YPos - 1, mob.YPos + 2);
+ int newXPos = rnd.Next(mob.XPos - 1, mob.XPos + 2);
- ChangePosition(mob, newYPos, newXPos, MapSizes.CurrSize);
+ ChangePosition(mob, newYPos, newXPos, MapSizes.CurrSize);
+ }
}
}
- }
+ }
}
}
@@ -41,22 +44,33 @@ namespace Mundus.Service.Mobs.Controllers {
public static void ChangePosition(MobTile mob, int yPos, int xPos) {
mob.CurrSuperLayer.RemoveMobFromPosition(mob.YPos, mob.XPos);
- if (mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null) {
- mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob);
+ if (mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null &&
+ HeightController.GetLayerUnderneathMob(mob) != null) {
+ if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null) {
+ mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob);
+ }
}
- else if (!mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos).Solid) {
- mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob);
+ else if (!mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos).Solid &&
+ HeightController.GetLayerUnderneathMob(mob) != null) {
+ if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null) {
+ mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob);
+ }
}
- else if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) != null) {
+ else if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) != null &&
+ HeightController.GetLayerAboveMob(mob).GetMobLayerTile(yPos, xPos) == null) {
//Mobs can only climb to the superlayer on top of them, if there is a climable structure
//and there is a "hole" on top of the climable structure
if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos).IsClimable &&
HeightController.GetLayerAboveMob(mob) != null)
{
+ // The ground above isn't solid or doesnt exist and there are no mobs on top
if (HeightController.GetLayerAboveMob(mob).GetGroundLayerTile(yPos, xPos) == null ||
!HeightController.GetLayerAboveMob(mob).GetGroundLayerTile(yPos, xPos).Solid)
{
mob.CurrSuperLayer = HeightController.GetLayerAboveMob(mob);
+ }
+ else {
+ // TODO: add a message to log
}
}
}
@@ -67,10 +81,11 @@ namespace Mundus.Service.Mobs.Controllers {
}
private static bool CanWalkAt(MobTile mob, int yPos, int xPos) {
- //Mobs can only walk on free ground (no structure on top) or walkable structures
+ //Mobs can only walk on free ground (no structure or mob) or walkable structures
return (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) == null ||
mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos).IsWalkable) &&
- mob.CurrSuperLayer.GetMobLayerTile(yPos, xPos) == null;
+ (mob.CurrSuperLayer.GetMobLayerTile(yPos, xPos) == null ||
+ mob.CurrSuperLayer.GetMobLayerTile(yPos, xPos) == mob);
}
private static bool InBoundaries(int yPos, int xPos) {
diff --git a/Mundus/Views/Windows/SmallGameWindow.cs b/Mundus/Views/Windows/SmallGameWindow.cs
index a5eebd8..143c47c 100644
--- a/Mundus/Views/Windows/SmallGameWindow.cs
+++ b/Mundus/Views/Windows/SmallGameWindow.cs
@@ -580,7 +580,7 @@ namespace Mundus.Views.Windows {
if (!HasSelection()) {
MobMovement.MovePlayer(mapYPos, mapXPos, Size);
- MobMovement.MoveRandomlyMobsAtPlayerLayer();
+ MobMovement.MoveRandomlyAllMobs();
}
else {
if (Inventory.GetPlayerItem(selPlace, selIndex) != null) {
diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
index 1e61604..b734c09 100644
--- a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
@@ -47,7 +47,7 @@ namespace Mundus.Views.Windows
this.lblBuild.WidthRequest = 300;
this.lblBuild.HeightRequest = 20;
this.lblBuild.Name = "lblBuild";
- this.lblBuild.LabelProp = "Build 16-04-2020 No1";
+ this.lblBuild.LabelProp = "Build 16-04-2020 No2";
this.lblBuild.Justify = ((global::Gtk.Justification)(2));
this.vboxUI.Add(this.lblBuild);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vboxUI[this.lblBuild]));
diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs
index 5faf09a..f6c1e0a 100644
--- a/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Windows.PauseWindow.cs
@@ -59,7 +59,7 @@ namespace Mundus.Views.Windows
this.lblBuild.WidthRequest = 300;
this.lblBuild.HeightRequest = 20;
this.lblBuild.Name = "lblBuild";
- this.lblBuild.LabelProp = "Build 16-04-2020 No1";
+ this.lblBuild.LabelProp = "Build 16-04-2020 No2";
this.lblBuild.Justify = ((global::Gtk.Justification)(2));
this.vbox1.Add(this.lblBuild);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.lblBuild]));
diff --git a/Mundus/gtk-gui/gui.stetic b/Mundus/gtk-gui/gui.stetic
index bb61167..abd2c43 100644
--- a/Mundus/gtk-gui/gui.stetic
+++ b/Mundus/gtk-gui/gui.stetic
@@ -5505,7 +5505,7 @@
<property name="MemberName" />
<property name="WidthRequest">300</property>
<property name="HeightRequest">20</property>
- <property name="LabelProp">Build 16-04-2020 No1</property>
+ <property name="LabelProp">Build 16-04-2020 No2</property>
<property name="Justify">Center</property>
</widget>
<packing>
@@ -6706,7 +6706,7 @@
<property name="MemberName" />
<property name="WidthRequest">300</property>
<property name="HeightRequest">20</property>
- <property name="LabelProp">Build 16-04-2020 No1</property>
+ <property name="LabelProp">Build 16-04-2020 No2</property>
<property name="Justify">Center</property>
</widget>
<packing>