Player_api: Integrate settable player collisionbox
authorparamat <paramat@users.noreply.github.com>
Tue, 1 Aug 2017 03:14:09 +0000 (04:14 +0100)
committerparamat <mat.gregory@virginmedia.com>
Sun, 6 Aug 2017 00:54:47 +0000 (01:54 +0100)
game_api.txt
mods/player_api/api.lua
mods/player_api/init.lua

index 4e200fbcef7e50c69630c41aef3ffbcbd42e92ed..7ea919e6482fac663eac3748b4a726d6c27cc750 100644 (file)
@@ -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
        }
 
 
index 21509210e8bf382fe0bef93af976d3cc2f6bf9aa..00fa2aef9423346ee4627f1fd4f826e9567b3bd9 100644 (file)
@@ -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
index 9484647cfbc791cb744ce0a5c36c61e17df2ab1e..61d43bd4ab3e37ce263cb518327c870a1f922187 100644 (file)
@@ -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