diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-30 11:20:07 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-30 11:20:07 +0100 |
commit | 8b3eaf5b05379f995bf8d55532c107b190848a69 (patch) | |
tree | b67b0d5052b512e58f27be27859522f1d4004311 /src/script/common/c_content.cpp | |
parent | 0a285dd338fb415744e3fb8d6a1cc3763d796c4a (diff) | |
download | dragonfireclient-8b3eaf5b05379f995bf8d55532c107b190848a69.tar.xz |
Lua API: Particle callbacks; Add NoWeather
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r-- | src/script/common/c_content.cpp | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 04f4c335c..72361bdb5 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -1325,20 +1325,6 @@ void push_inventory(lua_State *L, Inventory *inventory) } /******************************************************************************/ -void push_inventory_list(lua_State *L, Inventory *inv, const char *name) -{ - InventoryList *invlist = inv->getList(name); - if(invlist == NULL){ - lua_pushnil(L); - return; - } - std::vector<ItemStack> items; - for(u32 i=0; i<invlist->getSize(); i++) - items.push_back(invlist->getItem(i)); - push_items(L, items); -} - -/******************************************************************************/ void read_inventory_list(lua_State *L, int tableindex, Inventory *inv, const char *name, Server* srv, int forcesize) { @@ -1367,6 +1353,19 @@ void read_inventory_list(lua_State *L, int tableindex, } } +void push_inventory_list(lua_State *L, Inventory *inv, const char *name) +{ + InventoryList *invlist = inv->getList(name); + if(invlist == NULL){ + lua_pushnil(L); + return; + } + std::vector<ItemStack> items; + for(u32 i=0; i<invlist->getSize(); i++) + items.push_back(invlist->getItem(i)); + push_items(L, items); +} + /******************************************************************************/ struct TileAnimationParams read_animation_definition(lua_State *L, int index) { @@ -1402,6 +1401,29 @@ struct TileAnimationParams read_animation_definition(lua_State *L, int index) return anim; } +void push_animation_definition(lua_State *L, struct TileAnimationParams anim) +{ + switch (anim.type) { + case TAT_NONE: + lua_pushnil(L); + break; + case TAT_VERTICAL_FRAMES: + lua_newtable(L); + setstringfield(L, -1, "type", "vertical_frames"); + setfloatfield(L, -1, "aspect_w", anim.vertical_frames.aspect_w); + setfloatfield(L, -1, "aspect_h", anim.vertical_frames.aspect_h); + setfloatfield(L, -1, "length", anim.vertical_frames.length); + break; + case TAT_SHEET_2D: + lua_newtable(L); + setstringfield(L, -1, "type", "sheet_2d"); + setintfield(L, -1, "frames_w", anim.sheet_2d.frames_w); + setintfield(L, -1, "frames_h", anim.sheet_2d.frames_h); + setintfield(L, -1, "frame_length", anim.sheet_2d.frame_length); + break; + } +} + /******************************************************************************/ ToolCapabilities read_tool_capabilities( lua_State *L, int table) @@ -2103,6 +2125,7 @@ void push_collision_move_result(lua_State *L, const collisionMoveResult &res) /**/ } +/******************************************************************************/ void push_physics_override(lua_State *L, float speed, float jump, float gravity, bool sneak, bool sneak_glitch, bool new_move) { lua_createtable(L, 0, 6); |