----------------------------------------------------------------------------------------------------
-- Disable actor's weapon
----------------------------------------------------------------------------------------------------
--function printf()
--end

local state_nowhere = 0 -- схема только что включилась
local state_inside = 1 -- актер внутри
local state_outside = 2 -- актер снаружи

class "action_no_weapon"

function action_no_weapon:__init( obj, storage )
	self.object = obj
	self.st = storage
	self.inited_time = game.CTime()
end

function action_no_weapon:reset_scheme()
	--printf("_bp: sr_idle: action_no_weapon:reset_scheme: self.object:name()='%s'", self.object:name())
	
	self.state = state_nowhere -- еще неясно, в зоне он, или нет
	
	self:switch_state(db.actor)
	
	db.no_weap_zones[self.object:name()] = false
end

function action_no_weapon:update( delta )
	local actor = db.actor

	if xr_logic.try_switch_to_another_section( self.object, self.st, actor ) then
		if self.state == state_inside then
			self:zone_leave()
		end
		return
	end	
		
end

function action_no_weapon:switch_state( actor )

end

function action_no_weapon:zone_enter()
end

function action_no_weapon:zone_leave()
end

---------------------------------------------------------------------------------------------------------------------
function add_to_binder(npc, ini, scheme, section, storage)
	printf("DEBUG: add_to_binder: scheme='%s', section='%s'", scheme, section)

	local new_action = action_no_weapon(npc, storage)

	-- Зарегистрировать все actions, в которых должен быть вызван метод reset_scheme при изменении настроек схемы:
	xr_logic.subscribe_action_for_events(npc, storage, new_action)
end

function set_scheme(npc, ini, scheme, section, gulag_name)
	local st = xr_logic.assign_storage_and_bind(npc, ini, scheme, section)
	st.logic = xr_logic.cfg_get_switch_conditions(ini, section, npc)
end
