--/amk_rel_1/ local nrg,med,cnt function spawn_gauss_merc(npc) amk.add_spot_on_map(npc:id(), "red_location", "killer") amk.clear_npc_inventory(npc) amk.spawn_item_in_inv("wpn_gauss",npc) amk.spawn_ammo_in_inv("ammo_gauss",10,npc) amk.set_npc_community(npc,"stalker") amk.save_variable("npc_to_move",npc:id()) --amk.make_suicide(npc) end --'******************************************************************************* --' ** ** ** ** ** ** ** ** SLEEP_AMK ** ** ** ** ** ** ** ** ** --'******************************************************************************* --первый запуск мода function first_run() amk.g_start_timer("gg_need_sleep",0,0,6) amk.spawn_item_in_inv("matras") end --сон function reduce_need_sleep(time) local tmp=amk.load_variable("gg_need_sleep",0) tmp=tmp-time*120 if tmp<0 then tmp=0 end amk.save_variable("gg_need_sleep_nrg",0) amk.save_variable("block_sleep_menu",0) amk.save_variable("gg_need_sleep",tmp) test_sleep_pp() end function test_for_need_sleep() if sleep_manager.is_sleep_active() == false then amk.save_variable("gg_need_sleep",amk.load_variable("gg_need_sleep",0)+1) test_sleep_pp() end amk.g_start_timer("gg_need_sleep",0,0,6) end function test_sleep_pp() local tmp=amk.load_variable("gg_need_sleep",0) if tmp>360 then sleep_manager.main(5+amk.load_variable("gg_need_sleep_nrg",0)) end if tmp>300 then level.add_pp_effector("yantar_underground_psi.ppe", 999, true) level.set_pp_effector_factor(999, 5.0) end if tmp<=300 then level.remove_pp_effector(999) end end function check_sleep_item(obj) local section = obj:section() local stype=nil if section=="energy_drink" then stype="nrg" elseif (section=="medkit" or section=="medkit_army" or section=="medkit_scientic") then stype="med" elseif section=="matras" then stype="matras" end if stype~=nil then amk.start_timer("sleep_"..stype,0.1,obj:id()) end end function test_for_need_sleep_nrg(oid) if alife():object(oid)==nil then local n=amk.load_variable("gg_need_sleep_nrg",0) if n<3 then amk.save_variable("gg_need_sleep_nrg",n+1) amk.save_variable("gg_need_sleep",amk.load_variable("gg_need_sleep",0)-30+n*10) test_sleep_pp() end amk.g_start_timer("block_sleep_menu",0,1,0) amk.save_variable("block_sleep_menu",1) end end function test_for_need_sleep_med(oid) if alife():object(oid)==nil then amk.save_variable("gg_need_sleep",amk.load_variable("gg_need_sleep",0)+3) test_sleep_pp() end end function test_for_need_sleep_matras(oid) if alife():object(oid)==nil then --if amk.load_variable("block_sleep_menu",0)==0 then local spwn=ui_cheat.cheat(get_hud()) level.start_stop_menu(spwn,true) --else --amk.send_tip("Меченый не может спать из-за действия энергетика","Сообщение",nil,5) --end amk.spawn_item_in_inv("matras") end end --'******************************************************************************* --' ** ** ** ** ** ** ** ** RADAR_FIX ** ** ** ** ** ** ** ** ** --'******************************************************************************* function check_radar_off() if (level.name() == "l10_radar") then if not has_alife_info("bar_deactivate_radar_done") then local pos = db.actor:position() if pos.z>65 and pos.x>350 and pos.x<410 then if amk.load_variable("radar_fix",0)==0 then level.add_pp_effector("fire_hit.ppe", 1523, true) level.set_pp_effector_factor(1523, 0.5) amk.save_variable("radar_fix",1) amk.start_timer("radar_fix",5) end end end end end function radar_fix() level.remove_pp_effector(1523) local pos = db.actor:position() if pos.z>65 and pos.x>350 and pos.x<410 then db.actor:kill(db.actor) end amk.del_variable("radar_fix") end --'******************************************************************************* --' ** ** ** ** ** ** ** ** DYNWEATHERS ** ** ** ** ** ** ** ** --'******************************************************************************* dynweathers={ clear={ clear=75, pasmurno=15, rain=10, groza=5 }, pasmurno={ clear=65, rain=20, groza=10, pasmurno=5 }, rain={ clear=65, groza=20, pasmurno=10, rain=5 }, groza={ clear=65, rain=20, pasmurno=10, groza=5 } } function weather_manager() if sync_done==false then return end local hour = level.get_time_hours() local dynlasthour = amk.load_variable("dynlasthour",-1) if dynlasthour"..next_weather) if (news_main and news_main.on_weather_change) then news_main.on_weather_change(dynw, next_weather) end amk.save_variable("dynw",next_weather) amk.save_variable("dynlasthour",hour) amk.save_variable("dynweather","amk_"..dynw.."_"..next_weather.."_"..hour) end end --'******************************************************************************* --' ** ** ** ** ** ** ** ** OUTFIT_HUD ** ** ** ** ** ** ** ** ** --'******************************************************************************* local currhud local curr_tex local cur_weapon_fov local hud_tbl={ --'hud_gaz svoboda_gaz_outfit_m1="hud_gaz", dolg_gaz_outfit_m1="hud_gaz", neytral_gaz_outfit_m1="hud_gaz", neytral_novice_gaz_outfit_m1="hud_gaz", svoboda_heavy_gaz_outfit_m1="hud_gaz", bandit_gaz_outfit_m1="hud_gaz", --'hud_exo outfit_exo_m1="hud_exo_m1", neytral_exo_gaz_outfit_m1="hud_exo", svoboda_yellow_exo_outfit_m1="hud_exo", exo_outfit="hud_exo", dolg_black_exoskeleton="hud_exo", svoboda_exoskeleton="hud_exo", monolit_exoskeleton="hud_exo", exo_bandit_outfit="hud_exo_bandit", broken_exoskeleton="hud_exo_broken", neytral_exo_antigas_outfit="hud_exo", --'hud_merc killer_gaz_outfit_m1="hud_merc", killer_blue_exoskeleton="hud_merc", --'hud_sci dolg_scientific_outfit="hud_sci", ecolog_outfit="hud_sci", protection_outfit="hud_sci", scientific_outfit="hud_sci", freedom_scientific_outfit="hud_sci", merc_scientific_outfit="hud_sci", monolit_scientific_outfit="hud_sci", --'hud_military military_outfit="hud_military", outfit_specnaz_m1="hud_military2", specops_outfit="hud_military2", militaryspec_outfit="hud_military" } local current_static local static_enabled local current_zoom=1 update_hud=false function set_hud_tex(static,enabled) local zoom=67.5/device().fov zoom=(zoom-1)*1.5+1 if zoom<1.001 then zoom=1.001 end local stretchy=0.75/(math.floor(device().aspect_ratio*1000)/1000) if stretchy<1 then stretchy=1 end local rect={x=-768*zoom+768,y=(-512*zoom+512)*stretchy-(stretchy-1)*300,w=1028*zoom,h=668*zoom*stretchy} if amk.load_variable("option_hud",2)==2 then set_blurs(enabled and curr_tex~="hud_sci" and static~=nil,rect) else set_blurs(false,rect) end if enabled==static_enabled and current_static==static and zoom==current_zoom and (not update_hud) then return end update_hud=false current_zoom=zoom local need_change=false if current_static~=static then if current_static then get_hud():RemoveCustomStatic(current_static) end if static then get_hud():AddCustomStatic(static) end need_change=true current_static=static end local wnd=get_hud():GetCustomStatic(current_static) and get_hud():GetCustomStatic(current_static):wnd() if (not enabled) and wnd then wnd:SetWidth(0) elseif wnd then wnd:SetWndRect(rect.x,rect.y,rect.w,rect.h) end static_enabled=enabled end local blurs=nil local blurval=0 -- уровень запотевания от 0 до 1 local blurlt=0 -- время последнего обновления local blurcyctime=0 -- время начала последнего цикла дыхания (выдох) local blurlastphase=0 function set_blurs(enabled,rect) if (not blurs) or get_hud():GetCustomStatic("hud_blur1")==nil then blurs={} for i=1,4 do get_hud():AddCustomStatic("hud_blur"..i) blurs[i]=get_hud():GetCustomStatic("hud_blur"..i):wnd() blurs[i]:SetWidth(0) end end if not enabled then for i=1,4 do blurs[i]:SetWidth(0) end return end -- Циклы в зависимости от силы дыхания: 0->1->0 0->1->2->4->5->0 0->1->2->3->4->5->0 5->4->3->4->5 4->3->4 local power=db.actor.power local period=1.0+power*power*1.0 -- текущая частота дыхания от 30 до 120 циклов в минуту local expirt=0.3 local breathpower=3 local delta=(time_global()-blurlt)/1000 -- дельта в секундах local phase=(time_global()-blurcyctime)/1000 -- фаза дыхательного цикла в сек. blurlt=time_global() if phase>period then phase=phase%period blurcyctime=blurlt-phase*1000 end if blurlastphase>phase then blurlastphase=0 end local blurdelta=delta*-0.7 -- работа вентилляции if blurlastphase0.999 then blurval=0.999 elseif blurval<0 then blurval=0 end local tm=math.floor(blurval*3) local tmn=(tm+1) local v=blurval*3-math.floor(blurval*3) v=1-v local v1=1-v if tm~=0 then blurs[tm]:SetColor(GetARGB(v*255,255,255,255)) end if tmn~=0 then blurs[tmn]:SetColor(GetARGB(v1*255,255,255,255)) end for i=1,4 do if i==tm or i==tmn then blurs[i]:SetWndRect(rect.x,rect.y,rect.w,rect.h) else blurs[i]:SetWndRect(rect.x,rect.y,0,0) end end end local lhup=0 function check_hud() local hudotf,actor if db and db.actor then actor=db.actor else return false end if amk.is_debug then if lhup0 and not (act_it and act_it:section()=="wpn_binoc" and device().fov<50) and device().fov>30 and amk.load_variable("option_hud",2)~=0 then set_hud_tex(tex,true) else set_hud_tex(tex,false) end end --'*******************************************************************************