forked from mtcontrib/minetest-mod-snow
Fix sleds :)
This commit is contained in:
parent
f26ece0620
commit
a029130d61
23
src/sled.lua
23
src/sled.lua
|
@ -101,6 +101,16 @@ local function leave_sled(self, player)
|
|||
player:set_detach()
|
||||
default.player_attached[name] = false
|
||||
default.player_set_animation(player, "stand" , 30)
|
||||
|
||||
player:set_physics_override({
|
||||
speed = 1,
|
||||
jump = 1,
|
||||
})
|
||||
player:hud_remove(self.HUD) -- And here is part 2. ~ LazyJ
|
||||
self.object:remove()
|
||||
|
||||
--Give the sled back again
|
||||
player:get_inventory():add_item("main", "snow:sled")
|
||||
end
|
||||
|
||||
function sled:on_rightclick(player)
|
||||
|
@ -174,12 +184,6 @@ function sled:on_step(dtime)
|
|||
if player:get_player_control().sneak
|
||||
or not accelerating_possible(vector.round(self.object:getpos())) then
|
||||
leave_sled(self, player)
|
||||
player:set_physics_override({
|
||||
speed = 1,
|
||||
jump = 1,
|
||||
})
|
||||
player:hud_remove(self.HUD) -- And here is part 2. ~ LazyJ
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -194,14 +198,17 @@ minetest.register_craftitem("snow:sled", {
|
|||
liquids_pointable = true,
|
||||
stack_max = 1,
|
||||
|
||||
on_use = function(_, placer)
|
||||
on_use = function(itemstack, placer)
|
||||
if players_sled[placer:get_player_name()] then
|
||||
return
|
||||
end
|
||||
local pos = placer:getpos()
|
||||
if accelerating_possible(vector.round(pos)) then
|
||||
pos.y = pos.y+0.5
|
||||
minetest.add_entity(pos, "snow:sled")
|
||||
|
||||
--Get on the sled and remove it from inventory.
|
||||
minetest.add_entity(pos, "snow:sled"):right_click(placer)
|
||||
itemstack:take_item(); return itemstack
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user