From 104f9e127b259731836c2b88d74a8d731f3ad535 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Thu, 7 Sep 2017 10:25:34 +0200 Subject: Changed some int parameters to vector parameters (#3937) --- Server/Plugins/APIDump/Classes/World.lua | 126 +++++++++++++++++++++---------- 1 file changed, 88 insertions(+), 38 deletions(-) (limited to 'Server') diff --git a/Server/Plugins/APIDump/Classes/World.lua b/Server/Plugins/APIDump/Classes/World.lua index 63c2162e6..ac837dea3 100644 --- a/Server/Plugins/APIDump/Classes/World.lua +++ b/Server/Plugins/APIDump/Classes/World.lua @@ -2917,33 +2917,56 @@ function OnAllChunksAvailable() All return values from the callbacks are i }, SpawnBoat = { - Params = { + Params = { - Name = "X", - Type = "number", - }, - { - Name = "Y", - Type = "number", - }, - { - Name = "Z", - Type = "number", + { + Name = "Position", + Type = "Vector3d", + }, + { + Name = "Material", + Type = "cBoat#eMaterial", + }, }, + Returns = { - Name = "Material", - Type = "cBoat#eMaterial", + { + Name = "EntityID", + Type = "number", + }, }, + Notes = "Spawns a {{cBoat|boat}} at the specific coordinates. Returns the EntityID of the new boat, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no boat was created.", }, - Returns = { + Params = { - Name = "EntityID", - Type = "number", + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + { + Name = "Material", + Type = "cBoat#eMaterial", + }, }, + Returns = + { + { + Name = "EntityID", + Type = "number", + }, + }, + Notes = "Spawns a {{cBoat|boat}} at the specific coordinates. Returns the EntityID of the new boat, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no boat was created. (DEPRECATED, use vector-parametered version)", }, - Notes = "Spawns a {{cBoat|boat}} at the specific coordinates. Returns the EntityID of the new boat, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no boat was created.", }, SpawnExperienceOrb = { @@ -3220,37 +3243,64 @@ function OnAllChunksAvailable() All return values from the callbacks are i }, SpawnPrimedTNT = { - Params = { + Params = { - Name = "X", - Type = "number", - }, - { - Name = "Y", - Type = "number", - }, - { - Name = "Z", - Type = "number", - }, - { - Name = "FuseTicks", - Type = "number", + { + Name = "Position", + Type = "Vector3d", + }, + { + Name = "FuseTicks", + Type = "number", + }, + { + Name = "InitialVelocityCoeff", + Type = "number", + }, }, + Returns = { - Name = "InitialVelocityCoeff", - Type = "number", + { + Name = "EntityID", + Type = "number", + }, }, + Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse ticks. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value. Returns the EntityID of the new spawned primed tnt, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no primed tnt was created.", }, - Returns = { + Params = { - Name = "EntityID", - Type = "number", + { + Name = "X", + Type = "number", + }, + { + Name = "Y", + Type = "number", + }, + { + Name = "Z", + Type = "number", + }, + { + Name = "FuseTicks", + Type = "number", + }, + { + Name = "InitialVelocityCoeff", + Type = "number", + }, + }, + Returns = + { + { + Name = "EntityID", + Type = "number", + }, }, + Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse ticks. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value. Returns the EntityID of the new spawned primed tnt, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no primed tnt was created. (DEPRECATED, use vector-parametered version)", }, - Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse ticks. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value. Returns the EntityID of the new spawned primed tnt, or {{cEntity#INVALID_ID|cEntity#INVALID_ID}} if no primed tnt was created.", }, TryGetHeight = { -- cgit v1.2.3 From ed7adef1ca277c0eaef3be840be6b9ee456c04b8 Mon Sep 17 00:00:00 2001 From: Lukas Pioch Date: Thu, 7 Sep 2017 10:33:46 +0200 Subject: Updated APIDoc (#3985) --- Server/Plugins/APIDump/APIDesc.lua | 110 +++++++------------------ Server/Plugins/APIDump/Classes/Projectiles.lua | 23 +----- 2 files changed, 29 insertions(+), 104 deletions(-) (limited to 'Server') diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index 9a0b7a36e..0122a3e4f 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -3856,10 +3856,6 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") }, Notes = "This entity has killed another entity (the Victim). For players, adds the scoreboard statistics about the kill.", }, - KilledBy = - { - Notes = "FIXME: Remove this from API", - }, MoveToWorld = { { @@ -3987,10 +3983,6 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") }, Notes = "Sets the entity's health to the specified amount of hitpoints. Doesn't broadcast any hurt animation. Doesn't kill the entity if health drops below zero. Use the TakeDamage() function instead for taking damage.", }, - SetHeight = - { - Notes = "FIXME: Remove this from API", - }, SetInvulnerableTicks = { Params = @@ -4189,10 +4181,6 @@ local Hash = cCryptoHash.sha1HexString("DataToHash") }, Notes = "Sets the Z component of the entity speed", }, - SetWidth = - { - Notes = "FIXME: Remove this from API", - }, SetYaw = { Params = @@ -6472,7 +6460,13 @@ These ItemGrids are available in the API and can be manipulated by the plugins, }, RemoveOneEquippedItem = { - Notes = "Removes one item from the hotbar's currently selected slot", + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Removes one item from the hotbar's currently selected slot. Returns true on success.", }, SendEquippedSlot = { @@ -9344,7 +9338,7 @@ a_Player:OpenWindow(Window); { { Name = "EffectType", - Type = "cEntityEffect", + Type = "cEntityEffect#eType", }, { Name = "EffectDurationTicks", @@ -9365,22 +9359,13 @@ a_Player:OpenWindow(Window); { Notes = "Removes all currently applied entity effects", }, - GetHealth = - { - Returns = - { - { - Type = "number", - }, - }, - }, HasEntityEffect = { Params = { { Name = "EffectType", - Type = "cEntityEffect", + Type = "cEntityEffect#eType", }, }, Returns = @@ -9390,14 +9375,6 @@ a_Player:OpenWindow(Window); }, }, Notes = "Returns true, if the supplied entity effect type is currently applied", - }, - Heal = - { - - }, - KilledBy = - { - }, RemoveEntityEffect = { @@ -9405,23 +9382,11 @@ a_Player:OpenWindow(Window); { { Name = "EffectType", - Type = "cEntityEffect", + Type = "cEntityEffect#eType", }, }, Notes = "Removes a currently applied entity effect", }, - TakeDamage = - { - - }, - TeleportTo = - { - - }, - TeleportToEntity = - { - - }, }, Inherits = "cEntity", }, @@ -9869,6 +9834,12 @@ a_Player:OpenWindow(Window); Type = "number", }, }, + Returns = + { + { + Type = "number", + }, + }, Notes = "Adds or removes XP from the current XP amount. Won't allow XP to go negative. Returns the new experience, -1 on error (XP overflow).", }, Feed = @@ -9892,17 +9863,6 @@ a_Player:OpenWindow(Window); }, Notes = "Tries to add the specified amounts to food level and food saturation level (only positive amounts expected). Returns true if player was hungry and the food was consumed, false if too satiated.", }, - FoodPoison = - { - Params = - { - { - Name = "NumTicks", - Type = "number", - }, - }, - Notes = "Starts the food poisoning for the specified amount of ticks; if already foodpoisoned, sets FoodPoisonedTicksRemaining to the larger of the two", - }, ForceSetSpeed = { Params = @@ -10077,10 +10037,6 @@ a_Player:OpenWindow(Window); }, Notes = "Returns the food level (number of half-drumsticks on-screen)", }, - GetFoodPoisonedTicksRemaining = - { - Notes = "Returns the number of ticks left for the food posoning effect", - }, GetFoodSaturationLevel = { Returns = @@ -10093,6 +10049,12 @@ a_Player:OpenWindow(Window); }, GetFoodTickTimer = { + Returns = + { + { + Type = "number", + }, + }, Notes = "Returns the number of ticks past the last food-based heal or damage action; when this timer reaches 80, a new heal / damage is applied.", }, GetGameMode = @@ -10493,17 +10455,6 @@ a_Player:OpenWindow(Window); { Notes = "Reloads the player's rank, message visuals and permissions from the {{cRankManager}}, based on the player's current rank.", }, - MoveTo = - { - Params = - { - { - Name = "NewPosition", - Type = "Vector3d", - }, - }, - Notes = "Tries to move the player into the specified position.", - }, OpenWindow = { Params = @@ -10779,6 +10730,12 @@ a_Player:OpenWindow(Window); Type = "number", }, }, + Returns = + { + { + Type = "boolean", + }, + }, Notes = "Sets the current amount of experience (and indirectly, the XP level).", }, SetCustomName = @@ -10847,17 +10804,6 @@ a_Player:OpenWindow(Window); }, Notes = "Sets the food level (number of half-drumsticks on-screen)", }, - SetFoodPoisonedTicksRemaining = - { - Params = - { - { - Name = "FoodPoisonedTicksRemaining", - Type = "number", - }, - }, - Notes = "Sets the number of ticks remaining for food poisoning. Doesn't send foodpoisoning effect to the client, use FoodPoison() for that.", - }, SetFoodSaturationLevel = { Params = diff --git a/Server/Plugins/APIDump/Classes/Projectiles.lua b/Server/Plugins/APIDump/Classes/Projectiles.lua index a62779960..02ee01a1f 100644 --- a/Server/Plugins/APIDump/Classes/Projectiles.lua +++ b/Server/Plugins/APIDump/Classes/Projectiles.lua @@ -340,22 +340,12 @@ return ]], Functions = { - GetEntityEffect = - { - Returns = - { - { - Type = "cEntityEffect", - }, - }, - Notes = "Returns the entity effect in this potion", - }, GetEntityEffectType = { Returns = { { - Type = "cEntityEffect", + Type = "cEntityEffect#eType", }, }, Notes = "Returns the effect type of this potion", @@ -380,17 +370,6 @@ return }, Notes = "Returns the color index of the particles emitted by this potion", }, - SetEntityEffect = - { - Params = - { - { - Name = "EntityEffect", - Type = "cEntityEffect", - }, - }, - Notes = "Sets the entity effect for this potion", - }, SetEntityEffectType = { Params = -- cgit v1.2.3 From e33eb529addf7ca8870a02725e74d7120912eb6e Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Thu, 7 Sep 2017 09:59:08 +0100 Subject: Fire effect now shown for creative and spectator mode players (#3998) * Fire effect now shown for creative and spectator mode players Fixes #3989 * Add documentation for IsFireproof --- Server/Plugins/APIDump/APIDesc.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Server') diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index 0122a3e4f..3a4e81f0c 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -8812,7 +8812,7 @@ a_Player:OpenWindow(Window); } }, Notes = "Leash the monster to an entity.", - }, + }, MobTypeToString = { IsStatic = true, @@ -10351,6 +10351,16 @@ a_Player:OpenWindow(Window); }, Notes = "Returns true if the player is currently eating the item in their hand.", }, + IsFireproof = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if a player is fireproof. This is when the flag has been explicitly set, or the player is in creative or spectator mode.", + }, IsFishing = { Returns = @@ -15748,7 +15758,7 @@ end E_ITEM_LEASH = { Notes = "The itemtype for lead (E_ITEM_LEAD synonym)" - }, + }, E_ITEM_LEATHER = { Notes = "The itemtype for leather" @@ -17478,4 +17488,3 @@ end "__.*__", }, } - -- cgit v1.2.3 From b5a23e5cd9601a8d0779ecf930b84506fbd398d1 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Thu, 7 Sep 2017 11:56:17 +0100 Subject: Lighting now generally consistent with vanilla (#3988) * Lighting now generally consistent with vanilla Skylight is now dispersed by some blocks, instead of passing through unimpeded. Some blocks which were not marked as transparent are now marked as such. Water and other such blocks now attenuate light with the correct intensity. Generally changes were based on documentation in the Minecraft Wiki: https://minecraft.gamepedia.com/Opacity#On_block_light , however during play-testing on vanilla lava was found not to attenuate sky or block-light so the attenuation was removed. This fixes #3849 * Add API documentation for IsSkylightDispersant * Rename m_SkylightDispersant to m_IsSkylightDispersant * Update comment for m_Transparent property of Blocks --- Server/Plugins/APIDump/APIDesc.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Server') diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index 3a4e81f0c..dafe98619 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -294,6 +294,24 @@ return }, Notes = "Returns whether the specified block type is solid.", }, + IsSkylightDispersant = + { + IsStatic = true, + Params = + { + { + Name = "BlockType", + Type = "number", + }, + }, + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns true if skylight is impeded by passage through a block of the specified type.", + }, IsTransparent = { IsStatic = true, -- cgit v1.2.3 From b12f4ef7d58cfe4d815feb2db1f88f223c7f2a61 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Thu, 7 Sep 2017 07:41:16 -0500 Subject: Made world data paths adjustable, and added API to temporarily disable saving chunks to disk. (#3912) --- Server/Plugins/APIDump/APIDesc.lua | 11 ++++++++ Server/Plugins/APIDump/Classes/World.lua | 31 +++++++++++++++++++++++ Server/Plugins/APIDump/Hooks/OnChunkUnloading.lua | 3 +-- 3 files changed, 43 insertions(+), 2 deletions(-) (limited to 'Server') diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index dafe98619..334fed378 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -11501,6 +11501,17 @@ a_Player:OpenWindow(Window); { Notes = "Saves all the chunks in all the worlds. Note that the saving is queued on each world's tick thread and this functions returns before the chunks are actually saved.", }, + SetSavingEnabled = + { + Params = + { + { + Name = "SavingEnabled", + Type = "boolean", + }, + }, + Notes = "Sets whether saving chunk data is enabled for all worlds. If disabled, dirty chunks will stay in memory forever, which can cause performance and stability issues.", + }, }, AdditionalInfo = { diff --git a/Server/Plugins/APIDump/Classes/World.lua b/Server/Plugins/APIDump/Classes/World.lua index ac837dea3..82f31febe 100644 --- a/Server/Plugins/APIDump/Classes/World.lua +++ b/Server/Plugins/APIDump/Classes/World.lua @@ -1450,6 +1450,16 @@ function OnAllChunksAvailable() All return values from the callbacks are i }, Notes = "Returns the block type and metadata for the block at the specified coords. The first value specifies if the block is in a valid loaded chunk, the other values are valid only if BlockValid is true.", }, + GetDataPath = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns the path to the root of the world data.", + }, GetDefaultWeatherInterval = { Params = @@ -2117,6 +2127,16 @@ function OnAllChunksAvailable() All return values from the callbacks are i }, Notes = "Returns whether PVP is enabled in the world settings.", }, + IsSavingEnabled = + { + Returns = + { + { + Type = "boolean", + }, + }, + Notes = "Returns whether or not saving chunk data is enabled. If disabled, the world will keep dirty chunks in memory forever, and will simply regenerate non-dirty chunks that are unloaded.", + }, IsTrapdoorOpen = { Params = @@ -2726,6 +2746,17 @@ function OnAllChunksAvailable() All return values from the callbacks are i }, Notes = "Sets the blockticking to start at the specified block in the next tick.", }, + SetSavingEnabled = + { + Params = + { + { + Name = "SavingEnabled", + Type = "boolean", + }, + }, + Notes = "Sets whether saving chunk data is enabled. If disabled, dirty chunks will stay in memory forever, which may cause performance and stability issues.", + }, SetShouldUseChatPrefixes = { Params = diff --git a/Server/Plugins/APIDump/Hooks/OnChunkUnloading.lua b/Server/Plugins/APIDump/Hooks/OnChunkUnloading.lua index 98e0a71fd..7317db215 100644 --- a/Server/Plugins/APIDump/Hooks/OnChunkUnloading.lua +++ b/Server/Plugins/APIDump/Hooks/OnChunkUnloading.lua @@ -8,8 +8,7 @@ return Cuberite calls this function when a chunk is about to be unloaded from the memory. A plugin may force Cuberite to keep the chunk in memory by returning true.

- FIXME: The return value should be used only for event propagation stopping, not for the actual - decision whether to unload. + CAUTION: Preventing the server from unloading chunks can cause the server to use too much RAM, which will adversely affect both performance and stability (i.e. your computer will get slow and crash). Return true sparingly. ]], Params = { -- cgit v1.2.3