diff options
| author | Minetest-j45 <55553015+Minetest-j45@users.noreply.github.com> | 2021-08-30 15:22:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-30 15:22:40 +0100 |
| commit | 7824a4956bf489b4e2cc35e0c97272eee06be6ba (patch) | |
| tree | 70243765dc1743a83596f9c6eec122fb417ef92c /builtin/client | |
| parent | 607add326feb44e078b843464ce4a8de09f28743 (diff) | |
| parent | 35445d24f425c6291a0580b468919ca83de716fd (diff) | |
| download | dragonfireclient-7824a4956bf489b4e2cc35e0c97272eee06be6ba.tar.xz | |
Merge pull request #1 from EliasFleckenstein03/master
update
Diffstat (limited to 'builtin/client')
| -rw-r--r-- | builtin/client/chatcommands.lua | 8 | ||||
| -rw-r--r-- | builtin/client/death_formspec.lua | 4 | ||||
| -rw-r--r-- | builtin/client/register.lua | 4 | ||||
| -rw-r--r-- | builtin/client/util.lua | 20 |
4 files changed, 30 insertions, 6 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua index 0da3dab1b..37308efd9 100644 --- a/builtin/client/chatcommands.lua +++ b/builtin/client/chatcommands.lua @@ -7,7 +7,7 @@ core.register_on_sending_chat_message(function(message) local first_char = message:sub(1,1) if first_char == "/" or first_char == "." then - core.display_chat_message(core.gettext("issued command: ") .. message) + core.display_chat_message(core.gettext("Issued command: ") .. message) end if first_char ~= "." then @@ -18,7 +18,7 @@ core.register_on_sending_chat_message(function(message) param = param or "" if not cmd then - core.display_chat_message(core.gettext("-!- Empty command")) + core.display_chat_message("-!- " .. core.gettext("Empty command.")) return true end @@ -35,7 +35,7 @@ core.register_on_sending_chat_message(function(message) core.display_chat_message(result) end else - core.display_chat_message(core.gettext("-!- Invalid command: ") .. cmd) + core.display_chat_message("-!- " .. core.gettext("Invalid command: ") .. cmd) end return true @@ -69,7 +69,7 @@ core.register_chatcommand("teleport", { core.register_chatcommand("wielded", { description = "Print itemstring of wieleded item", func = function() - return true, core.localplayer:get_wielded_item():get_name() + return true, core.localplayer:get_wielded_item():to_string() end }) diff --git a/builtin/client/death_formspec.lua b/builtin/client/death_formspec.lua index 7b8530440..6d6fd6fd9 100644 --- a/builtin/client/death_formspec.lua +++ b/builtin/client/death_formspec.lua @@ -11,12 +11,12 @@ core.register_on_death(function() if core.settings:get_bool("autorespawn") then core.send_respawn() else - core.show_formspec("__builtin__:death", death_formspec) + core.show_formspec("bultin:death", death_formspec) end end) core.register_on_formspec_input(function(formname, fields) - if formname == "__builtin__:death" then + if formname == "bultin:death" then if fields.btn_ghost_mode then core.display_chat_message("You are in ghost mode. Use .respawn to Respawn.") else diff --git a/builtin/client/register.lua b/builtin/client/register.lua index 2b5526523..f17188b84 100644 --- a/builtin/client/register.lua +++ b/builtin/client/register.lua @@ -105,6 +105,10 @@ core.registered_on_inventory_open, core.register_on_inventory_open = make_regist core.registered_on_recieve_physics_override, core.register_on_recieve_physics_override = make_registration() core.registered_on_play_sound, core.register_on_play_sound = make_registration() core.registered_on_spawn_particle, core.register_on_spawn_particle = make_registration() +core.registered_on_object_properties_change, core.register_on_object_properties_change = make_registration() +core.registered_on_object_hp_change, core.register_on_object_hp_change = make_registration() +core.registered_on_object_add, core.register_on_object_add = make_registration() core.registered_nodes = {} core.registered_items = {} +core.object_refs = {} diff --git a/builtin/client/util.lua b/builtin/client/util.lua index aea15e00f..440f99ebc 100644 --- a/builtin/client/util.lua +++ b/builtin/client/util.lua @@ -58,3 +58,23 @@ end function core.get_nearby_objects(radius) return core.get_objects_inside_radius(core.localplayer:get_pos(), radius) end + +-- HTTP callback interface + +function core.http_add_fetch(httpenv) + httpenv.fetch = function(req, callback) + local handle = httpenv.fetch_async(req) + + local function update_http_status() + local res = httpenv.fetch_async_get(handle) + if res.completed then + callback(res) + else + core.after(0, update_http_status) + end + end + core.after(0, update_http_status) + end + + return httpenv +end |
