diff options
-rw-r--r-- | Server/Plugins/APIDump/APIDesc.lua | 243 | ||||
m--------- | lib/tolua++ | 0 | ||||
-rw-r--r-- | src/Bindings/AllToLua.pkg | 1 | ||||
-rw-r--r-- | src/Bindings/BindingsProcessor.lua | 37 | ||||
-rw-r--r-- | src/Bindings/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/BlockID.h | 38 | ||||
-rw-r--r-- | src/EffectID.h | 4 | ||||
-rw-r--r-- | src/World.h | 2 |
8 files changed, 304 insertions, 22 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index fb6dc44ec..d01ac3319 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -12252,6 +12252,249 @@ end }, -- ConstantGroups }, -- cWindow + EffectID = + { + Desc = [[ + An enumeration of sound and particle effects which can be used with + {{cWorld#BroadcastSoundParticleEffect|BroadcastSoundParticleEffect}}. + ]], + Constants = + { + SFX_RANDOM_DISPENSER_DISPENSE = + { + Notes = "Sound of droper/dispenser releasing an item", + }, + SFX_RANDOM_DISPENSER_DISPENSE_FAIL = + { + Notes = "Sound of a droper/dispenser activated without items", + }, + SFX_RANDOM_DISPENSER_SHOOT = + { + Notes = "Sound of a dispenser shooting", + }, + SFX_RANDOM_ENDER_EYE_LAUNCH = + { + Notes = "Sound of an ender eye launch" + }, + SFX_RANDOM_FIREWORK_SHOT = + { + Notes = "Sound of a firework shot", + }, + SFX_RANDOM_IRON_DOOR_OPEN = + { + Notes = "Sound of an iron door opening", + }, + SFX_RANDOM_WOODEN_DOOR_OPEN = + { + Notes = "Sound of a wooden door opening" + }, + SFX_RANDOM_WOODEN_TRAPDOOR_OPEN = + { + Notes = "Sound of a wooden trapdoor opening" + }, + SFX_RANDOM_FENCE_GATE_OPEN = + { + Notes = "Sound of a fence gate opening", + }, + SFX_RANDOM_FIRE_EXTINGUISH = + { + Notes = "Sound of a fire extinguishing", + }, + SFX_RANDOM_PLAY_MUSIC_DISC = + { + Notes = "Starts playing a music disc. Needs an accompanting music disc ID", + }, + SFX_RANDOM_IRON_DOOR_CLOSE = + { + Notes = "Sound of an iron door closing", + }, + SFX_RANDOM_WOODEN_DOOR_CLOSE = + { + Notes = "Sound of a wooden door closing", + }, + SFX_RANDOM_WOODEN_TRAPDOOR_CLOSE = + { + Notes = "Sound of a trapdoor closing", + }, + SFX_RANDOM_FENCE_GATE_CLOSE = + { + Notes = "Sound of a fence gate closing", + }, + SFX_MOB_GHAST_WARN = + { + Notes = "Sound of a ghast warning cry", + }, + SFX_MOB_GHAST_SHOOT = + { + Notes = "Sound of a ghast shooting", + }, + SFX_MOB_ENDERDRAGON_SHOOT = + { + Notes = "Sound of the enderdragon shooting", + }, + SFX_MOB_BLAZE_SHOOT = + { + Notes = "Sound of a blaze shooting", + }, + SFX_MOB_ZOMBIE_WOOD = + { + Notes = "Sound of a zombie attacking a wooden door", + }, + SFX_MOB_ZOMBIE_METAL = + { + Notes = "Sound of a zombie attacking a metal door", + }, + SFX_MOB_ZOMBIE_WOOD_BREAK = + { + Notes = "Sound of a zombie breaking a wooden door", + }, + SFX_MOB_WITHER_BREAK_BLOCK = + { + Notes = "Sound of a wither breaking blocks", + }, + SFX_MOB_WITHER_SPAWN = + { + Notes = "Sound of a wither spawning", + }, + SFX_MOB_WITHER_SHOOT = + { + Notes = "Sound of a wither shooting", + }, + SFX_MOB_BAT_TAKEOFF = + { + Notes = "Sound of a bat taking off", + }, + SFX_MOB_ZOMBIE_INFECT = + { + Notes = "Sound of a zombie infecting a villager", + }, + SFX_MOB_ZOMBIE_UNFECT = + { + Notes = "Sound of a zombie villager converting to villager", + }, + SFX_MOB_ENDERDRAGON_DEATH = + { + Notes = "Sound of the dragon releasing dragon breath", + }, + SFX_RANDOM_ANVIL_BREAK = + { + Notes = "Sound of an anvil breaking", + }, + SFX_RANDOM_ANVIL_USE = + { + Notes = "Sound of using an anvil", + }, + SFX_RANDOM_ANVIL_LAND = + { + Notes = "Sound of a falling anvil landing", + }, + SFX_RANDOM_PORTAL_TRAVEL = + { + Notes = "Sound of travelling through a portal", + }, + SFX_RANDOM_CHORUS_FLOWER_GROW = + { + Notes = "Sound of a growing chorus flower", + }, + SFX_RANDOM_CHORUS_FLOWER_DEATH = + { + Notes = "Sound of a dieing chorus flower", + }, + SFX_RANDOM_BREWING_STAND_BREW = + { + Notes = "Sound of an active brewing stand", + }, + SFX_RANDOM_IRON_TRAPDOOR_OPEN = + { + Notes = "Sound of an iron trapdoor opening", + }, + SFX_RANDOM_IRON_TRAPDOOR_CLOSE = + { + Notes = "Sound of an iron trapdoor closing", + }, + PARTICLE_SMOKE = + { + Notes = "Spawns 10 smoke particles, e.g. from a fire. Needs a {{SmokeDirection|SmokeDirection}}", + }, + PARTICLE_BLOCK_BREAK = + { + Notes = "Block break particle and sound. Needs a BlockID", + }, + PARTICLE_SPLASH_POTION = + { + Notes = "Splash potion particles and glass break sound. Needs a PotionID", + }, + PARTICLE_EYE_OF_ENDER = + { + Notes = "Eye of ender entity break particles and sound", + }, + PARTICLE_MOBSPAWN = + { + Notes = "Mob spawn particle effect: smoke and flames", + }, + PARTICLE_HAPPY_VILLAGER = + { + Notes = "Happy villager/bonemeal particles. Number of particles may be given or 0 for default of 15", + }, + PARTICLE_DRAGON_BREATH = + { + Notes = "Dragon breath particle effect", + }, + PARTICLE_END_GATEWAY_SPAWN = + { + Notes = "End gateway spawn particle effect", + }, + PARTICLE_ENDERDRAGON_GROWL = + { + Notes = "Ender dragon growl particle effect", + }, + }, + }, + SmokeDirection = + { + Desc = [[ + An enumeration of the direction spawned smoke will drift in as it floats up. + ]], + Constants = + { + SOUTH_EAST = + { + Notes = "Smoke drifts south-east", + }, + SOUTH = + { + Notes = "Smoke drifts south", + }, + SOUTH_WEST = + { + Notes = "Smoke drifts south-west", + }, + EAST = + { + Notes = "Smoke drifts east", + }, + CENTRE = + { + Notes = "Smoke does not drift", + }, + WEST = + { + Notes = "Smoke drifts west", + }, + NORTH_EAST = + { + Notes = "Smoke drifts north-east", + }, + NORTH = + { + Notes = "Smoke drifts north", + }, + NORTH_WEST = + { + Notes = "Smoke drifts west", + }, + } + }, Globals = { Desc = [[ diff --git a/lib/tolua++ b/lib/tolua++ -Subproject 2bfca6b56847d6de5e6afd51a8fa69716f337cd +Subproject 988cab37e47a9efd7366d0d43babc58e068968d diff --git a/src/Bindings/AllToLua.pkg b/src/Bindings/AllToLua.pkg index 418e37d23..b59af7374 100644 --- a/src/Bindings/AllToLua.pkg +++ b/src/Bindings/AllToLua.pkg @@ -46,6 +46,7 @@ $cfile "../StringUtils.h" $cfile "../Defines.h" $cfile "../ChatColor.h" $cfile "../ClientHandle.h" +$cfile "../EffectID.h" $cfile "../Server.h" $cfile "../World.h" $cfile "../Inventory.h" diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua index 4bea64435..d6c39dec6 100644 --- a/src/Bindings/BindingsProcessor.lua +++ b/src/Bindings/BindingsProcessor.lua @@ -951,8 +951,9 @@ end --- Installs a hook that is called by ToLua++ for each instantiation of classEnumerate -- The hook is used to fix DoxyComments in enums local function installEnumHook() + --Hook for normal enums local oldEnumerate = Enumerate - Enumerate = function (a_Name, a_Body, a_VarName) + Enumerate = function (a_Name, a_Body, a_VarName, a_Type) -- We need to remove the DoxyComment items from the enum -- otherwise ToLua++ parser would make an enum value out of them a_Body = string.gsub(a_Body, ",[%s\n]*}", "\n}") -- eliminate last ',' @@ -977,7 +978,39 @@ local function installEnumHook() enumValues[numEnumValues] = txt end end - local res = oldEnumerate(a_Name, "{" .. table.concat(enumValues, ",") .. "}", a_VarName) + local res = oldEnumerate(a_Name, "{" .. table.concat(enumValues, ",") .. "}", a_VarName, a_Type) + res.DoxyComments = doxyComments + return res + end + + --Hook for scoped enums + local oldScopedEnum = ScopedEnum + ScopedEnum = function (a_Name, a_Body, a_VarName, a_Type) + -- We need to remove the DoxyComment items from the enum class + -- otherwise ToLua++ parser would make an enum value out of them + a_Body = string.gsub(a_Body, ",[%s\n]*}", "\n}") -- eliminate last ',' + local t = split(strsub(a_Body, 2, -2), ',') -- eliminate braces + local doxyComments = {} + local enumValues = {} + local numEnumValues = 0 + for _, txt in ipairs(t) do + txt = txt:gsub("(%b\17\18)", + function (a_CommentID) + doxyComments[numEnumValues + 1] = g_ForwardDoxyComments[tonumber(a_CommentID:sub(2, -2))] + return "" + end + ):gsub("(%b\19\20)", + function (a_CommentID) + doxyComments[numEnumValues] = g_BackwardDoxyComments[tonumber(a_CommentID:sub(2, -2))] + return "" + end + ) + if (txt ~= "") then + numEnumValues = numEnumValues + 1 + enumValues[numEnumValues] = txt + end + end + local res = oldScopedEnum(a_Name, "{" .. table.concat(enumValues, ",") .. "}", a_VarName, a_Type) res.DoxyComments = doxyComments return res end diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt index 747f22157..64db464f2 100644 --- a/src/Bindings/CMakeLists.txt +++ b/src/Bindings/CMakeLists.txt @@ -92,6 +92,7 @@ set(BINDING_DEPENDENCIES ../CraftingRecipes.h ../Cuboid.h ../Defines.h + ../EffectID.h ../Enchantments.h ../Entities/Boat.h ../Entities/ArrowEntity.h diff --git a/src/BlockID.h b/src/BlockID.h index bd24f9312..0f66026b6 100644 --- a/src/BlockID.h +++ b/src/BlockID.h @@ -1,15 +1,11 @@ #pragma once -// The following hackery is to allow typed C++ enum for C++ code, yet have ToLua process the values. -// ToLua doesn't understand typed enums, so we use preprocessor to hide it from ToLua. - -static const BLOCKTYPE -#if 0 // tolua_begin -enum BLOCKTYPE + + +enum ENUM_BLOCK_ID : BLOCKTYPE { -#endif E_BLOCK_AIR = 0, E_BLOCK_STONE = 1, E_BLOCK_GRASS = 2, @@ -265,20 +261,14 @@ enum BLOCKTYPE E_BLOCK_RED_ROSE = E_BLOCK_FLOWER, E_BLOCK_WOODEN_DOOR = E_BLOCK_OAK_DOOR, E_BLOCK_FENCE_GATE = E_BLOCK_OAK_FENCE_GATE, - E_BLOCK_WOODEN_STAIRS = E_BLOCK_OAK_WOOD_STAIRS - -#if 0 -} -#endif - ; -// tolua_end + E_BLOCK_WOODEN_STAIRS = E_BLOCK_OAK_WOOD_STAIRS, +}; -// tolua_begin -enum ENUM_ITEM_ID +enum ENUM_ITEM_ID : short { E_ITEM_EMPTY = -1, @@ -514,10 +504,10 @@ enum ENUM_ITEM_ID -enum +enum ENUM_BLOCK_META : NIBBLETYPE { - // Please keep this list alpha-sorted by the blocktype / itemtype part - // then number-sorted for the same block / item + // Please keep this list alpha-sorted by the blocktype part + // then number-sorted for the same block //////////////////////////////////////////////////////////////////////////////// // Block metas: @@ -912,6 +902,16 @@ enum E_META_WOOL_GREEN = 13, E_META_WOOL_RED = 14, E_META_WOOL_BLACK = 15, +}; + + + + + +enum ENUM_ITEM_META : short +{ + // Please keep this list alpha-sorted by the itemtype part + // then number-sorted for the same item //////////////////////////////////////////////////////////////////////////////// // Item metas: diff --git a/src/EffectID.h b/src/EffectID.h index 471266ac1..355412a21 100644 --- a/src/EffectID.h +++ b/src/EffectID.h @@ -1,5 +1,7 @@ #pragma once +// tolua_begin + enum class EffectID : Int32 { SFX_RANDOM_DISPENSER_DISPENSE = 1000, @@ -64,3 +66,5 @@ enum class SmokeDirection : Int32 NORTH = 7, NORTH_WEST = 8, }; + +// tolua_end diff --git a/src/World.h b/src/World.h index 495fdf174..3af766166 100644 --- a/src/World.h +++ b/src/World.h @@ -4,7 +4,7 @@ #ifndef _WIN32 #include "BlockID.h" #else - enum ENUM_ITEM_ID; + enum ENUM_ITEM_ID : short; #endif #define MAX_PLAYERS 65535 |