qwertyuiop 16 Опубликовано 11 Марта 2010 (изменено) Я недоволен счетчиком выброса на ЧАЭС.В оригинале он реалтаймовый и прекращается при выходе с локации.Цель фикса - сделать настоящий выброс или убрать его.Таймер выбросов работает ... все знают или объяснять? Счетчик выброса на ЧАЭС пока убит совсем.С целью повышения хардкорности в момент 1-го захода в рестриктор ЧАЭС можно запрограммировать следующий настоящий выброс через минут 40 игрового времени.На худ под миникарту выводится время и предсказанное время до выброса, точность пока фиксирована. Кроме того, remove_aes_space_restrictor_timer() встравятся в любую функцию, вызываемую при инициализации игры,show_time_to_blowout() вставляется вместо sak.show_time(). function printf(fmt, ...) local msg = string.format(fmt, ...) local msg_no_ws = string.gsub(msg, "%s", "_") get_console():execute("dbg:" .. msg_no_ws) end function remove_aes_space_restrictor_timer() local obj=alife():object("aes_space_restrictor_timer") if (obj) then printf("Chaes timer found") alife():release(obj, true) end end local blow_prediction_precision = 60 -- minutes local timer_next_blow = 0 local timer_next_blow_predict_diff = nil function predict_blowout() printf("blowout predicted!") timer_next_blow_predict_diff = - blow_prediction_precision + math.random(blow_prediction_precision*2) crdigger.on_game_save() end function game_minutes() local gtime = level.get_time_days()*60*24+level.get_time_hours()*60+level.get_time_minutes() --time in game minutes return gtime end function get_next_blowout_time() local name, delay for a=1,100,1 do name = amk.load_variable("gt"..a,nil) if (name ~= nil and name == "blow_shift") then delay = amk.load_variable("gd"..a, nil) if (delay) then timer_next_blow = delay return(delay) end end end return(0) end --returns time to blowout in minutes function get_next_blowout_time_predicted() if (timer_next_blow == 0) then get_next_blowout_time() end if (timer_next_blow == 0) then --cannot determine actual blowout time return 0 end if (timer_next_blow_predict_diff == nil) then predict_blowout() end local minutes = game_minutes() if (minutes > timer_next_blow) then timer_next_blow = 0 -- blowout occured timer_next_blow_predict_diff = nil return 0 end if (minutes > timer_next_blow + timer_next_blow_predict_diff) then -- predicted time passed return 0 else return timer_next_blow + timer_next_blow_predict_diff - minutes; end end function show_time_to_blowout() local hud = get_hud() local cs = hud:GetCustomStatic("hud_show_time") if cs == nil then hud:AddCustomStatic("hud_show_time", true) cs = hud:GetCustomStatic("hud_show_time") if cs == nil then return end end local time_h = level.get_time_hours() local time_m = level.get_time_minutes() local msg local predicted_time = get_next_blowout_time_predicted() -- printf("predicted_time %d actual time %d game_minutes %d",predicted_time,timer_next_blow,game_minutes()); if predicted_time == 0 then msg = string.format("┬Ёхь %d:%.2d ┬√сЁюё єцх фюыцхэ с√Є№!",time_h,time_m) else msg = string.format("┬Ёхь %d:%.2d ─ю т√сЁюёр %d:%.2d+-%d min",time_h,time_m,math.floor(predicted_time / 60),math.fmod(predicted_time,60),blow_prediction_precision) end cs:wnd():SetText(msg) end function on_game_save() printf("crdigger.on_game_save") if timer_next_blow_predict_diff == nil then return end printf("saved %d",timer_next_blow_predict_diff); amk.save_variable("blowout_prediction",timer_next_blow_predict_diff) end function on_game_load() printf("crdigger.on_game_load") local tmp = amk.load_variable("blowout_prediction") if tmp ~= nil then printf("loaded %d",tmp); timer_next_blow_predict_diff = tmp end end function my_hook(npc,obj) if timer_next_blow_predict_diff == nil then return end --- printf("prediction_diff %d actual time %d game_minutes %d",timer_next_blow_predict_diff,timer_next_blow,game_minutes()); end правка часов на HUD <hud_show_time x="0" y="220" width="250" height="20" complex_mode="1" stretch="1"> <text x="22" y="1" font="letterica16" r="238" g="155" b="23" a="255"/> <texture>ui_hud_frame_clock_vergas</texture> </hud_show_time> file bind_stalker.script function actor_binder:on_item_drop (obj) .... crdigger.my_hook(self.object,obj) -- hook item drop for debug purposes crdigger.remove_aes_space_restrictor_timer() -- remove CHAES blow timer end function actor_binder:update(delta) ..... --sak.show_time() -- I encommented old clockm display crdigger.show_time_to_blowout() -- my clock and blowout prediction display .... file netpacket_pda_binder.script : function my_binder:net_spawn(data) .... crdigger.on_game_load(obj) return object_binder.net_spawn(self, data) end Изменено 14 Марта 2010 пользователем qwertyuiop Прошел Солянку, иду в NLC Поделиться этим сообщением Ссылка на сообщение