From c0711407e96353e14bfa41f17db4e45c43f8ebb9 Mon Sep 17 00:00:00 2001 From: 12xx12 <44411062+12xx12@users.noreply.github.com> Date: Sat, 10 Oct 2020 21:31:44 +0200 Subject: Adding more customize options to mob spawners and improving the way to look for surrounding entities (#4955) * added nearly any customize option * fixed unnecessary diff added comments * removed unnecessary const qualifier * fixed build * changed to ForEachEntityInBox * added docs * updated lua api description * checkstyle * added changes suggested by @peterbell10 And now the player may break the server by setting ridiculous ranges * updated docs changed cast to static cast * fixed clang * fixed clang on WSSAnvil.cpp Co-authored-by: 12xx12 <12xx12100@gmail.com> --- Server/Plugins/APIDump/Classes/BlockEntities.lua | 120 ++++++++++++++++++++++- 1 file changed, 117 insertions(+), 3 deletions(-) (limited to 'Server') diff --git a/Server/Plugins/APIDump/Classes/BlockEntities.lua b/Server/Plugins/APIDump/Classes/BlockEntities.lua index b5e4cdf3b..98de99bf4 100644 --- a/Server/Plugins/APIDump/Classes/BlockEntities.lua +++ b/Server/Plugins/APIDump/Classes/BlockEntities.lua @@ -1353,7 +1353,7 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), Type = "number", }, }, - Notes = "Returns the amount of this monster type in a 8-block radius (Y: 4-block radius).", + Notes = "Returns the amount of this monster type in a radius defined by SetSpawnRange (Y: 4-block radius).", }, GetNearbyPlayersNum = { @@ -1365,6 +1365,22 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), }, Notes = "Returns the amount of the nearby players in a 16-block radius.", }, + GetSpawnCount = + { + Returns = + { + Type = "number", + }, + Notes = "Returns the number of entities the spawner will try to spawn on each activation.", + }, + GetSpawnRange = + { + Returns = + { + Type = "number", + }, + Notes = "Returns half the length of the square the spawner tries to spawn entities in.", + }, GetSpawnDelay = { Returns = @@ -1375,6 +1391,38 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), }, Notes = "Returns the spawn delay. This is the tick delay that is needed to spawn new monsters.", }, + GetMinSpawnDelay = + { + Returns = + { + Type = "number", + }, + Notes = "Returns the minimum number of ticks the spawner waits until spawning new entities automatically.", + }, + GetMaxSpawnDelay = + { + Returns = + { + Type = "number", + }, + Notes = "Returns the maximum number of ticks the spawner waits until spawning new entities automatically.", + }, + GetMaxNearbyEntities = + { + Returns = + { + Type = "number", + }, + Notes = "Returns the maximum number of entities of the same type that can be present before the spawner cannot spawn more entities.", + }, + GetRequiredPlayerRange = + { + Returns = + { + Type = "number" + }, + Notes = "Returns the maximum euclidean distance from a player where the spawner can be activated.", + }, ResetTimer = { Notes = "Sets the spawn delay to a new random value.", @@ -1401,13 +1449,79 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(), }, Notes = "Sets the spawn delay.", }, + SetSpawnCount = + { + Params = + { + { + Name = "SpawnCount", + Type = "number", + }, + }, + Notes = "Sets the number of entities the spawner will try to spawn in each activation. Might not spawn all of them due to spawn limitations of the entity.", + }, + SetSpawnRange = + { + Params = + { + { + Name = "SpawnRange", + Type = "number", + }, + }, + Notes = "Sets half the length of the square the spawner will try to spawn entities in.", + }, + SetMinSpawnDelay = + { + Params = + { + { + Name = "MinSpawnDelay", + Type = "number", + }, + }, + Notes = "Sets the minimum amount of ticks the spawner will wait before spawning new entities.", + }, + SetMaxSpawnDelay = + { + Params = + { + { + Name = "MaxSpawnDelay", + Type = "number", + }, + }, + Notes = "Sets the maximum amount of ticks the spawner will wait before spawning new entities.", + }, + SetMaxNearbyEntities = + { + Params = + { + { + Name = "MaxNearbyEntities", + Type = "number", + }, + }, + Notes = "Sets the maximum amount of nearby entities until the spawner will stop spawning this entity type.", + }, + SetRequiredPlayerRange = + { + Params = + { + { + Name = "RequiredPlayerRange", + Type = "number", + }, + }, + Notes = "Sets the maximum euclidean distance from a player where the spawner can be activated.", + }, SpawnEntity = { - Notes = "Spawns the entity. This function automaticly change the spawn delay!", + Notes = "Spawns the entity. NOTE: This function resets the delay before the next automatic activation of the spawner.", }, UpdateActiveState = { - Notes = "Upate the active flag from the mob spawner. This function is called every 5 seconds from the Tick() function.", + Notes = "Update the active flag from the mob spawner. This function is called every 5 seconds from the Tick() function.", }, }, Inherits = "cBlockEntity", -- cgit v1.2.3