From 3b1f11bd6abff2e146135dc000855cf1269715fd Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 10 May 2014 16:43:06 +0200 Subject: [PATCH 1/4] Each time a portal block receives a tick it has a 1 in 500 chance of spawning a zombie pigman. --- src/Blocks/BlockPortal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 21bcbdeea..9f78f230e 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -2,6 +2,7 @@ #pragma once #include "BlockHandler.h" +#include "../Mobs/Monster.h" @@ -38,6 +39,19 @@ public: return; // No pickups } + virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override + { + cFastRandom Random; + if (Random.NextInt(500) != 0) + { + return; + } + + int PosX = a_Chunk.GetPosX() * 16 + a_RelX; + int PosZ = a_Chunk.GetPosZ() * 16 + a_RelZ; + + a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::eType::mtZombiePigman); + } virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override { From 7f3683cfab490ca74eb61101dc00c57c2c6682e5 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 10 May 2014 17:03:02 +0200 Subject: [PATCH 2/4] A portal block now chooses a number between 2000 and 0 --- src/Blocks/BlockPortal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 9f78f230e..47f0bca64 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -42,7 +42,7 @@ public: virtual void OnUpdate(cChunkInterface & cChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_PluginInterface, cChunk & a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override { cFastRandom Random; - if (Random.NextInt(500) != 0) + if (Random.NextInt(2000) != 0) { return; } From 4ca178f24ab74ee32340d40fad12a70e65a134df Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 10 May 2014 17:09:48 +0200 Subject: [PATCH 3/4] Fixed compile problem. --- src/Blocks/BlockPortal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index 47f0bca64..3b8030028 100644 --- a/src/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h @@ -50,7 +50,7 @@ public: int PosX = a_Chunk.GetPosX() * 16 + a_RelX; int PosZ = a_Chunk.GetPosZ() * 16 + a_RelZ; - a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::eType::mtZombiePigman); + a_WorldInterface.SpawnMob(PosX, a_RelY, PosZ, cMonster::mtZombiePigman); } virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override From 079f8cd535e98bcf303667fb3394f779781c1527 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 10 May 2014 17:55:39 +0200 Subject: [PATCH 4/4] Fixed the console saying no plugins are loaded. --- src/Bindings/PluginManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 310ecc7e8..fc690d4de 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -144,7 +144,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni) } size_t NumLoadedPlugins = GetNumPlugins(); - if (NumLoadedPlugins) + if (NumLoadedPlugins == 0) { LOG("-- No Plugins Loaded --"); }