-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode_placer.lua
More file actions
26 lines (22 loc) · 956 Bytes
/
node_placer.lua
File metadata and controls
26 lines (22 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local format = string.format
core.register_craftitem(core.get_current_modname() .. ":unknown_node", {
description = "Unknown Node Spawner",
inventory_image = core.inventorycube("unknown_node.png"),
node_placement_prediction = "unknown",
on_place = function(itemstack, placer, pointed_thing)
itemstack:peek_item()
local pos, under = pointed_thing.above, pointed_thing.under
if core.get_node_or_nil(under).buildable_to then
pos = under
end
local playername = placer:get_player_name()
if core.is_protected(pos, playername) then
core.log("action", format("%s tried to placean unknown node at protected position %s", playername, core.pos_to_string(pos)))
core.record_protection_violation(pos, playername)
return itemstack
end
core.log("action", format("%s places unknown node at %s", playername, core.pos_to_string(pos)))
cubictest.provider.map_content(pos, cubictest.constants.CONTENT_UNKNOWN)
return itemstack
end,
})