1
0
mirror of https://github.com/Splizard/minetest-mod-snow.git synced 2024-12-29 16:00:16 +01:00

Make sled HUD a entity variable.

This commit is contained in:
Splizard 2014-06-05 17:42:44 +12:00
parent 31dba55c81
commit 2ea175600e

View File

@ -68,6 +68,7 @@ local sled = {
visual = "mesh", visual = "mesh",
mesh = "sled.x", mesh = "sled.x",
textures = {"sled.png"}, textures = {"sled.png"},
HUD,
driver = nil, driver = nil,
sliding = false, sliding = false,
@ -100,7 +101,7 @@ function sled:on_rightclick(clicker)
--]] --]]
-- Here is part 1 of the fix. ~ LazyJ -- Here is part 1 of the fix. ~ LazyJ
HUD = clicker:hud_add({ self.HUD = clicker:hud_add({
hud_elem_type = "text", hud_elem_type = "text",
position = {x=0.5, y=0.89}, position = {x=0.5, y=0.89},
name = "sled", name = "sled",
@ -156,7 +157,7 @@ function sled:on_step(dtime)
players_sled[self.driver:get_player_name()] = false players_sled[self.driver:get_player_name()] = false
self.object:set_detach() self.object:set_detach()
--self.driver:hud_remove("sled") --self.driver:hud_remove("sled")
self.driver:hud_remove(HUD) -- And here is part 2. ~ LazyJ self.driver:hud_remove(self.HUD) -- And here is part 2. ~ LazyJ
self.driver = nil self.driver = nil
self.object:remove() self.object:remove()