Skip to content

Commit b4abb07

Browse files
committed
Player_api: Integrate settable player collisionbox
1 parent 271b2be commit b4abb07

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

game_api.txt

+1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ The player API can register player models and update the player's appearence
331331
bar = {x = 20, y = 39},
332332
-- ...
333333
},
334+
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3}, -- In nodes from centre of feet
334335
}
335336

336337

mods/player_api/api.lua

+2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ function player_api.set_model(player, model_name)
4545
textures = player_textures[name] or model.textures,
4646
visual = "mesh",
4747
visual_size = model.visual_size or {x=1, y=1},
48+
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
4849
})
4950
player_api.set_animation(player, "stand")
5051
else
5152
player:set_properties({
5253
textures = { "player.png", "player_back.png", },
5354
visual = "upright_sprite",
55+
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
5456
})
5557
end
5658
player_model[name] = model_name

mods/player_api/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ player_api.register_model("character.b3d", {
1313
walk_mine = { x=200, y=219, },
1414
sit = { x= 81, y=160, },
1515
},
16+
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
1617
})
1718

1819
-- Update appearance when the player joins

0 commit comments

Comments
 (0)