exit cleanups / blocking review
This commit is contained in:
parent
b123b036bd
commit
05a935ef0a
@ -115,12 +115,5 @@ epic.register_hook({
|
||||
minetest.sound_stop(state.data.loop_sound_handle)
|
||||
state.data.loop_sound_handle = nil
|
||||
end
|
||||
end,
|
||||
|
||||
on_epic_abort = function(_, state)
|
||||
if state and state.data and state.data.loop_sound_handle then
|
||||
minetest.sound_stop(state.data.loop_sound_handle)
|
||||
state.data.loop_sound_handle = nil
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -89,6 +89,9 @@ local function initialize_reviews(meta)
|
||||
|
||||
end
|
||||
|
||||
-- playername -> bool
|
||||
local form_visited = {}
|
||||
|
||||
-- review block
|
||||
minetest.register_node("epic:review", {
|
||||
description = "Epic review block",
|
||||
@ -126,12 +129,22 @@ minetest.register_node("epic:review", {
|
||||
end,
|
||||
|
||||
epic = {
|
||||
on_enter = function(pos, meta, player, ctx)
|
||||
on_enter = function(pos, meta, player)
|
||||
local name = player:get_player_name()
|
||||
meta:set_string("lastplayer", name)
|
||||
show_formspec(pos, name)
|
||||
ctx.next()
|
||||
end
|
||||
end,
|
||||
on_check = function(_, _, player, ctx)
|
||||
local name = player:get_player_name()
|
||||
if form_visited[name] then
|
||||
form_visited[name] = nil
|
||||
ctx.next()
|
||||
end
|
||||
end,
|
||||
on_exit = function(_, _, player)
|
||||
local name = player:get_player_name()
|
||||
form_visited[name] = nil
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
@ -167,5 +180,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
meta:set_int("counter", meta:get_int("counter") + 1)
|
||||
|
||||
update_formspec(meta)
|
||||
form_visited[player:get_player_name()] = true
|
||||
epic.on_review(pos, player, stars)
|
||||
end)
|
||||
|
@ -69,3 +69,13 @@ minetest.register_node("epic:daynightratio", {
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
epic.register_hook({
|
||||
on_epic_exit = function(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
if player then
|
||||
player:override_day_night_ratio(nil)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -61,3 +61,16 @@ minetest.register_node("epic:set_gravity", {
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
epic.register_hook({
|
||||
on_epic_exit = function(playername)
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
if player then
|
||||
if use_player_monoids then
|
||||
player_monoids.gravity:del_change(player, "epic:set_gravity")
|
||||
else
|
||||
player:set_physics_override({ gravity = 9.81 })
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user