Skip to content

Commit

Permalink
Player_api: Integrate settable player collisionbox
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Aug 6, 2017
1 parent 271b2be commit b4abb07
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions game_api.txt
Expand Up @@ -331,6 +331,7 @@ The player API can register player models and update the player's appearence
bar = {x = 20, y = 39},
-- ...
},
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3}, -- In nodes from centre of feet
}


Expand Down
2 changes: 2 additions & 0 deletions mods/player_api/api.lua
Expand Up @@ -45,12 +45,14 @@ function player_api.set_model(player, model_name)
textures = player_textures[name] or model.textures,
visual = "mesh",
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")
else
player:set_properties({
textures = { "player.png", "player_back.png", },
visual = "upright_sprite",
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
})
end
player_model[name] = model_name
Expand Down
1 change: 1 addition & 0 deletions mods/player_api/init.lua
Expand Up @@ -13,6 +13,7 @@ player_api.register_model("character.b3d", {
walk_mine = { x=200, y=219, },
sit = { x= 81, y=160, },
},
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3},
})

-- Update appearance when the player joins
Expand Down

0 comments on commit b4abb07

Please sign in to comment.