Skip to content

Commit

Permalink
Core: base_classes: abitlity to pass args into `Form.Base::{regis…
Browse files Browse the repository at this point in the history
…ter|open|close}()` & catch in `::on_{register|open|close}()`. Closes #1697
  • Loading branch information
alek13 committed Sep 28, 2024
1 parent 2508df7 commit de39834
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mods/lord/Core/base_classes/src/base_classes/Form/Base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ function BaseForm:get_spec()
end

--- @public
function BaseForm:open()
self.event:trigger(self.event.Type.on_open, self)
function BaseForm:open(...)
self.event:trigger(self.event.Type.on_open, self, ...)
minetest.show_formspec(self.player_name, self.NAME, self:get_spec())
end

--- @public
function BaseForm:close()
self.event:trigger(self.event.Type.on_close, self)
function BaseForm:close(...)
self.event:trigger(self.event.Type.on_close, self, ...)
end

--- @protected
Expand Down Expand Up @@ -111,8 +111,8 @@ end

--- @public
--- @return base_classes.Form.Base
function BaseForm:register()
self.event:trigger(self.event.Type.on_register, self)
function BaseForm:register(...)
self.event:trigger(self.event.Type.on_register, self, ...)

minetest.register_on_player_receive_fields(function(player, form_name, fields)
self:handler(player, form_name, fields)
Expand Down

0 comments on commit de39834

Please sign in to comment.