aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
Commit message (Expand)AuthorAge
...
* [CSM] Add callback on open inventory (#5793)Vincent Glize2017-10-02
* Implement mod communication channels (#6351)Loïc Blot2017-09-26
* Set placer to nil instead of a non-functional one in item_OnPlace (#6449)DTA72017-09-21
* on_death: Fix callback number of pushed arguments (Fixes #6451)SmallJoker2017-09-21
* ServerEnv: Clean up object lifecycle handling (#6414)sfan52017-09-15
* Make INodeDefManager::getIds return a vector, not a setKahrl2017-09-12
* Implement minetest.register_can_bypass_userlimit (#6369)Loïc Blot2017-09-04
* Remove nodeupdate completely (#6358)Rui2017-09-01
* Modernize source code: last part (#6285)Loïc Blot2017-08-20
* Optimize headers (part 2) (#6272)Loïc Blot2017-08-18
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
* Cleanup various headers to reduce compilation times (#6255)Loïc Blot2017-08-16
* Add LuaEntity on_death callback (#6177)Loïc Blot2017-07-27
* Add 'plantlike_rooted' drawtypenumber Zero2017-07-11
* Expose getPointedThing to LuaDániel Juhász2017-07-07
* Create a filesystem abstraction layer for CSM and only allow accessing files ...red-0012017-06-30
* C++11 cleanup on constructors (#6000)Vincent Glize2017-06-19
* Remove threads.h and replace its definitions with their C++11 equivalents (#5...ShadowNinja2017-06-11
* C++11 patchset 6: forbid object copy using assigment/copy function deleters (...Loïc Blot2017-06-10
* Order es_DrawType exactly like enum NodeDrawType in nodedef.h (#5946)Thomas--S2017-06-10
* CSM: Fix documentation error for register_on_*_chat_messages (#5917)DS2017-06-09
* Use C++11 mutexes only (remove compat code) (#5922)Loïc Blot2017-06-06
* Fix CSM crash (#5779)red-0012017-05-20
* Fix a warning pointed by GCC 7.1Loic Blot2017-05-18
* Use a settings object for the main settingsShadowNinja2017-05-06
* [CSM] add `on_item_use` (#5544)red-0012017-05-06
* [CSM] Add event on_place_node API lua (#5548)Vincent Glize2017-04-29
* Fix various points reported by cppcheck (#5656)Loïc Blot2017-04-25
* Pass clang-format on various cpp/header files (#5559)Loïc Blot2017-04-23
* Add on_flood() callback.Auke Kok2017-04-22
* Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)Loïc Blot2017-04-20
* Plug two minor Leaks (#5603)Auke Kok2017-04-17
* Hardware coloring for itemstacksDániel Juhász2017-04-08
* code style fix on src/script/cpp_api/s_client.hLoic Blot2017-04-08
* [CSM] Add event on_connect player API lua (#5540)Vincent Glize2017-04-08
* Pass clang-format on 14 trivial header files fixesLoic Blot2017-04-07
* Paramtype2: Add missing type CPT2_GLASSLIKE_LIQUID_LEVELparamat2017-03-30
* Block access to the `io` libraryred-0012017-03-19
* [CSM] Add core.get_timeofday & core.get_day_count env calls (#5401)Loïc Blot2017-03-17
* Add `get_wielded_item`red-0012017-03-13
* [CSM] Add enable_client_modding param (default: false)nerzhul2017-03-13
* [CSM] Add `on_punchnode` callbackred-0012017-03-13
* [CSM] Add `on_dignode` callback (#5140)red-0012017-03-13
* [CSM] Improve security for client-sided mods (#5100)red-0012017-03-13
* [CSM] Add local formspecs. (#5094)red-0012017-03-13
* [CSM] sound_play & sound_stop support + client_lua_api doc (#5096)Loïc Blot2017-03-13
* [CSM] Add on_death, on_hp_modification & oh_damage_taken callbacks (#5093)Loïc Blot2017-03-13
* [CSM] Client side moddingLoic Blot2017-03-13
* Tell on_punch to expect a return valueDuane Robertson2017-02-01
* Make entity on_punch have same signature and behaviour as player on_punchsapier2017-01-28
if (self.have_move_buttons) then local btn_dec_pos = {} btn_dec_pos.x = self.pos.x + (self.btn_size * 0.05) btn_dec_pos.y = self.pos.y + (self.btn_size * 0.05) local btn_inc_pos = {} local btn_size = {} if self.orientation == "horizontal" then btn_size.x = 0.5 btn_size.y = self.btn_size btn_inc_pos.x = self.pos.x + self.size.x - 0.5 btn_inc_pos.y = self.pos.y + (self.btn_size * 0.05) else btn_size.x = self.btn_size btn_size.y = 0.5 btn_inc_pos.x = self.pos.x + (self.btn_size * 0.05) btn_inc_pos.y = self.pos.y + self.size.y - 0.5 end local text_dec = "<" local text_inc = ">" if self.orientation == "vertical" then text_dec = "^" text_inc = "v" end formspec = formspec .. string.format("image_button[%f,%f;%f,%f;;btnbar_dec_%s;%s;true;true]", btn_dec_pos.x, btn_dec_pos.y, btn_size.x, btn_size.y, self.name, text_dec) formspec = formspec .. string.format("image_button[%f,%f;%f,%f;;btnbar_inc_%s;%s;true;true]", btn_inc_pos.x, btn_inc_pos.y, btn_size.x, btn_size.y, self.name, text_inc) end return formspec end local function buttonbar_buttonhandler(self, fields) if fields["btnbar_inc_" .. self.name] ~= nil and self.startbutton < #self.buttons then self.startbutton = self.startbutton + 1 return true end if fields["btnbar_dec_" .. self.name] ~= nil and self.startbutton > 1 then self.startbutton = self.startbutton - 1 return true end for i=1,#self.buttons,1 do if fields[self.buttons[i].name] ~= nil then return self.userbuttonhandler(fields) end end end local buttonbar_metatable = { handle_buttons = buttonbar_buttonhandler, handle_events = function(self, event) end, get_formspec = buttonbar_formspec, hide = function(self) self.hidden = true end, show = function(self) self.hidden = false end, delete = function(self) ui.delete(self) end, add_button = function(self, name, caption, image, tooltip) if caption == nil then caption = "" end if image == nil then image = "" end if tooltip == nil then tooltip = "" end self.buttons[#self.buttons + 1] = { name = name, caption = caption, image = image, tooltip = tooltip } if self.orientation == "horizontal" then if ( (self.btn_size * #self.buttons) + (self.btn_size * 0.05 *2) > self.size.x ) then self.btn_initial_offset = self.btn_size * 0.05 + 0.5 self.have_move_buttons = true end else if ((self.btn_size * #self.buttons) + (self.btn_size * 0.05 *2) > self.size.y ) then self.btn_initial_offset = self.btn_size * 0.05 + 0.5 self.have_move_buttons = true end end end, set_bgparams = function(self, bgcolor) if (type(bgcolor) == "string") then self.bgcolor = bgcolor end end, } buttonbar_metatable.__index = buttonbar_metatable function buttonbar_create(name, cbf_buttonhandler, pos, orientation, size) assert(name ~= nil) assert(cbf_buttonhandler ~= nil) assert(orientation == "vertical" or orientation == "horizontal") assert(pos ~= nil and type(pos) == "table") assert(size ~= nil and type(size) == "table") local self = {} self.name = name self.type = "addon" self.bgcolor = "#000000" self.pos = pos self.size = size self.orientation = orientation self.startbutton = 1 self.have_move_buttons = false self.hidden = false if self.orientation == "horizontal" then self.btn_size = self.size.y else self.btn_size = self.size.x end if (self.btn_initial_offset == nil) then self.btn_initial_offset = self.btn_size * 0.05 end self.userbuttonhandler = cbf_buttonhandler self.buttons = {} setmetatable(self,buttonbar_metatable) ui.add(self) return self end