function on_use(obj)
local ui_sleep_init = true
-- Ваш код...
if obj:section() == "sleepingbag" then
for id, v in pairs(db.storage) do
local object = level.object_by_id(id)
if (IsStalker(object) and object:relation(db.actor) == game_object.enemy) or IsMonster(object) then
if object:position():distance_to(db.actor:position()) < ENEMY_RADIUS and object:see(db.actor) then
news_manager.send_tip(db.actor, "sleep_warning_enemy", nil, "default", 5000)
ui_sleep_init = false
break
end
end
end
end
if db.actor.satiety < 0.5 and ui_sleep_init then
news_manager.send_tip(db.actor, "satiety_warning_radiation", nil, "default", 5000)
ui_sleep_init = false
end
-- Остальная логика переносится в on_use...
end