From d879a539cd19ddd1ee34afec2512fb2238de2822 Mon Sep 17 00:00:00 2001 From: Novatux Date: Sat, 23 Nov 2013 15:35:49 +0100 Subject: Add minetest.swap_node --- src/map.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index 8e55af437..8abea896e 100644 --- a/src/map.h +++ b/src/map.h @@ -61,6 +61,8 @@ enum MapEditEventType{ MEET_ADDNODE, // Node removed (changed to air) MEET_REMOVENODE, + // Node swapped (changed without metadata change) + MEET_SWAPNODE, // Node metadata of block changed (not knowing which node exactly) // p stores block coordinate MEET_BLOCK_NODE_METADATA_CHANGED, @@ -99,6 +101,8 @@ struct MapEditEvent return VoxelArea(p); case MEET_REMOVENODE: return VoxelArea(p); + case MEET_SWAPNODE: + return VoxelArea(p); case MEET_BLOCK_NODE_METADATA_CHANGED: { v3s16 np1 = p*MAP_BLOCKSIZE; @@ -236,7 +240,8 @@ public: These handle lighting but not faces. */ void addNodeAndUpdate(v3s16 p, MapNode n, - std::map &modified_blocks); + std::map &modified_blocks, + bool remove_metadata = true); void removeNodeAndUpdate(v3s16 p, std::map &modified_blocks); @@ -245,7 +250,7 @@ public: These emit events. Return true if succeeded, false if not. */ - bool addNodeWithEvent(v3s16 p, MapNode n); + bool addNodeWithEvent(v3s16 p, MapNode n, bool remove_metadata = true); bool removeNodeWithEvent(v3s16 p); /* -- cgit v1.2.3