Fix placing shared locked signs in creative mode
This commit is contained in:
		
							
								
								
									
										12
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								init.lua
									
									
									
									
									
								
							| @@ -15,6 +15,7 @@ arrow_signs={} | |||||||
|  |  | ||||||
| arrow_signs.formspec = "field[text;Sign text:;${text}]"; | arrow_signs.formspec = "field[text;Sign text:;${text}]"; | ||||||
|  |  | ||||||
|  | local creative = minetest.setting_getbool("creative_mode") or false | ||||||
| arrow_signs.on_place = function(itemstack, placer, pointed_thing) | arrow_signs.on_place = function(itemstack, placer, pointed_thing) | ||||||
| 	 | 	 | ||||||
| 	local posabove = pointed_thing.above | 	local posabove = pointed_thing.above | ||||||
| @@ -98,16 +99,15 @@ arrow_signs.on_place = function(itemstack, placer, pointed_thing) | |||||||
| 		place = false | 		place = false | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	if not(place) then | 	if place then | ||||||
| 		minetest.rotate_node(itemstack, placer, pointed_thing) | 		if not creative then | ||||||
| 	else |  | ||||||
| 			itemstack:take_item() | 			itemstack:take_item() | ||||||
| 		end | 		end | ||||||
| 		 | 	else | ||||||
| 	if not minetest.setting_getbool("creative_mode") then | 		itemstack = minetest.rotate_node(itemstack, placer, pointed_thing) | ||||||
| 		return itemstack |  | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
|  | 	return itemstack | ||||||
| end | end | ||||||
|  |  | ||||||
| arrow_signs.savetext = function(pos, formname, fields, sender) | arrow_signs.savetext = function(pos, formname, fields, sender) | ||||||
|   | |||||||
| @@ -27,8 +27,9 @@ minetest.register_node("arrow_signs:shared_locked", { | |||||||
| 	legacy_wallmounted = true, | 	legacy_wallmounted = true, | ||||||
| 	 | 	 | ||||||
| 	on_place = function(itemstack, placer, pointed_thing) | 	on_place = function(itemstack, placer, pointed_thing) | ||||||
| 			arrow_signs.on_place(itemstack, placer, pointed_thing); | 			itemstack = arrow_signs.on_place(itemstack, placer, pointed_thing); | ||||||
| 			locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign"); | 			locks:lock_set_owner( pointed_thing.above, placer, "Shared locked sign"); | ||||||
|  | 			return itemstack | ||||||
| 	end, | 	end, | ||||||
| 	on_construct = function(pos) | 	on_construct = function(pos) | ||||||
| 			local meta =  minetest.get_meta(pos) | 			local meta =  minetest.get_meta(pos) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user