Compare commits
8 Commits
de62b0dd1b
...
88f32b7fe5
Author | SHA1 | Date | |
---|---|---|---|
88f32b7fe5 | |||
796bba5386 | |||
e96fc05124 | |||
ea7c18886f | |||
da95192b0e | |||
322d7d3b70 | |||
5c5e8058d5 | |||
98e5ebc431 |
@ -485,28 +485,32 @@ minetest.register_abm({
|
||||
|
||||
|
||||
--
|
||||
-- Checks if specified volume intersects a protected volume
|
||||
-- Checks if specified volume intersects a protected volume, return first node intersected in protected area by player
|
||||
--
|
||||
|
||||
function default.intersects_protection(minp, maxp, player_name, interval)
|
||||
-- 'interval' is the largest allowed interval for the 3D lattice of checks
|
||||
|
||||
if is_50 then
|
||||
-- but newer engines returned first node that intersect area protected or false
|
||||
if is_50 then
|
||||
return minetest.is_area_protected(minp, maxp, player_name, interval)
|
||||
else
|
||||
else
|
||||
-- Compute the optimal float step 'd' for each axis so that all corners and
|
||||
-- borders are checked. 'd' will be smaller or equal to 'interval'.
|
||||
-- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the
|
||||
-- for loop (which might otherwise not be the case due to rounding errors).
|
||||
local d = {}
|
||||
for _, c in pairs({"x", "y", "z"}) do
|
||||
|
||||
if minp[c] > maxp[c] then
|
||||
local tmp = maxp[c]
|
||||
maxp[c] = minp[c]
|
||||
minp[c] = tmp -- Repair positions: 'minp' > 'maxp'
|
||||
end
|
||||
|
||||
if maxp[c] > minp[c] then
|
||||
d[c] = (maxp[c] - minp[c]) / math.ceil((maxp[c] - minp[c]) / interval) - 1e-4
|
||||
elseif maxp[c] == minp[c] then
|
||||
else
|
||||
d[c] = 1 -- Any value larger than 0 to avoid division by zero
|
||||
else -- maxp[c] < minp[c], print error and treat as protection intersected
|
||||
minetest.log("error", "maxp < minp in 'default.intersects_protection()'")
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@ -516,8 +520,9 @@ else
|
||||
local y = math.floor(yf + 0.5)
|
||||
for xf = minp.x, maxp.x, d.x do
|
||||
local x = math.floor(xf + 0.5)
|
||||
if minetest.is_protected({x = x, y = y, z = z}, player_name) then
|
||||
return true
|
||||
local pos = {x = x, y = y, z = z}
|
||||
if core.is_protected(pos, player_name) then
|
||||
return pos
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -525,8 +530,13 @@ else
|
||||
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if not is_50 then
|
||||
-- older engines backguar compatibility
|
||||
minetest.is_area_protected = default.intersects_protection
|
||||
end
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ default.LIGHT_MAX = 14
|
||||
|
||||
-- GUI related stuff
|
||||
default.gui_bg = "bgcolor[#080808BB;true]"
|
||||
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
||||
default.gui_bg_img = ""
|
||||
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||
|
||||
function default.get_hotbar_bg(x,y)
|
||||
|
@ -25,6 +25,7 @@ LIGHT_MAX = default.LIGHT_MAX
|
||||
default.gui_suvival_form = default.gui_survival_form
|
||||
default.gui_bg = ""
|
||||
default.gui_bg_img = ""
|
||||
default.gui_slots = ""
|
||||
|
||||
-- Players
|
||||
if minetest.get_modpath("player_api") then
|
||||
|
BIN
mods/default/models/character50.b3d
Normal file
BIN
mods/default/models/character50.blend
Normal file
@ -5,16 +5,22 @@
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local animation_blend = 0
|
||||
local hp_player_maximun = tonumber(minetest.settings:get('default_hp_player_maximun')) or 40
|
||||
local modelchar
|
||||
local eyeheithg
|
||||
|
||||
if minetest.has_feature("object_use_texture_alpha") then
|
||||
core.PLAYER_MAX_HP_DEFAULT = hp_player_maximun
|
||||
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
|
||||
|
||||
if is_50 then
|
||||
core.PLAYER_MAX_HP_DEFAULT = hp_player_maximun
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.47
|
||||
else
|
||||
core.PLAYER_MAX_HP = hp_player_maximun
|
||||
core.PLAYER_MAX_HP = hp_player_maximun
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.625
|
||||
end
|
||||
|
||||
default.registered_player_models = { }
|
||||
if minetest.get_modpath("hudbars") then
|
||||
hb.settings.hp_player_maximun = hp_player_maximun
|
||||
end
|
||||
|
||||
-- Local for speed.
|
||||
local models = default.registered_player_models
|
||||
@ -24,7 +30,7 @@ function default.player_register_model(name, def)
|
||||
end
|
||||
|
||||
-- Default player appearance
|
||||
default.player_register_model("character.b3d", {
|
||||
default.player_register_model( modelchar, {
|
||||
animation_speed = 30,
|
||||
textures = {"character.png", },
|
||||
animations = {
|
||||
@ -36,7 +42,9 @@ default.player_register_model("character.b3d", {
|
||||
walk_mine = { x=200, y=219, },
|
||||
sit = { x= 81, y=160, },
|
||||
},
|
||||
eye_height = 1.625,
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
|
||||
-- Player stats and animations
|
||||
@ -68,14 +76,19 @@ function default.player_set_model(player, model_name)
|
||||
textures = player_textures[name] or model.textures,
|
||||
visual = "mesh",
|
||||
visual_size = model.visual_size or {x=1, y=1},
|
||||
eye_height = model.eye_height or 1.47,
|
||||
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
stepheight = model.stepheight or 0.6,
|
||||
eye_height = model.eye_height or eyeheithg,
|
||||
})
|
||||
default.player_set_animation(player, "stand")
|
||||
else
|
||||
player:set_properties({
|
||||
textures = { "player.png", "player_back.png", },
|
||||
visual = "upright_sprite",
|
||||
eye_height = 1.625,
|
||||
visual_size = {x=1, y=2},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
end
|
||||
player_model[name] = model_name
|
||||
@ -83,8 +96,10 @@ end
|
||||
|
||||
function default.player_set_textures(player, textures)
|
||||
local name = player:get_player_name()
|
||||
player_textures[name] = textures
|
||||
player:set_properties({textures = textures,})
|
||||
local model = models[player_model[name]]
|
||||
local model_textures = model and model.textures or nil
|
||||
player_textures[name] = textures or model_textures
|
||||
player:set_properties({textures = textures or model_textures,})
|
||||
player:set_properties({hp_max = hp_player_maximun})
|
||||
end
|
||||
|
||||
@ -105,12 +120,9 @@ end
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
default.player_set_model(player, "character.b3d")
|
||||
default.player_set_model(player, modelchar)
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
player:set_properties({hp_max = hp_player_maximun})
|
||||
|
||||
player:hud_set_hotbar_image("gui_hotbar.png")
|
||||
player:hud_set_hotbar_selected_image("gui_hotbar_selected.png")
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
@ -124,6 +136,15 @@ end)
|
||||
local player_set_animation = default.player_set_animation
|
||||
local player_attached = default.player_attached
|
||||
|
||||
-- Prevent knockback for attached players
|
||||
local old_calculate_knockback = minetest.calculate_knockback
|
||||
function minetest.calculate_knockback(player, ...)
|
||||
if player_attached[player:get_player_name()] then
|
||||
return 0
|
||||
end
|
||||
return old_calculate_knockback(player, ...)
|
||||
end
|
||||
|
||||
-- Check each player and apply animations
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
|
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 167 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 161 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 202 B After Width: | Height: | Size: 174 B |
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 224 B |
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 1017 B After Width: | Height: | Size: 891 B |
Before Width: | Height: | Size: 925 B After Width: | Height: | Size: 804 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 184 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 203 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 148 B |
Before Width: | Height: | Size: 156 B After Width: | Height: | Size: 127 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 163 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 481 B After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 193 B After Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 128 B |