From b4abb0757250625e4231478ccde292307c27bc69 Mon Sep 17 00:00:00 2001
From: paramat <paramat@users.noreply.github.com>
Date: Tue, 1 Aug 2017 04:14:09 +0100
Subject: [PATCH] Player_api: Integrate settable player collisionbox

---
 game_api.txt             | 1 +
 mods/player_api/api.lua  | 2 ++
 mods/player_api/init.lua | 1 +
 3 files changed, 4 insertions(+)

diff --git a/game_api.txt b/game_api.txt
index 4e200fbc..7ea919e6 100644
--- a/game_api.txt
+++ b/game_api.txt
@@ -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
 	}
 
 
diff --git a/mods/player_api/api.lua b/mods/player_api/api.lua
index 21509210..00fa2aef 100644
--- a/mods/player_api/api.lua
+++ b/mods/player_api/api.lua
@@ -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
diff --git a/mods/player_api/init.lua b/mods/player_api/init.lua
index 9484647c..61d43bd4 100644
--- a/mods/player_api/init.lua
+++ b/mods/player_api/init.lua
@@ -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
-- 
GitLab