Fix for 0.4.18.5-dev.
• Remove the "binoculars" mod, as it is broken on 0.4.
This commit is contained in:
parent
b853c8a509
commit
0e0ea932ef
@ -1,37 +0,0 @@
|
|||||||
Minetest Game mod: binoculars
|
|
||||||
=============================
|
|
||||||
See license.txt for license information.
|
|
||||||
|
|
||||||
Authors of source code
|
|
||||||
----------------------
|
|
||||||
paramat (MIT)
|
|
||||||
|
|
||||||
Authors of media (textures)
|
|
||||||
---------------------------
|
|
||||||
paramat (CC BY-SA 3.0):
|
|
||||||
binoculars_binoculars.png
|
|
||||||
|
|
||||||
Crafting
|
|
||||||
--------
|
|
||||||
binoculars:binoculars
|
|
||||||
|
|
||||||
default:obsidian_glass O
|
|
||||||
default:bronze_ingot B
|
|
||||||
|
|
||||||
O_O
|
|
||||||
BBB
|
|
||||||
O_O
|
|
||||||
|
|
||||||
Usage
|
|
||||||
-----
|
|
||||||
In survival mode, use of zoom requires the binoculars item in your inventory,
|
|
||||||
they will allow a 10 degree field of view.
|
|
||||||
It can take up to 5 seconds for adding to or removal from inventory to have an
|
|
||||||
effect, however to instantly allow the use of this zoom 'use' (leftclick) the
|
|
||||||
item.
|
|
||||||
|
|
||||||
Zoom with a field of view of 15 degrees is automatically allowed in creative
|
|
||||||
mode and for any player with the 'creative' privilege.
|
|
||||||
|
|
||||||
The 'binoculars.update_player_property()' function is global so can be
|
|
||||||
redefined by a mod for alternative behaviour.
|
|
@ -1,2 +0,0 @@
|
|||||||
default
|
|
||||||
creative?
|
|
@ -1,76 +0,0 @@
|
|||||||
-- Mod global namespace
|
|
||||||
|
|
||||||
binoculars = {}
|
|
||||||
|
|
||||||
|
|
||||||
-- Detect creative mod
|
|
||||||
local creative_mod = minetest.get_modpath("creative")
|
|
||||||
-- Cache creative mode setting as fallback if creative mod not present
|
|
||||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
|
||||||
|
|
||||||
|
|
||||||
-- Update player property
|
|
||||||
-- Global to allow overriding
|
|
||||||
|
|
||||||
function binoculars.update_player_property(player)
|
|
||||||
local creative_enabled =
|
|
||||||
(creative_mod and creative.is_enabled_for(player:get_player_name())) or
|
|
||||||
creative_mode_cache
|
|
||||||
local new_zoom_fov = 0
|
|
||||||
|
|
||||||
if player:get_inventory():contains_item(
|
|
||||||
"main", "binoculars:binoculars") then
|
|
||||||
new_zoom_fov = 10
|
|
||||||
elseif creative_enabled then
|
|
||||||
new_zoom_fov = 15
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Only set property if necessary to avoid player mesh reload
|
|
||||||
if player:get_properties().zoom_fov ~= new_zoom_fov then
|
|
||||||
player:set_properties({zoom_fov = new_zoom_fov})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Set player property 'on joinplayer'
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
|
||||||
binoculars.update_player_property(player)
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
-- Cyclic update of player property
|
|
||||||
|
|
||||||
local function cyclic_update()
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
|
||||||
binoculars.update_player_property(player)
|
|
||||||
end
|
|
||||||
minetest.after(4.7, cyclic_update)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.after(4.7, cyclic_update)
|
|
||||||
|
|
||||||
|
|
||||||
-- Binoculars item
|
|
||||||
|
|
||||||
minetest.register_craftitem("binoculars:binoculars", {
|
|
||||||
description = "Binoculars\nUse with 'Zoom' key",
|
|
||||||
inventory_image = "binoculars_binoculars.png",
|
|
||||||
stack_max = 1,
|
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
binoculars.update_player_property(user)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- Crafting
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "binoculars:binoculars",
|
|
||||||
recipe = {
|
|
||||||
{"default:obsidian_glass", "", "default:obsidian_glass"},
|
|
||||||
{"default:bronze_ingot", "default:bronze_ingot", "default:bronze_ingot"},
|
|
||||||
{"default:obsidian_glass", "", "default:obsidian_glass"},
|
|
||||||
}
|
|
||||||
})
|
|
@ -1,59 +0,0 @@
|
|||||||
License of source code
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
Copyright (C) 2017 paramat
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
||||||
software and associated documentation files (the "Software"), to deal in the Software
|
|
||||||
without restriction, including without limitation the rights to use, copy, modify, merge,
|
|
||||||
publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
||||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or
|
|
||||||
substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
||||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
|
||||||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
||||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
For more details:
|
|
||||||
https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
|
|
||||||
Licenses of media (textures)
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
|
|
||||||
Copyright (C) 2017 paramat
|
|
||||||
|
|
||||||
You are free to:
|
|
||||||
Share — copy and redistribute the material in any medium or format.
|
|
||||||
Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
|
||||||
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
|
||||||
|
|
||||||
Under the following terms:
|
|
||||||
|
|
||||||
Attribution — You must give appropriate credit, provide a link to the license, and
|
|
||||||
indicate if changes were made. You may do so in any reasonable manner, but not in any way
|
|
||||||
that suggests the licensor endorses you or your use.
|
|
||||||
|
|
||||||
ShareAlike — If you remix, transform, or build upon the material, you must distribute
|
|
||||||
your contributions under the same license as the original.
|
|
||||||
|
|
||||||
No additional restrictions — You may not apply legal terms or technological measures that
|
|
||||||
legally restrict others from doing anything the license permits.
|
|
||||||
|
|
||||||
Notices:
|
|
||||||
|
|
||||||
You do not have to comply with the license for elements of the material in the public
|
|
||||||
domain or where your use is permitted by an applicable exception or limitation.
|
|
||||||
No warranties are given. The license may not give you all of the permissions necessary
|
|
||||||
for your intended use. For example, other rights such as publicity, privacy, or moral
|
|
||||||
rights may limit how you use the material.
|
|
||||||
|
|
||||||
For more details:
|
|
||||||
http://creativecommons.org/licenses/by-sa/3.0/
|
|
Binary file not shown.
Before Width: | Height: | Size: 219 B |
@ -40,12 +40,18 @@ function player_api.set_model(player, model_name)
|
|||||||
if player_model[name] == model_name then
|
if player_model[name] == model_name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local c = model.collisionbox or {-0.3, -1, -0.3, 0.3, 0.75, 0.3}
|
||||||
|
|
||||||
|
if c[2] > -0.5 then
|
||||||
|
c = {c[1], c[2] - 1, c[3], c[4], c[5] - 1, c[6]}
|
||||||
|
end
|
||||||
|
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
mesh = model_name,
|
mesh = model_name,
|
||||||
textures = player_textures[name] or model.textures,
|
textures = player_textures[name] or model.textures,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
visual_size = model.visual_size or {x = 1, y = 1},
|
visual_size = model.visual_size or {x = 1, y = 1},
|
||||||
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
collisionbox = c,
|
||||||
stepheight = model.stepheight or 0.6,
|
stepheight = model.stepheight or 0.6,
|
||||||
eye_height = model.eye_height or 1.47,
|
eye_height = model.eye_height or 1.47,
|
||||||
})
|
})
|
||||||
@ -54,7 +60,7 @@ function player_api.set_model(player, model_name)
|
|||||||
player:set_properties({
|
player:set_properties({
|
||||||
textures = {"player.png", "player_back.png"},
|
textures = {"player.png", "player_back.png"},
|
||||||
visual = "upright_sprite",
|
visual = "upright_sprite",
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
collisionbox = {-0.3, -1.0, -0.3, 0.3, 0.75, 0.3},
|
||||||
stepheight = 0.6,
|
stepheight = 0.6,
|
||||||
eye_height = 1.625,
|
eye_height = 1.625,
|
||||||
})
|
})
|
||||||
|
@ -13,7 +13,7 @@ player_api.register_model("character.b3d", {
|
|||||||
walk_mine = {x = 200, y = 219},
|
walk_mine = {x = 200, y = 219},
|
||||||
sit = {x = 81, y = 160},
|
sit = {x = 81, y = 160},
|
||||||
},
|
},
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
collisionbox = {-0.3, -1, -0.3, 0.3, 0.75, 0.3},
|
||||||
stepheight = 0.6,
|
stepheight = 0.6,
|
||||||
eye_height = 1.47,
|
eye_height = 1.47,
|
||||||
})
|
})
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user