Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- put near top of _g.script
- ONLINE_EXCLUSION_DISTANCE = tonumber(axr_main.config:GetValue("mm_options","excl_dist",0,30))
- -- replace function in sim_squad_scripted.script with
- function sim_squad_scripted:can_switch_online()
- --alun_utils.debug_write(strformat("sim_squad_scripted:switch_online %s",self:name()))
- if (not self.online and is_squad_monster[self.player_id] and not get_object_story_id(self.id)) then
- -- Check for exiled zones
- local zone
- for i,name in pairs(exiled_zones) do
- zone = db.zone_by_name[name]
- if (zone and zone:inside(self.position)) then
- return false
- end
- end
- if (self.current_action == 0) then
- if (self.player_id == "monster_predatory_day" and not in_time_interval(22,5)) then
- return false
- elseif (self.player_id == "monster_predatory_night" and not in_time_interval(5,22)) then
- --printf("%s not allowed to come online",self:name())
- return false
- elseif (self.player_id == "monster_zombied_day" and not in_time_interval(22,5)) then
- return false
- elseif (self.player_id == "monster_zombied_night" and not in_time_interval(5,22)) then
- return false
- end
- end
- --/ brute force prevent from coming online /--
- if self.first_update and atmosfear.valid_levels[level.name()] and (self.position:distance_to(alife():actor().position) <= ONLINE_EXCLUSION_DISTANCE) then
- return false
- end
- --/---------------------------------------/--
- end
- return cse_alife_online_offline_group.can_switch_online(self)
- end
- -- replace function in se_stalker.script with
- function se_stalker:can_switch_online()
- if self.group_id ~= 65535 then
- return true
- end
- --/ brute force prevent from coming online /--
- if self.first_update and atmosfear.valid_levels[level.name()] and not(self.online) and (self.position:distance_to(alife():actor().position) <= ONLINE_EXCLUSION_DISTANCE) then
- return false
- end
- --/-----------------------------------------/--
- return cse_alife_human_stalker.can_switch_online(self)
- end
- function se_stalker:update()
- if not self.first_update then self.first_update = true end -- new
- cse_alife_human_stalker.update(self)
- end
- -- replace function in se_monster.script with
- function se_monster:can_switch_online()
- if self.group_id ~= 65535 then
- return true
- end
- --/ brute force prevent from coming online /--
- if self.first_update and atmosfear.valid_levels[level.name()] and not(self.online) and (self.position:distance_to(alife():actor().position) <= ONLINE_EXCLUSION_DISTANCE) then
- return false
- end
- --/-----------------------------------------/--
- return cse_alife_monster_base.can_switch_online(self)
- end
- function se_monster:update()
- if not self.first_update then self.first_update = true end -- new
- cse_alife_monster_base.update(self)
- end
- -- added to make axr option
- -- axr_main_options.script change these functions
- function main_menu_on_init(menu)
- -- axr option default config
- local need_save
- -- -- exclusion distance list
- if not (axr_main.config:KeyExist("mm_options","excl_dist")) then
- axr_main.config:SetValue("mm_options","excl_dist",30)
- need_save = true
- end
- --
- for k,v in pairs(check_box_options) do
- if not (axr_main.config:KeyExist("mm_options","enable_"..k)) then
- axr_main.config:SetValue("mm_options","enable_"..k,v.default)
- need_save = true
- end
- end
- if (need_save) then
- axr_main.config:Save()
- end
- end
- function opt_menu_on_init(menu)
- local xml = menu.xml
- local pos
- local y = 0
- -- -- exclusion distance list
- local excl_dist_list = {10,20,30,40,50,60,70,80,90,100,200,500}
- menu.list_excl_caption = xml:InitStatic("tab_gameplay:cap_list_excl_dist_axr", menu.dlg_gameplay)
- menu.list_excl_caption:TextControl():SetText(game.translate_string("ui_mm_excl_dist"))
- menu.list_excl_list = xml:InitComboBox("tab_gameplay:list_excl_dist_axr", menu.dlg_gameplay)
- menu.list_excl_list:ClearList()
- menu.list_excl_list:SetAutoDelete(true)
- for i,dist in pairs(excl_dist_list) do
- menu.list_excl_list:AddItem(dist.." meters", i-1)
- end
- menu:Register(menu.list_excl_list,"list_excl_dist")
- --
- for k,v in pairs(check_box_options) do
- if (v.debug_only ~= true or DEV_DEBUG) then
- if not (menu.axr_options_caption) then
- menu.axr_options_caption = {}
- end
- if not (menu.axr_options_check) then
- menu.axr_options_check = {}
- end
- -- caption
- menu.axr_options_caption[k] = xml:InitStatic("tab_gameplay:cap_check_axr", menu.dlg_gameplay)
- pos = menu.axr_options_caption[k]:GetWndPos()
- pos.y = pos.y + y
- menu.axr_options_caption[k]:SetWndPos(pos)
- menu.axr_options_caption[k]:TextControl():SetText(game.translate_string("ui_mm_"..k))
- -- checkbox
- menu.axr_options_check[k] = xml:InitCheck("tab_gameplay:check_axr", menu.dlg_gameplay)
- pos = menu.axr_options_check[k]:GetWndPos()
- pos.y = pos.y + y
- menu.axr_options_check[k]:SetWndPos(pos)
- menu:Register(menu.axr_options_check[k],"ck_"..k)
- y = y + 25
- end
- end
- end
- function opt_menu_on_accept(menu,optMgr,console)
- --
- if (menu.list_excl_list) then
- local num = string.match(menu.list_excl_list:GetText(),"([%d]+)%s%w")
- ONLINE_EXCLUSION_DISTANCE = tonumber(num)
- axr_main.config:SetValue("mm_options","excl_dist",tonumber(num))
- end
- --
- for k,v in pairs(check_box_options) do
- if (menu.axr_options_check and menu.axr_options_check[k]) then
- axr_main.config:SetValue("mm_options","enable_"..k,menu.axr_options_check[k]:GetCheck())
- end
- end
- if (level.present() and dynamic_news_manager) then
- if (axr_main.config:GetValue("mm_options","enable_dynamic_news",1,true) == true) then
- dynamic_news_manager.get_dynamic_news()
- else
- dynamic_news_manager.destroy_dynamic_news()
- end
- end
- axr_main.config:Save()
- end
- function opt_menu_on_set_values(menu,optMgr)
- --
- if (menu.list_excl_list) then
- menu.list_excl_list:SetText(axr_main.config:GetValue("mm_options","excl_dist",0,30).." meters")
- end
- --
- for k,v in pairs(check_box_options) do
- if (menu.axr_options_check and menu.axr_options_check[k]) then
- menu.axr_options_check[k]:SetCheck(axr_main.config:GetValue("mm_options","enable_"..k,1,false))
- end
- end
- end
- -- ui_mm_opt_16.xml these sections added or changed in "tab_gameplay"
- <cap_list_excl_dist_axr x="250" y="3" width="80" height="24">
- <text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c">ui_mm_excl_dist</text>
- </cap_list_excl_dist_axr>
- <list_excl_dist_axr x="335" y="5" width="75" height="20">
- <list_font r="170" g="170" b="170" font="letterica16"/>
- <text_color>
- <e r="170" g="170" b="170"/>
- <d r="70" g="70" b="70"/>
- </text_color>
- </list_excl_dist_axr>
- <cap_check_axr x="247" y="28" width="108" height="24">
- <text r="170" g="170" b="170" font="letterica16" align="r" vert_align="c"></text>
- </cap_check_axr>
- <check_axr x="364" y="25" width="35" stretch="1" height="29">
- <texture>ui_inGame2_checkbox</texture>
- </check_axr>
- -- ui_st_mm.xml add section
- <string id="ui_mm_excl_dist">
- <text>Online exclusion radius</text>
- </string>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement