Player_api: Integrate settable player collisionbox
This commit is contained in:
parent
271b2befaa
commit
b4abb07572
|
@ -331,6 +331,7 @@ The player API can register player models and update the player's appearence
|
||||||
bar = {x = 20, y = 39},
|
bar = {x = 20, y = 39},
|
||||||
-- ...
|
-- ...
|
||||||
},
|
},
|
||||||
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3}, -- In nodes from centre of feet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,14 @@ function player_api.set_model(player, model_name)
|
||||||
textures = player_textures[name] or model.textures,
|
textures = player_textures[name] or model.textures,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
visual_size = model.visual_size or {x=1, y=1},
|
visual_size = model.visual_size or {x=1, y=1},
|
||||||
|
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
|
||||||
})
|
})
|
||||||
player_api.set_animation(player, "stand")
|
player_api.set_animation(player, "stand")
|
||||||
else
|
else
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
textures = { "player.png", "player_back.png", },
|
textures = { "player.png", "player_back.png", },
|
||||||
visual = "upright_sprite",
|
visual = "upright_sprite",
|
||||||
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
player_model[name] = model_name
|
player_model[name] = model_name
|
||||||
|
|
|
@ -13,6 +13,7 @@ player_api.register_model("character.b3d", {
|
||||||
walk_mine = { x=200, y=219, },
|
walk_mine = { x=200, y=219, },
|
||||||
sit = { x= 81, y=160, },
|
sit = { x= 81, y=160, },
|
||||||
},
|
},
|
||||||
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Update appearance when the player joins
|
-- Update appearance when the player joins
|
||||||
|
|
Loading…
Reference in New Issue