mirror of
				https://github.com/minetest-mods/mesecons.git
				synced 2025-11-04 04:55:26 +01:00 
			
		
		
		
	Add protection support to Luacontrollers,
protection is ignored with protection_bypass_priv
This commit is contained in:
		@@ -508,10 +508,15 @@ local digiline = {
 | 
			
		||||
		end
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
local function on_receive_fields(pos, form_name, fields)
 | 
			
		||||
local function on_receive_fields(pos, form_name, fields, sender)
 | 
			
		||||
	if not fields.program then
 | 
			
		||||
		return
 | 
			
		||||
	end
 | 
			
		||||
	local name = sender:get_player_name()
 | 
			
		||||
	if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then
 | 
			
		||||
		minetest.record_protection_violation(pos, name)
 | 
			
		||||
		return
 | 
			
		||||
	end
 | 
			
		||||
	reset(pos)
 | 
			
		||||
	reset_meta(pos, fields.code)
 | 
			
		||||
	local err = run(pos, {type="program"})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user