- Fix crash on map placement
- Add temp map texture
- Fix player marker on map
This commit is contained in:
Hugues Ross 2020-03-20 08:01:43 -04:00
parent 26e4377cf9
commit 7bb3b544e2
3 changed files with 13 additions and 6 deletions

View File

@ -16,9 +16,11 @@ local function map_from_meta(meta, player_x, player_y)
return id;
end
-- The map item/node
minetest.register_node("cartographer:map", {
description = "Map",
inventory_image = "cartographer_map.png",
tiles = { "cartographer_map.png" },
drawtype = "signlike",
paramtype = "light",
paramtype2 = "wallmounted",
@ -43,14 +45,19 @@ minetest.register_node("cartographer:map", {
return stack;
end,
after_place_node = function(stack, placer, pointed_thing)
-- Called when this node is placed in the world. Copies map data from the
-- item to the node.
-- pos: The position of the node
-- placer: The object that placed this node (can be nil)
-- stack: The itemstack that was placed
-- pointed_thing: The current pointed thing
after_place_node = function(pos, placer, stack, pointed_thing)
local meta = stack:get_meta():to_table();
local s = minetest.item_place(stack, placer, pointed_thing);
local node_meta = minetest.get_meta(pointed_thing);
local node_meta = minetest.get_meta(pos);
node_meta:from_table(meta);
return nil;
-- Consume the item after placing
return false;
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)

View File

@ -13,7 +13,7 @@ local map_formspec_prefix = [[
]];
local tile = "image[%f,%f;%f,%f;%s]";
local marker = "animated_image[%f,%f;%f,%f;%s:%d,%d]";
local marker = "animated_image[%f,%f;%f,%f;;%s;%d;%d]";
local function generate_map(data, x, y, w, h, player_x, player_y, detail, map_scale, is_visible, get_marker, user)
local str = "";

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB