Skip to content

Commit

Permalink
Update tolua and export EffectID
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbell10 authored and Seadragon91 committed Jun 29, 2017
1 parent 3f7bf88 commit 3352706
Show file tree
Hide file tree
Showing 8 changed files with 305 additions and 23 deletions.
243 changes: 243 additions & 0 deletions Server/Plugins/APIDump/APIDesc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [[
Expand Down
2 changes: 1 addition & 1 deletion lib/tolua++
1 change: 1 addition & 0 deletions src/Bindings/AllToLua.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 35 additions & 2 deletions src/Bindings/BindingsProcessor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ','
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ set(BINDING_DEPENDENCIES
../CraftingRecipes.h
../Cuboid.h
../Defines.h
../EffectID.h
../Enchantments.h
../Entities/Boat.h
../Entities/ArrowEntity.h
Expand Down
38 changes: 19 additions & 19 deletions src/BlockID.h
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 3352706

Please sign in to comment.