summaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2016-05-30 15:07:09 -0700
committerparamat <mat.gregory@virginmedia.com>2016-06-17 04:41:20 +0100
commit39a9e9874ee739aea91acf36c6f81fc38bce7363 (patch)
tree71141b53e953660320ac428660f7b273027d25ff /builtin/game
parent1b8dbf072ad042542b6bfb29eaed81b8a21ac38c (diff)
downloadminetest-39a9e9874ee739aea91acf36c6f81fc38bce7363.tar.gz
minetest-39a9e9874ee739aea91acf36c6f81fc38bce7363.tar.bz2
minetest-39a9e9874ee739aea91acf36c6f81fc38bce7363.zip
Builtin/game/item: Add `place_param2` nodedef field
This allows a nodedef to specify a fixed value for param2 to be used for all normal placements. There are several uses for this: - nodes that require param2 to be set to a non-zero value for internal mod use. E.g. leafdecay could use this to detect that leaves are played by players. - force wallmounted or facedir value at placement at placement This overrides any player look direction or other on-the-fly param2 setting during placement.
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/item.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 36c2c1a68..26ff8225c 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -250,7 +250,9 @@ function core.item_place_node(itemstack, placer, pointed_thing, param2)
local newnode = {name = def.name, param1 = 0, param2 = param2}
-- Calculate direction for wall mounted stuff like torches and signs
- if def.paramtype2 == 'wallmounted' and not param2 then
+ if def.place_param2 ~= nil then
+ newnode.param2 = def.place_param2
+ elseif def.paramtype2 == 'wallmounted' and not param2 then
local dir = {
x = under.x - above.x,
y = under.y - above.y,
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244