init
This commit is contained in:
commit
2fe6ca2f65
1473 changed files with 251771 additions and 0 deletions
22
gamedata/scripts/.vscode/launch.json
vendored
Normal file
22
gamedata/scripts/.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
{
|
||||
// Используйте IntelliSense, чтобы узнать о возможных атрибутах.
|
||||
// Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов.
|
||||
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "lua",
|
||||
"request": "launch",
|
||||
"name": "LuaPanda",
|
||||
"description": "IX-Ray Lua Debug",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"luaFileExtension": "script",
|
||||
"connectionPort": 8818,
|
||||
"stopOnEntry": true,
|
||||
"useCHook": true,
|
||||
"autoPathMode": true,
|
||||
"updateTips": true
|
||||
}
|
||||
]
|
||||
}
|
||||
5
gamedata/scripts/.vscode/settings.json
vendored
Normal file
5
gamedata/scripts/.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"Lua.diagnostics.disable": [
|
||||
"undefined-global"
|
||||
]
|
||||
}
|
||||
218
gamedata/scripts/alife_storage_manager.script
Normal file
218
gamedata/scripts/alife_storage_manager.script
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
--[[
|
||||
This script handles the serialization of data using the marshal library and the saving of this data to disk depending
|
||||
on save game name. What this means is that you can save entire tables to disk instead of saving to object packet.
|
||||
This script was created to alleviate issues with using packets to save dynamic data (pstor) which lead to save corruption.
|
||||
Also it removes some restrictions on what you can save.
|
||||
|
||||
*only store valid lua types such as numbers, strings, boolean, functions or tables that contain these valid types. Userdata needs to have a special
|
||||
__persist function defined in it's metatable. See how it is done for CTime in _G.script
|
||||
|
||||
*Supposedly you can save userdata if you write a proper __persist method for the metatable but I have failed to achieve proper results with serializing CTime.
|
||||
|
||||
*You must register for 'save_state' and 'load_state' and add your own table to m_data for it to be encoded then stored in *.scoc
|
||||
*Although marshal is pretty fast, keep in mind that encoding/decoding a ton of data, saves will start to noticeablely take longer to save/load.
|
||||
*For testing/debugging you can uncomment the print_table calls in save_state and load_state. It will save the before and after tables to print_table.txt in your main directory.
|
||||
|
||||
|
||||
by: Alundaio
|
||||
--]]
|
||||
local m_data = {}
|
||||
|
||||
-- store stuff that you want to persist even offline
|
||||
m_data.se_object = {}
|
||||
|
||||
-- store stuff only for online objects. When object goes offline this table is purged.
|
||||
m_data.game_object = {}
|
||||
|
||||
-- PDA known contacts
|
||||
-- m_data.actor_contacts = {}
|
||||
|
||||
saved_game_extension_ex = save_extension() .. "_data"
|
||||
|
||||
local function on_pstor_load_all(obj,packet)
|
||||
local id = obj:id()
|
||||
local state = get_game_object_state(obj,false)
|
||||
if (state and db.storage[id]) then
|
||||
if (state.pstor_all) then
|
||||
db.storage[id].pstor = state.pstor_all
|
||||
state.pstor_all = nil
|
||||
end
|
||||
|
||||
if (state.pstor_ctime) then
|
||||
db.storage[id].pstor_ctime = state.pstor_ctime
|
||||
state.pstor_ctime = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function on_game_start()
|
||||
if not isMarshal then
|
||||
return
|
||||
end
|
||||
--RegisterScriptCallback("on_pstor_load_all",on_pstor_load_all)
|
||||
end
|
||||
|
||||
-- called from engine!
|
||||
function CALifeStorageManager_before_save(fname)
|
||||
if not isMarshal then
|
||||
return
|
||||
end
|
||||
|
||||
--printf("CALifeStorageManager_before_save BEFORE callback")
|
||||
|
||||
m_data.GAME_VERSION = GAME_VERSION
|
||||
|
||||
SendScriptCallback("save_state",m_data)
|
||||
|
||||
--printf("CALifeStorageManager_before_save AFTER callback")
|
||||
|
||||
-- save pstor
|
||||
for id,t in pairs(db.storage) do
|
||||
if (m_data.game_object[id]) then
|
||||
if (t.pstor and not is_empty(t.pstor)) then
|
||||
m_data.game_object[id].pstor_all = t.pstor
|
||||
end
|
||||
|
||||
-- serialization with game.CTime.__persist
|
||||
if (t.pstor_ctime and not is_empty(t.pstor_ctime)) then
|
||||
m_data.game_object[id].pstor_ctime = t.pstor_ctime
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--ProcessEventQueueState(m_data,true)
|
||||
|
||||
-- clean out game_object table of empty sub tables
|
||||
for id,tbl in pairs(m_data.game_object) do
|
||||
for k,v in pairs(tbl) do
|
||||
if (type(v) == "table" and is_empty(v)) then
|
||||
m_data.game_object[id][k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local data = marshal.encode(m_data)
|
||||
if not (data) then
|
||||
return
|
||||
end
|
||||
|
||||
local path = getFS():update_path('$game_saves$', '')
|
||||
|
||||
lfs.mkdir(path) -- incase savegame folder doesn't exist yet
|
||||
path = path .. fname:sub(0,-6):lower() .. saved_game_extension_ex
|
||||
|
||||
local savegame = io.open(path,"wb")
|
||||
if not (io.type(savegame) == "file") then
|
||||
printf("Error: Unable to write to %s",path)
|
||||
return
|
||||
end
|
||||
|
||||
--printf("axr_main: saving custom data %s",path)
|
||||
savegame:write(data)
|
||||
savegame:close()
|
||||
|
||||
--printf("CALifeStorageManager_before_save FINISHED")
|
||||
end
|
||||
|
||||
-- called from engine!
|
||||
function CALifeStorageManager_after_save(fname)
|
||||
if ffx_path_utils then
|
||||
fname = ffx_path_utils.get_file_name(fname, false)
|
||||
end
|
||||
|
||||
local _path = getFS():update_path('$game_saves$', '')
|
||||
|
||||
SendScriptCallback("save_file_created", _path, fname)
|
||||
end
|
||||
|
||||
-- called from engine!
|
||||
function CALifeStorageManager_new_game(fname)
|
||||
if ffx_path_utils then
|
||||
fname = ffx_path_utils.get_file_name(fname, false)
|
||||
end
|
||||
|
||||
local _path = getFS():update_path('$game_saves$', '')
|
||||
|
||||
SendScriptCallback("new_game_created", _path, fname)
|
||||
end
|
||||
|
||||
-- called from engine!
|
||||
function CALifeStorageManager_save(fname)
|
||||
--printf("CALifeStorageManager_save START FINISHED")
|
||||
end
|
||||
|
||||
-- called from engine
|
||||
function CALifeStorageManager_load(fname)
|
||||
if not isMarshal then
|
||||
return
|
||||
end
|
||||
|
||||
local path = fname:sub(0,-6) .. saved_game_extension_ex
|
||||
|
||||
--alun_utils.debug_write(strformat("CALifeStorageManager_load %s",path))
|
||||
|
||||
local savegame = io.open(path,"rb")
|
||||
if not (io.type(savegame) == "file") then
|
||||
return
|
||||
end
|
||||
|
||||
local data = savegame:read("*all")
|
||||
savegame:close()
|
||||
|
||||
if not (data and data ~= "") then
|
||||
printf("Error: Failed to read %s",path)
|
||||
return
|
||||
end
|
||||
|
||||
m_data = marshal.decode(data)
|
||||
|
||||
--ProcessEventQueueState(m_data,false)
|
||||
|
||||
-- For debugging save state
|
||||
--alun_utils.print_table(m_data,"m_data_on_load ("..path..")")
|
||||
|
||||
SendScriptCallback("load_state",m_data)
|
||||
|
||||
if ffx_path_utils then
|
||||
fname = ffx_path_utils.get_file_name(fname, false)
|
||||
end
|
||||
local _path = getFS():update_path('$game_saves$', '')
|
||||
SendScriptCallback("save_file_loaded", _path, fname)
|
||||
|
||||
--alun_utils.debug_write(strformat("CALifeStorageManager_load END"))
|
||||
end
|
||||
|
||||
function get_state()
|
||||
return m_data
|
||||
end
|
||||
|
||||
function decode(t)
|
||||
return marshal.decode(t)
|
||||
end
|
||||
|
||||
-- storage based on ID but verified by object name
|
||||
function get_game_object_state(obj,create_if_dont_exist)
|
||||
local id = obj:id()
|
||||
local name = obj:name()
|
||||
if not (m_data.game_object[id]) then
|
||||
if not (create_if_dont_exist) then
|
||||
return
|
||||
end
|
||||
m_data.game_object[id] = {}
|
||||
m_data.game_object[id].name = name
|
||||
end
|
||||
return m_data.game_object[id]
|
||||
end
|
||||
|
||||
function get_se_obj_state(se_obj,create_if_dont_exist)
|
||||
local id = se_obj.id
|
||||
local name = se_obj:name()
|
||||
if not (m_data.se_object[id]) then
|
||||
if not (create_if_dont_exist) then
|
||||
return
|
||||
end
|
||||
m_data.se_object[id] = {}
|
||||
m_data.se_object[id].name = name
|
||||
end
|
||||
return m_data.se_object[id]
|
||||
end
|
||||
96
gamedata/scripts/bind_crow.script
Normal file
96
gamedata/scripts/bind_crow.script
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
--------------------------------------------------------------------------------
|
||||
-- Crow binding ----------------------------------------------------------------
|
||||
-- Made by Peacemaker ----------------------------------------------------------
|
||||
-- 25.12.07 --------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
crow_storage = {}
|
||||
crow_counter = 0
|
||||
-- Standart function for object binding
|
||||
function bind(obj)
|
||||
-- local new_binder = crow_binder(obj)
|
||||
obj:bind_object(crow_binder(obj))
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
-- Class "crow_binder"
|
||||
--------------------------------------------------------------------------------
|
||||
class "crow_binder" (object_binder)
|
||||
-- Class constructor
|
||||
function crow_binder:__init(obj) super(obj)
|
||||
self.body_timer = 0
|
||||
end
|
||||
-- Class update
|
||||
function crow_binder:update(delta)
|
||||
-- standart update
|
||||
object_binder.update(self, delta)
|
||||
if not(self.object:alive()) and (self.body_timer<=time_global()-120000) and (self.body_timer~=0) then
|
||||
-- if crow is killed and body lays down for two minutes - release it
|
||||
printf("releasing object ["..self.object:name().."]")
|
||||
alife():release(alife():object(self.object:id()), true)
|
||||
end
|
||||
end
|
||||
-- Reload object
|
||||
function crow_binder:reload(section)
|
||||
object_binder.reload(self, section)
|
||||
end
|
||||
-- Reinitialize object
|
||||
function crow_binder:reinit()
|
||||
self.body_timer = 0
|
||||
object_binder.reinit(self)
|
||||
db.storage[self.object:id()] = {}
|
||||
self.st = db.storage[self.object:id()]
|
||||
end
|
||||
-- Net spawn
|
||||
function crow_binder:net_spawn(sobject)
|
||||
if not(object_binder.net_spawn(self, sobject)) then
|
||||
return false
|
||||
end
|
||||
db.add_obj(self.object)
|
||||
bind_crow.crow_storage[self.object:id()] = self.object:id()
|
||||
bind_crow.crow_counter = bind_crow.crow_counter + 1
|
||||
self.object:set_callback(callback.death, self.death_callback, self)
|
||||
return true
|
||||
end
|
||||
-- Net destroy
|
||||
function crow_binder:net_destroy()
|
||||
self.object:set_callback(callback.death, nil)
|
||||
if (bind_crow.crow_storage[self.object:id()] ~= nil) then --*Crow FIX*
|
||||
bind_crow.crow_storage[self.object:id()] = nil
|
||||
bind_crow.crow_counter = bind_crow.crow_counter - 1
|
||||
if (bind_crow.crow_counter < 0) then --*Crow FIX*
|
||||
bind_crow.crow_counter = 0 --*Crow FIX*
|
||||
end --*Crow FIX*
|
||||
end --*Crow FIX*
|
||||
db.del_obj(self.object)
|
||||
object_binder.net_destroy(self)
|
||||
end
|
||||
-- Crow death callback
|
||||
function crow_binder:death_callback(victim, who)
|
||||
self.body_timer = time_global()
|
||||
if (bind_crow.crow_storage[self.object:id()] ~= nil) then --*Crow FIX*
|
||||
bind_crow.crow_storage[self.object:id()] = nil
|
||||
bind_crow.crow_counter = bind_crow.crow_counter - 1
|
||||
if (bind_crow.crow_counter < 0) then --*Crow FIX*
|
||||
bind_crow.crow_counter = 0 --*Crow FIX*
|
||||
end --*Crow FIX*
|
||||
end --*Crow FIX*
|
||||
end
|
||||
-- Standart function for save
|
||||
function crow_binder:net_save_relevant()
|
||||
return true
|
||||
end
|
||||
-- Saving crow
|
||||
function crow_binder:save(package)
|
||||
set_save_marker(package, "save", false, "crow_binder")
|
||||
object_binder.save(self, package)
|
||||
xr_logic.save_obj(self.object, package)
|
||||
package:w_u32(self.body_timer)
|
||||
set_save_marker(package, "save", true, "crow_binder")
|
||||
end
|
||||
-- Loading crow
|
||||
function crow_binder:load(reader)
|
||||
set_save_marker(reader, "load", false, "crow_binder")
|
||||
object_binder.load(self, reader)
|
||||
xr_logic.load_obj(self.object, reader)
|
||||
self.body_timer = reader:r_u32()
|
||||
set_save_marker(reader, "load", true, "crow_binder")
|
||||
end
|
||||
321
gamedata/scripts/bind_monster.script
Normal file
321
gamedata/scripts/bind_monster.script
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
-----------------------------------------------------------------------------------
|
||||
-- Monster binding
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
function bind(obj)
|
||||
printf("_bp: monster.bind: name='%s', id='%d'", obj:name(), obj:id())
|
||||
|
||||
-- Äëÿ ñïàóíà
|
||||
--xr_spawner.spawn_client(obj)
|
||||
|
||||
local new_binder = generic_object_binder(obj)
|
||||
obj:bind_object(new_binder)
|
||||
end
|
||||
|
||||
local last_update = 0 -- combat
|
||||
------------------------------------------------------------------------------------
|
||||
class "generic_object_binder" (object_binder)
|
||||
|
||||
function generic_object_binder:__init(obj) super(obj)
|
||||
self.loaded = false
|
||||
end
|
||||
|
||||
function generic_object_binder:reload(section)
|
||||
object_binder.reload(self, section)
|
||||
end
|
||||
|
||||
function generic_object_binder:reinit()
|
||||
object_binder.reinit(self)
|
||||
|
||||
db.storage[self.object:id()] = { }
|
||||
|
||||
self.st = db.storage[self.object:id()]
|
||||
|
||||
self.object:set_callback(callback.patrol_path_in_point, self.waypoint_callback, self)
|
||||
self.object:set_callback(callback.hit, self.hit_callback, self)
|
||||
self.object:set_callback(callback.death, self.death_callback, self)
|
||||
self.object:set_callback(callback.sound, self.hear_callback, self)
|
||||
end
|
||||
|
||||
function generic_object_binder:update(delta)
|
||||
object_binder.update(self, delta)
|
||||
|
||||
if xr_combat_ignore.fighting_with_actor_npcs[self.object:id()] and self.object:best_enemy() == nil then
|
||||
xr_combat_ignore.fighting_with_actor_npcs[self.object:id()] = nil
|
||||
end
|
||||
|
||||
local squad = get_object_squad(self.object)
|
||||
local object_alive = self.object:alive()
|
||||
--' printf("_bp: generic_object_binder: UPDATE [name='%s' time=%d]",
|
||||
--' self.object:name(), time_global())
|
||||
|
||||
if not object_alive then
|
||||
return
|
||||
end
|
||||
|
||||
local st = db.storage[self.object:id()]
|
||||
if st ~= nil and st.active_scheme ~= nil then
|
||||
xr_logic.try_switch_to_another_section(self.object, st[st.active_scheme], db.actor)
|
||||
end
|
||||
-- Àïäåéò îòðÿäà
|
||||
if squad ~= nil then
|
||||
if squad:commander_id() == self.object:id() then
|
||||
squad:update()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
self.object:info_clear()
|
||||
|
||||
local active_section = db.storage[self.object:id()] and db.storage[self.object:id()].active_section
|
||||
if active_section then
|
||||
self.object:info_add("section: " .. active_section)
|
||||
end
|
||||
local best_enemy = self.object:best_enemy()
|
||||
if best_enemy then
|
||||
self.object:info_add("enemy: " .. best_enemy:name())
|
||||
end
|
||||
self.object:info_add(self.object:name().." ["..self.object:team().."]["..self.object:squad().."]["..self.object:group().."]")
|
||||
|
||||
if alife():object(self.object:id()) == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if squad ~= nil then
|
||||
self.object:info_add("squad_id: " .. squad:section_name())
|
||||
if squad.current_action ~= nil then
|
||||
local target = squad.assigned_target_id and alife():object(squad.assigned_target_id) and alife():object(squad.assigned_target_id):name()
|
||||
self.object:info_add("current_action: " .. squad.current_action.name .."["..tostring(target).."]")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Åñëè åñòü âðàã , òî èäåì â êîìáàò !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
if self.object:get_enemy() then
|
||||
if xr_logic.mob_captured(self.object) then
|
||||
xr_logic.mob_release(self.object)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
if squad and squad.current_action and squad.current_action.name == "reach_target" then
|
||||
local squad_target = simulation_objects.get_sim_obj_registry().objects[squad.assigned_target_id]
|
||||
if squad_target == nil then return end
|
||||
-- printf("_bp: mob_reach_task:reset_scheme: %s", self.object:name())
|
||||
|
||||
local target_pos, target_lv_id, target_gv_id = squad_target:get_location()
|
||||
-- if not xr_logic.mob_captured(self.object) then
|
||||
xr_logic.mob_capture(self.object, true)
|
||||
-- end
|
||||
if squad:commander_id() == self.object:id() then
|
||||
action(self.object, move(move.walk_with_leader, target_pos),
|
||||
cond(cond.move_end))
|
||||
else
|
||||
local commander_pos = alife():object(squad:commander_id()).position
|
||||
if commander_pos:distance_to(self.object:position()) > 10 then
|
||||
action(self.object, move(move.run_with_leader, target_pos),
|
||||
cond(cond.move_end))
|
||||
else
|
||||
action(self.object, move(move.walk_with_leader, target_pos),
|
||||
cond(cond.move_end))
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if self.st.active_section ~= nil then
|
||||
xr_logic.issue_event(self.object, self.st[self.st.active_scheme], "update", delta)
|
||||
end
|
||||
end
|
||||
|
||||
function generic_object_binder:extrapolate_callback()
|
||||
-- Ïðîâåðÿåì, ÷òî îáúåêò åùå â îíëàéíå
|
||||
if db.storage[self.object:id()] == nil or
|
||||
db.storage[self.object:id()].object == nil
|
||||
then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local cur_pt = self.object:get_current_point_index()
|
||||
if self.object:get_script() == false then
|
||||
return false
|
||||
end
|
||||
|
||||
local patrol_path = self.object:patrol()
|
||||
if not level.patrol_path_exists(patrol_path) then
|
||||
return false
|
||||
--abort("bind_monster:extrapolate_callback(). There is no patrol path [%s]", tostring(patrol_path))
|
||||
end
|
||||
if patrol(patrol_path):flags(cur_pt):get() == 0 then
|
||||
--printf("_bp: generic_object_binder: extrapolate_callback: cur_pt = %d: true", cur_pt)
|
||||
return true
|
||||
end
|
||||
--printf("_bp: generic_object_binder: extrapolate_callback: cur_pt = %d: false", cur_pt)
|
||||
return false
|
||||
end
|
||||
|
||||
function generic_object_binder:waypoint_callback(obj, action_type, index)
|
||||
if self.st.active_section ~= nil then
|
||||
xr_logic.issue_event(self.object, self.st[self.st.active_scheme], "waypoint_callback", obj, action_type, index)
|
||||
end
|
||||
end
|
||||
|
||||
function generic_object_binder:death_callback(victim, who)
|
||||
printf("stop_dead_id"..self.object:id())
|
||||
|
||||
xr_combat_ignore.fighting_with_actor_npcs[self.object:id()] = nil
|
||||
|
||||
self:hit_callback(victim, 1, vector():set(0,0,0), who, "from_death_callback")
|
||||
if who:id() == db.actor:id() then
|
||||
xr_statistic.inc_killed_monsters_counter()
|
||||
xr_statistic.set_best_monster(self.object)
|
||||
end
|
||||
|
||||
if self.st.mob_death then
|
||||
xr_logic.issue_event(self.object, self.st.mob_death, "death_callback", victim, who)
|
||||
end
|
||||
|
||||
if self.st.active_section then
|
||||
xr_logic.issue_event(self.object, self.st[self.st.active_scheme], "death_callback", victim, who)
|
||||
end
|
||||
--' Íàíîñèì íåáîëüøîé èìïóëüñ âïåðåä.
|
||||
local h = hit()
|
||||
h.draftsman = self.object
|
||||
h.type = hit.fire_wound
|
||||
h.direction = db.actor:position():sub(self.object:position())
|
||||
h:bone("pelvis")
|
||||
h.power = 1
|
||||
h.impulse = 10
|
||||
self.object:hit(h)
|
||||
|
||||
local obj_clsid = self.object:clsid()
|
||||
if obj_clsid == clsid.poltergeist_s then
|
||||
printf("releasing object ["..self.object:name().."]")
|
||||
if alife():object(self.object:id()) ~= nil then
|
||||
alife():release(alife():object(self.object:id()), true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function generic_object_binder:hit_callback(obj, amount, local_direction, who, bone_index)
|
||||
-- printf("HIT_CALLBACK: [%s] amount[%s]", obj:name(), amount)
|
||||
|
||||
if(who:id()==db.actor:id()) then
|
||||
xr_statistic.set_best_weapon(amount)
|
||||
end
|
||||
|
||||
if self.st.hit then
|
||||
xr_logic.issue_event(self.object, self.st.hit, "hit_callback", obj, amount, local_direction, who, bone_index)
|
||||
end
|
||||
|
||||
if amount > 0 then
|
||||
printf("HIT_CALLBACK: %s amount=%s bone=%s who:id() = [%s] actor:id() = [%s]", obj:name(), amount, tostring(bone_index), who:id(), db.actor:id())
|
||||
end
|
||||
end
|
||||
|
||||
function generic_object_binder:hear_callback(self, who_id, sound_type, sound_position, sound_power)
|
||||
if who_id == self:id() then
|
||||
return
|
||||
end
|
||||
xr_hear.hear_callback(self, who_id, sound_type, sound_position, sound_power)
|
||||
end
|
||||
|
||||
function generic_object_binder:net_spawn(sobject)
|
||||
if not object_binder.net_spawn(self, sobject) then
|
||||
return false
|
||||
end
|
||||
|
||||
local on_offline_condlist = db.storage[self.object:id()] and db.storage[self.object:id()].overrides and db.storage[self.object:id()].overrides.on_offline_condlist
|
||||
if on_offline_condlist ~= nil then
|
||||
xr_logic.pick_section_from_condlist(db.actor, self.object, on_offline_condlist)
|
||||
end
|
||||
|
||||
if not self.object:alive() then
|
||||
return true
|
||||
end
|
||||
if alife():object(self.object:id()) == nil then
|
||||
return false
|
||||
end
|
||||
|
||||
-- local pos = self.object:position()
|
||||
-- printf("net_spawn mpos[%s][%s][%s]", tostring(pos.x), tostring(pos.y), tostring(pos.z))
|
||||
|
||||
db.add_obj(self.object)
|
||||
|
||||
--******************************* Òåëåïîðò íà ïåðâóþ òî÷êó ïóòè ðàáîòû ñìàðòòåððåéíà...*****************************
|
||||
local se_obj = alife():object(self.object:id())
|
||||
if db.spawned_vertex_by_id[se_obj.id] ~= nil then
|
||||
self.object:set_npc_position(level.vertex_position(db.spawned_vertex_by_id[se_obj.id]))
|
||||
db.spawned_vertex_by_id[se_obj.id] = nil
|
||||
elseif db.offline_objects[se_obj.id] ~= nil and db.offline_objects[se_obj.id].level_vertex_id ~= nil then
|
||||
printf("changing position for object[%s] from %s to %s : level vertex [%s] to [%s]", se_obj:name(), vec_to_str(se_obj.position), vec_to_str(level.vertex_position(db.offline_objects[se_obj.id].level_vertex_id)), tostring(se_obj.m_level_vertex_id), tostring(db.offline_objects[se_obj.id].level_vertex_id))
|
||||
self.object:set_npc_position(level.vertex_position(db.offline_objects[se_obj.id].level_vertex_id))
|
||||
elseif se_obj.m_smart_terrain_id ~= 65535 then
|
||||
local smart_terrain = alife():object(se_obj.m_smart_terrain_id)
|
||||
if smart_terrain.arriving_npc[se_obj.id] == nil then
|
||||
local smart_task = smart_terrain.job_data[smart_terrain.npc_info[se_obj.id].job_id].alife_task
|
||||
self.object:set_npc_position(smart_task:position())
|
||||
end
|
||||
end
|
||||
--******************************************************************************************************************
|
||||
|
||||
|
||||
smart_terrain.setup_gulag_and_logic_on_spawn( self.object, self.st, sobject, modules.stype_mobile, self.loaded)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function generic_object_binder:net_destroy()
|
||||
self.object:set_callback(callback.death, nil)
|
||||
self.object:set_callback(callback.patrol_path_in_point, nil)
|
||||
self.object:set_callback(callback.hit, nil)
|
||||
self.object:set_callback(callback.sound, nil)
|
||||
xr_sound.stop_sounds_by_id(self.object:id())
|
||||
|
||||
xr_combat_ignore.fighting_with_actor_npcs[self.object:id()] = nil
|
||||
|
||||
local st = db.storage[self.object:id()]
|
||||
if st and st.active_scheme then
|
||||
xr_logic.issue_event(self.object, st[st.active_scheme], "net_destroy")
|
||||
end
|
||||
|
||||
-- Çàïîìèíàåì ïîçèöèþ è àêòèâíóþ ñåêöèþ --------
|
||||
if db.offline_objects[self.object:id()] then
|
||||
db.offline_objects[self.object:id()].level_vertex_id = self.object:level_vertex_id()
|
||||
db.offline_objects[self.object:id()].active_section = db.storage[self.object:id()].active_section
|
||||
end
|
||||
------------------------------------------------n
|
||||
|
||||
db.del_obj(self.object)
|
||||
db.storage[self.object:id()] = nil
|
||||
object_binder.net_destroy(self)
|
||||
end
|
||||
|
||||
function generic_object_binder:reload(section)
|
||||
object_binder.reload(self, section)
|
||||
--printf("generic_object_binder:reload(): self.object:name()='%s'", self.object:name())
|
||||
end
|
||||
|
||||
function generic_object_binder:net_save_relevant()
|
||||
--printf("generic_object_binder:net_save_relevant(): self.object:name()='%s'", self.object:name())
|
||||
return true
|
||||
end
|
||||
|
||||
function generic_object_binder:save(packet)
|
||||
|
||||
set_save_marker(packet, "save", false, "generic_object_binder")
|
||||
object_binder.save(self, packet)
|
||||
xr_logic.save_obj(self.object, packet)
|
||||
set_save_marker(packet, "save", true, "generic_object_binder")
|
||||
end
|
||||
|
||||
function generic_object_binder:load(reader)
|
||||
self.loaded = true
|
||||
set_save_marker(reader, "load", false, "generic_object_binder")
|
||||
object_binder.load(self, reader)
|
||||
xr_logic.load_obj(self.object, reader)
|
||||
set_save_marker(reader, "load", true, "generic_object_binder")
|
||||
end
|
||||
597
gamedata/scripts/bind_stalker.script
Normal file
597
gamedata/scripts/bind_stalker.script
Normal file
|
|
@ -0,0 +1,597 @@
|
|||
function init (obj)
|
||||
xr_motivator.AddToMotivator(obj)
|
||||
end
|
||||
|
||||
function actor_init (npc)
|
||||
npc:bind_object(actor_binder(npc))
|
||||
end
|
||||
|
||||
local game_difficulty_by_num = {
|
||||
[0] = "gd_novice",
|
||||
[1] = "gd_stalker",
|
||||
[2] = "gd_veteran",
|
||||
[3] = "gd_master"
|
||||
}
|
||||
|
||||
local weapon_hide = {}
|
||||
local primary_objects_filled = false
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
class "actor_binder" (object_binder)
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:__init (obj) super(obj)
|
||||
self.bCheckStart = false
|
||||
self.weather_manager = level_weathers.get_weather_manager()
|
||||
self.surge_manager = surge_manager.get_surge_manager()
|
||||
--self.actor_detector = xr_detector.actor_detector()
|
||||
self.last_level_name = nil
|
||||
self.deimos_intensity = nil
|
||||
-- self.actor_weapon_on_start = true
|
||||
self.loaded_active_slot = 3
|
||||
self.loaded_slot_applied = false
|
||||
self.last_detective_achievement_spawn_time = nil
|
||||
self.last_mutant_hunter_achievement_spawn_time = nil
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:net_spawn(data)
|
||||
-- printf("actor net spawn")
|
||||
level.show_indicators()
|
||||
self.bCheckStart = true
|
||||
self.weapon_hide = false -- спрятано или нет оружие при разговоре.
|
||||
self.weapon_hide_in_dialog = false
|
||||
weapon_hide = {} -- устанавливаем глобальный дефолтовый флаг.
|
||||
if object_binder.net_spawn(self,data) == false then
|
||||
return false
|
||||
end
|
||||
db.add_actor(self.object)
|
||||
db.actor.deimos_intensity = self.deimos_intensity
|
||||
self.deimos_intensity = nil
|
||||
if self.st.disable_input_time == nil then
|
||||
level.enable_input()
|
||||
end
|
||||
xr_s.on_game_load() --' Distemper 03.2008 --
|
||||
self.weather_manager:reset()
|
||||
--' Загружаем настройки дропа
|
||||
death_manager.init_drop_settings()
|
||||
--'Устанавливаем ссылку на таскменеджер
|
||||
self.task_manager = task_manager.get_task_manager()
|
||||
self.spawn_frame = device().frame
|
||||
self.already_jumped = false
|
||||
-- self.loaded = false
|
||||
benchmark.main() --' Distemper 06.2008 --
|
||||
return true
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:net_destroy()
|
||||
xr_sound.stop_sounds_by_id(self.object:id())
|
||||
local board_factions = sim_board.get_sim_board().players
|
||||
if(board_factions) then
|
||||
for k,v in pairs (board_factions) do
|
||||
xr_sound.stop_sounds_by_id(v.id)
|
||||
end
|
||||
end
|
||||
if(actor_stats.remove_from_ranking~=nil)then
|
||||
actor_stats.remove_from_ranking(self.object:id())
|
||||
end
|
||||
level.show_weapon(true)
|
||||
db.del_actor(self.object)
|
||||
|
||||
self.object:set_callback(callback.inventory_info, nil)
|
||||
self.object:set_callback(callback.article_info, nil)
|
||||
self.object:set_callback(callback.on_item_take, nil)
|
||||
self.object:set_callback(callback.on_item_drop, nil)
|
||||
self.object:set_callback(callback.task_state, nil)
|
||||
self.object:set_callback(callback.level_border_enter, nil)
|
||||
self.object:set_callback(callback.level_border_exit, nil)
|
||||
self.object:set_callback(callback.take_item_from_box, nil)
|
||||
self.object:set_callback(callback.use_object, nil)
|
||||
-- IX-Ray
|
||||
self.object:set_callback(callback.actor_before_death, nil)
|
||||
-- END IX-Ray
|
||||
|
||||
log("--------->"..tostring(_G.amb_vol))
|
||||
log("--------->"..tostring(_G.mus_vol))
|
||||
if(_G.amb_vol~=0) then
|
||||
get_console():execute("snd_volume_eff "..tostring(_G.amb_vol))
|
||||
_G.amb_vol = 0
|
||||
end
|
||||
if(_G.mus_vol~=0) then
|
||||
get_console():execute("snd_volume_music "..tostring(_G.mus_vol))
|
||||
_G.mus_vol = 0
|
||||
end
|
||||
if sr_psy_antenna.psy_antenna then
|
||||
sr_psy_antenna.psy_antenna:destroy()
|
||||
sr_psy_antenna.psy_antenna = false
|
||||
end
|
||||
xrs_dyn_music.finish_theme()
|
||||
xr_s.on_actor_destroy()
|
||||
object_binder.net_destroy(self)
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:reinit()
|
||||
object_binder.reinit(self)
|
||||
local npc_id = self.object:id()
|
||||
db.storage[npc_id] = { }
|
||||
self.st = db.storage[npc_id]
|
||||
self.st.pstor = nil
|
||||
|
||||
self.object:set_callback(callback.inventory_info, self.info_callback, self)
|
||||
self.object:set_callback(callback.on_item_take, self.on_item_take, self)
|
||||
self.object:set_callback(callback.on_item_drop, self.on_item_drop, self)
|
||||
self.object:set_callback(callback.trade_sell_buy_item, self.on_trade, self) -- for game stats
|
||||
self.object:set_callback(callback.task_state, self.task_callback, self)
|
||||
self.object:set_callback(callback.take_item_from_box, self.take_item_from_box, self)
|
||||
self.object:set_callback(callback.use_object, self.use_inventory_item, self)
|
||||
-- IX-Ray
|
||||
self.object:set_callback(callback.actor_before_death, self.on_actor_before_death, self)
|
||||
-- END IX-Ray
|
||||
end
|
||||
|
||||
-- IX-Ray
|
||||
-- actor before death callback
|
||||
-- IMPORTANT: if you wish to kill actor you need to call db.actor:kill(level.object_by_id(whoID), true) in actor_before_death callback, to ensure all objects are properly destroyed.
|
||||
function actor_binder:on_actor_before_death(whoID)
|
||||
local killer = level.object_by_id(whoID) or db.actor
|
||||
db.actor:kill(killer, true)
|
||||
end
|
||||
-- END IX-Ray
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:take_item_from_box(box, item)
|
||||
local box_name = box:name()
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:info_callback(npc, info_id)
|
||||
printf("*INFO*: npc='%s' id='%s'", npc:name(), info_id)
|
||||
--' Сюжет
|
||||
-- Отметки на карте
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:on_trade (item, sell_bye, money)
|
||||
if sell_bye == true then
|
||||
game_stats.money_trade_update (money)
|
||||
else
|
||||
game_stats.money_trade_update (-money)
|
||||
end
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:article_callback(npc, group, name)
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:on_item_take (obj)
|
||||
printf("on_item_take [%s]", obj:name())
|
||||
if isArtefact(obj) then
|
||||
local anomal_zone = bind_anomaly_zone.parent_zones_by_artefact_id[obj:id()]
|
||||
if anomal_zone ~= nil then
|
||||
anomal_zone:on_artefact_take(obj)
|
||||
else
|
||||
bind_anomaly_zone.artefact_ways_by_id[obj:id()] = nil
|
||||
end
|
||||
local artefact = obj:get_artefact()
|
||||
artefact:FollowByPath("NULL",0,vector():set(500,500,500))
|
||||
xr_statistic.inc_founded_artefacts_counter(obj:id())
|
||||
--[[
|
||||
local s_art = alife():object(obj:id())
|
||||
if(s_art) then
|
||||
xr_statistic.inc_founded_artefacts_counter(s_art:section_name())
|
||||
else
|
||||
xr_statistic.inc_founded_artefacts_counter()
|
||||
end
|
||||
]]
|
||||
end
|
||||
treasure_manager.get_treasure_manager():on_item_take(obj:id())
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:on_item_drop (obj)
|
||||
end
|
||||
|
||||
function actor_binder:use_inventory_item(obj)
|
||||
if(obj) then
|
||||
local s_obj = alife():object(obj:id())
|
||||
if(s_obj) and (s_obj:section_name()=="drug_anabiotic") then
|
||||
xr_effects.disable_ui_only(db.actor, nil)
|
||||
level.add_cam_effector("camera_effects\\surge_02.anm", 10, false, "bind_stalker.anabiotic_callback")
|
||||
level.add_pp_effector("surge_fade.ppe", 11, false)
|
||||
give_info("anabiotic_in_process")
|
||||
_G.mus_vol = get_console():get_float("snd_volume_music")
|
||||
_G.amb_vol = get_console():get_float("snd_volume_eff")
|
||||
get_console():execute("snd_volume_music 0")
|
||||
get_console():execute("snd_volume_eff 0")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function anabiotic_callback()
|
||||
level.add_cam_effector("camera_effects\\surge_01.anm", 10, false, "bind_stalker.anabiotic_callback2")
|
||||
local rnd = math.random(35,45)
|
||||
local m = surge_manager.get_surge_manager()
|
||||
if(m.started) then
|
||||
local tf = level.get_time_factor()
|
||||
local diff_sec = math.ceil(game.get_game_time():diffSec(m.inited_time)/tf)
|
||||
if(rnd>(m.surge_time-diff_sec)*tf/60) then
|
||||
m.time_forwarded = true
|
||||
m.ui_disabled = true
|
||||
m:kill_all_unhided()
|
||||
m:end_surge()
|
||||
end
|
||||
end
|
||||
level.change_game_time(0,0,rnd)
|
||||
level_weathers.get_weather_manager():forced_weather_change()
|
||||
printf("anabiotic_callback: time forwarded on [%d]", rnd)
|
||||
end
|
||||
|
||||
function anabiotic_callback2()
|
||||
xr_effects.enable_ui(db.actor, nil)
|
||||
get_console():execute("snd_volume_music "..tostring(_G.mus_vol))
|
||||
get_console():execute("snd_volume_eff "..tostring(_G.amb_vol))
|
||||
_G.amb_vol = 0
|
||||
_G.mus_vol = 0
|
||||
disable_info("anabiotic_in_process")
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function actor_binder:task_callback(_task, _state)
|
||||
if _state ~= task.fail then
|
||||
if _state == task.completed then
|
||||
news_manager.send_task(db.actor, "complete", _task)
|
||||
else
|
||||
news_manager.send_task(db.actor, "new", _task)
|
||||
end
|
||||
end
|
||||
task_manager.task_callback(_task, _state)
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function actor_binder:update(delta)
|
||||
object_binder.update(self, delta)
|
||||
|
||||
if string.find(command_line(), "-designer") then
|
||||
return
|
||||
end
|
||||
|
||||
if self.already_jumped==false and jump_level.need_jump==true and (device().frame > self.spawn_frame+2000) then
|
||||
jump_level.try_to_jump()
|
||||
self.already_jumped = true
|
||||
return
|
||||
end
|
||||
|
||||
-- Вызов апдейта переноса игрока проводником
|
||||
if travel_func ~= nil then
|
||||
travel_func()
|
||||
end
|
||||
|
||||
-- DEBUG slowdown
|
||||
--slowdown.update()
|
||||
local time = time_global()
|
||||
game_stats.update (delta, self.object)
|
||||
-- апдейт погоды
|
||||
self.weather_manager:update()
|
||||
|
||||
self:check_detective_achievement()
|
||||
self:check_mutant_hunter_achievement()
|
||||
|
||||
--' Апдейт саундменеджера
|
||||
xr_sound.update(self.object:id())
|
||||
|
||||
-- Обновление отключения ввода с клавиатуры.
|
||||
if self.st.disable_input_time ~= nil and
|
||||
game.get_game_time():diffSec(self.st.disable_input_time) >= self.st.disable_input_idle
|
||||
then
|
||||
level.enable_input()
|
||||
self.st.disable_input_time = nil
|
||||
end
|
||||
|
||||
-- Апдейт прятание оружия игрока во время диалога
|
||||
if self.object:is_talking() then
|
||||
if self.weapon_hide_in_dialog == false then
|
||||
self.object:hide_weapon()
|
||||
printf("hiding weapon!!!")
|
||||
self.weapon_hide_in_dialog = true
|
||||
end
|
||||
else
|
||||
if self.weapon_hide_in_dialog == true then
|
||||
printf("restoring weapon!!!")
|
||||
self.object:restore_weapon()
|
||||
self.weapon_hide_in_dialog = false
|
||||
end
|
||||
end
|
||||
-- Апдейт прятание оружия игрока в зоне sr_no_weapon
|
||||
if check_for_weapon_hide_by_zones() == true then
|
||||
if self.weapon_hide == false then
|
||||
printf("hiding weapon!!!")
|
||||
self.object:hide_weapon()
|
||||
self.weapon_hide = true
|
||||
end
|
||||
else
|
||||
if self.weapon_hide == true then
|
||||
printf("restoring weapon!!!")
|
||||
self.object:restore_weapon()
|
||||
self.weapon_hide = false
|
||||
end
|
||||
end
|
||||
|
||||
-- обновление пси-антенны
|
||||
if sr_psy_antenna.psy_antenna then
|
||||
sr_psy_antenna.psy_antenna:update(delta)
|
||||
end
|
||||
--[[
|
||||
--' Вывод сообщения о большой радиации
|
||||
if self.object.radiation >= 0.7 then
|
||||
local hud = get_hud()
|
||||
local custom_static = hud:GetCustomStatic("cs_radiation_danger")
|
||||
if custom_static == nil then
|
||||
hud:AddCustomStatic("cs_radiation_danger", true)
|
||||
hud:GetCustomStatic("cs_radiation_danger"):wnd():TextControl():SetTextST("st_radiation_danger")
|
||||
end
|
||||
else
|
||||
local hud = get_hud()
|
||||
local custom_static = hud:GetCustomStatic("cs_radiation_danger")
|
||||
if custom_static ~= nil then
|
||||
hud:RemoveCustomStatic("cs_radiation_danger")
|
||||
end
|
||||
end
|
||||
]]--
|
||||
|
||||
if self.bCheckStart then
|
||||
printf("SET DEFAULT INFOS")
|
||||
if not has_alife_info("global_dialogs") then
|
||||
self.object:give_info_portion("global_dialogs")
|
||||
end
|
||||
if not has_alife_info("level_changer_icons") then
|
||||
self.object:give_info_portion("level_changer_icons")
|
||||
end
|
||||
self.bCheckStart = false
|
||||
|
||||
-- if self.actor_weapon_on_start == true then
|
||||
-- db.actor:activate_slot(3)
|
||||
-- self.actor_weapon_on_start = false
|
||||
-- end
|
||||
end
|
||||
-- device().precache_frame == 0 and
|
||||
if not self.loaded_slot_applied then
|
||||
self.object:activate_slot(self.loaded_active_slot)
|
||||
self.loaded_slot_applied = true
|
||||
end
|
||||
|
||||
xr_s.on_actor_update(delta)
|
||||
|
||||
if(self.surge_manager) then
|
||||
if(self.f_surge_manager_loaded ~= true) then
|
||||
self.surge_manager:initialize()
|
||||
self.f_surge_manager_loaded = true
|
||||
end
|
||||
if(self.surge_manager.levels_respawn[level.name()]) then
|
||||
self.surge_manager:respawn_artefacts_and_replace_anomaly_zone()
|
||||
end
|
||||
self.surge_manager:update()
|
||||
end
|
||||
-- Апдейт доступности для симуляции.
|
||||
simulation_objects.get_sim_obj_registry():update_avaliability(alife():actor())
|
||||
|
||||
-- Not used
|
||||
--if not self.loaded then
|
||||
-- get_console():execute("dump_infos")
|
||||
-- self.loaded = true
|
||||
--end
|
||||
treasure_manager.get_treasure_manager():update()
|
||||
|
||||
if not(primary_objects_filled) then
|
||||
pda.fill_primary_objects()
|
||||
primary_objects_filled = true
|
||||
end
|
||||
pda.fill_sleep_zones()
|
||||
|
||||
SendScriptCallback("update") -- IX-Ray
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:save(packet)
|
||||
set_save_marker(packet, "save", false, "actor_binder")
|
||||
object_binder.save(self, packet)
|
||||
--' Сохраняем уровень сложности
|
||||
packet:w_u8(level.get_game_difficulty())
|
||||
--' Сохраняем данные об отключенном вводе
|
||||
if self.st.disable_input_time == nil then
|
||||
packet:w_bool(false)
|
||||
else
|
||||
packet:w_bool(true)
|
||||
utils.w_CTime(packet, self.st.disable_input_time)
|
||||
end
|
||||
xr_logic.pstor_save_all(self.object, packet)
|
||||
self.weather_manager:save(packet)
|
||||
release_body_manager.get_release_body_manager():save(packet)
|
||||
self.surge_manager:save(packet)
|
||||
sr_psy_antenna.save( packet )
|
||||
packet:w_bool(sim_board.get_sim_board().simulation_started)
|
||||
|
||||
xr_sound.actor_save(packet)
|
||||
packet:w_stringZ(tostring(self.last_level_name))
|
||||
xr_statistic.save(packet)
|
||||
treasure_manager.get_treasure_manager():save(packet)
|
||||
|
||||
local n = 0
|
||||
for k,v in pairs(db.script_ids) do
|
||||
n = n + 1
|
||||
end
|
||||
packet:w_u8(n)
|
||||
for k,v in pairs (db.script_ids) do
|
||||
packet:w_u16(k)
|
||||
packet:w_stringZ(v)
|
||||
end
|
||||
task_manager.get_task_manager():save(packet)
|
||||
|
||||
-- packet:w_bool(self.actor_weapon_on_start)
|
||||
|
||||
packet:w_u8(self.object:active_slot())
|
||||
|
||||
|
||||
local deimos_exist = false
|
||||
for k,v in pairs(db.zone_by_name) do
|
||||
if(db.storage[v:id()] and db.storage[v:id()].active_scheme=="sr_deimos") then
|
||||
deimos_exist = true
|
||||
packet:w_bool(true)
|
||||
packet:w_float(db.storage[v:id()].sr_deimos.intensity)
|
||||
end
|
||||
end
|
||||
if not deimos_exist then
|
||||
packet:w_bool(false)
|
||||
end
|
||||
|
||||
if self.last_detective_achievement_spawn_time == nil then
|
||||
packet:w_bool(false)
|
||||
else
|
||||
packet:w_bool(true)
|
||||
utils.w_CTime(packet, self.last_detective_achievement_spawn_time)
|
||||
end
|
||||
if self.last_mutant_hunter_achievement_spawn_time == nil then
|
||||
packet:w_bool(false)
|
||||
else
|
||||
packet:w_bool(true)
|
||||
utils.w_CTime(packet, self.last_mutant_hunter_achievement_spawn_time)
|
||||
end
|
||||
set_save_marker(packet, "save", true, "actor_binder")
|
||||
|
||||
SendScriptCallback("save", packet) -- IX-Ray
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function actor_binder:load(reader)
|
||||
set_save_marker(reader, "load", false, "actor_binder")
|
||||
object_binder.load(self, reader)
|
||||
--' Загружаем уровень сложности
|
||||
local game_difficulty = reader:r_u8()
|
||||
printf("load game_difficulty %s", tostring(game_difficulty))
|
||||
get_console():execute("g_game_difficulty "..game_difficulty_by_num[game_difficulty])
|
||||
local stored_input_time = reader:r_u8()
|
||||
if stored_input_time == true then
|
||||
self.st.disable_input_time = utils.r_CTime(reader)
|
||||
end
|
||||
xr_logic.pstor_load_all(self.object, reader)
|
||||
self.weather_manager:load(reader)
|
||||
release_body_manager.get_release_body_manager():load(reader)
|
||||
-- self.surge_manager:initialize()
|
||||
self.surge_manager:load(reader)
|
||||
self.f_surge_manager_loaded = true
|
||||
sr_psy_antenna.load(reader)
|
||||
sim_board.get_sim_board().simulation_started = reader:r_bool()
|
||||
|
||||
xr_sound.actor_load(reader)
|
||||
local n = reader:r_stringZ()
|
||||
if(n~="nil") then
|
||||
self.last_level_name = n
|
||||
end
|
||||
xr_statistic.load(reader)
|
||||
treasure_manager.get_treasure_manager():load(reader)
|
||||
n = reader:r_u8()
|
||||
for i = 1,n do
|
||||
db.script_ids[reader:r_u16()] = reader:r_stringZ()
|
||||
end
|
||||
|
||||
task_manager.get_task_manager():load(reader)
|
||||
|
||||
-- self.actor_weapon_on_start = reader:r_bool()
|
||||
|
||||
self.loaded_active_slot = reader:r_u8()
|
||||
|
||||
self.loaded_slot_applied = false
|
||||
|
||||
local b = reader:r_bool()
|
||||
if(b) then
|
||||
self.deimos_intensity = reader:r_float()
|
||||
end
|
||||
|
||||
local stored_achievement_time = reader:r_bool()
|
||||
if stored_achievement_time == true then
|
||||
self.last_detective_achievement_spawn_time = utils.r_CTime(reader)
|
||||
end
|
||||
stored_achievement_time = reader:r_bool()
|
||||
if stored_achievement_time == true then
|
||||
self.last_mutant_hunter_achievement_spawn_time = utils.r_CTime(reader)
|
||||
end
|
||||
set_save_marker(reader, "load", true, "actor_binder")
|
||||
|
||||
SendScriptCallback("load", reader) -- IX-Ray
|
||||
end
|
||||
|
||||
--*************************************************************
|
||||
--* Подспаун вещей в ящики *
|
||||
--*************************************************************
|
||||
local detective_achievement_items = { "medkit",
|
||||
"antirad",
|
||||
"bandage"}
|
||||
|
||||
local mutant_hunter_achievement_items = { "ammo_5.45x39_ap",
|
||||
"ammo_5.56x45_ap",
|
||||
"ammo_9x39_ap",
|
||||
"ammo_5.56x45_ap",
|
||||
"ammo_12x76_zhekan"}
|
||||
|
||||
local function spawn_achivement_items(items_table, count, inv_box_story_id)
|
||||
local inv_box = alife():object(get_story_object_id(inv_box_story_id))
|
||||
for i = 1,count do
|
||||
alife():create(items_table[math.random(#items_table)],
|
||||
inv_box.position,
|
||||
inv_box.m_level_vertex_id,
|
||||
inv_box.m_game_vertex_id,
|
||||
inv_box.id)
|
||||
end
|
||||
end
|
||||
|
||||
function actor_binder:check_detective_achievement()
|
||||
if not has_alife_info("detective_achievement_gained") then
|
||||
return
|
||||
end
|
||||
if self.last_detective_achievement_spawn_time == nil then
|
||||
self.last_detective_achievement_spawn_time = game.get_game_time()
|
||||
end
|
||||
if game.get_game_time():diffSec(self.last_detective_achievement_spawn_time) > 43200 then
|
||||
spawn_achivement_items(detective_achievement_items, 4, "zat_a2_actor_treasure")
|
||||
xr_effects.send_tip(db.actor, nil, {"st_detective_news","got_medicine"})
|
||||
self.last_detective_achievement_spawn_time = game.get_game_time()
|
||||
end
|
||||
end
|
||||
|
||||
function actor_binder:check_mutant_hunter_achievement()
|
||||
if not has_alife_info("mutant_hunter_achievement_gained") then
|
||||
return
|
||||
end
|
||||
if self.last_mutant_hunter_achievement_spawn_time == nil then
|
||||
self.last_mutant_hunter_achievement_spawn_time = game.get_game_time()
|
||||
end
|
||||
if game.get_game_time():diffSec(self.last_mutant_hunter_achievement_spawn_time) > 43200 then
|
||||
spawn_achivement_items(mutant_hunter_achievement_items, 5, "jup_b202_actor_treasure")
|
||||
xr_effects.send_tip(db.actor, nil, {"st_mutant_hunter_news","got_ammo"})
|
||||
self.last_mutant_hunter_achievement_spawn_time = game.get_game_time()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function check_for_weapon_hide_by_zones()
|
||||
for k,v in pairs(weapon_hide) do
|
||||
if v == true then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Weapon functions
|
||||
function hide_weapon(zone_id)
|
||||
printf("[WEAPON_CONTROL]:hiding weapon from zone [%s] in section [%s]!!!", zone_id, db.storage[zone_id].active_section)
|
||||
weapon_hide[zone_id] = true
|
||||
end
|
||||
|
||||
function restore_weapon(zone_id)
|
||||
printf("[WEAPON_CONTROL]:restoring weapon from zone [%s] in section [%s]!!!", zone_id, db.storage[zone_id].active_section)
|
||||
weapon_hide[zone_id] = false
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1023
gamedata/scripts/gulag_general.script
Normal file
1023
gamedata/scripts/gulag_general.script
Normal file
File diff suppressed because it is too large
Load diff
49
gamedata/scripts/ixray_global.script
Normal file
49
gamedata/scripts/ixray_global.script
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
math.randomseed(time_global())
|
||||
|
||||
_G.isMarshal = marshal ~= nil
|
||||
_G.isLfs = lfs ~= nil
|
||||
|
||||
_G.bit_and = bit.band
|
||||
_G.bit_or = bit.bor
|
||||
_G.bit_xor = bit.bxor
|
||||
_G.bit_not = bit.bnot
|
||||
|
||||
--// Some X-Ray block
|
||||
_G.DebugLog = false
|
||||
|
||||
_G.log = function (str)
|
||||
if DebugLog then
|
||||
SemiLog(str)
|
||||
end
|
||||
if DebuggerMode then
|
||||
LuaPanda.printToVSCode(str,1,2)
|
||||
end
|
||||
end
|
||||
|
||||
function register(object_factory)
|
||||
class_registrator.cs_register(object_factory, "CCar", "se_car.se_car", "SCRPTCAR", "car_s")
|
||||
end
|
||||
|
||||
_G.convert_class_name = function(obj)
|
||||
if obj then
|
||||
local name = class_info(obj).name
|
||||
|
||||
if name == "game_object" then
|
||||
return "client"
|
||||
else
|
||||
return "server"
|
||||
end
|
||||
else
|
||||
return "nil"
|
||||
end
|
||||
end
|
||||
|
||||
_G.g_EnablePrintfXRScript = false
|
||||
|
||||
-- используется для выявления сигнатур функций которые заложены в xr_conditions
|
||||
_G.printf_xrscript = function(fmt, ...)
|
||||
if g_EnablePrintfXRScript then
|
||||
log(debug.traceback(1))
|
||||
printf(fmt, ...)
|
||||
end
|
||||
end
|
||||
47
gamedata/scripts/ixray_system/dynamic_callbacks.lua
Normal file
47
gamedata/scripts/ixray_system/dynamic_callbacks.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
local intercepts =
|
||||
{
|
||||
save = {},
|
||||
load = {},
|
||||
update = {},
|
||||
|
||||
save_state = {},
|
||||
load_state = {}
|
||||
}
|
||||
|
||||
function RegisterScriptCallback(name, func_or_userdata)
|
||||
if (func_or_userdata == nil) then
|
||||
SemiLog("! func_or_userdata == nil")
|
||||
callstack()
|
||||
end
|
||||
|
||||
if (name == nil) then
|
||||
SemiLog("! name == nil")
|
||||
callstack()
|
||||
end
|
||||
if (intercepts == nil) then
|
||||
SemiLog("! intercepts == nil")
|
||||
callstack()
|
||||
end
|
||||
|
||||
if (intercepts[name]) then
|
||||
intercepts[name][func_or_userdata] = true
|
||||
end
|
||||
end
|
||||
|
||||
function UnregisterScriptCallback(name, func_or_userdata)
|
||||
if (intercepts[name]) then
|
||||
intercepts[name][func_or_userdata] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function SendScriptCallback(name,...)
|
||||
if (intercepts[name]) then
|
||||
for func_or_userdata,v in pairs(intercepts[name]) do
|
||||
if (type(func_or_userdata) == "function") then
|
||||
func_or_userdata(...)
|
||||
elseif (func_or_userdata[name]) then
|
||||
func_or_userdata[name](func_or_userdata,...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
34
gamedata/scripts/ixray_system/global.lua
Normal file
34
gamedata/scripts/ixray_system/global.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
--// General
|
||||
jit.opt.start(2)
|
||||
|
||||
string.gfind = string.gmatch
|
||||
math.mod = math.fmod
|
||||
|
||||
--// LuaPandas
|
||||
DebuggerMode = false
|
||||
|
||||
function debug_jit_off()
|
||||
if DebuggerMode then
|
||||
if jit then jit.off() end
|
||||
end
|
||||
end
|
||||
|
||||
function debug_jit_on()
|
||||
if DebuggerMode then
|
||||
if jit then jit.on() end
|
||||
end
|
||||
end
|
||||
|
||||
function debugger_attach()
|
||||
if DebuggerMode then
|
||||
debug_jit_off()
|
||||
LuaPanda.reConnect()
|
||||
debug_jit_on()
|
||||
else
|
||||
debug_jit_off()
|
||||
SemiLog('LuaPanda starting...')
|
||||
LuaPanda.start("127.0.0.1", 8818)
|
||||
DebuggerMode = true
|
||||
debug_jit_on()
|
||||
end
|
||||
end
|
||||
3626
gamedata/scripts/ixray_system/luapanda.lua
Normal file
3626
gamedata/scripts/ixray_system/luapanda.lua
Normal file
File diff suppressed because it is too large
Load diff
149
gamedata/scripts/ixray_system/socket.lua
Normal file
149
gamedata/scripts/ixray_system/socket.lua
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
-----------------------------------------------------------------------------
|
||||
-- LuaSocket helper module
|
||||
-- Author: Diego Nehab
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Declare module and import dependencies
|
||||
-----------------------------------------------------------------------------
|
||||
local base = _G
|
||||
local string = require("string")
|
||||
local math = require("math")
|
||||
local socket = require("socket.core")
|
||||
|
||||
local _M = socket
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Exported auxiliar functions
|
||||
-----------------------------------------------------------------------------
|
||||
function _M.connect4(address, port, laddress, lport)
|
||||
return socket.connect(address, port, laddress, lport, "inet")
|
||||
end
|
||||
|
||||
function _M.connect6(address, port, laddress, lport)
|
||||
return socket.connect(address, port, laddress, lport, "inet6")
|
||||
end
|
||||
|
||||
function _M.bind(host, port, backlog)
|
||||
if host == "*" then host = "0.0.0.0" end
|
||||
local addrinfo, err = socket.dns.getaddrinfo(host);
|
||||
if not addrinfo then return nil, err end
|
||||
local sock, res
|
||||
err = "no info on address"
|
||||
for i, alt in base.ipairs(addrinfo) do
|
||||
if alt.family == "inet" then
|
||||
sock, err = socket.tcp4()
|
||||
else
|
||||
sock, err = socket.tcp6()
|
||||
end
|
||||
if not sock then return nil, err end
|
||||
sock:setoption("reuseaddr", true)
|
||||
res, err = sock:bind(alt.addr, port)
|
||||
if not res then
|
||||
sock:close()
|
||||
else
|
||||
res, err = sock:listen(backlog)
|
||||
if not res then
|
||||
sock:close()
|
||||
else
|
||||
return sock
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil, err
|
||||
end
|
||||
|
||||
_M.try = _M.newtry()
|
||||
|
||||
function _M.choose(table)
|
||||
return function(name, opt1, opt2)
|
||||
if base.type(name) ~= "string" then
|
||||
name, opt1, opt2 = "default", name, opt1
|
||||
end
|
||||
local f = table[name or "nil"]
|
||||
if not f then base.error("unknown key (".. base.tostring(name) ..")", 3)
|
||||
else return f(opt1, opt2) end
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Socket sources and sinks, conforming to LTN12
|
||||
-----------------------------------------------------------------------------
|
||||
-- create namespaces inside LuaSocket namespace
|
||||
local sourcet, sinkt = {}, {}
|
||||
_M.sourcet = sourcet
|
||||
_M.sinkt = sinkt
|
||||
|
||||
_M.BLOCKSIZE = 2048
|
||||
|
||||
sinkt["close-when-done"] = function(sock)
|
||||
return base.setmetatable({
|
||||
getfd = function() return sock:getfd() end,
|
||||
dirty = function() return sock:dirty() end
|
||||
}, {
|
||||
__call = function(self, chunk, err)
|
||||
if not chunk then
|
||||
sock:close()
|
||||
return 1
|
||||
else return sock:send(chunk) end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
sinkt["keep-open"] = function(sock)
|
||||
return base.setmetatable({
|
||||
getfd = function() return sock:getfd() end,
|
||||
dirty = function() return sock:dirty() end
|
||||
}, {
|
||||
__call = function(self, chunk, err)
|
||||
if chunk then return sock:send(chunk)
|
||||
else return 1 end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
sinkt["default"] = sinkt["keep-open"]
|
||||
|
||||
_M.sink = _M.choose(sinkt)
|
||||
|
||||
sourcet["by-length"] = function(sock, length)
|
||||
return base.setmetatable({
|
||||
getfd = function() return sock:getfd() end,
|
||||
dirty = function() return sock:dirty() end
|
||||
}, {
|
||||
__call = function()
|
||||
if length <= 0 then return nil end
|
||||
local size = math.min(socket.BLOCKSIZE, length)
|
||||
local chunk, err = sock:receive(size)
|
||||
if err then return nil, err end
|
||||
length = length - string.len(chunk)
|
||||
return chunk
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
sourcet["until-closed"] = function(sock)
|
||||
local done
|
||||
return base.setmetatable({
|
||||
getfd = function() return sock:getfd() end,
|
||||
dirty = function() return sock:dirty() end
|
||||
}, {
|
||||
__call = function()
|
||||
if done then return nil end
|
||||
local chunk, err, partial = sock:receive(socket.BLOCKSIZE)
|
||||
if not err then return chunk
|
||||
elseif err == "closed" then
|
||||
sock:close()
|
||||
done = 1
|
||||
return partial
|
||||
else return nil, err end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
sourcet["default"] = sourcet["until-closed"]
|
||||
|
||||
_M.source = _M.choose(sourcet)
|
||||
|
||||
return _M
|
||||
117
gamedata/scripts/luaxml.script
Normal file
117
gamedata/scripts/luaxml.script
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
local base = _G
|
||||
local xml = xml
|
||||
module("xml")
|
||||
|
||||
-- symbolic name for tag index, this allows accessing the tag by var[xml.TAG]
|
||||
TAG = 0
|
||||
|
||||
-- sets or returns tag of a LuaXML object
|
||||
function tag(var,tag)
|
||||
if base.type(var)~="table" then return end
|
||||
if base.type(tag)=="nil" then
|
||||
return var[TAG]
|
||||
end
|
||||
var[TAG] = tag
|
||||
end
|
||||
|
||||
-- creates a new LuaXML object either by setting the metatable of an existing Lua table or by setting its tag
|
||||
function new(arg)
|
||||
if base.type(arg)=="table" then
|
||||
base.setmetatable(arg,{__index=xml, __tostring=xml.str})
|
||||
return arg
|
||||
end
|
||||
local var={}
|
||||
base.setmetatable(var,{__index=xml, __tostring=xml.str})
|
||||
if base.type(arg)=="string" then var[TAG]=arg end
|
||||
return var
|
||||
end
|
||||
|
||||
-- appends a new subordinate LuaXML object to an existing one, optionally sets tag
|
||||
function append(var,tag)
|
||||
if base.type(var)~="table" then return end
|
||||
local newVar = new(tag)
|
||||
var[#var+1] = newVar
|
||||
return newVar
|
||||
end
|
||||
|
||||
-- converts any Lua var into an XML string
|
||||
function str(var,indent,tagValue)
|
||||
if base.type(var)=="nil" then return end
|
||||
local indent = indent or 0
|
||||
local indentStr=""
|
||||
for i = 1,indent do indentStr=indentStr.." " end
|
||||
local tableStr=""
|
||||
|
||||
if base.type(var)=="table" then
|
||||
local tag = var[0] or tagValue or base.type(var)
|
||||
local s = indentStr.."<"..tag
|
||||
for k,v in base.pairs(var) do -- attributes
|
||||
if base.type(k)=="string" then
|
||||
if base.type(v)=="table" and k~="_M" then -- otherwise recursiveness imminent
|
||||
tableStr = tableStr..str(v,indent+1,k)
|
||||
else
|
||||
s = s.." "..k.."=\""..encode(base.tostring(v)).."\""
|
||||
end
|
||||
end
|
||||
end
|
||||
if #var==0 and #tableStr==0 then
|
||||
s = s.." />\n"
|
||||
elseif #var==1 and base.type(var[1])~="table" and #tableStr==0 then -- single element
|
||||
s = s..">"..encode(base.tostring(var[1])).."</"..tag..">\n"
|
||||
else
|
||||
s = s..">\n"
|
||||
for k,v in base.ipairs(var) do -- elements
|
||||
if base.type(v)=="string" then
|
||||
s = s..indentStr.." "..encode(v).." \n"
|
||||
else
|
||||
s = s..str(v,indent+1)
|
||||
end
|
||||
end
|
||||
s=s..tableStr..indentStr.."</"..tag..">\n"
|
||||
end
|
||||
return s
|
||||
else
|
||||
local tag = base.type(var)
|
||||
return indentStr.."<"..tag.."> "..encode(base.tostring(var)).." </"..tag..">\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- saves a Lua var as xml file
|
||||
function save(var,filename)
|
||||
if not var then return end
|
||||
if not filename or #filename==0 then return end
|
||||
local file = base.io.open(filename,"w")
|
||||
file:write("<?xml version=\"1.0\"?>\n<!-- file \"",filename, "\", generated by LuaXML -->\n\n")
|
||||
file:write(str(var))
|
||||
base.io.close(file)
|
||||
end
|
||||
|
||||
|
||||
-- recursively parses a Lua table for a substatement fitting to the provided tag and attribute
|
||||
function find(var, tag, attributeKey,attributeValue)
|
||||
-- check input:
|
||||
if base.type(var)~="table" then return end
|
||||
if base.type(tag)=="string" and #tag==0 then tag=nil end
|
||||
if base.type(attributeKey)~="string" or #attributeKey==0 then attributeKey=nil end
|
||||
if base.type(attributeValue)=="string" and #attributeValue==0 then attributeValue=nil end
|
||||
-- compare this table:
|
||||
if tag~=nil then
|
||||
if var[0]==tag and ( attributeValue == nil or var[attributeKey]==attributeValue ) then
|
||||
base.setmetatable(var,{__index=xml, __tostring=xml.str})
|
||||
return var
|
||||
end
|
||||
else
|
||||
if attributeValue == nil or var[attributeKey]==attributeValue then
|
||||
base.setmetatable(var,{__index=xml, __tostring=xml.str})
|
||||
return var
|
||||
end
|
||||
end
|
||||
-- recursively parse subtags:
|
||||
for k,v in base.ipairs(var) do
|
||||
if base.type(v)=="table" then
|
||||
local ret = find(v, tag, attributeKey,attributeValue)
|
||||
if ret ~= nil then return ret end
|
||||
end
|
||||
end
|
||||
end
|
||||
450
gamedata/scripts/pda.script
Normal file
450
gamedata/scripts/pda.script
Normal file
|
|
@ -0,0 +1,450 @@
|
|||
-- вызывается 1 раз в 3 секунды
|
||||
function fill_faction_state(state)
|
||||
local board = sim_board.get_sim_board()
|
||||
|
||||
state.member_count = 0
|
||||
state.resource = 0
|
||||
state.power = 0
|
||||
|
||||
|
||||
state.actor_goodwill = 3000
|
||||
state.name = "ui_inGame2_hint_wnd_bar"
|
||||
state.icon = "ui_inGame2_hint_wnd_bar"
|
||||
state.icon_big = "logos_big_empty"
|
||||
state.target = game.translate_string("ui_st_no_faction")
|
||||
state.target_desc = "aaa"
|
||||
state.location = "a"
|
||||
|
||||
state.war_state1 = "a"
|
||||
state.war_state_hint1 = "1"
|
||||
state.war_state2 = "3"
|
||||
state.war_state_hint2 = "2"
|
||||
state.war_state3 = "33"
|
||||
state.war_state_hint3 = ""
|
||||
state.war_state4 = "23"
|
||||
state.war_state_hint4 = ""
|
||||
state.war_state5 = "5"
|
||||
state.war_state_hint5 = "5"
|
||||
|
||||
state.bonus = 0
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
--int get_max_member_count (); ------ 1 раз в 3 секунды
|
||||
--float get_max_resource();
|
||||
--float get_max_power();
|
||||
|
||||
function get_max_member_count()
|
||||
return 10
|
||||
end
|
||||
|
||||
function get_max_resource()
|
||||
return 10
|
||||
end
|
||||
|
||||
function get_max_power()
|
||||
return 10
|
||||
end
|
||||
|
||||
|
||||
-- потом это нужно стереть
|
||||
|
||||
-- int mode:
|
||||
-- 0 = Undefined = закрыто
|
||||
-- 1 = Inventory
|
||||
-- 2 = Trade
|
||||
-- 3 = Upgrade
|
||||
-- 4 = DeadBodySearch
|
||||
-- 10 = Talk dialog show
|
||||
-- 11 = Talk dialog hide
|
||||
local last_mode = 0
|
||||
dialog_closed = false
|
||||
trade_closed = false
|
||||
upgrade_closed = false
|
||||
function actor_menu_mode(mode)
|
||||
if(mode==0) then
|
||||
if(last_mode==1) then
|
||||
inventory_wnd_closed()
|
||||
elseif(last_mode==2) then
|
||||
trade_wnd_closed()
|
||||
elseif(last_mode==3) then
|
||||
upgrade_wnd_closed()
|
||||
elseif(last_mode==4) then
|
||||
dead_body_search_wnd_closed()
|
||||
end
|
||||
last_mode = 0
|
||||
elseif(mode==1) then
|
||||
last_mode = 1
|
||||
inventory_wnd_opened()
|
||||
elseif(mode==2) then
|
||||
last_mode = 2
|
||||
trade_wnd_opened()
|
||||
elseif(mode==3) then
|
||||
last_mode = 3
|
||||
upgrade_wnd_opened()
|
||||
elseif(mode==4) then
|
||||
last_mode = 4
|
||||
dead_body_search_wnd_opened()
|
||||
elseif(mode==10) then
|
||||
dialog_wnd_showed()
|
||||
elseif(mode==11) then
|
||||
dialog_wnd_closed()
|
||||
end
|
||||
end
|
||||
|
||||
function inventory_wnd_opened()
|
||||
--printf("---:>Inventory opened")
|
||||
end
|
||||
|
||||
function inventory_wnd_closed()
|
||||
--printf("---:>Inventory closed")
|
||||
end
|
||||
|
||||
function trade_wnd_opened()
|
||||
dialog_closed = false
|
||||
--printf("---:>Trade opened")
|
||||
end
|
||||
|
||||
function trade_wnd_closed()
|
||||
--printf("---:>Trade closed")
|
||||
trade_closed = true
|
||||
end
|
||||
|
||||
function upgrade_wnd_opened()
|
||||
dialog_closed = false
|
||||
--printf("---:>Upgrade opened")
|
||||
end
|
||||
|
||||
function upgrade_wnd_closed()
|
||||
--printf("---:>Upgrade closed")
|
||||
upgrade_closed = true
|
||||
end
|
||||
|
||||
function dead_body_search_wnd_opened()
|
||||
--printf("---:>DeadBodySearch opened")
|
||||
end
|
||||
|
||||
function dead_body_search_wnd_closed()
|
||||
--printf("---:>DeadBodySearch closed")
|
||||
end
|
||||
|
||||
function dialog_wnd_showed()
|
||||
dialog_closed = false
|
||||
for k,v in pairs(db.storage) do
|
||||
local npc = v.object
|
||||
if npc ~= nil then
|
||||
local npc_id = npc:id()
|
||||
if npc:is_talking() and npc_id ~= db.actor:id() then
|
||||
local sound_theme = xr_sound.sound_table[npc_id]
|
||||
if sound_theme and sound_theme.reset then
|
||||
sound_theme:reset(npc_id)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
--printf("---:>Talk Dialog show")
|
||||
end
|
||||
|
||||
function dialog_wnd_closed()
|
||||
--printf("---:>Talk Dialog hide")
|
||||
dialog_closed = true
|
||||
end
|
||||
|
||||
-- CoCray
|
||||
function get_time_elapsed()
|
||||
local s_time = level.get_start_time()
|
||||
local seconds = tonumber(game.get_game_time():diffSec(s_time))
|
||||
|
||||
if (seconds < 60) then
|
||||
return string.format("%d %s",seconds,game.translate_string("ui_st_secs"))
|
||||
elseif (seconds < 3600) then
|
||||
return string.format("%d %s",seconds/60,game.translate_string("ui_st_mins"))
|
||||
elseif (seconds < 86400) then
|
||||
return string.format("%d %s",seconds/60/60,game.translate_string("ui_st_hours"))
|
||||
end
|
||||
|
||||
return string.format("%d %s",seconds/60/60/24,game.translate_string("ui_st_days"))
|
||||
end
|
||||
--//
|
||||
|
||||
function get_stat(index) -- index= int return string
|
||||
if(index==0) then
|
||||
return tostring(get_time_elapsed())
|
||||
elseif(index==1) then
|
||||
return tostring(xr_statistic.actor_statistic.surges)
|
||||
elseif(index==2) then
|
||||
return tostring(xr_statistic.actor_statistic.completed_quests)
|
||||
elseif(index==3) then
|
||||
return tostring(xr_statistic.actor_statistic.killed_monsters)
|
||||
elseif(index==4) then
|
||||
return tostring(xr_statistic.actor_statistic.killed_stalkers)
|
||||
elseif(index==5) then
|
||||
return tostring(xr_statistic.actor_statistic.artefacts_founded)
|
||||
elseif(index==6) then
|
||||
return tostring(xr_statistic.actor_statistic.founded_secrets)
|
||||
end
|
||||
return "Unknown"
|
||||
end
|
||||
|
||||
killed_monsters_tbl =
|
||||
{
|
||||
bloodsucker_weak = {back = "ui_inGame2_Krovosos", icon = ""},
|
||||
bloodsucker_normal = {back = "ui_inGame2_Krovosos_1", icon = ""},
|
||||
bloodsucker_strong = {back = "ui_inGame2_Krovosos_2", icon = ""},
|
||||
boar_weak = {back = "ui_inGame2_Kaban_1", icon = ""},
|
||||
boar_strong = {back = "ui_inGame2_Kaban", icon = ""},
|
||||
burer = {back = "ui_inGame2_Burer", icon = ""},
|
||||
chimera = {back = "ui_inGame2_Himera", icon = ""},
|
||||
controller = {back = "ui_inGame2_Controller", icon = ""},
|
||||
dog = {back = "ui_inGame2_Blind_Dog", icon = ""},
|
||||
flesh_weak = {back = "ui_inGame2_Flesh", icon = ""},
|
||||
flesh_strong = {back = "ui_inGame2_Flesh_1", icon = ""},
|
||||
gigant = {back = "ui_inGame2_Pseudo_Gigant", icon = ""},
|
||||
poltergeist_tele = {back = "ui_inGame2_Poltergeyst", icon = ""},
|
||||
poltergeist_flame = {back = "ui_inGame2_Poltergeist_1", icon = ""},
|
||||
psy_dog_weak = {back = "ui_inGame2_PseudoDog_1", icon = ""},
|
||||
psy_dog_strong = {back = "ui_inGame2_PseudoDog", icon = ""},
|
||||
pseudodog_weak = {back = "ui_inGame2_PseudoDog_1", icon = ""},
|
||||
pseudodog_strong = {back = "ui_inGame2_PseudoDog", icon = ""},
|
||||
snork = {back = "ui_inGame2_Snork", icon = ""},
|
||||
tushkano = {back = "ui_inGame2_Tushkan", icon = ""},
|
||||
none = {back = "", icon = ""}
|
||||
}
|
||||
function get_monster_back()
|
||||
if not(xr_statistic.actor_statistic.best_monster) or not(killed_monsters_tbl[xr_statistic.actor_statistic.best_monster]) then
|
||||
return tostring(killed_monsters_tbl.none.back)
|
||||
end
|
||||
return tostring(killed_monsters_tbl[xr_statistic.actor_statistic.best_monster].back)
|
||||
end
|
||||
function get_monster_icon()
|
||||
if not(xr_statistic.actor_statistic.best_monster) or not(killed_monsters_tbl[xr_statistic.actor_statistic.best_monster]) then
|
||||
return tostring(killed_monsters_tbl.none.icon)
|
||||
end
|
||||
return tostring(killed_monsters_tbl[xr_statistic.actor_statistic.best_monster].icon)
|
||||
end
|
||||
function get_favorite_weapon()
|
||||
if not(xr_statistic.actor_statistic.favorite_weapon_sect) then
|
||||
return "wpn_knife"
|
||||
end
|
||||
return xr_statistic.actor_statistic.favorite_weapon_sect
|
||||
end
|
||||
|
||||
local primary_objects_tbl =
|
||||
{
|
||||
{target="zat_b55_spot", hint="st_zat_b55_name"},
|
||||
{target="zat_b100_spot", hint="st_zat_b100_name"},
|
||||
{target="zat_b104_spot", hint="st_zat_b104_name"},
|
||||
{target="zat_b38_spot", hint="st_zat_b38_name"},
|
||||
{target="zat_b40_spot", hint="st_zat_b40_name"},
|
||||
{target="zat_b56_spot", hint="st_zat_b56_name"},
|
||||
{target="zat_b5_spot", hint="st_zat_b5_name"},
|
||||
{target="zat_a2_spot", hint="st_zat_a2_name"},
|
||||
{target="zat_b20_spot", hint="st_zat_b20_name"},
|
||||
{target="zat_b53_spot", hint="st_zat_b53_name"},
|
||||
{target="zat_b101_spot", hint="st_zat_b101_name"},
|
||||
{target="zat_b106_spot", hint="st_zat_b106_name"},
|
||||
{target="zat_b7_spot", hint="st_zat_b7_name"},
|
||||
{target="zat_b14_spot", hint="st_zat_b14_name"},
|
||||
{target="zat_b52_spot", hint="st_zat_b52_name"},
|
||||
{target="zat_b39_spot", hint="st_zat_b39_name"},
|
||||
{target="zat_b33_spot", hint="st_zat_b33_name"},
|
||||
{target="zat_b18_spot", hint="st_zat_b18_name"},
|
||||
{target="zat_b54_spot", hint="st_zat_b54_name"},
|
||||
{target="zat_b12_spot", hint="st_zat_b12_name"},
|
||||
{target="zat_b28_spot", hint="st_zat_b28_name"},
|
||||
{target="zat_b103_spot", hint="st_zat_b103_name"},
|
||||
|
||||
{target="jup_b1_spot", hint="st_jup_b1_name"},
|
||||
{target="jup_b46_spot", hint="st_jup_b46_name"},
|
||||
{target="jup_b202_spot", hint="st_jup_b202_name"},
|
||||
{target="jup_b211_spot", hint="st_jup_b211_name"},
|
||||
{target="jup_b200_spot", hint="st_jup_b200_name"},
|
||||
{target="jup_b19_spot", hint="st_jup_b19_name"},
|
||||
{target="jup_a6_spot", hint="st_jup_a6_name"},
|
||||
{target="jup_b25_spot", hint="st_jup_b25_name"},
|
||||
{target="jup_b6_spot", hint="st_jup_b6_name"},
|
||||
{target="jup_b205_spot", hint="st_jup_b205_name"},
|
||||
{target="jup_b206_spot", hint="st_jup_b206_name"},
|
||||
{target="jup_b32_spot", hint="st_jup_b32_name"},
|
||||
{target="jup_a10_spot", hint="st_jup_a10_name"},
|
||||
{target="jup_b209_spot", hint="st_jup_b209_name"},
|
||||
{target="jup_b208_spot", hint="st_jup_b208_name"},
|
||||
{target="jup_a12_spot", hint="st_jup_a12_name"},
|
||||
{target="jup_b212_spot", hint="st_jup_b212_name"},
|
||||
{target="jup_b9_spot", hint="st_jup_b9_name"},
|
||||
{target="jup_b201_spot", hint="st_jup_b201_name"},
|
||||
{target="jup_a9_spot", hint="st_jup_a9_name"},
|
||||
|
||||
{target="pri_a28_spot", hint="st_pri_a28_name"},
|
||||
{target="pri_b36_spot", hint="st_pri_b36_name"},
|
||||
{target="pri_b303_spot", hint="st_pri_b303_name"},
|
||||
{target="pri_b301_spot", hint="st_pri_b301_name"},
|
||||
{target="pri_a17_spot", hint="st_pri_a17_name"},
|
||||
{target="pri_b306_spot", hint="st_pri_b306_name"},
|
||||
{target="pri_a16_spot", hint="st_pri_a16_name"},
|
||||
{target="pri_a25_spot", hint="st_pri_a25_name"},
|
||||
{target="pri_b35_spot", hint="st_pri_b35_name"},
|
||||
{target="pri_a21_spot", hint="st_pri_a21_name"},
|
||||
{target="pri_b304_spot", hint="st_pri_b304_name"},
|
||||
{target="pri_a18_spot", hint="st_pri_a18_name"}
|
||||
}
|
||||
|
||||
local change_objects_tbl =
|
||||
{
|
||||
{target = "jup_b32_spot", hint = "st_jup_b32_name", zone = "jup_b32_anomal_zone", group = "jup_b32_scanner_1_placed", enabled = false},
|
||||
{target = "jup_b201_spot", hint = "st_jup_b201_name", zone = "jup_b201_anomal_zone", group = "jup_b32_scanner_2_placed", enabled = false},
|
||||
{target = "jup_b209_spot", hint = "st_jup_b209_name", zone = "jup_b209_anomal_zone", group = "jup_b32_scanner_3_placed", enabled = false},
|
||||
{target = "jup_b211_spot", hint = "st_jup_b211_name", zone = "jup_b211_anomal_zone", group = "jup_b32_scanner_4_placed", enabled = false},
|
||||
{target = "jup_b1_spot", hint = "st_jup_b1_name", zone = "jup_b10_anomal_zone", group = "jup_b32_scanner_5_placed", enabled = false},
|
||||
|
||||
}
|
||||
|
||||
local sleep_zones_tbl =
|
||||
{
|
||||
{target = "zat_a2_sr_sleep_id", hint = "st_ui_pda_sleep_place"},
|
||||
{target = "jup_a6_sr_sleep_id", hint = "st_ui_pda_sleep_place"},
|
||||
{target = "pri_a16_sr_sleep_id", hint = "st_ui_pda_sleep_place"},
|
||||
}
|
||||
|
||||
function fill_primary_objects()
|
||||
for k,v in pairs(primary_objects_tbl) do
|
||||
local obj_id = get_story_object_id(v.target)
|
||||
if(obj_id) then
|
||||
level.map_add_object_spot(obj_id, "primary_object", v.hint)
|
||||
end
|
||||
end
|
||||
change_anomalies_names()
|
||||
fill_sleep_zones()
|
||||
end
|
||||
|
||||
function fill_sleep_zones()
|
||||
for k,v in pairs(sleep_zones_tbl) do
|
||||
local obj_id = get_story_object_id(v.target)
|
||||
if(obj_id and db.storage[obj_id] and db.storage[obj_id].object) then
|
||||
if(db.storage[obj_id].object:position():distance_to(db.actor:position())<=150 and level.map_has_object_spot(obj_id, "ui_pda2_actor_sleep_location")==0) then
|
||||
level.map_add_object_spot(obj_id, "ui_pda2_actor_sleep_location", v.hint)
|
||||
elseif(db.storage[obj_id].object:position():distance_to(db.actor:position())>150 and level.map_has_object_spot(obj_id, "ui_pda2_actor_sleep_location")~=0) then
|
||||
level.map_remove_object_spot(obj_id, "ui_pda2_actor_sleep_location")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function add_quick_slot_items_on_game_start()
|
||||
local _ini = system_ini()
|
||||
local str = utils.cfg_get_string(_ini, "actor", "quick_item_1", db.actor, false, "", "")
|
||||
get_console():execute("slot_0 "..str)
|
||||
local str = utils.cfg_get_string(_ini, "actor", "quick_item_2", db.actor, false, "", "")
|
||||
get_console():execute("slot_1 "..str)
|
||||
local str = utils.cfg_get_string(_ini, "actor", "quick_item_3", db.actor, false, "", "")
|
||||
get_console():execute("slot_2 "..str)
|
||||
local str = utils.cfg_get_string(_ini, "actor", "quick_item_4", db.actor, false, "", "")
|
||||
get_console():execute("slot_3 "..str)
|
||||
end
|
||||
|
||||
function change_anomalies_names()
|
||||
if has_alife_info("jup_b32_scanner_reward") then
|
||||
for k,v in pairs(change_objects_tbl) do
|
||||
if has_alife_info(v.group) and not v.enabled then
|
||||
v.enabled = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if level.name() ~= "jupiter" then
|
||||
return
|
||||
end
|
||||
for k,v in pairs(change_objects_tbl) do
|
||||
if v.enabled then
|
||||
local obj_id = get_story_object_id(v.target)
|
||||
if (obj_id) and (level.map_has_object_spot(obj_id, "primary_object") ~= 0) then
|
||||
level.map_remove_object_spot(obj_id, "primary_object")
|
||||
end
|
||||
local hint = game.translate_string(v.hint).."\\n".." \\n"
|
||||
local has_af = false
|
||||
local af_table = {}
|
||||
has_af, af_table = xr_conditions.anomaly_has_artefact(db.actor, nil, {v.zone})
|
||||
if has_af then
|
||||
hint = hint..game.translate_string("st_jup_b32_has_af")
|
||||
for k,v in pairs(af_table) do
|
||||
hint = hint.."\\n"..game.translate_string("st_"..v.."_name")
|
||||
end
|
||||
else
|
||||
hint = hint..game.translate_string("st_jup_b32_no_af")
|
||||
end
|
||||
if (obj_id) and level.map_has_object_spot(obj_id, "primary_object") == 0 then
|
||||
level.map_add_object_spot(obj_id, "primary_object", hint)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- CoCray
|
||||
----------------------------------------------------------------------------
|
||||
-- Engine->lua function calls
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
-- PDA Tabs
|
||||
-- It's now possible to add new button tabs to pda*.xml.
|
||||
-- You can use ActorMenu.get_pda_menu():GetActiveSection() to find out active pda tab
|
||||
-- UI returned must be CUIScriptWnd
|
||||
function set_active_subdialog(section)
|
||||
--printf("section=%s",section)
|
||||
if (section == "eptTasks") then
|
||||
|
||||
elseif (section == "eptRanking") then
|
||||
|
||||
elseif (section == "eptLogs") then
|
||||
return nil
|
||||
|
||||
elseif (section == "eptRelations") then
|
||||
--return ui_pda_relations_tab.get_ui()
|
||||
elseif (section == "eptContacts") then
|
||||
--return ui_pda_contacts_tab.get_ui()
|
||||
elseif (section == "eptEncyclopedia") then
|
||||
--return ui_pda_encyclopedia_tab.get_ui()
|
||||
end
|
||||
end
|
||||
|
||||
function property_box_clicked(property_ui)
|
||||
-- See CoC for implmentation
|
||||
end
|
||||
|
||||
function property_box_add_properties(property_ui,id,level_name,hint)
|
||||
-- See CoC for implmentation
|
||||
end
|
||||
|
||||
-- called from engine! It's how many character rankings to display! u8 (max 255)
|
||||
function get_rankings_array_size()
|
||||
return 1
|
||||
end
|
||||
|
||||
-- called from engine! must return bool!
|
||||
function coc_rankings_can_show(index)
|
||||
return false
|
||||
end
|
||||
|
||||
-- called from engine! must return string!
|
||||
function coc_rankings_set_name(index)
|
||||
return ""
|
||||
end
|
||||
|
||||
-- called from engine! must return string!
|
||||
function coc_rankings_set_hint(index)
|
||||
return ""
|
||||
end
|
||||
|
||||
-- called from engine! must return string!
|
||||
function coc_rankings_set_description(index)
|
||||
return ""
|
||||
end
|
||||
|
||||
-- called from engine! must return string!
|
||||
function coc_rankings_set_icon(index)
|
||||
return ""
|
||||
end
|
||||
-- //
|
||||
37
gamedata/scripts/se_car.script
Normal file
37
gamedata/scripts/se_car.script
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
---------------------------------------------------------------------
|
||||
class "se_car" (cse_alife_car)
|
||||
--------------------
|
||||
function se_car:__init (section) super (section)
|
||||
--log("_bp: set_car:__init")
|
||||
self.ini = nil
|
||||
self.spawner_present = false
|
||||
end
|
||||
|
||||
function se_car:on_register()
|
||||
cse_alife_car.on_register(self)
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
--from test xr_effects.spawn_object_in(db.actor, nil, {"wpn_pm","my_moskvich_story_id"})
|
||||
end
|
||||
function se_car:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_car.on_unregister(self)
|
||||
end
|
||||
--------------------
|
||||
function se_car:can_switch_offline ()
|
||||
return cse_alife_car.can_switch_offline(self)
|
||||
end
|
||||
--------------------
|
||||
function se_car:can_switch_online ()
|
||||
if self.ini == nil then
|
||||
self.ini = self:spawn_ini()
|
||||
self.spawner_present = self.ini:section_exist("spawner")
|
||||
end
|
||||
|
||||
if self.ini == nil or self.spawner_present == false then
|
||||
return cse_alife_car.can_switch_online(self)
|
||||
end
|
||||
return xr_spawner.check_spawn (self)
|
||||
end
|
||||
--------------------
|
||||
512
gamedata/scripts/se_item.script
Normal file
512
gamedata/scripts/se_item.script
Normal file
|
|
@ -0,0 +1,512 @@
|
|||
local registred_items = {}
|
||||
-- Outfits ---------------------------------------------------------------------
|
||||
class "se_outfit" (cse_alife_item_custom_outfit)
|
||||
function se_outfit:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_outfit:on_register()
|
||||
cse_alife_item_custom_outfit.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_outfit:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_custom_outfit.on_unregister( self )
|
||||
end
|
||||
function se_outfit:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_custom_outfit.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_helmet" (cse_alife_item_helmet)
|
||||
function se_helmet:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_helmet:on_register()
|
||||
cse_alife_item_helmet.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_helmet:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_helmet.on_unregister( self )
|
||||
end
|
||||
function se_helmet:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_helmet.can_switch_online(self)
|
||||
end
|
||||
|
||||
-- Weapons ---------------------------------------------------------------------
|
||||
class "se_weapon" (cse_alife_item_weapon)
|
||||
function se_weapon:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_weapon:on_register()
|
||||
cse_alife_item_weapon.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_weapon:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_weapon.on_unregister( self )
|
||||
end
|
||||
function se_weapon:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_weapon.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_weapon_shotgun" (cse_alife_item_weapon_shotgun)
|
||||
function se_weapon_shotgun:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_weapon_shotgun:on_register()
|
||||
cse_alife_item_weapon_shotgun.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_weapon_shotgun:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_weapon_shotgun.on_unregister( self )
|
||||
end
|
||||
function se_weapon_shotgun:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_weapon_shotgun.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_weapon_automatic_shotgun" (cse_alife_item_weapon_auto_shotgun)
|
||||
function se_weapon_automatic_shotgun:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_weapon_automatic_shotgun:on_register()
|
||||
cse_alife_item_weapon_auto_shotgun.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_weapon_automatic_shotgun:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_weapon_auto_shotgun.on_unregister( self )
|
||||
end
|
||||
function se_weapon_automatic_shotgun:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_weapon_auto_shotgun.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_weapon_magazined" (cse_alife_item_weapon_magazined)
|
||||
function se_weapon_magazined:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_weapon_magazined:on_register()
|
||||
cse_alife_item_weapon_magazined.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_weapon_magazined:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_weapon_magazined.on_unregister( self )
|
||||
end
|
||||
function se_weapon_magazined:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_weapon_magazined.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_weapon_magazined_w_gl" (cse_alife_item_weapon_magazined_w_gl)
|
||||
function se_weapon_magazined_w_gl:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_weapon_magazined_w_gl:on_register()
|
||||
cse_alife_item_weapon_magazined_w_gl.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_weapon_magazined_w_gl:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_weapon_magazined_w_gl.on_unregister( self )
|
||||
end
|
||||
function se_weapon_magazined_w_gl:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_weapon_magazined_w_gl.can_switch_online(self)
|
||||
end
|
||||
|
||||
-- Items -----------------------------------------------------------------------
|
||||
class "se_item" (cse_alife_item)
|
||||
function se_item:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_item:on_register()
|
||||
cse_alife_item.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_item:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item.on_unregister( self )
|
||||
end
|
||||
function se_item:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_item_torch" (cse_alife_item_torch)
|
||||
function se_item_torch:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_item_torch:on_register()
|
||||
cse_alife_item_torch.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_item_torch:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_torch.on_unregister( self )
|
||||
end
|
||||
function se_item_torch:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_torch.can_switch_online(self)
|
||||
end
|
||||
|
||||
--' ФИзобъекты
|
||||
class "se_physic" (cse_alife_object_physic)
|
||||
function se_physic:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_physic:on_register()
|
||||
cse_alife_object_physic.on_register(self)
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_physic:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_object_physic.on_unregister(self)
|
||||
end
|
||||
function se_physic:keep_saved_data_anyway()
|
||||
return true
|
||||
end
|
||||
function se_physic:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_object_physic.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_lamp" (cse_alife_object_hanging_lamp)
|
||||
function se_lamp:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_lamp:on_register()
|
||||
cse_alife_object_hanging_lamp.on_register(self)
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_lamp:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_object_hanging_lamp.on_unregister(self)
|
||||
end
|
||||
function se_lamp:keep_saved_data_anyway()
|
||||
return true
|
||||
end
|
||||
function se_lamp:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_object_hanging_lamp.can_switch_online(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- AMMO ------------------------------------------------------------------------
|
||||
class "se_ammo" (cse_alife_item_ammo)
|
||||
function se_ammo:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
|
||||
function se_ammo:on_register()
|
||||
cse_alife_item_ammo.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
|
||||
function se_ammo:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_ammo.on_unregister(self)
|
||||
end
|
||||
function se_ammo:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_ammo.can_switch_online(self)
|
||||
end
|
||||
-- IX-Ray START
|
||||
function se_ammo:keep_saved_data_anyway()
|
||||
return false
|
||||
end
|
||||
-- IX-Ray END
|
||||
-- GRENADES --------------------------------------------------------------------------------------------------------------------------
|
||||
class "se_grenade" (cse_alife_item_grenade)
|
||||
function se_grenade:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
|
||||
function se_grenade:on_register()
|
||||
cse_alife_item_grenade.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
|
||||
function se_grenade:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_grenade.on_unregister(self)
|
||||
end
|
||||
function se_grenade:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_grenade.can_switch_online(self)
|
||||
end
|
||||
-- EATEBLE ---------------------------------------------------------------------------------------------------------------------------
|
||||
class "se_eatable" (cse_alife_item)
|
||||
function se_eatable:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
|
||||
function se_eatable:on_register()
|
||||
cse_alife_item.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
|
||||
function se_eatable:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item.on_unregister(self)
|
||||
end
|
||||
function se_eatable:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item.can_switch_online(self)
|
||||
end
|
||||
|
||||
-- INVENTORY BOX ---------------------------------------------------------------------------------------------------------------------
|
||||
class "se_invbox" (cse_alife_inventory_box)
|
||||
function se_invbox:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
|
||||
function se_invbox:on_register()
|
||||
cse_alife_inventory_box.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
|
||||
function se_invbox:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_inventory_box.on_unregister(self)
|
||||
end
|
||||
function se_invbox:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_inventory_box.can_switch_online(self)
|
||||
end
|
||||
|
||||
-- EXPLOSIVE -------------------------------------------------------------------------------------------------------------------------
|
||||
class "se_explosive" (cse_alife_item_explosive)
|
||||
function se_explosive:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
|
||||
function se_explosive:on_register()
|
||||
cse_alife_item_explosive.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
|
||||
function se_explosive:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_explosive.on_unregister(self)
|
||||
end
|
||||
function se_explosive:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_explosive.can_switch_online(self)
|
||||
end
|
||||
|
||||
-- PDA -------------------------------------------------------------------------------------------------------------------------------
|
||||
class "se_pda" (cse_alife_item_pda)
|
||||
function se_pda:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
|
||||
function se_pda:on_register()
|
||||
cse_alife_item_pda.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
|
||||
function se_pda:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_pda.on_unregister(self)
|
||||
end
|
||||
function se_pda:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_pda.can_switch_online(self)
|
||||
end
|
||||
|
||||
class "se_detector" (cse_alife_item_detector)
|
||||
function se_detector:__init (section) super (section)
|
||||
self.secret_item = false
|
||||
end
|
||||
function se_detector:on_register()
|
||||
cse_alife_item_detector.on_register( self )
|
||||
-- Проверяем кастомдату обьекта на наличие стори айди.
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
-- Собираем статистику по предметам.
|
||||
if registred_items[self:section_name()] == nil then
|
||||
registred_items[self:section_name()] = 1
|
||||
else
|
||||
registred_items[self:section_name()] = registred_items[self:section_name()] + 1
|
||||
end
|
||||
|
||||
self.secret_item = treasure_manager.get_treasure_manager():register_item(self)
|
||||
end
|
||||
function se_detector:on_unregister()
|
||||
--' Отрегистрация в таскменеджере
|
||||
unregister_story_object_by_id(self.id)
|
||||
cse_alife_item_detector.on_unregister( self )
|
||||
end
|
||||
function se_detector:can_switch_online()
|
||||
if(self.secret_item) then
|
||||
return false
|
||||
end
|
||||
return cse_alife_item_detector.can_switch_online(self)
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function stats()
|
||||
printf("*** SIM ITEMS STATISTIC ***")
|
||||
for k,v in pairs(registred_items) do
|
||||
printf("item = %s, num = %s", k, v)
|
||||
end
|
||||
end
|
||||
153
gamedata/scripts/se_smart_cover.script
Normal file
153
gamedata/scripts/se_smart_cover.script
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
--'******************************************************
|
||||
--'* серверный класс объекта смарт кавер .
|
||||
--'******************************************************
|
||||
registered_smartcovers = {}
|
||||
registered_smartcovers_by_lv_id = {}
|
||||
|
||||
class "se_smart_cover" (cse_smart_cover)
|
||||
function se_smart_cover:__init (section) super (section)
|
||||
-- printf("se_smart_cover:__init( ) called")
|
||||
self.loopholes = {}
|
||||
self.last_description = ""
|
||||
if self.set_available_loopholes ~= nil then
|
||||
self:set_available_loopholes ( self.loopholes )
|
||||
end
|
||||
end
|
||||
function se_smart_cover:STATE_Write (packet)
|
||||
cse_smart_cover.STATE_Write (self, packet)
|
||||
packet:w_stringZ(self.last_description)
|
||||
local n = 0
|
||||
for k,v in pairs (self.loopholes) do
|
||||
n = n + 1
|
||||
end
|
||||
packet:w_u8(n)
|
||||
for k,v in pairs (self.loopholes) do
|
||||
packet:w_stringZ(k)
|
||||
packet:w_bool(v)
|
||||
end
|
||||
-- printf("write")
|
||||
-- print_table(self.loopholes)
|
||||
end
|
||||
function se_smart_cover:STATE_Read (packet, size)
|
||||
cse_smart_cover.STATE_Read (self, packet, size)
|
||||
if self.script_version >= 9 then
|
||||
self.last_description = packet:r_stringZ()
|
||||
local smart_cover_description
|
||||
if self.last_description ~= "" then
|
||||
smart_cover_description = self.last_description
|
||||
else
|
||||
smart_cover_description = self:description()
|
||||
end
|
||||
local existing_loopholes = {}
|
||||
if smart_cover_description ~= nil then
|
||||
printf("name %s descr %s", self:name(), tostring(smart_cover_description))
|
||||
if smart_covers == nil then
|
||||
abort("smartcovers is nil")
|
||||
end
|
||||
if smart_covers.descriptions[smart_cover_description] == nil then
|
||||
abort("smartcover [%s] has wrong description [%s]!!!", self:name(), tostring(smart_cover_description))
|
||||
end
|
||||
local loopholes = smart_covers.descriptions[smart_cover_description].loopholes
|
||||
for k,v in pairs (loopholes) do
|
||||
existing_loopholes[v.id] = true
|
||||
end
|
||||
end
|
||||
|
||||
local n = packet:r_u8()
|
||||
for i = 1, n do
|
||||
local loophole_id = packet:r_stringZ()
|
||||
local loophole_exist = packet:r_bool()
|
||||
if existing_loopholes[loophole_id] then
|
||||
self.loopholes[loophole_id] = loophole_exist
|
||||
end
|
||||
end
|
||||
else
|
||||
local smart_cover_description = self:description()
|
||||
if smart_cover_description ~= nil and
|
||||
smart_covers.descriptions[smart_cover_description] ~= nil -- IX-Ray: Fixed scripts working in editors
|
||||
then
|
||||
local loopholes = smart_covers.descriptions[smart_cover_description].loopholes
|
||||
for k,v in pairs (loopholes) do
|
||||
self.loopholes[v.id] = true
|
||||
end
|
||||
self.last_description = smart_cover_description
|
||||
end
|
||||
end
|
||||
end
|
||||
function se_smart_cover:on_before_register()
|
||||
cse_smart_cover.on_before_register( self )
|
||||
registered_smartcovers[self:name()] = self
|
||||
end
|
||||
function se_smart_cover:on_register()
|
||||
cse_smart_cover.on_register( self )
|
||||
story_objects.check_spawn_ini_for_story_id(self)
|
||||
local level_id = game_graph():vertex(self.m_game_vertex_id):level_id()
|
||||
if registered_smartcovers_by_lv_id[level_id] == nil then
|
||||
registered_smartcovers_by_lv_id[level_id] = {}
|
||||
end
|
||||
registered_smartcovers_by_lv_id[level_id][self.m_level_vertex_id] = self
|
||||
-- printf("smart_cover [%s] is registered lvlid [%s] lvid[%s]", self:name(), tostring(level_id), tostring(self.m_level_vertex_id))
|
||||
end
|
||||
function se_smart_cover:on_unregister()
|
||||
unregister_story_object_by_id(self.id)
|
||||
registered_smartcovers[self:name()] = nil
|
||||
local level_id = game_graph():vertex(self.m_game_vertex_id):level_id()
|
||||
registered_smartcovers_by_lv_id[level_id][self.m_level_vertex_id] = nil
|
||||
-- printf("smart_cover [%s] is unregistered", self:name())
|
||||
cse_smart_cover.on_unregister(self)
|
||||
end
|
||||
function se_smart_cover:update()
|
||||
cse_smart_cover.update(self)
|
||||
end
|
||||
|
||||
function se_smart_cover:FillProps (pref,items)
|
||||
-- log ("CSE_NewAttachableItem::FillProps called!")
|
||||
-- log (tostring(self:description()))
|
||||
cse_smart_cover.FillProps (self,pref,items)
|
||||
local prefix = pref .. "\\" .. self:section_name().."\\"
|
||||
local smart_cover_description = self:description()
|
||||
if smart_cover_description ~= self.last_description then
|
||||
for k,v in pairs (self.loopholes) do
|
||||
self.loopholes[k] = nil
|
||||
end
|
||||
self.last_description = tostring(smart_cover_description)
|
||||
end
|
||||
if smart_cover_description ~= nil then
|
||||
local loopholes = smart_covers.descriptions[smart_cover_description].loopholes
|
||||
for k,v in pairs (loopholes) do
|
||||
if self.loopholes[v.id] == nil then
|
||||
self.loopholes[v.id] = true
|
||||
end
|
||||
local h = properties_helper():create_bool (items, prefix .. "loopholes\\"..v.id,self,self.loopholes,v.id)
|
||||
self:set_loopholes_table_checker(h)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1058
gamedata/scripts/sim_squad_scripted.script
Normal file
1058
gamedata/scripts/sim_squad_scripted.script
Normal file
File diff suppressed because it is too large
Load diff
1427
gamedata/scripts/smart_terrain.script
Normal file
1427
gamedata/scripts/smart_terrain.script
Normal file
File diff suppressed because it is too large
Load diff
781
gamedata/scripts/state_lib.script
Normal file
781
gamedata/scripts/state_lib.script
Normal file
|
|
@ -0,0 +1,781 @@
|
|||
----------------------------------------------------------------------------------------------------------------------
|
||||
-- Библиотека состояний тела
|
||||
-- автор: Диденко Руслан (Stohe)
|
||||
-- TODO:
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
states = {
|
||||
-- Дефолтовый
|
||||
idle = { weapon = nil,
|
||||
movement = nil,
|
||||
mental = nil,
|
||||
bodystate = nil,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
smartcover = { weapon = "unstrapped",
|
||||
movement = nil,
|
||||
mental = nil,
|
||||
bodystate = nil,
|
||||
animstate = nil,
|
||||
animation = nil,
|
||||
direction = CSightParams.eSightTypeAnimationDirection
|
||||
},
|
||||
|
||||
-- Ходячие состояния
|
||||
walk = { weapon = "strapped",
|
||||
movement = move.walk,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
walk_noweap = { weapon = "none",
|
||||
movement = move.walk,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
run = { weapon = "strapped",
|
||||
movement = move.run,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
sprint = { weapon = "strapped",
|
||||
movement = move.run,
|
||||
mental = anim.panic,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
patrol = { weapon = "unstrapped",
|
||||
movement = move.walk,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
patrol_fire = { weapon = "fire",
|
||||
movement = move.walk,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
raid = { weapon = "unstrapped",
|
||||
movement = move.walk,
|
||||
mental = anim.danger,
|
||||
special_danger_move = true,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
raid_fire = {weapon = "fire",
|
||||
movement = move.walk,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
sneak = { weapon = "unstrapped",
|
||||
movement = move.walk,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
sneak_run = { weapon = "unstrapped",
|
||||
movement = move.run,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
sneak_no_wpn = { weapon = "strapped",
|
||||
movement = move.walk,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
sneak_fire = { weapon = "fire",
|
||||
movement = move.walk,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
assault = { weapon = "unstrapped",
|
||||
movement = move.run,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
assault_fire = { weapon = "fire",
|
||||
movement = move.run,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
rush = { weapon = "unstrapped",
|
||||
movement = move.run,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
|
||||
-- Стоячие состояния
|
||||
wait = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "idle"
|
||||
},
|
||||
wait_trade = { weapon = "none",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "idle"
|
||||
},
|
||||
wait_na = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
guard = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "idle"
|
||||
},
|
||||
guard_chasovoy = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "idle_chasovoy"
|
||||
},
|
||||
guard_na = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
guard_fire = { weapon = "fire",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
threat = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil,
|
||||
fast_set = true
|
||||
},
|
||||
threat_danger = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "bloodsucker_search",
|
||||
},
|
||||
give_orders = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "give_orders",
|
||||
},
|
||||
threat_heli = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
threat_na = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil,
|
||||
fast_set = true
|
||||
},
|
||||
threat_fire = { weapon = "fire",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
threat_sniper_fire = { weapon = "sniper_fire",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
hide = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = "hide"
|
||||
},
|
||||
hide_na = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
hide_fire = { weapon = "fire",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
hide_sniper_fire = { weapon = "sniper_fire",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = nil
|
||||
},
|
||||
caution = { weapon = nil,
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "caution"
|
||||
},
|
||||
choose = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "choosing"
|
||||
},
|
||||
press = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "press"
|
||||
},
|
||||
ward = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "warding"
|
||||
},
|
||||
ward_short = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "warding_short"
|
||||
},
|
||||
ward_noweap = {weapon = "none",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "warding"
|
||||
},
|
||||
ward_noweap_short = {weapon = "none",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "warding_short"
|
||||
},
|
||||
fold_arms = {weapon = "none",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "fold_arms"
|
||||
},
|
||||
|
||||
search = {weapon = nil,
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "poisk"
|
||||
},
|
||||
stoop_no_weap = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "stoop_no_weap"
|
||||
},
|
||||
salut = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "salut"
|
||||
},
|
||||
salut_free = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "salut_free"
|
||||
},
|
||||
prisoner = {weapon = "strapped",
|
||||
movement = nil,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "prisoner"
|
||||
},
|
||||
|
||||
hide_no_wpn = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = "hide"
|
||||
},
|
||||
-- Сидячие состояния
|
||||
sit = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit",
|
||||
animation = nil
|
||||
},
|
||||
sit_knee = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_knee",
|
||||
animation = nil
|
||||
},
|
||||
sit_ass = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = nil
|
||||
},
|
||||
|
||||
play_guitar = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_knee",
|
||||
animation = "play_guitar"
|
||||
},
|
||||
play_harmonica = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = "play_harmonica"
|
||||
},
|
||||
|
||||
|
||||
|
||||
sleep = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "sleeping"
|
||||
},
|
||||
-- START IX-Ray
|
||||
sleep_sit = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = "sleep_sit"
|
||||
},
|
||||
eat_bread = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_knee",
|
||||
animation = "eat_bread"
|
||||
},
|
||||
eat_vodka = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = "eat_vodka"
|
||||
},
|
||||
eat_energy = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = "eat_energy"
|
||||
},
|
||||
eat_kolbasa = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = "eat_kolbasa"
|
||||
},
|
||||
|
||||
guitar = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_knee",
|
||||
animation = "guitar"
|
||||
},
|
||||
harmonica = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = "sit_ass",
|
||||
animation = "harmonica"
|
||||
},
|
||||
-- END IX-Ray
|
||||
hello = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "hello"
|
||||
},
|
||||
hello_wpn = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "hello"
|
||||
},
|
||||
|
||||
refuse = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "refuse"
|
||||
},
|
||||
claim = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "claim"
|
||||
},
|
||||
backoff = { weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "backoff"
|
||||
},
|
||||
backoff2 = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "backoff"
|
||||
},
|
||||
punch = { weapon = nil,
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "punch"
|
||||
},
|
||||
|
||||
search_corpse = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = "search_corpse"
|
||||
},
|
||||
|
||||
help_wounded = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = "help_wounded"
|
||||
},
|
||||
|
||||
dynamite = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = "dynamite"
|
||||
},
|
||||
|
||||
binocular = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "binocular"
|
||||
},
|
||||
hide_rac = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
animstate = nil,
|
||||
animation = "cr_raciya"
|
||||
},
|
||||
wait_rac = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "raciya"
|
||||
},
|
||||
wait_rac_noweap = {weapon = "none",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "raciya"
|
||||
},
|
||||
wait_rac_stc = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "raciya_stc"
|
||||
},
|
||||
guard_rac = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "raciya"
|
||||
},
|
||||
|
||||
probe_stand = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_stand"
|
||||
},
|
||||
probe_stand_detector_advanced = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_stand_detector_advanced"
|
||||
},
|
||||
probe_stand_detector_elite = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_stand_detector_elite"
|
||||
},
|
||||
probe_way = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_way"
|
||||
},
|
||||
probe_way_detector_advanced = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_way_detector_advanced"
|
||||
},
|
||||
probe_way_detector_elite = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_way_detector_elite"
|
||||
},
|
||||
probe_crouch = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_crouch"
|
||||
},
|
||||
probe_crouch_detector_advanced = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_crouch_detector_advanced"
|
||||
},
|
||||
probe_crouch_detector_elite = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "probe_crouch_detector_elite"
|
||||
},
|
||||
|
||||
scaner_stand = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "scaner_stand"
|
||||
},
|
||||
scaner_way = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "scaner_way"
|
||||
},
|
||||
|
||||
scaner_crouch = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "scaner_crouch"
|
||||
},
|
||||
|
||||
hands_up = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "hands_up"
|
||||
},
|
||||
|
||||
|
||||
|
||||
-- Раненый
|
||||
wounded = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
direction = look.cur_dir,
|
||||
animstate = nil,
|
||||
animation = "wounded"
|
||||
},
|
||||
wounded_heavy = { weapon = "drop",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
direction = look.cur_dir, --CSightParams.eSightTypeAnimationDirection
|
||||
animstate = nil,
|
||||
animation = "wounded_heavy_1"
|
||||
},
|
||||
wounded_heavy_2 = { weapon = "drop",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
direction = look.cur_dir,
|
||||
animstate = nil,
|
||||
animation = "wounded_heavy_2"
|
||||
},
|
||||
wounded_heavy_3 = { weapon = "drop",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
direction = look.cur_dir,
|
||||
animstate = nil,
|
||||
animation = "wounded_heavy_3"
|
||||
},
|
||||
wounded_zombie = { weapon = "drop",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
direction = look.cur_dir,
|
||||
animstate = nil,
|
||||
animation = "wounded_zombie"
|
||||
},
|
||||
trans_0 = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "trans_0"
|
||||
},
|
||||
trans_1 = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "trans_1"
|
||||
},
|
||||
trans_zombied = {weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "trans_zombied"
|
||||
},
|
||||
|
||||
talk_default = { weapon = "strapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "talk_default"
|
||||
},
|
||||
|
||||
-- Пси раненый
|
||||
psy_pain = {weapon = "drop",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "psy_armed"
|
||||
},
|
||||
psy_armed = {weapon = "unstrapped",
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "psy_armed"
|
||||
},
|
||||
psy_shoot = {weapon = "fire",
|
||||
weapon_slot = 1,
|
||||
movement = move.stand,
|
||||
mental = anim.free,
|
||||
bodystate = move.standing,
|
||||
animstate = nil,
|
||||
animation = "psy_shoot"
|
||||
},
|
||||
lay_on_bed = { weapon = "drop",
|
||||
movement = move.stand,
|
||||
mental = anim.danger,
|
||||
bodystate = move.crouch,
|
||||
direction = look.cur_dir,
|
||||
animstate = nil,
|
||||
animation = "wounded_heavy_1"}
|
||||
}
|
||||
|
||||
utils.copy_table(states, state_lib_animpoint.add_state_lib())
|
||||
utils.copy_table(states, state_mgr_scenario.add_state_lib())
|
||||
utils.copy_table(states, state_mgr_pri_a15.add_state_lib())
|
||||
751
gamedata/scripts/state_mgr_animation_list.script
Normal file
751
gamedata/scripts/state_mgr_animation_list.script
Normal file
|
|
@ -0,0 +1,751 @@
|
|||
animations = {
|
||||
idle = { prop = { maxidle = 5,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "idle_0_idle_1",
|
||||
[1] = "idle_1_idle_1",
|
||||
[2] = "idle_2_idle_1",
|
||||
[3] = "idle_3_idle_1",
|
||||
[4] = "idle_4_idle_1",
|
||||
[8] = "idle_8_idle_1",
|
||||
[9] = "idle_2_idle_1",
|
||||
[10]= "idle_10_idle_1" },
|
||||
rnd = { [0] = { "idle_0_idle_0",
|
||||
"idle_0_idle_2",
|
||||
"idle_0_idle_3",
|
||||
"idle_0_idle_4" },
|
||||
[1] = { "idle_1_idle_0",
|
||||
"idle_1_idle_2",
|
||||
"idle_1_idle_3",
|
||||
"idle_1_idle_4" },
|
||||
[2] = { "idle_2_idle_0",
|
||||
"idle_2_idle_2",
|
||||
"idle_2_idle_3",
|
||||
"idle_2_idle_4"},
|
||||
[3] = { "idle_3_idle_0",
|
||||
"idle_3_idle_2",
|
||||
"idle_3_idle_3",
|
||||
"idle_3_idle_4" },
|
||||
[4] = { "idle_4_idle_0",
|
||||
"idle_4_idle_2",
|
||||
"idle_4_idle_3",
|
||||
"idle_4_idle_4" },
|
||||
[8] = { "idle_8_idle_0",
|
||||
"idle_8_idle_2",
|
||||
"idle_8_idle_3",
|
||||
"idle_8_idle_4" },
|
||||
[9] = { "idle_2_idle_0",
|
||||
"idle_2_idle_2",
|
||||
"idle_2_idle_3",
|
||||
"idle_2_idle_4" },
|
||||
[10]= { "idle_10_idle_0",
|
||||
"idle_10_idle_2",
|
||||
"idle_10_idle_3",
|
||||
"idle_10_idle_4" }}},
|
||||
idle_chasovoy = { prop = { maxidle = 5,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "idle_0_idle_1",
|
||||
[1] = "idle_1_idle_1",
|
||||
[2] = "idle_2_idle_1",
|
||||
[3] = "idle_3_idle_1",
|
||||
[4] = "idle_4_idle_1",
|
||||
[8] = "idle_8_idle_1",
|
||||
[9] = "idle_2_idle_1",
|
||||
[10]= "idle_10_idle_1" },
|
||||
rnd = { [0] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4" },
|
||||
[1] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"},
|
||||
[2] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"},
|
||||
[3] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"},
|
||||
[4] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"},
|
||||
[8] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"},
|
||||
[9] = { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"},
|
||||
[10]= { "chasovoy_0",
|
||||
"chasovoy_1",
|
||||
"chasovoy_2",
|
||||
"chasovoy_3",
|
||||
"chasovoy_4"}}},
|
||||
caution = { prop = { maxidle = 5,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = { "prisluh_0_in" },
|
||||
[1] = { "prisluh_1_in" },
|
||||
[2] = { "prisluh_2_in" },
|
||||
[3] = { "prisluh_3_in" },
|
||||
[4] = { "prisluh_4_in" },
|
||||
[8] = { "prisluh_8_in" },
|
||||
[9] = { "prisluh_9_in" },
|
||||
[10]= { "prisluh_10_in" } },
|
||||
out = { [0] = { "prisluh_0_out" },
|
||||
[1] = { "prisluh_1_out" },
|
||||
[2] = { "prisluh_2_out" },
|
||||
[3] = { "prisluh_3_out" },
|
||||
[4] = { "prisluh_4_out" },
|
||||
[8] = { "prisluh_8_out" },
|
||||
[9] = { "prisluh_9_out" },
|
||||
[10]= { "prisluh_10_out" } },
|
||||
idle = { [0] = "prisluh_0_1",
|
||||
[1] = "prisluh_1_1",
|
||||
[2] = "prisluh_2_1",
|
||||
[3] = "prisluh_3_1",
|
||||
[4] = "prisluh_4_1",
|
||||
[8] = "prisluh_8_1",
|
||||
[9] = "prisluh_9_1",
|
||||
[10]= "prisluh_10_1" },
|
||||
rnd = { [0] = { "prisluh_0_0",
|
||||
"prisluh_0_2" },
|
||||
[1] = { "prisluh_1_0",
|
||||
"prisluh_1_2" },
|
||||
[2] = { "prisluh_2_0",
|
||||
"prisluh_2_2" },
|
||||
[3] = { "prisluh_3_0",
|
||||
"prisluh_3_2" },
|
||||
[4] = { "prisluh_4_0",
|
||||
"prisluh_4_2" },
|
||||
[8] = { "prisluh_8_0",
|
||||
"prisluh_8_2" },
|
||||
[9] = { "prisluh_9_0",
|
||||
"prisluh_9_2" },
|
||||
[10]= { "prisluh_10_0",
|
||||
"prisluh_10_2" }}},
|
||||
poisk = { prop = { maxidle = 5,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "poisk_0_idle_1",
|
||||
[1] = "poisk_1_idle_1",
|
||||
[2] = "poisk_2_idle_1",
|
||||
[3] = "poisk_3_idle_1",
|
||||
[4] = "poisk_4_idle_1",
|
||||
[8] = "poisk_8_idle_1",
|
||||
[9] = "poisk_9_idle_1",
|
||||
[10]= "poisk_10_idle_1"},
|
||||
rnd = { [0] = { "poisk_0_idle_0",
|
||||
"poisk_0_idle_2" },
|
||||
[1] = { "poisk_1_idle_0",
|
||||
"poisk_1_idle_2" },
|
||||
[2] = { "poisk_2_idle_0",
|
||||
"poisk_2_idle_2" },
|
||||
[3] = { "poisk_3_idle_0",
|
||||
"poisk_3_idle_2" },
|
||||
[4] = { "poisk_4_idle_0",
|
||||
"poisk_4_idle_2" },
|
||||
[8] = { "poisk_8_idle_0",
|
||||
"poisk_8_idle_2" },
|
||||
[9] = { "poisk_9_idle_0",
|
||||
"poisk_9_idle_2" },
|
||||
[10]= { "poisk_10_idle_0",
|
||||
"poisk_10_idle_2" }}},
|
||||
stoop_no_weap = { prop = { maxidle = 2,
|
||||
sumidle = 1,
|
||||
rnd = 80 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "poisk_0_idle_0"},
|
||||
rnd = nil},
|
||||
hide = { prop = { maxidle = 5,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = { "cr_idle_0_in" },
|
||||
[1] = { "cr_idle_1_in" },
|
||||
[2] = { "cr_idle_2_in" },
|
||||
[3] = { "cr_idle_3_in" },
|
||||
[4] = { "cr_idle_4_in" },
|
||||
[8] = { "cr_idle_8_in" },
|
||||
[9] = { "cr_idle_9_in" },
|
||||
[10] ={ "cr_idle_10_in" }},
|
||||
out = { [0] = { "cr_idle_0_out" },
|
||||
[1] = { "cr_idle_1_out" },
|
||||
[2] = { "cr_idle_2_out" },
|
||||
[3] = { "cr_idle_3_out" },
|
||||
[4] = { "cr_idle_4_out" },
|
||||
[8] = { "cr_idle_8_out" },
|
||||
[9] = { "cr_idle_9_out" },
|
||||
[10] ={ "cr_idle_10_out" }},
|
||||
idle = { [0] = "cr_idle_0_1",
|
||||
[1] = "cr_idle_1_1",
|
||||
[2] = "cr_idle_2_1",
|
||||
[3] = "cr_idle_3_1",
|
||||
[4] = "cr_idle_4_1",
|
||||
[8] = "cr_idle_8_1",
|
||||
[9] = "cr_idle_9_1",
|
||||
[10]= "cr_idle_10_1" },
|
||||
rnd = { [0] = { "cr_idle_0_0",
|
||||
"cr_idle_0_2" },
|
||||
[1] = { "cr_idle_1_0",
|
||||
"cr_idle_1_2" },
|
||||
[2] = { "cr_idle_2_0",
|
||||
"cr_idle_2_2" },
|
||||
[3] = { "cr_idle_3_0",
|
||||
"cr_idle_3_2" },
|
||||
[4] = { "cr_idle_4_0",
|
||||
"cr_idle_4_2" },
|
||||
[8] = { "cr_idle_8_0",
|
||||
"cr_idle_8_2" },
|
||||
[9] = { "cr_idle_9_0",
|
||||
"cr_idle_9_2" },
|
||||
[10]= { "cr_idle_10_0",
|
||||
"cr_idle_10_2" }}},
|
||||
|
||||
play_guitar = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"sit_1_guitar_0_0", {a="guitar_a"}, {f=sr_camp.start_guitar}, "sit_1_guitar_0_1"}},
|
||||
out = { [0] = {"guitar_0_sit_1_0", {d="guitar_a"}, "guitar_0_sit_1_1"} },
|
||||
idle = { [0] = "guitar_0" },
|
||||
rnd = nil },
|
||||
play_harmonica = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"sit_2_harmonica_1_0", {a="harmonica_a"}, {f=sr_camp.start_harmonica}, "sit_2_harmonica_1_1"}},
|
||||
out = { [0] = {"harmonica_1_sit_2_0", {d="harmonica_a"}, "harmonica_1_sit_2_1"} },
|
||||
idle = { [0] = "harmonica_0" },
|
||||
rnd = nil },
|
||||
|
||||
|
||||
|
||||
hello = { prop = { maxidle = 5,
|
||||
sumidle = 5,
|
||||
rnd = 100 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = { [0] = { "hello_0_idle_0" },
|
||||
[1] = { "hello_1_idle_0" },
|
||||
[2] = { "hello_2_idle_0" },
|
||||
[3] = { "hello_3_idle_0" },
|
||||
[4] = { "hello_4_idle_0" },
|
||||
[8] = { "hello_8_idle_0" },
|
||||
[9] = { "hello_9_idle_0" },
|
||||
[10]= { "hello_10_idle_0" }}},
|
||||
refuse = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 100 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = { [0] = { "net_0_0" },
|
||||
[1] = { "net_1_0" },
|
||||
[2] = { "net_2_0" },
|
||||
[3] = { "net_3_0" },
|
||||
[4] = { "net_4_0" },
|
||||
[8] = { "net_8_0" },
|
||||
[9] = { "net_9_0" },
|
||||
[10]= { "net_10_0" }}},
|
||||
claim = { prop = { maxidle = 5,
|
||||
sumidle = 2,
|
||||
rnd = 100 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = { [0] = nil,
|
||||
[1] = { "gop_stop_1_0" },
|
||||
[2] = { "gop_stop_2_0" },
|
||||
[3] = { "gop_stop_3_0" },
|
||||
[4] = { "gop_stop_4_0" },
|
||||
[8] = { "gop_stop_8_0" },
|
||||
[9] = { "gop_stop_9_0" },
|
||||
[10]= { "gop_stop_10_0" }}},
|
||||
backoff = { prop = { maxidle = 5,
|
||||
sumidle = 2,
|
||||
rnd = 100 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = { [0] = { "uhodi_1_0",
|
||||
"uhodi_1_1" },
|
||||
[1] = { "uhodi_1_0",
|
||||
"uhodi_1_1" },
|
||||
[2] = { "uhodi_2_0",
|
||||
"uhodi_2_1" },
|
||||
[3] = { "uhodi_3_0",
|
||||
"uhodi_3_1" },
|
||||
[4] = { "uhodi_4_0",
|
||||
"uhodi_4_1" },
|
||||
[8] = { "uhodi_8_0",
|
||||
"uhodi_8_1" },
|
||||
[9] = { "uhodi_9_0",
|
||||
"uhodi_9_1" },
|
||||
[10]= { "uhodi_10_0",
|
||||
"uhodi_10_1" }}},
|
||||
|
||||
punch = { prop = { maxidle = 5,
|
||||
sumidle = 2,
|
||||
rnd = 100 },
|
||||
into = { [0] = { "norm_facer_0_0", {f=xr_effects.actor_punch}, "norm_facer_0_1", {f=xr_effects.clearAbuse}},
|
||||
[1] = { "norm_facer_1_0", {f=xr_effects.actor_punch}, "norm_facer_1_1", {f=xr_effects.clearAbuse}},
|
||||
[2] = { "norm_facer_2_0", {f=xr_effects.actor_punch}, "norm_facer_2_1", {f=xr_effects.clearAbuse}},
|
||||
[3] = { "norm_facer_3_0", {f=xr_effects.actor_punch}, "norm_facer_3_1", {f=xr_effects.clearAbuse}},
|
||||
[4] = { "norm_facer_4_0", {f=xr_effects.actor_punch}, "norm_facer_4_1", {f=xr_effects.clearAbuse}},
|
||||
[8] = { "norm_facer_8_0", {f=xr_effects.actor_punch}, "norm_facer_8_1", {f=xr_effects.clearAbuse}},
|
||||
[9] = { "norm_facer_9_0", {f=xr_effects.actor_punch}, "norm_facer_9_1", {f=xr_effects.clearAbuse}},
|
||||
[10]= { "norm_facer_10_0", {f=xr_effects.actor_punch}, "norm_facer_10_1", {f=xr_effects.clearAbuse}}},
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = nil},
|
||||
|
||||
sleeping = { prop = { maxidle = 5,
|
||||
sumidle = 10,
|
||||
rnd = 100 },
|
||||
into = { [0] = { "idle_0_to_sit_0","sit_to_sleep_0" }},
|
||||
out = { [0] = { "sleep_to_sit_0", "sit_0_to_idle_0" }},
|
||||
idle = { [0] = "sleep_idle_0" },
|
||||
rnd = { [0] = { "sleep_idle_1" }}},
|
||||
|
||||
wounded = { prop = { maxidle = 5,
|
||||
sumidle = 10,
|
||||
rnd = 70 },
|
||||
into = { [0] = {"idle_to_wounded_0"}},
|
||||
out = { [0] = {"wounded_to_idle_0"}},
|
||||
idle = { [0] = "wounded_idle_0" },
|
||||
rnd = nil },
|
||||
wounded_heavy_1 = { prop = { maxidle = 5,
|
||||
sumidle = 10,
|
||||
rnd = 70 },
|
||||
into = { [0] = {"idle_to_wounded_1"}},
|
||||
out = { [0] = {"waunded_1_out"}},
|
||||
idle = { [0] = "waunded_1_idle_0" },
|
||||
rnd = nil },
|
||||
wounded_heavy_2 = { prop = { maxidle = 5,
|
||||
sumidle = 10,
|
||||
rnd = 70 },
|
||||
into = { [0] = {"idle_to_wounded_2"}},
|
||||
out = { [0] = {"wounded_2_out"}},
|
||||
idle = { [0] = "wounded_2_idle_0" },
|
||||
rnd = nil },
|
||||
wounded_heavy_3 = { prop = { maxidle = 5,
|
||||
sumidle = 10,
|
||||
rnd = 70 },
|
||||
into = { [0] = {"idle_to_wounded_3"}},
|
||||
out = { [0] = {"wounded_3_out"}},
|
||||
idle = { [0] = "wounded_3_idle_0" },
|
||||
rnd = nil },
|
||||
wounded_zombie = { prop = { maxidle = 5,
|
||||
sumidle = 10,
|
||||
rnd = 70 },
|
||||
into = { [0] = {"idle_to_wounded_0"}},
|
||||
out = { [0] = {"wounded_to_idle_0"}},
|
||||
idle = { [0] = "wounded_idle_0" },
|
||||
rnd = { [0] = { "wounded_idle_1" }}},
|
||||
-- START IX-Ray
|
||||
eat_bread = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"item_2_draw_0", {a="bread"}, "item_2_draw_1"} },
|
||||
out = { [0] = {"item_2_holster_0", {d="bread"}, "item_2_holster_1"} },
|
||||
idle = { [0] = "item_2_aim_0" },
|
||||
rnd = { [0] = { "item_2_prepare_0",
|
||||
"item_2_attack_0" } }},
|
||||
eat_vodka = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"item_4_draw_0", {a="vodka"}, "item_4_draw_1"} },
|
||||
out = { [0] = {"item_4_holster_0", {d="vodka"}, "item_4_holster_1"} },
|
||||
idle = { [0] = "item_4_aim_0" },
|
||||
rnd = { [0] = { "item_4_prepare_0",
|
||||
"item_4_attack_0" } }},
|
||||
eat_energy = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"item_5_draw_0", {a="energy_drink"}, "item_5_draw_1"} },
|
||||
out = { [0] = {"item_5_holster_0", {d="energy_drink"}, "item_5_holster_1"} },
|
||||
idle = { [0] = "item_5_aim_0" },
|
||||
rnd = { [0] = { "item_5_prepare_0",
|
||||
"item_5_attack_0" } }},
|
||||
eat_kolbasa = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"item_1_draw_0", {a="kolbasa"}, "item_1_draw_1"}},
|
||||
out = { [0] = {"item_1_holster_0", {d="kolbasa"}, "item_1_holster_1"} },
|
||||
idle = { [0] = "item_1_idle_1" },
|
||||
rnd = { [0] = { "item_1_attack_0",
|
||||
"item_1_idle_0" } }},
|
||||
|
||||
guitar = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"sit_1_guitar_0_0", {a="guitar_a"}, {f=sr_camp.start_guitar}, "sit_1_guitar_0_1"}},
|
||||
out = { [0] = {"guitar_0_sit_1_0", {d="guitar_a"}, "guitar_0_sit_1_1"} },
|
||||
idle = { [0] = "guitar_0" },
|
||||
-- rnd = { [0] = { "guitar_1", "guitar_2" } },
|
||||
},
|
||||
harmonica = { prop = { maxidle = 3,
|
||||
sumidle = 3,
|
||||
rnd = 80 },
|
||||
into = { [0] = {"sit_2_harmonica_1_0", {a="harmonica_a"}, {f=sr_camp.start_harmonica}, "sit_2_harmonica_1_1"}},
|
||||
out = { [0] = {"harmonica_1_sit_2_0", {d="harmonica_a"}, "harmonica_1_sit_2_1"} },
|
||||
idle = { [0] = "harmonica_0" },
|
||||
-- rnd = { [0] = { "harmonica_2","harmonica_3" } }
|
||||
},
|
||||
-- END IX-Ray
|
||||
choosing = { prop = { maxidle = 8,
|
||||
sumidle = 10,
|
||||
rnd = 80 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = { [0] = { "komandir_0",
|
||||
"komandir_1",
|
||||
"komandir_2" } }},
|
||||
press = { prop = { maxidle = 8,
|
||||
sumidle = 10,
|
||||
rnd = 80 },
|
||||
into = { [0] = { "knopka_0" } },
|
||||
out = { [0] = { "knopka_1" } },
|
||||
idle = { [0] = "knopka_2" },
|
||||
rnd = nil },
|
||||
|
||||
|
||||
warding = { prop = { maxidle = 10,
|
||||
sumidle = 10,
|
||||
rnd = 0 },
|
||||
into = { [0] = { "ohrana_0" }},
|
||||
out = { [0] = { "ohrana_2" }},
|
||||
idle = { [0] = "ohrana_1"},
|
||||
rnd = nil },
|
||||
|
||||
warding_short = { prop = { maxidle = 10,
|
||||
sumidle = 10,
|
||||
rnd = 0 },
|
||||
into = { [0] = { "ohrana_0" }},
|
||||
out = { [0] = { "ohrana_2" }},
|
||||
idle = { [0] = "ohrana_1_short"},
|
||||
rnd = nil },
|
||||
|
||||
fold_arms = { prop = { maxidle = 10,
|
||||
sumidle = 10,
|
||||
rnd = 0 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "cut_scene_idle_0"},
|
||||
rnd = nil },
|
||||
|
||||
|
||||
|
||||
talk_default = { prop = { maxidle = 5,
|
||||
sumidle = 5,
|
||||
rnd = 70 },
|
||||
into = { [0] = nil,
|
||||
[2] = { "norm_talk_2_in_0" } },
|
||||
out = { [0] = nil,
|
||||
[2] = { "norm_talk_2_out_0" } },
|
||||
idle = { [0] = "idle_0_idle_1",
|
||||
[2] = "norm_talk_2_idle_1" },
|
||||
rnd = { [0] = { "idle_0_idle_0" },
|
||||
[2] = { "norm_talk_2_idle_0",
|
||||
"norm_talk_2_idle_2",
|
||||
"norm_talk_2_idle_3",
|
||||
"norm_talk_2_idle_4"} } },
|
||||
|
||||
binocular = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"binoculars_draw_0", {a="wpn_binoc"}, "binoculars_draw_1", "binoculars_zoom_in_0"} },
|
||||
|
||||
out = { [0] = {"binoculars_zoom_out_0", "binoculars_hide_0", {d="wpn_binoc"}, "binoculars_hide_1"} },
|
||||
idle = { [0] = "binoculars_zoom_idle_0" },
|
||||
rnd = { [0] = {"binoculars_zoom_idle_1",
|
||||
"binoculars_zoom_idle_2",
|
||||
"binoculars_zoom_idle_3",
|
||||
"binoculars_zoom_idle_4"} } },
|
||||
salut = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"chest_0_idle_0", "chest_0_idle_2"} },
|
||||
out = { [0] = {"chest_0_idle_3"} },
|
||||
idle = { [0] = "chest_0_idle_1" },
|
||||
rnd = nil },
|
||||
salut_free = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"chest_1_idle_0"} },
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = nil },
|
||||
hands_up = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "hand_up_0" },
|
||||
rnd = nil },
|
||||
trans_0 = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"idle_0_to_trans_0"} },
|
||||
out = { [0] = {"trans_0_to_idle_0"} },
|
||||
idle = { [0] = "trans_0_idle_0" },
|
||||
rnd = nil },
|
||||
trans_1 = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"idle_0_to_trans_1"} },
|
||||
out = { [0] = {"trans_1_to_idle_0"} },
|
||||
idle = { [0] = "trans_1_idle_0" },
|
||||
rnd = nil },
|
||||
trans_zombied = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = nil,
|
||||
out = nil,
|
||||
idle = { [0] = "trans_0_idle_1" },
|
||||
rnd = { [0] = {"trans_0_idle_0",
|
||||
"trans_0_idle_2",
|
||||
"trans_0_idle_3",
|
||||
"trans_0_idle_4",
|
||||
"trans_0_idle_5",
|
||||
"trans_0_idle_6"} } },
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
probe_stand = { prop = { maxidle = 0,
|
||||
sumidle = 0,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"metering_anomalys_0_draw_0", {f=xr_effects.get_best_detector}, "metering_anomalys_0_draw_1"} },
|
||||
out = { [0] = {"metering_anomalys_0_hide_0", {f=xr_effects.hide_best_detector}, "metering_anomalys_0_hide_1"} },
|
||||
idle = { [0] = "metering_anomalys_0_idle_0" },
|
||||
rnd = { [0] = {"metering_anomalys_0_idle_1",
|
||||
"metering_anomalys_0_idle_2",
|
||||
"metering_anomalys_0_idle_3",
|
||||
"metering_anomalys_0_idle_4",
|
||||
"metering_anomalys_0_idle_5"} } },
|
||||
|
||||
|
||||
probe_way = { prop = { maxidle = 0,
|
||||
sumidle = 0,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"metering_anomalys_0_draw_0", {f=xr_effects.get_best_detector}, "metering_anomalys_0_draw_1", "metering_anomalys_0_idle_6"} },
|
||||
out = { [0] = {"metering_anomalys_0_hide_0", {f=xr_effects.hide_best_detector}, "metering_anomalys_0_hide_1"} },
|
||||
idle = { [0] = "metering_anomalys_0_idle_0" },
|
||||
rnd = nil },
|
||||
|
||||
|
||||
|
||||
probe_crouch = { prop = { maxidle = 0,
|
||||
sumidle = 0,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"metering_anomalys_1_draw_0", {f=xr_effects.get_best_detector}, "metering_anomalys_1_draw_1"} },
|
||||
out = { [0] = {"metering_anomalys_1_hide_0", {f=xr_effects.hide_best_detector}, "metering_anomalys_1_hide_1"} },
|
||||
idle = { [0] = "metering_anomalys_1_idle_0" },
|
||||
rnd = { [0] = {"metering_anomalys_1_idle_1",
|
||||
"metering_anomalys_1_idle_2",
|
||||
"metering_anomalys_1_idle_3",
|
||||
"metering_anomalys_1_idle_4"} } },
|
||||
|
||||
scaner_stand = { prop = { maxidle = 0,
|
||||
sumidle = 0,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"metering_anomalys_0_draw_0", {a="anomaly_scaner"}, "metering_anomalys_0_draw_1"} },
|
||||
out = { [0] = {"metering_anomalys_0_hide_0", {d="anomaly_scaner"}, "metering_anomalys_0_hide_1"} },
|
||||
idle = { [0] = "metering_anomalys_0_idle_0" },
|
||||
rnd = { [0] = {"metering_anomalys_0_idle_1",
|
||||
"metering_anomalys_0_idle_2",
|
||||
"metering_anomalys_0_idle_3",
|
||||
"metering_anomalys_0_idle_4",
|
||||
"metering_anomalys_0_idle_5"} } },
|
||||
|
||||
|
||||
scaner_way = { prop = { maxidle = 0,
|
||||
sumidle = 0,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"metering_anomalys_0_draw_0", {a="anomaly_scaner"}, "metering_anomalys_0_draw_1", "metering_anomalys_0_idle_6"} },
|
||||
out = { [0] = {"metering_anomalys_0_hide_0", {d="anomaly_scaner"}, "metering_anomalys_0_hide_1"} },
|
||||
idle = { [0] = "metering_anomalys_0_idle_0" },
|
||||
rnd = nil },
|
||||
|
||||
|
||||
|
||||
scaner_crouch = { prop = { maxidle = 0,
|
||||
sumidle = 0,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"metering_anomalys_1_draw_0", {a="anomaly_scaner"}, "metering_anomalys_1_draw_1"} },
|
||||
out = { [0] = {"metering_anomalys_1_hide_0", {d="anomaly_scaner"}, "metering_anomalys_1_hide_1"} },
|
||||
idle = { [0] = "metering_anomalys_1_idle_0" },
|
||||
rnd = { [0] = {"metering_anomalys_1_idle_1",
|
||||
"metering_anomalys_1_idle_2",
|
||||
"metering_anomalys_1_idle_3",
|
||||
"metering_anomalys_1_idle_4"} } },
|
||||
|
||||
prisoner = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"prisoner_0_sit_down_0"}},
|
||||
out = { [0] = {"prisoner_0_stand_up_0"}},
|
||||
idle = { [0] = "prisoner_0_sit_idle_0" },
|
||||
rnd = nil },
|
||||
|
||||
|
||||
raciya = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"raciya_0_draw_0", {a="hand_radio"}, "raciya_0_draw_1"},
|
||||
[1] = {"raciya_1_draw_0", {a="hand_radio"}, "raciya_1_draw_1"},
|
||||
[2] = {"raciya_2_draw_0", {a="hand_radio"}, "raciya_2_draw_1"},
|
||||
[3] = {"raciya_3_draw_0", {a="hand_radio"}, "raciya_3_draw_1"},
|
||||
[4] = {"raciya_4_draw_0", {a="hand_radio"}, "raciya_4_draw_1"},
|
||||
[8] = {"raciya_8_draw_0", {a="hand_radio"}, "raciya_8_draw_1"},
|
||||
[9] = {"raciya_9_draw_0", {a="hand_radio"}, "raciya_9_draw_1"},
|
||||
[10]= {"raciya_10_draw_0",{a="hand_radio"}, "raciya_10_draw_1"} },
|
||||
out = { [0] = {"raciya_0_hide_0", {d="hand_radio"}, "raciya_0_hide_1"},
|
||||
[1] = {"raciya_1_hide_0", {d="hand_radio"}, "raciya_1_hide_1"},
|
||||
[2] = {"raciya_2_hide_0", {d="hand_radio"}, "raciya_2_hide_1"},
|
||||
[3] = {"raciya_3_hide_0", {d="hand_radio"}, "raciya_3_hide_1"},
|
||||
[4] = {"raciya_4_hide_0", {d="hand_radio"}, "raciya_4_hide_1"},
|
||||
[8] = {"raciya_8_hide_0", {d="hand_radio"}, "raciya_8_hide_1"},
|
||||
[9] = {"raciya_9_hide_0", {d="hand_radio"}, "raciya_9_hide_1"},
|
||||
[10]= {"raciya_10_hide_0",{d="hand_radio"}, "raciya_10_hide_1"} },
|
||||
idle = { [0] = "raciya_0_idle_0",
|
||||
[1] = "raciya_1_idle_0",
|
||||
[2] = "raciya_2_idle_0",
|
||||
[3] = "raciya_3_idle_0",
|
||||
[4] = "raciya_4_idle_0",
|
||||
[8] = "raciya_8_idle_0",
|
||||
[9] = "raciya_9_idle_0",
|
||||
[10]= "raciya_10_idle_0" },
|
||||
rnd = { [0] = {"raciya_0_talk_0"},
|
||||
[1] = {"raciya_1_talk_0"},
|
||||
[2] = {"raciya_2_talk_0"},
|
||||
[3] = {"raciya_3_talk_0"},
|
||||
[4] = {"raciya_4_talk_0"},
|
||||
[8] = {"raciya_8_talk_0"},
|
||||
[9] = {"raciya_9_talk_0"},
|
||||
[10]= {"raciya_10_talk_0"} } },
|
||||
|
||||
cr_raciya = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = {"cr_raciya_0_draw_0", {a="hand_radio"}, "cr_raciya_0_draw_1"},
|
||||
[1] = {"cr_raciya_1_draw_0", {a="hand_radio"}, "cr_raciya_1_draw_1"},
|
||||
[2] = {"cr_raciya_2_draw_0", {a="hand_radio"}, "cr_raciya_2_draw_1"},
|
||||
[3] = {"cr_raciya_3_draw_0", {a="hand_radio"}, "cr_raciya_3_draw_1"},
|
||||
[4] = {"cr_raciya_4_draw_0", {a="hand_radio"}, "cr_raciya_4_draw_1"},
|
||||
[8] = {"cr_raciya_8_draw_0", {a="hand_radio"}, "cr_raciya_8_draw_1"},
|
||||
[9] = {"cr_raciya_9_draw_0", {a="hand_radio"}, "cr_raciya_9_draw_1"},
|
||||
[10]= {"cr_raciya_10_draw_0",{a="hand_radio"},"cr_raciya_10_draw_1"} },
|
||||
out = { [0] = {"cr_raciya_0_hide_0", {d="hand_radio"}, "cr_raciya_0_hide_1"},
|
||||
[1] = {"cr_raciya_1_hide_0", {d="hand_radio"}, "cr_raciya_1_hide_1"},
|
||||
[2] = {"cr_raciya_2_hide_0", {d="hand_radio"}, "cr_raciya_2_hide_1"},
|
||||
[3] = {"cr_raciya_3_hide_0", {d="hand_radio"}, "cr_raciya_3_hide_1"},
|
||||
[4] = {"cr_raciya_4_hide_0", {d="hand_radio"}, "cr_raciya_4_hide_1"},
|
||||
[8] = {"cr_raciya_8_hide_0", {d="hand_radio"}, "cr_raciya_8_hide_1"},
|
||||
[9] = {"cr_raciya_9_hide_0", {d="hand_radio"}, "cr_raciya_9_hide_1"},
|
||||
[10]= {"cr_raciya_10_hide_0",{d="hand_radio"},"cr_raciya_10_hide_1"} },
|
||||
idle = { [0] = "cr_raciya_0_idle_0",
|
||||
[1] = "cr_raciya_1_idle_0",
|
||||
[2] = "cr_raciya_2_idle_0",
|
||||
[3] = "cr_raciya_3_idle_0",
|
||||
[4] = "cr_raciya_4_idle_0",
|
||||
[8] = "cr_raciya_8_idle_0",
|
||||
[9] = "cr_raciya_9_idle_0",
|
||||
[10]= "cr_raciya_10_idle_0" },
|
||||
rnd = { [0] = {"cr_raciya_0_talk_0"},
|
||||
[1] = {"cr_raciya_1_talk_0"},
|
||||
[2] = {"cr_raciya_2_talk_0"},
|
||||
[3] = {"cr_raciya_3_talk_0"},
|
||||
[4] = {"cr_raciya_4_talk_0"},
|
||||
[8] = {"cr_raciya_8_talk_0"},
|
||||
[9] = {"cr_raciya_9_talk_0"},
|
||||
[10]= {"cr_raciya_10_talk_0"} } },
|
||||
|
||||
|
||||
|
||||
psy_armed = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = { "idle_0_to_psy_0_idle_0" },
|
||||
[1] = { "idle_0_to_psy_1_idle_0" } },
|
||||
out = { [0] = { "psy_0_idle_0_to_idle_0" },
|
||||
[1] = { "psy_1_idle_0_to_idle_0" } },
|
||||
idle = { [0] = "psy_0_idle_0",
|
||||
[1] = "psy_1_idle_0" },
|
||||
rnd = { [0] = { "psy_0_idle_1",
|
||||
"psy_0_idle_2",
|
||||
"psy_0_idle_3" },
|
||||
[1] = { "psy_1_idle_1",
|
||||
"psy_1_idle_2",
|
||||
"psy_1_idle_3" } } },
|
||||
psy_shoot = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [1] = {"psy_1_shot_0", {sh=1000}} },
|
||||
out = nil,
|
||||
idle = { [1] = "psy_1_death_0" },
|
||||
rnd = nil },
|
||||
lay_on_bed = { prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100,
|
||||
moving = true },
|
||||
into = { [0] = {"cut_scene_0_actor"}},
|
||||
out = nil,
|
||||
idle = nil,
|
||||
rnd = nil},
|
||||
|
||||
search_corpse = {prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = { "dinamit_1", {f=xr_corpse_detection.get_all_from_corpse} }},
|
||||
out = nil,
|
||||
rnd = nil,
|
||||
idle = nil},
|
||||
|
||||
help_wounded = {prop = { maxidle = 1,
|
||||
sumidle = 1,
|
||||
rnd = 100 },
|
||||
into = { [0] = { "dinamit_1", {f=xr_help_wounded.help_wounded} }},
|
||||
out = nil,
|
||||
rnd = nil,
|
||||
idle = nil},
|
||||
}
|
||||
|
||||
utils.copy_table(animations, state_mgr_animation_list_animpoint.add_animation_list())
|
||||
utils.copy_table(animations, state_mgr_scenario.add_animation_list())
|
||||
utils.copy_table(animations, state_mgr_pri_a15.add_animation_list())
|
||||
176
gamedata/scripts/task_functor.script
Normal file
176
gamedata/scripts/task_functor.script
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
--'*************************************************************************************
|
||||
--' Функторы тайтла и описания квеста (должны возвращать строку)
|
||||
--'*************************************************************************************
|
||||
|
||||
function condlist(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
local cond_string = p
|
||||
|
||||
-- MTB-marek.siemieniuk Start: cached condlist
|
||||
local parsed_condlist = cached_condlist[cond_string];
|
||||
if parsed_condlist == nil then
|
||||
parsed_condlist = xr_logic.parse_condlist(nil, "task", "task_condlist", cond_string)
|
||||
cached_condlist[cond_string] = parsed_condlist
|
||||
end
|
||||
-- MTB-marek.siemieniuk End
|
||||
|
||||
return xr_logic.pick_section_from_condlist(get_story_object("actor"), nil, parsed_condlist)
|
||||
end
|
||||
|
||||
function zat_b29_adv_title(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
local actor = get_story_object("actor")
|
||||
for i = 16, 23 do
|
||||
if (has_alife_info(dialogs_zaton.zat_b29_infop_bring_table[i]) and actor:object(dialogs_zaton.zat_b29_af_table[i])) then
|
||||
title = "zat_b29_simple_bring_title_"..i
|
||||
break
|
||||
elseif has_alife_info(dialogs_zaton.zat_b29_infop_bring_table[i]) then
|
||||
title = "zat_b29_simple_find_title_"..i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return title
|
||||
end
|
||||
|
||||
function zat_b29_adv_descr(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
local descr
|
||||
local f_af = 0
|
||||
local actor = get_story_object("actor")
|
||||
|
||||
for i = 16, 23 do
|
||||
if (has_alife_info(dialogs_zaton.zat_b29_infop_bring_table[i]) and actor:object(dialogs_zaton.zat_b29_af_table[i])) then
|
||||
f_af = 1
|
||||
descr = "zat_b29_simple_bring_text_5"
|
||||
if has_alife_info("zat_b29_stalker_rival_1_found_af") and has_alife_info("zat_b29_first_rival_taken_out") and f_af ~= 0 then
|
||||
return descr
|
||||
elseif has_alife_info("zat_b29_stalker_rival_2_found_af") and has_alife_info("zat_b29_second_rival_taken_out") and f_af ~= 0 then
|
||||
return descr
|
||||
elseif has_alife_info("zat_b29_linker_take_af_from_rival") then
|
||||
descr = "zat_b29_simple_bring_text_4"
|
||||
elseif has_alife_info("zat_b29_stalkers_rivals_found_af") then
|
||||
descr = "zat_b29_simple_bring_text_3"
|
||||
elseif has_alife_info("zat_b29_rivals_search") and has_alife_info("zat_b29_exclusive_conditions") then
|
||||
descr = "zat_b29_simple_bring_text_1"
|
||||
elseif has_alife_info("zat_b29_rivals_search") then
|
||||
descr = "zat_b29_simple_bring_text_2"
|
||||
end
|
||||
break
|
||||
elseif has_alife_info(dialogs_zaton.zat_b29_infop_bring_table[i]) then
|
||||
descr = "zat_b29_simple_find_text_5"
|
||||
if has_alife_info("zat_b29_stalker_rival_1_found_af") and has_alife_info("zat_b29_first_rival_taken_out") and f_af ~= 0 then
|
||||
return descr
|
||||
elseif has_alife_info("zat_b29_stalker_rival_2_found_af") and has_alife_info("zat_b29_second_rival_taken_out") and f_af ~= 0 then
|
||||
return descr
|
||||
elseif has_alife_info("zat_b29_linker_take_af_from_rival") then
|
||||
descr = "zat_b29_simple_find_text_4"
|
||||
elseif has_alife_info("zat_b29_stalkers_rivals_found_af") then
|
||||
descr = "zat_b29_simple_find_text_3"
|
||||
elseif has_alife_info("zat_b29_rivals_search") and has_alife_info("zat_b29_exclusive_conditions") then
|
||||
descr = "zat_b29_simple_find_text_1"
|
||||
elseif has_alife_info("zat_b29_rivals_search") then
|
||||
descr = "zat_b29_simple_find_text_2"
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return descr
|
||||
end
|
||||
|
||||
function surge_task_title(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
if(surge_manager.actor_in_cover()) then
|
||||
return "hide_from_surge_name_2"
|
||||
else
|
||||
return "hide_from_surge_name_1"
|
||||
end
|
||||
end
|
||||
|
||||
function surge_task_descr(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
return surge_manager.get_task_descr()
|
||||
end
|
||||
--'*************************************************************************************
|
||||
--' Функторы цели квеста (должны возвращать id персонажа)
|
||||
--'*************************************************************************************
|
||||
|
||||
function target_condlist(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
local cond_string = p
|
||||
|
||||
-- MTB-marek.siemieniuk Start: cached condlist
|
||||
local parsed_condlist = cached_condlist[cond_string];
|
||||
if parsed_condlist == nil then
|
||||
parsed_condlist = xr_logic.parse_condlist(nil, "task", "task_condlist", cond_string)
|
||||
cached_condlist[cond_string] = parsed_condlist
|
||||
end
|
||||
-- MTB-marek.siemieniuk End
|
||||
|
||||
local value = xr_logic.pick_section_from_condlist(get_story_object("actor"), nil, parsed_condlist)
|
||||
|
||||
if value == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
local target_obj_id = get_story_object_id(value)
|
||||
|
||||
if target_obj_id == nil then
|
||||
-- abort("There is no object with story_id %s", value)
|
||||
end
|
||||
|
||||
return target_obj_id
|
||||
end
|
||||
|
||||
function zat_b29_adv_target(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
local target_obj_id = "zat_a2_stalker_barmen"
|
||||
local af = nil
|
||||
local actor = get_story_object("actor")
|
||||
|
||||
|
||||
for i = 16, 23 do
|
||||
if (has_alife_info(dialogs_zaton.zat_b29_infop_bring_table[i])
|
||||
and actor:object(dialogs_zaton.zat_b29_af_table[i])) then
|
||||
af = dialogs_zaton.zat_b29_af_table[i]
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if (not has_alife_info("zat_b29_linker_take_af_from_rival") and has_alife_info("zat_b29_stalkers_rivals_found_af")) then
|
||||
if has_alife_info("zat_b29_stalker_rival_1_found_af") then
|
||||
if not has_alife_info("zat_b29_first_rival_taken_out") then
|
||||
if has_alife_info("zat_b29_exclusive_conditions") then
|
||||
target_obj_id = "zat_b29_stalker_rival_1"
|
||||
else
|
||||
target_obj_id = "zat_b29_stalker_rival_default_1"
|
||||
end
|
||||
elseif af == nil then
|
||||
if has_alife_info("zat_b29_exclusive_conditions") then
|
||||
target_obj_id = "zat_b29_stalker_rival_1"
|
||||
else
|
||||
target_obj_id = "zat_b29_stalker_rival_default_1"
|
||||
end
|
||||
end
|
||||
elseif has_alife_info("zat_b29_stalker_rival_2_found_af") then
|
||||
if not has_alife_info("zat_b29_second_rival_taken_out") then
|
||||
if has_alife_info("zat_b29_exclusive_conditions") then
|
||||
target_obj_id = "zat_b29_stalker_rival_2"
|
||||
else
|
||||
target_obj_id = "zat_b29_stalker_rival_default_2"
|
||||
end
|
||||
elseif af == nil then
|
||||
if has_alife_info("zat_b29_exclusive_conditions") then
|
||||
target_obj_id = "zat_b29_stalker_rival_2"
|
||||
else
|
||||
target_obj_id = "zat_b29_stalker_rival_default_2"
|
||||
end
|
||||
end
|
||||
end
|
||||
return get_story_object_id(target_obj_id)
|
||||
end
|
||||
|
||||
if af ~= nil then
|
||||
return get_story_object_id(target_obj_id)
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
function surge_task_target(id, field, p, cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
return surge_manager.get_task_target()
|
||||
end
|
||||
364
gamedata/scripts/task_objects.script
Normal file
364
gamedata/scripts/task_objects.script
Normal file
|
|
@ -0,0 +1,364 @@
|
|||
--'*************************************************************************************
|
||||
--' Дескриптор обычного задания
|
||||
--'*************************************************************************************
|
||||
local guiders_by_level = {
|
||||
["zaton"]={["jupiter"]="zat_b215_stalker_guide_zaton", ["pripyat"]="zat_b215_stalker_guide_zaton"},
|
||||
["jupiter"]={["zaton"]="zat_b215_stalker_guide_jupiter", ["pripyat"]="jup_b43_stalker_assistant"},
|
||||
["pripyat"]={["zaton"]="jup_b43_stalker_assistant_pri", ["jupiter"]="jup_b43_stalker_assistant_pri"},
|
||||
}
|
||||
function get_guider(target_level)
|
||||
local ln = level.name()
|
||||
if(guiders_by_level[ln] and guiders_by_level[ln][target_level]) then
|
||||
return get_story_object_id(guiders_by_level[ln][target_level])
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local valid_values = {
|
||||
complete = true,
|
||||
fail = true,
|
||||
reversed = true
|
||||
}
|
||||
|
||||
--[[
|
||||
C++ class task {
|
||||
const additional = 1;
|
||||
const completed = 2;
|
||||
const fail = 0;
|
||||
const in_progress = 1;
|
||||
const insignificant = 2;
|
||||
const storyline = 0;
|
||||
const task_dummy = 65535;
|
||||
};
|
||||
]]
|
||||
|
||||
local status_by_id = {
|
||||
[0] = "normal",
|
||||
[1] = "selected",
|
||||
[2] = "completed",
|
||||
[3] = "fail",
|
||||
[4] = "reversed"
|
||||
}
|
||||
|
||||
local id_by_status = {
|
||||
normal = 0,
|
||||
selected = 1,
|
||||
completed = 2,
|
||||
fail = 3,
|
||||
reversed = 4
|
||||
}
|
||||
|
||||
class "CGeneralTask"
|
||||
function CGeneralTask:__init(task_ini, id)
|
||||
self.task_ini = task_ini
|
||||
|
||||
self.id = id
|
||||
|
||||
self.title = utils.cfg_get_string(task_ini, id, "title", nil, false, "", "TITLE_DOESNT_EXIST")
|
||||
self.title_functor = utils.cfg_get_string(task_ini, id, "title_functor", nil, false, "", "condlist")
|
||||
self.current_title = nil
|
||||
|
||||
self.descr = utils.cfg_get_string(task_ini, id, "descr", nil, false, "", "DESCR_DOESNT_EXIST")
|
||||
self.descr_functor = utils.cfg_get_string(task_ini, id, "descr_functor", nil, false, "", "condlist")
|
||||
self.current_descr = nil
|
||||
|
||||
self.target = utils.cfg_get_string(task_ini, id, "target", nil, false, "", "DESCR_DOESNT_EXIST")
|
||||
self.target_functor = utils.cfg_get_string(task_ini, id, "target_functor", nil, false, "", "target_condlist")
|
||||
self.current_target = nil
|
||||
|
||||
self.icon = utils.cfg_get_string(task_ini, id, "icon", nil, false, "", "ui_pda2_mtask_overlay")
|
||||
self.prior = utils.cfg_get_number(task_ini, id, "prior", nil, false, 0)
|
||||
self.storyline = utils.cfg_get_bool(task_ini, id, "storyline", nil, false, true)
|
||||
|
||||
--' Условия выполнения и провала квеста
|
||||
local i = 0
|
||||
self.condlist = {}
|
||||
while task_ini:line_exist(id, "condlist_"..i) do
|
||||
self.condlist[i] = xr_logic.parse_condlist(nil, "task_manager", "condlist", task_ini:r_string(id, "condlist_"..i))
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
--' Кондлисты на статусы квеста
|
||||
self.on_init = xr_logic.parse_condlist(nil, "task_manager", "condlist", utils.cfg_get_string(task_ini, id, "on_init", nil, false, "", ""))
|
||||
self.on_complete = xr_logic.parse_condlist(nil, "task_manager", "condlist", utils.cfg_get_string(task_ini, id, "on_complete", nil, false, "", ""))
|
||||
self.on_reversed = xr_logic.parse_condlist(nil, "task_manager", "condlist", utils.cfg_get_string(task_ini, id, "on_reversed", nil, false, "", ""))
|
||||
|
||||
--' Награды за квест
|
||||
self.reward_money = xr_logic.parse_condlist(nil, "task_manager", "condlist", utils.cfg_get_string(task_ini, id, "reward_money", nil, false, "", ""))
|
||||
self.reward_item = xr_logic.parse_condlist(nil, "task_manager", "condlist", utils.cfg_get_string(task_ini, id, "reward_item", nil, false, "", ""))
|
||||
|
||||
self.community_relation_delta_fail = utils.cfg_get_number(task_ini, id, "community_relation_delta_fail", nil, false, 0)
|
||||
self.community_relation_delta_complete = utils.cfg_get_number(task_ini, id, "community_relation_delta_complete", nil, false, 0)
|
||||
|
||||
--' Статус квеста, может быть: "normal", "selected", "completed", "fail", "reversed"
|
||||
self.status = "normal"
|
||||
|
||||
self.cached_condlist = {} -- MTB-marek.siemieniuk: cached condlist
|
||||
|
||||
self.current_title = task_functor[self.title_functor](self.id, "title", self.title, self.cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
self.current_descr = task_functor[self.descr_functor](self.id, "descr", self.descr, self.cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
|
||||
local time = 0
|
||||
if self.wait_time ~= nil then
|
||||
time = self.wait_time -- Тут время задано в игровых секундах
|
||||
end
|
||||
if(self.storyline) then
|
||||
if time == 0 then
|
||||
self.spot = "storyline_task_location"
|
||||
else
|
||||
self.spot = "storyline_task_location_complex_timer"
|
||||
end
|
||||
else
|
||||
if time == 0 then
|
||||
self.spot = "secondary_task_location"
|
||||
else
|
||||
self.spot = "secondary_task_location_complex_timer"
|
||||
end
|
||||
end
|
||||
self.current_target = task_functor[self.target_functor](self.id, "target", self.target, self.cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
self.dont_send_update_news = utils.cfg_get_bool(task_ini, id, "dont_send_update_news", nil, false, false)
|
||||
end
|
||||
--' Выдача квеста
|
||||
function CGeneralTask:give_task(community)
|
||||
local t = CGameTask()
|
||||
t:set_id(tostring(self.id))
|
||||
if(self.storyline) then
|
||||
t:set_type(task.storyline)
|
||||
else
|
||||
t:set_type(task.additional)
|
||||
end
|
||||
t:set_title(self.current_title)
|
||||
t:set_description(self.current_descr)
|
||||
t:set_priority(self.prior)
|
||||
t:set_icon_name(self.icon)
|
||||
t:add_complete_func("task_manager.task_complete")
|
||||
t:add_fail_func("task_manager.task_fail")
|
||||
|
||||
xr_logic.pick_section_from_condlist(db.actor, db.actor, self.on_init)
|
||||
|
||||
if self.current_target ~= nil then
|
||||
t:set_map_location(self.spot)
|
||||
t:set_map_object_id(self.current_target)
|
||||
|
||||
if(self.storyline) then
|
||||
level.map_add_object_spot(self.current_target, "ui_storyline_task_blink", "")
|
||||
else
|
||||
level.map_add_object_spot(self.current_target, "ui_secondary_task_blink", "")
|
||||
end
|
||||
end
|
||||
local time = 0
|
||||
if self.wait_time ~= nil then
|
||||
time = self.wait_time -- Тут время задано в игровых секундах
|
||||
end
|
||||
--' Заносим в task_info
|
||||
self.status = "selected"
|
||||
self.inited_time = game.get_game_time()
|
||||
|
||||
db.actor:give_task(t, time*10, false, time)
|
||||
self.t = t
|
||||
end
|
||||
--' Проверка текущего выполнения квеста
|
||||
function CGeneralTask:check_task(tm)
|
||||
local global_time = time_global()
|
||||
local task_updated = false
|
||||
if self.check_time ~= nil and
|
||||
self.last_check_task ~= nil and
|
||||
global_time - self.check_time <= 50
|
||||
then
|
||||
--' Возвращаем результат прошлой проверки (для оптимизации)
|
||||
return
|
||||
end
|
||||
if self.t == nil then
|
||||
self.t = db.actor and db.actor:get_task(self.id, true)
|
||||
return
|
||||
end
|
||||
|
||||
self.check_time = global_time
|
||||
|
||||
local t_tile = task_functor[self.title_functor](self.id, "title", self.title, self.cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
if self.current_title ~= t_tile then
|
||||
printf("task [%s] updated due to title change from [%s] to [%s]", tostring(self.id), tostring(self.current_title), tostring(t_tile))
|
||||
task_updated = true
|
||||
self.current_title = t_tile
|
||||
self.t:set_title(game.translate_string(t_tile))
|
||||
end
|
||||
|
||||
local t_descr = task_functor[self.descr_functor](self.id, "descr", self.descr, self.cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
if self.current_descr ~= t_descr then
|
||||
printf("task [%s] updated due to description change from [%s] to [%s]", tostring(self.id), tostring(self.current_descr), tostring(t_descr))
|
||||
task_updated = true
|
||||
self.current_descr = t_descr
|
||||
self.t:set_description(game.translate_string(t_descr))
|
||||
end
|
||||
|
||||
local t_target = task_functor[self.target_functor](self.id, "target", self.target, self.cached_condlist) -- MTB-marek.siemieniuk: cached condlist
|
||||
self:check_level(t_target)
|
||||
if self.current_target ~= t_target then
|
||||
printf("task [%s] updated due to target change from [%s] to [%s]", tostring(self.id), tostring(self.current_target), tostring(t_target))
|
||||
if self.current_target == nil then
|
||||
task_updated = true
|
||||
self.t:change_map_location(self.spot, t_target)
|
||||
if(self.storyline) then
|
||||
level.map_add_object_spot(t_target, "ui_storyline_task_blink", "")
|
||||
else
|
||||
level.map_add_object_spot(t_target, "ui_secondary_task_blink", "")
|
||||
end
|
||||
else
|
||||
if t_target == nil then
|
||||
self.t:remove_map_locations(false)
|
||||
task_updated = true
|
||||
else
|
||||
if(self.storyline) then
|
||||
level.map_add_object_spot(t_target, "ui_storyline_task_blink", "")
|
||||
else
|
||||
level.map_add_object_spot(t_target, "ui_secondary_task_blink", "")
|
||||
end
|
||||
self.t:change_map_location(self.spot, t_target)
|
||||
task_updated = true
|
||||
end
|
||||
end
|
||||
self.current_target = t_target
|
||||
end
|
||||
if task_updated and not(self.dont_send_update_news) then
|
||||
news_manager.send_task(db.actor, "updated", self.t)
|
||||
end
|
||||
for k,v in pairs(self.condlist) do
|
||||
local t = xr_logic.pick_section_from_condlist(db.actor, db.actor, v)
|
||||
if t ~= nil then
|
||||
--' Проверка на валидность
|
||||
if valid_values[t] ~= true then
|
||||
abort("Invalid task status [%s] for task [%s]", t, self.name)
|
||||
end
|
||||
self.last_check_task = t
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--' Инициализация награды
|
||||
function CGeneralTask:give_reward()
|
||||
xr_logic.pick_section_from_condlist(db.actor, db.actor, self.on_complete)
|
||||
|
||||
local money = xr_logic.pick_section_from_condlist(db.actor, db.actor, self.reward_money)
|
||||
local items = xr_logic.pick_section_from_condlist(db.actor, db.actor, self.reward_item)
|
||||
|
||||
-- Награду можно выдать двумя методами: от нпс или просто свалитьс неба. Если не найден НПС, с которым мы в диалоге, то просто валим с неба
|
||||
|
||||
local npc = inventory_upgrades.victim
|
||||
|
||||
if money ~= nil then
|
||||
dialogs.relocate_money(npc, tonumber(money), "in")
|
||||
end
|
||||
|
||||
if items ~= nil then
|
||||
local ancillary_item_table = {}
|
||||
for k,v in pairs(utils.parse_names(items)) do
|
||||
if ancillary_item_table[v] == nil then
|
||||
ancillary_item_table[v] = 1
|
||||
else
|
||||
ancillary_item_table[v] = ancillary_item_table[v] + 1
|
||||
end
|
||||
end
|
||||
for k,v in pairs(ancillary_item_table) do
|
||||
dialogs.relocate_item_section(npc, k, "in", v)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
function CGeneralTask:reverse_task()
|
||||
self.last_check_task = "reversed"
|
||||
end
|
||||
--' Деактивация квеста
|
||||
function CGeneralTask:deactivate_task(task)
|
||||
printf("deactivate task %s", self.id)
|
||||
|
||||
self.check_time = nil
|
||||
if self.last_check_task == "fail" then
|
||||
news_manager.send_task(db.actor, "fail", task)
|
||||
elseif self.last_check_task == "reversed" then
|
||||
xr_logic.pick_section_from_condlist(db.actor, db.actor, self.on_reversed)
|
||||
news_manager.send_task(db.actor, "reversed", task)
|
||||
end
|
||||
self.last_check_task = nil
|
||||
|
||||
self.status = "normal"
|
||||
end
|
||||
function CGeneralTask:check_level(target)
|
||||
if not(db.actor:is_active_task(self.t)) or not(target) then
|
||||
return
|
||||
end
|
||||
if not(level) then
|
||||
return
|
||||
end
|
||||
local s_obj = alife():object(target)
|
||||
if(s_obj) then
|
||||
local target_level = alife():level_name(game_graph():vertex(s_obj.m_game_vertex_id):level_id())
|
||||
local level_name = level.name()
|
||||
if(level_name~=target_level) then
|
||||
local guider_id = get_guider(target_level)
|
||||
if not(guider_id) then
|
||||
return
|
||||
end
|
||||
local guider_spot = ""
|
||||
local guider_spot2 = ""
|
||||
if(self.storyline) then
|
||||
guider_spot = "storyline_task_on_guider"
|
||||
guider_spot2 = "secondary_task_on_guider"
|
||||
else
|
||||
guider_spot = "secondary_task_on_guider"
|
||||
guider_spot2 = "storyline_task_on_guider"
|
||||
end
|
||||
if(level.map_has_object_spot(guider_id, guider_spot2)~=0) then
|
||||
level.map_remove_object_spot(guider_id, guider_spot2)
|
||||
end
|
||||
if(guider_id and level.map_has_object_spot(guider_id, guider_spot)==0) then
|
||||
level.map_add_object_spot(guider_id, guider_spot, "")
|
||||
end
|
||||
else
|
||||
self:remove_guider_spot()
|
||||
end
|
||||
end
|
||||
end
|
||||
function CGeneralTask:remove_guider_spot(target)
|
||||
if not(guiders_by_level[level.name()]) then
|
||||
return
|
||||
end
|
||||
for k,v in pairs(guiders_by_level[level.name()]) do
|
||||
local guider_id = get_story_object_id(v)
|
||||
if(guider_id) then
|
||||
if(level.map_has_object_spot(guider_id, "storyline_task_on_guider")~=0) then
|
||||
level.map_remove_object_spot(guider_id, "storyline_task_on_guider")
|
||||
end
|
||||
if(level.map_has_object_spot(guider_id, "secondary_task_on_guider")~=0) then
|
||||
level.map_remove_object_spot(guider_id, "secondary_task_on_guider")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- Save quest
|
||||
function CGeneralTask:save(packet)
|
||||
set_save_marker(packet, "save", false, "CGeneralTask")
|
||||
packet:w_u8(id_by_status[self.status])
|
||||
utils.w_CTime(packet, self.inited_time)
|
||||
packet:w_stringZ(self.current_title)
|
||||
packet:w_stringZ(self.current_descr)
|
||||
packet:w_stringZ(tostring(self.current_target))
|
||||
set_save_marker(packet, "save", true, "CGeneralTask")
|
||||
end
|
||||
-- Load quest
|
||||
function CGeneralTask:load(packet)
|
||||
set_save_marker(packet, "load", false, "CGeneralTask")
|
||||
self.status = status_by_id[packet:r_u8()]
|
||||
self.inited_time = utils.r_CTime(packet)
|
||||
self.current_title = packet:r_stringZ()
|
||||
self.current_descr = packet:r_stringZ()
|
||||
self.current_target = packet:r_stringZ()
|
||||
if self.current_target == "nil" then
|
||||
self.current_target = nil
|
||||
else
|
||||
self.current_target = tonumber(self.current_target)
|
||||
end
|
||||
|
||||
set_save_marker(packet, "load", true, "CGeneralTask")
|
||||
end
|
||||
365
gamedata/scripts/ui_load_dialog.script
Normal file
365
gamedata/scripts/ui_load_dialog.script
Normal file
|
|
@ -0,0 +1,365 @@
|
|||
saved_game_extension = save_extension()
|
||||
saved_game_extension_ex = alife_storage_manager.saved_game_extension_ex
|
||||
|
||||
class "load_item" (CUIListBoxItem)
|
||||
|
||||
function load_item:__init(height) super(height)
|
||||
printf("%f",height)
|
||||
self.file_name = "filename"
|
||||
|
||||
self:SetTextColor(GetARGB(255, 170, 170, 170))
|
||||
|
||||
self.fn = self:GetTextItem()
|
||||
self.fn:SetFont(GetFontLetterica18Russian())
|
||||
self.fn:SetEllipsis(true)
|
||||
end
|
||||
|
||||
function load_item:__finalize()
|
||||
end
|
||||
|
||||
class "load_dialog" (CUIScriptWnd)
|
||||
|
||||
function load_dialog:__init() super()
|
||||
self:InitControls()
|
||||
self:InitCallBacks()
|
||||
end
|
||||
|
||||
function load_dialog:__finalize()
|
||||
end
|
||||
|
||||
function load_dialog:FillList()
|
||||
self.list_box:RemoveAll()
|
||||
local f = getFS()
|
||||
local flist = f:file_list_open_ex("$game_saves$",bit_or(FS.FS_ListFiles,FS.FS_RootOnly),"*"..saved_game_extension)
|
||||
local f_cnt = flist:Size()
|
||||
|
||||
flist:Sort(FS.FS_sort_by_modif_down)
|
||||
|
||||
for it=0, f_cnt-1 do
|
||||
local file = flist:GetAt(it)
|
||||
local file_name = string.sub(file:NameFull(), 0, (string.len(file:NameFull()) - string.len(saved_game_extension)))
|
||||
local date_time = "[" .. file:ModifDigitOnly() .. "]"
|
||||
--menu_item = ..
|
||||
self:AddItemToList(file_name, date_time)
|
||||
end
|
||||
end
|
||||
|
||||
function load_dialog:InitControls()
|
||||
self:SetWndRect (Frect():set(0,0,1024,768))
|
||||
|
||||
local xml = CScriptXmlInit()
|
||||
local ctrl
|
||||
xml:ParseFile ("ui_mm_load_dlg.xml")
|
||||
|
||||
xml:InitStatic ("background",self)
|
||||
|
||||
ctrl = CUIWindow()
|
||||
xml:InitWindow ("file_item:main",0,ctrl)
|
||||
|
||||
self.file_item_main_sz = vector2():set(ctrl:GetWidth(),ctrl:GetHeight())
|
||||
|
||||
xml:InitWindow ("file_item:fn",0,ctrl)
|
||||
self.file_item_fn_sz = vector2():set(ctrl:GetWidth(),ctrl:GetHeight())
|
||||
|
||||
xml:InitWindow ("file_item:fd",0,ctrl)
|
||||
self.file_item_fd_sz = vector2():set(ctrl:GetWidth(),ctrl:GetHeight())
|
||||
|
||||
self.form = xml:InitStatic("form",self)
|
||||
|
||||
xml:InitStatic ("form:caption",self.form)
|
||||
|
||||
self.picture = xml:InitStatic("form:picture",self.form)
|
||||
|
||||
-- xml:InitStatic ("form:file_info",self.form)
|
||||
|
||||
self.file_caption = xml:InitTextWnd("form:file_caption",self.form)
|
||||
self.file_data = xml:InitTextWnd("form:file_data",self.form)
|
||||
|
||||
xml:InitFrame ("form:list_frame",self.form)
|
||||
|
||||
self.list_box = xml:InitListBox("form:list",self.form)
|
||||
|
||||
self.list_box:ShowSelectedItem (true)
|
||||
self:Register (self.list_box, "list_window")
|
||||
|
||||
ctrl = xml:Init3tButton("form:btn_load", self.form)
|
||||
self:Register (ctrl, "button_load")
|
||||
|
||||
ctrl = xml:Init3tButton ("form:btn_delete", self.form)
|
||||
self:Register (ctrl, "button_del")
|
||||
|
||||
ctrl = xml:Init3tButton ("form:btn_cancel", self.form)
|
||||
self:Register (ctrl, "button_back")
|
||||
|
||||
self.message_box = CUIMessageBoxEx()
|
||||
self:Register (self.message_box,"message_box")
|
||||
end
|
||||
|
||||
function load_dialog:InitCallBacks()
|
||||
self:AddCallback("button_load", ui_events.BUTTON_CLICKED, self.OnButton_load_clicked, self)
|
||||
self:AddCallback("button_back", ui_events.BUTTON_CLICKED, self.OnButton_back_clicked, self)
|
||||
self:AddCallback("button_del", ui_events.BUTTON_CLICKED, self.OnButton_del_clicked, self)
|
||||
self:AddCallback("message_box", ui_events.MESSAGE_BOX_YES_CLICKED, self.OnMsgYes, self)
|
||||
self:AddCallback("message_box", ui_events.MESSAGE_BOX_OK_CLICKED, self.OnMsgYes, self)
|
||||
|
||||
self:AddCallback("list_window", ui_events.LIST_ITEM_CLICKED, self.OnListItemClicked, self)
|
||||
self:AddCallback("list_window", ui_events.WINDOW_LBUTTON_DB_CLICK, self.OnListItemDbClicked, self)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function file_exist(fname)
|
||||
local f = getFS();
|
||||
local flist = f:file_list_open_ex("$game_saves$",bit_or(FS.FS_ListFiles,FS.FS_RootOnly) , fname)
|
||||
local f_cnt = flist:Size()
|
||||
|
||||
if f_cnt > 0 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function delete_save_game(filename)
|
||||
|
||||
local save_file = filename .. saved_game_extension
|
||||
local dds_file = filename .. ".dds"
|
||||
|
||||
local f = getFS()
|
||||
|
||||
f:file_delete("$game_saves$", save_file)
|
||||
|
||||
-- START IX-Ray
|
||||
if (file_exist(filename..saved_game_extension_ex)) then
|
||||
f:file_delete("$game_saves$",filename..saved_game_extension_ex)
|
||||
end
|
||||
-- END IX-Ray
|
||||
|
||||
if file_exist(dds_file) then
|
||||
f:file_delete("$game_saves$", dds_file)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function AddTimeDigit(str, dig)
|
||||
if (dig > 9) then
|
||||
str = str .. dig
|
||||
else
|
||||
str = str .. "0" .. dig
|
||||
end
|
||||
|
||||
return str
|
||||
|
||||
end
|
||||
|
||||
function file_data(fname)
|
||||
local f = getFS();
|
||||
local flist = f:file_list_open_ex("$game_saves$",bit_or(FS.FS_ListFiles,FS.FS_RootOnly) , fname .. saved_game_extension)
|
||||
local f_cnt = flist:Size()
|
||||
|
||||
if f_cnt > 0 then
|
||||
local file = flist:GetAt(0)
|
||||
local sg = CSavedGameWrapper(fname)
|
||||
|
||||
local y,m,d,h,min,sec,ms = 0,0,0,0,0,0,0
|
||||
y,m,d,h,min,sec,ms = sg:game_time():get(y,m,d,h,min,sec,ms)
|
||||
|
||||
|
||||
local date_time = ""
|
||||
|
||||
date_time = AddTimeDigit(date_time, h)
|
||||
date_time = date_time .. ":"
|
||||
date_time = AddTimeDigit(date_time, min)
|
||||
date_time = date_time .. " "
|
||||
date_time = AddTimeDigit(date_time, m)
|
||||
date_time = date_time .. "/"
|
||||
date_time = AddTimeDigit(date_time, d)
|
||||
date_time = date_time .. "/"
|
||||
|
||||
date_time = date_time .. y
|
||||
|
||||
|
||||
--string.format("[%d/%d/%d %d]",m,d,h,min,y)
|
||||
local health = string.format("\\n%s %d%s", game.translate_string("st_ui_health_sensor"),sg:actor_health()*100,"%")
|
||||
|
||||
return game.translate_string("st_level") .. ": " .. game.translate_string(sg:level_name()) .. "\\n" .. game.translate_string("ui_inv_time")..": " .. date_time .. health
|
||||
else
|
||||
return "no file data"
|
||||
end
|
||||
end
|
||||
|
||||
function load_dialog:OnListItemClicked()
|
||||
if self.list_box:GetSize()==0 then return end
|
||||
|
||||
local item = self.list_box:GetSelectedItem()
|
||||
|
||||
if item == nil then
|
||||
self.file_caption:SetText ("")
|
||||
self.file_data:SetText ("")
|
||||
|
||||
local r = self.picture:GetTextureRect()
|
||||
self.picture:InitTexture ("ui\\ui_noise")
|
||||
self.picture:SetTextureRect(Frect():set(r.x1,r.y1,r.x2,r.y2))
|
||||
|
||||
return
|
||||
end
|
||||
local item_text = item.fn:GetText()
|
||||
self.file_caption:SetText (item_text)
|
||||
self.file_caption:SetEllipsis(true)
|
||||
self.file_data:SetText (file_data(item_text))
|
||||
|
||||
if file_exist(item_text .. saved_game_extension) ~= true then
|
||||
self.list_box:RemoveItem(item)
|
||||
return
|
||||
end
|
||||
|
||||
local r = self.picture:GetTextureRect()
|
||||
if file_exist(item_text .. ".dds") then
|
||||
self.picture:InitTexture(item_text)
|
||||
else
|
||||
self.picture:InitTexture("ui\\ui_noise")
|
||||
end
|
||||
-- self.picture:SetTextureRect(Frect():set(r.x1,r.y1,r.x2,r.y2))
|
||||
end
|
||||
|
||||
function load_dialog:OnListItemDbClicked()
|
||||
self:OnButton_load_clicked()
|
||||
end
|
||||
|
||||
function load_dialog:OnMsgYes()
|
||||
local index = self.list_box:GetSelectedIndex()
|
||||
|
||||
if index == -1 then return end
|
||||
|
||||
if self.msgbox_id == 1 then
|
||||
local item = self.list_box:GetItemByIndex(index)
|
||||
|
||||
local fname = item.fn:GetText()
|
||||
|
||||
delete_save_game (fname)
|
||||
|
||||
self.list_box:RemoveItem(item)
|
||||
|
||||
self:OnListItemClicked()
|
||||
elseif self.msgbox_id == 2 then
|
||||
self:load_game_internal()
|
||||
end
|
||||
|
||||
self.msgbox_id = 0
|
||||
end
|
||||
|
||||
function load_dialog:load_game_internal()
|
||||
local console = get_console()
|
||||
|
||||
if self.list_box:GetSize()==0 then return end
|
||||
|
||||
local index = self.list_box:GetSelectedIndex()
|
||||
|
||||
if index == -1 then return end
|
||||
|
||||
local item = self.list_box:GetItemByIndex(index)
|
||||
|
||||
local fname = item.fn:GetText()
|
||||
|
||||
if (alife() == nil) then
|
||||
console:execute ("disconnect")
|
||||
console:execute ("start server(" .. fname .. "/single/alife/load) client(localhost)")
|
||||
else
|
||||
console:execute ("load " .. fname)
|
||||
end
|
||||
end
|
||||
|
||||
function load_dialog:OnButton_load_clicked()
|
||||
local console = get_console()
|
||||
|
||||
if self.list_box:GetSize()==0 then
|
||||
return
|
||||
end
|
||||
|
||||
local item = self.list_box:GetSelectedItem()
|
||||
if item == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local fname = item.fn:GetText()
|
||||
|
||||
if ( not valid_saved_game(fname) ) then
|
||||
self.msgbox_id = 0
|
||||
self.message_box:InitMessageBox ("message_box_invalid_saved_game")
|
||||
self.message_box:ShowDialog(true)
|
||||
return
|
||||
end
|
||||
|
||||
if (alife() == nil) then
|
||||
self:load_game_internal ()
|
||||
return
|
||||
end
|
||||
|
||||
if ( (db.actor ~= nil) and (db.actor:alive() == false) ) then
|
||||
self:load_game_internal ()
|
||||
return
|
||||
end
|
||||
|
||||
self.msgbox_id = 2
|
||||
self.message_box:InitMessageBox ("message_box_confirm_load_save")
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
|
||||
function load_dialog:OnButton_back_clicked()
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show (true)
|
||||
end
|
||||
|
||||
function load_dialog:OnButton_del_clicked()
|
||||
if self.list_box:GetSize()==0 then return end
|
||||
local index = self.list_box:GetSelectedIndex()
|
||||
local item = self.list_box:GetItemByIndex(index) -- Suhar_
|
||||
|
||||
if index == -1 or item==nil then -- Suhar_
|
||||
return
|
||||
end
|
||||
|
||||
self.msgbox_id = 1
|
||||
|
||||
self.message_box:InitMessageBox("message_box_delete_file_name")
|
||||
self.message_box:ShowDialog(true)
|
||||
|
||||
end
|
||||
|
||||
function load_dialog:OnKeyboard(dik, keyboard_action) --virtual function
|
||||
CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
|
||||
local bind = dik_to_bind(dik)
|
||||
if bind == key_bindings.kQUIT then
|
||||
self:OnButton_back_clicked()
|
||||
else
|
||||
|
||||
DIK_RETURN = 40 -- IX-Ray: Fixed DIK_RETURN
|
||||
|
||||
if dik == DIK_RETURN and keyboard_action == ui_events.WINDOW_KEY_PRESSED then
|
||||
self:OnButton_load_clicked()
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function load_dialog:AddItemToList(file_name, date_time)
|
||||
|
||||
local _itm = load_item(self.file_item_main_sz.y)
|
||||
|
||||
_itm:SetWndSize (self.file_item_main_sz)
|
||||
|
||||
_itm.fn:SetWndPos (vector2():set(0,0))
|
||||
_itm.fn:SetWndSize (self.file_item_fn_sz)
|
||||
_itm.fn:SetText (file_name)
|
||||
|
||||
_itm.fage = _itm:AddTextField(date_time, self.file_item_fd_sz.x)
|
||||
_itm.fage:SetFont (GetFontLetterica16Russian())
|
||||
_itm.fage:SetWndPos (vector2():set(self.file_item_fn_sz.x+4, 0))
|
||||
_itm.fage:SetWndSize(self.file_item_fd_sz)
|
||||
|
||||
self.list_box:AddExistingItem(_itm)
|
||||
end
|
||||
|
||||
|
||||
|
||||
381
gamedata/scripts/ui_main_menu.script
Normal file
381
gamedata/scripts/ui_main_menu.script
Normal file
|
|
@ -0,0 +1,381 @@
|
|||
-- File: UI_MAIN_MENU.SCRIPT
|
||||
-- Description: Load Dialog for STALKER
|
||||
-- Created: 28.10.2004
|
||||
-- Lasd edit: 18.01.2006
|
||||
-- Copyright: 2004 GSC Game World
|
||||
-- Author: Serhiy Vynnychenko (narrator@gsc-game.kiev.ua)
|
||||
-- Version: 0.9
|
||||
|
||||
class "main_menu" (CUIScriptWnd)
|
||||
|
||||
function main_menu:__init() super()
|
||||
self.mbox_mode = 0
|
||||
self:InitControls()
|
||||
self:InitCallBacks()
|
||||
xr_s.on_main_menu_on() --' Distemper 03.2008 --
|
||||
end
|
||||
|
||||
function main_menu:__finalize()
|
||||
end
|
||||
|
||||
function main_menu:InitControls()
|
||||
self:SetWndRect (Frect():set(0,0,1024,768))
|
||||
|
||||
local xml = CScriptXmlInit()
|
||||
xml:ParseFile ("ui_mm_main.xml")
|
||||
|
||||
xml:InitStatic ("background", self)
|
||||
self.shniaga = xml:InitMMShniaga("shniaga_wnd",self);
|
||||
|
||||
self.message_box = CUIMessageBoxEx()
|
||||
self:Register (self.message_box, "msg_box")
|
||||
|
||||
local _ver = xml:InitStatic ("static_version",self)
|
||||
local mm = _G.main_menu.get_main_menu()
|
||||
_ver:TextControl():SetText ("ver. " .. mm:GetGSVer())
|
||||
|
||||
-- IX-Ray start
|
||||
local btn
|
||||
if xml:NodeExist("english_lang", 0) then
|
||||
btn = xml:Init3tButton("english_lang", self)
|
||||
self:Register(btn, "english_lang")
|
||||
end
|
||||
|
||||
if xml:NodeExist("russian_lang", 0) then
|
||||
btn = xml:Init3tButton("russian_lang", self)
|
||||
self:Register(btn, "russian_lang")
|
||||
end
|
||||
-- IX-Ray end
|
||||
end
|
||||
|
||||
function main_menu:Show(f)
|
||||
self.shniaga:SetVisibleMagnifier(f)
|
||||
end
|
||||
|
||||
|
||||
function main_menu:InitCallBacks()
|
||||
-- new game
|
||||
self:AddCallback("btn_novice", ui_events.BUTTON_CLICKED, self.OnButton_new_novice_game, self)
|
||||
self:AddCallback("btn_stalker", ui_events.BUTTON_CLICKED, self.OnButton_new_stalker_game, self)
|
||||
self:AddCallback("btn_veteran", ui_events.BUTTON_CLICKED, self.OnButton_new_veteran_game, self)
|
||||
self:AddCallback("btn_master", ui_events.BUTTON_CLICKED, self.OnButton_new_master_game, self)
|
||||
self:AddCallback("btn_spawn", ui_events.BUTTON_CLICKED, self.OnButton_load_spawn, self)
|
||||
-- options
|
||||
self:AddCallback("btn_options", ui_events.BUTTON_CLICKED, self.OnButton_options_clicked, self)
|
||||
-- load
|
||||
self:AddCallback("btn_load", ui_events.BUTTON_CLICKED, self.OnButton_load_clicked, self)
|
||||
-- save
|
||||
self:AddCallback("btn_save", ui_events.BUTTON_CLICKED, self.OnButton_save_clicked, self)
|
||||
|
||||
-- multiplayer
|
||||
if (IsSupportMP()) then -- IX-Ray: Optional multiplayer check
|
||||
self:AddCallback("btn_net_game", ui_events.BUTTON_CLICKED, self.OnButton_network_game_clicked, self)
|
||||
self:AddCallback("btn_internet", ui_events.BUTTON_CLICKED, self.OnButton_internet_clicked, self)
|
||||
self:AddCallback("btn_localnet", ui_events.BUTTON_CLICKED, self.OnButton_localnet_clicked, self)
|
||||
self:AddCallback("btn_multiplayer", ui_events.BUTTON_CLICKED, self.OnButton_multiplayer_clicked, self)
|
||||
end
|
||||
|
||||
self:AddCallback("btn_logout", ui_events.BUTTON_CLICKED, self.OnButton_logout_clicked, self)
|
||||
|
||||
-- quit
|
||||
self:AddCallback("btn_quit", ui_events.BUTTON_CLICKED, self.OnButton_quit_clicked, self)
|
||||
self:AddCallback("btn_quit_to_mm", ui_events.BUTTON_CLICKED, self.OnButton_disconnect_clicked, self)
|
||||
self:AddCallback("btn_ret", ui_events.BUTTON_CLICKED, self.OnButton_return_game, self)
|
||||
self:AddCallback("btn_lastsave", ui_events.BUTTON_CLICKED, self.OnButton_last_save, self)
|
||||
self:AddCallback("btn_credits", ui_events.BUTTON_CLICKED, self.OnButton_credits_clicked, self)
|
||||
|
||||
-- IX-Ray start
|
||||
self:AddCallback("english_lang", ui_events.BUTTON_CLICKED, self.OnBtnEnglish, self)
|
||||
self:AddCallback("russian_lang", ui_events.BUTTON_CLICKED, self.OnBtnRussian, self)
|
||||
-- IX-Ray end
|
||||
|
||||
-- message box
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_OK_CLICKED, self.OnMsgOk, self)
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_CANCEL_CLICKED, self.OnMsgCancel, self)
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_YES_CLICKED, self.OnMsgYes, self)
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_NO_CLICKED, self.OnMsgNo, self)
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_QUIT_GAME_CLICKED,self.OnMessageQuitGame, self)
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_QUIT_WIN_CLICKED, self.OnMessageQuitWin, self)
|
||||
|
||||
self:Register(self, "self")
|
||||
self:AddCallback("self", ui_events.MAIN_MENU_RELOADED, self.OnMenuReloaded, self)
|
||||
end
|
||||
function main_menu:OnMsgOk()
|
||||
self.mbox_mode = 0
|
||||
end
|
||||
|
||||
function main_menu:OnMsgCancel()
|
||||
self.mbox_mode = 0
|
||||
end
|
||||
|
||||
function main_menu:OnMsgYes()
|
||||
|
||||
if self.mbox_mode == 1 then
|
||||
self:LoadLastSave()
|
||||
end
|
||||
|
||||
self.mbox_mode = 0
|
||||
end
|
||||
|
||||
function main_menu:OnMsgNo()
|
||||
self.mbox_mode = 0
|
||||
end
|
||||
|
||||
function main_menu:LoadLastSave()
|
||||
local console = get_console()
|
||||
console:execute ("main_menu off")
|
||||
console:execute ("load_last_save")
|
||||
end
|
||||
|
||||
function main_menu:OnButton_last_save()
|
||||
if ( alife() == nil) then
|
||||
self:LoadLastSave ()
|
||||
return
|
||||
end
|
||||
|
||||
if ( (db.actor ~= nil) and (db.actor:alive() == false) ) then
|
||||
self:LoadLastSave ()
|
||||
return
|
||||
end
|
||||
|
||||
self.mbox_mode = 1
|
||||
self.message_box:InitMessageBox ("message_box_confirm_load_save")
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
|
||||
function main_menu:OnButton_credits_clicked()
|
||||
-- local console = get_console()
|
||||
-- console:execute("main_menu off")
|
||||
game.start_tutorial("credits_seq")
|
||||
end
|
||||
|
||||
function main_menu:OnButton_quit_clicked()
|
||||
self.message_box:InitMessageBox("message_box_quit_windows")
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
|
||||
|
||||
function main_menu:OnButton_disconnect_clicked()
|
||||
self.message_box:InitMessageBox("message_box_quit_game")
|
||||
|
||||
if (level.game_id() ~= 1) then
|
||||
self.message_box:SetText("ui_mm_disconnect_message") -- MultiPlayer
|
||||
else
|
||||
self.message_box:SetText("ui_mm_quit_game_message") -- SinglePlayer
|
||||
end
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
|
||||
function main_menu:OnMessageQuitGame()
|
||||
local console = get_console()
|
||||
console:execute("disconnect")
|
||||
end
|
||||
|
||||
function main_menu:OnMessageQuitWin()
|
||||
local console = get_console()
|
||||
console:execute("quit")
|
||||
end
|
||||
|
||||
function main_menu:OnButton_return_game()
|
||||
local console = get_console()
|
||||
console:execute("main_menu off")
|
||||
xr_s.on_main_menu_off() --' Distemper 03.2008 --
|
||||
end
|
||||
|
||||
function main_menu:OnButton_new_novice_game()
|
||||
local console = get_console()
|
||||
console:execute("g_game_difficulty gd_novice")
|
||||
self:StartGame()
|
||||
end
|
||||
|
||||
function main_menu:OnButton_new_stalker_game()
|
||||
local console = get_console()
|
||||
console:execute("g_game_difficulty gd_stalker")
|
||||
self:StartGame()
|
||||
end
|
||||
|
||||
function main_menu:OnButton_new_veteran_game()
|
||||
local console = get_console()
|
||||
console:execute("g_game_difficulty gd_veteran")
|
||||
self:StartGame()
|
||||
end
|
||||
|
||||
function main_menu:OnButton_new_master_game()
|
||||
local console = get_console()
|
||||
console:execute("g_game_difficulty gd_master")
|
||||
self:StartGame()
|
||||
end
|
||||
|
||||
function main_menu:StartGame()
|
||||
local console = get_console()
|
||||
|
||||
if (alife() ~= nil) then
|
||||
console:execute ("disconnect")
|
||||
end
|
||||
device():pause(false)
|
||||
console:execute("start server(all/single/alife/new) client(localhost)")
|
||||
console:execute("main_menu off")
|
||||
end
|
||||
|
||||
function main_menu:OnButton_load_spawn()
|
||||
if self.spawn_dlg == nil then
|
||||
self.spawn_dlg = ui_spawn_dialog.spawn_dialog()
|
||||
self.spawn_dlg.owner = self
|
||||
end
|
||||
|
||||
self.spawn_dlg:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
function main_menu:OnButton_save_clicked()
|
||||
if self.save_dlg == nil then
|
||||
self.save_dlg = ui_save_dialog.save_dialog()
|
||||
self.save_dlg.owner = self
|
||||
end
|
||||
|
||||
self.save_dlg:FillList()
|
||||
self.save_dlg:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
function main_menu:OnButton_options_clicked()
|
||||
if self.opt_dlg == nil then
|
||||
self.opt_dlg = ui_mm_opt_main.options_dialog()
|
||||
self.opt_dlg.owner = self
|
||||
end
|
||||
|
||||
self.opt_dlg:SetCurrentValues()
|
||||
self.opt_dlg:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
-- IX-Ray start
|
||||
function main_menu:OnBtnEnglish()
|
||||
local console = get_console()
|
||||
console:execute("language eng")
|
||||
end
|
||||
|
||||
function main_menu:OnBtnRussian()
|
||||
local console = get_console()
|
||||
console:execute("language rus")
|
||||
end
|
||||
-- IX-Ray end
|
||||
|
||||
function main_menu:OnButton_load_clicked()
|
||||
if self.load_dlg ==nil then
|
||||
self.load_dlg = ui_load_dialog.load_dialog()
|
||||
self.load_dlg.owner = self
|
||||
end
|
||||
|
||||
self.load_dlg:FillList()
|
||||
self.load_dlg:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
end
|
||||
|
||||
function main_menu:OnButton_network_game_clicked()
|
||||
self.shniaga:ShowPage(CUIMMShniaga.epi_new_network_game)
|
||||
end
|
||||
|
||||
function main_menu:OnButton_multiplayer_clicked()
|
||||
-- assert(self.gs_profile)
|
||||
|
||||
if not(self.mp_dlg) then
|
||||
self.mp_dlg = ui_mp_main.mp_main()
|
||||
self.mp_dlg.owner = self
|
||||
self.mp_dlg:OnRadio_NetChanged()
|
||||
end
|
||||
self.mp_dlg:UpdateControls()
|
||||
self.mp_dlg:ShowDialog(true)
|
||||
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
|
||||
local console = get_console()
|
||||
console:execute ("check_for_updates 0")
|
||||
end
|
||||
|
||||
function main_menu:OnButton_logout_clicked()
|
||||
-- assert(self.gs_profile)
|
||||
self.shniaga:ShowPage(CUIMMShniaga.epi_new_network_game) --fake
|
||||
self.l_mgr:logout()
|
||||
self.gs_profile = nil
|
||||
self.mp_dlg = nil
|
||||
self.shniaga:SetPage(CUIMMShniaga.epi_main, "ui_mm_main.xml", "menu_main")
|
||||
self.shniaga:ShowPage(CUIMMShniaga.epi_main)
|
||||
end
|
||||
|
||||
function main_menu:OnButton_internet_clicked()
|
||||
if not(self.gs_dlg) then
|
||||
self.gs_dlg = ui_mm_mp_gamespy.gamespy_page()
|
||||
self.gs_dlg.owner = self
|
||||
end
|
||||
self.gs_dlg:ShowLoginPage()
|
||||
self.gs_dlg:ShowDialog(true)
|
||||
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
|
||||
local console = get_console()
|
||||
console:execute ("check_for_updates 0")
|
||||
end
|
||||
|
||||
function main_menu:OnButton_localnet_clicked()
|
||||
if not(self.ln_dlg) then
|
||||
self.ln_dlg = ui_mm_mp_localnet.localnet_page()
|
||||
self.ln_dlg.owner = self
|
||||
self.ln_dlg.lp_nickname:SetText(self.l_mgr:get_nick_from_registry())
|
||||
self.ln_dlg.lp_check_remember_me:SetCheck(self.l_mgr:get_remember_me_from_registry())
|
||||
end
|
||||
self.ln_dlg:ShowDialog(true)
|
||||
|
||||
self:HideDialog()
|
||||
self:Show(false)
|
||||
|
||||
local console = get_console()
|
||||
console:execute ("check_for_updates 0")
|
||||
end
|
||||
|
||||
function main_menu:Dispatch(cmd, param) --virtual function
|
||||
if cmd == 2 then
|
||||
self:OnButton_multiplayer_clicked()
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function main_menu:OnKeyboard(dik, keyboard_action) --virtual function
|
||||
CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
|
||||
local bind = dik_to_bind(dik)
|
||||
local console = get_console()
|
||||
|
||||
if keyboard_action == ui_events.WINDOW_KEY_PRESSED then
|
||||
if dik == DIK_keys.DIK_ESCAPE then
|
||||
if level.present() and
|
||||
( ((db.actor ~= nil)and(db.actor:alive())) or
|
||||
(false==IsGameTypeSingle())
|
||||
) then
|
||||
self.OnButton_return_game() --' xStream 02.2008
|
||||
-- console:execute("main_menu off") --' xStream 02.2008
|
||||
end
|
||||
end
|
||||
|
||||
-- if dik == DIK_keys.DIK_S then
|
||||
-- self:OnButton_load_spawn()
|
||||
|
||||
-- else
|
||||
if dik == DIK_keys.DIK_Q then
|
||||
self:OnMessageQuitWin()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function main_menu:OnMenuReloaded()
|
||||
self:OnButton_options_clicked()
|
||||
self.opt_dlg:OnMenuReloaded()
|
||||
end
|
||||
85
gamedata/scripts/ui_mm_mp_join.script
Normal file
85
gamedata/scripts/ui_mm_mp_join.script
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
-- file: UI_MM_MP_JOIN.SCRIPT
|
||||
-- description: join tab in mm_mp
|
||||
-- created: 16.05.2005
|
||||
-- author: Serge Vynnychenko
|
||||
-- mail: narrator@gsc-game.kiev.ua
|
||||
--
|
||||
-- Copyright 2005 GSC Game World
|
||||
|
||||
|
||||
class "mp_join" (CUIWindow)
|
||||
|
||||
function mp_join:__init() super()
|
||||
end
|
||||
|
||||
function mp_join:__finalize()
|
||||
end
|
||||
|
||||
function mp_join:InitControls(x, y, xml, handler)
|
||||
self:SetAutoDelete (true)
|
||||
|
||||
xml:InitWindow ("tab_client:main", 0, self)
|
||||
-- self.bk = xml:InitFrame ("frame", self)
|
||||
-- xml:InitFrameLine ("tab_client:vert_separator",self)
|
||||
|
||||
handler.server_list = xml:InitServerList("tab_client:server_list", self)
|
||||
|
||||
-- xml:InitStatic("tab_client:cap_network_connection", self)
|
||||
xml:InitStatic("tab_client:cap_server_list", self)
|
||||
xml:InitStatic("tab_client:cap_filters",self)
|
||||
|
||||
-- xml:InitStatic("tab_client:rust_00",self)
|
||||
-- xml:InitStatic("tab_client:rust_01",self)
|
||||
|
||||
|
||||
local radio = xml:InitTab("tab_client:radio_tab_network_connection", self)
|
||||
handler:Register(radio, "radio_net_conn")
|
||||
handler.radio_net_connection = radio
|
||||
radio:SetActiveTab("internet")
|
||||
|
||||
local btn = xml:Init3tButton("tab_client:btn_direct_ip", self)
|
||||
handler:Register(btn, "btn_direct_ip")
|
||||
handler.btn_direct_ip = btn
|
||||
handler.filters = {}
|
||||
|
||||
local btn = xml:InitCheck("tab_client:check_empty", self)
|
||||
handler:Register(btn, "check_empty")
|
||||
handler.filters.btn_check_empty = btn
|
||||
btn:SetCheck(true)
|
||||
|
||||
btn = xml:InitCheck("tab_client:check_full", self)
|
||||
handler:Register(btn, "check_full")
|
||||
handler.filters.btn_check_full = btn
|
||||
btn:SetCheck(true)
|
||||
|
||||
btn = xml:InitCheck("tab_client:check_with_pass", self)
|
||||
handler:Register(btn, "check_with_pass")
|
||||
handler.filters.btn_check_with_pass = btn
|
||||
btn:SetCheck(true)
|
||||
|
||||
btn = xml:InitCheck("tab_client:check_without_pass", self)
|
||||
handler:Register(btn, "check_without_pass")
|
||||
handler.filters.btn_check_without_pass = btn
|
||||
btn:SetCheck(true)
|
||||
|
||||
btn = xml:InitCheck("tab_client:check_without_ff", self)
|
||||
handler:Register(btn, "check_without_ff")
|
||||
handler.filters.btn_check_without_ff = btn
|
||||
btn:SetCheck(true)
|
||||
|
||||
btn = xml:InitCheck("tab_client:check_listen_servers", self)
|
||||
handler:Register(btn, "check_listen_servers")
|
||||
handler.filters.btn_check_listen_servers = btn
|
||||
btn:SetCheck(true)
|
||||
|
||||
btn = xml:Init3tButton("tab_client:btn_refresh", self)
|
||||
handler:Register(btn, "btn_refresh")
|
||||
|
||||
btn = xml:Init3tButton("tab_client:btn_quick_refresh", self)
|
||||
handler:Register(btn,"btn_quick_refresh")
|
||||
|
||||
|
||||
btn = xml:Init3tButton("tab_client:btn_server_info", self)
|
||||
handler:Register(btn, "btn_server_info")
|
||||
|
||||
end
|
||||
199
gamedata/scripts/ui_mm_mp_options.script
Normal file
199
gamedata/scripts/ui_mm_mp_options.script
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
-- file: UI_MM_MP_CREATE.SCRIPT
|
||||
--
|
||||
|
||||
|
||||
class "mp_options" (CUIWindow)
|
||||
|
||||
function mp_options:__init() super()
|
||||
end
|
||||
|
||||
function mp_options:__finalize()
|
||||
end
|
||||
|
||||
function mp_options:InitControls(x, y, xml, handler)
|
||||
|
||||
self:SetAutoDelete (true)
|
||||
xml:InitWindow ("tab_options:main", 0, self)
|
||||
|
||||
-- self.bk = xml:InitFrame("frame", self)
|
||||
xml:InitFrame("tab_options:frame_1", self)
|
||||
xml:InitFrame("tab_options:frame_2", self)
|
||||
xml:InitFrame("tab_options:frame_3", self)
|
||||
|
||||
-- xml:InitFrameLine("tab_options:vert_separator", self)
|
||||
-- xml:InitFrameLine("tab_options:vert_separator_2", self)
|
||||
xml:InitFrameLine("tab_options:cap_network_connection", self)
|
||||
xml:InitFrameLine("tab_options:cap_respawn_options", self)
|
||||
xml:InitFrameLine("tab_options:cap_server_list", self)
|
||||
xml:InitFrameLine("tab_options:cap_weather_options", self)
|
||||
xml:InitFrameLine("tab_options:cap_spectator_options", self)
|
||||
xml:InitFrameLine("tab_options:cap_demosave_options", self)
|
||||
xml:InitStatic("tab_options:cap_damage_block", self)
|
||||
xml:InitStatic("tab_options:cap_artreturn_time", self)
|
||||
|
||||
xml:InitStatic("tab_options:cap_friendly_fire", self)
|
||||
xml:InitStatic("tab_options:cap_frag_limit", self)
|
||||
xml:InitStatic("tab_options:cap_time_limit", self)
|
||||
xml:InitStatic("tab_options:cap_artefact_stay", self)
|
||||
xml:InitStatic("tab_options:cap_artefact_num", self)
|
||||
xml:InitStatic("tab_options:cap_anomaly_time", self)
|
||||
xml:InitStatic("tab_options:cap_warm_up_time", self)
|
||||
xml:InitStatic("tab_options:cap_artefact_delay", self)
|
||||
xml:InitStatic("tab_options:cap_starting_weather", self)
|
||||
xml:InitStatic("tab_options:cap_rate_of_change", self)
|
||||
xml:InitStatic("tab_options:cap_max_ping", self)
|
||||
|
||||
-- xml:InitStatic("tab_options:public_server_t", self)
|
||||
|
||||
handler.check_public_server = xml:InitCheck("tab_options:check_public_server", self)
|
||||
handler.check_spectator = xml:InitCheck("tab_options:check_spectator", self)
|
||||
handler.check_allow_voting = xml:InitCheck("tab_options:check_allow_voting", self)
|
||||
handler.spin_max_ping = xml:InitSpinNum("tab_options:spin_max_ping", self)
|
||||
|
||||
|
||||
handler.check_damage_block = xml:InitCheck("tab_options:check_damage_block", self)
|
||||
handler.check_auto_team_balance = xml:InitCheck("tab_options:check_auto_team_balance", self)
|
||||
handler.check_auto_team_swap = xml:InitCheck("tab_options:check_auto_team_swap", self)
|
||||
handler.check_friendly_indicators = xml:InitCheck("tab_options:check_friendly_indicators", self)
|
||||
handler.check_friendly_names = xml:InitCheck("tab_options:check_friendly_names", self)
|
||||
handler.check_no_anmalies = xml:InitCheck("tab_options:check_no_anmalies", self)
|
||||
|
||||
handler.check_spec_teamonly = xml:InitCheck("tab_options:check_spec_teamonly", self)
|
||||
handler.check_spec_freefly = xml:InitCheck("tab_options:check_spec_freefly", self)
|
||||
handler.check_spec_firsteye = xml:InitCheck("tab_options:check_spec_firsteye", self)
|
||||
handler.check_spec_lookat = xml:InitCheck("tab_options:check_spec_lookat", self)
|
||||
handler.check_spec_freelook = xml:InitCheck("tab_options:check_spec_freelook", self)
|
||||
|
||||
handler.check_demosave = xml:InitCheck("tab_options:check_demosave", self)
|
||||
handler:Register (handler.check_demosave, "check_demosave")
|
||||
|
||||
handler.tab_respawn = xml:InitTab("tab_options:radio_tab_respawn_options", self)
|
||||
-- spin boxes
|
||||
handler.spin_friendly_fire = xml:InitSpinFlt("tab_options:spin_friendly_fire", self)
|
||||
handler.spin_artefacts_num = xml:InitSpinNum("tab_options:spin_artefacts_num", self)
|
||||
handler.spin_spectator = xml:InitSpinNum("tab_options:spin_spectator", self)
|
||||
handler.spin_force_respawn = xml:InitSpinNum("tab_options:spin_force_respawn", self)
|
||||
handler.spin_reinforcement = xml:InitSpinNum("tab_options:spin_reinforcement", self)
|
||||
|
||||
handler.spin_damage_block = xml:InitSpinNum("tab_options:spin_damage_block", self)
|
||||
handler.spin_artreturn_time = xml:InitSpinNum("tab_options:spin_artreturn_time", self)
|
||||
handler.check_activated_return = xml:InitCheck("tab_options:check_activated_return", self)
|
||||
handler.spin_frag_limit = xml:InitSpinNum("tab_options:spin_frag_limit", self)
|
||||
handler.spin_time_limit = xml:InitSpinNum("tab_options:spin_time_limit", self)
|
||||
handler.spin_artefact_stay = xml:InitSpinNum("tab_options:spin_artefact_stay", self)
|
||||
handler.spin_artefact_delay = xml:InitSpinNum("tab_options:spin_artefact_delay", self)
|
||||
handler.spin_anomaly_time = xml:InitSpinNum("tab_options:spin_anomaly_time", self)
|
||||
handler.spin_warm_up_time = xml:InitSpinNum("tab_options:spin_warm_up_time", self)
|
||||
|
||||
handler.check_pda_hunt = xml:InitCheck("tab_options:check_pda_hunt", self)
|
||||
|
||||
handler.spin_rate_of_change = xml:InitSpinFlt("tab_options:spin_rate_of_change", self)
|
||||
|
||||
handler.spin_weather = xml:InitComboBox("tab_options:spin_weather", self)
|
||||
|
||||
handler.check_spectator:SetDependControl(handler.spin_spectator)
|
||||
|
||||
-- handler.check_public_server:SetDependControl(handler.check_verify_cdkey)
|
||||
|
||||
--[[if (self.online) then
|
||||
-- handler.check_public_server:SetCheck(true)
|
||||
else
|
||||
-- handler.check_public_server:SetCheck(false)
|
||||
end]]
|
||||
|
||||
|
||||
end
|
||||
|
||||
function mp_options:SetGameMode(mode, handler)
|
||||
handler.spin_friendly_fire:Enable(true)
|
||||
handler.check_auto_team_balance:Enable(true)
|
||||
handler.check_auto_team_swap:Enable(true)
|
||||
handler.spin_artefacts_num:Enable(true)
|
||||
handler.spin_artefact_delay:Enable(true)
|
||||
handler.spin_artefact_stay:Enable(true)
|
||||
handler.check_friendly_indicators:Enable(true)
|
||||
handler.check_friendly_names:Enable(true)
|
||||
handler.spin_reinforcement:Enable(true)
|
||||
handler.spin_frag_limit:Enable(true)
|
||||
handler.check_spec_teamonly:Enable(true)
|
||||
|
||||
handler.spin_artreturn_time:Enable(true);
|
||||
handler.check_activated_return:Enable(true)
|
||||
|
||||
|
||||
local btn_reinforcement = handler.tab_respawn:GetButtonById("reinforcement")
|
||||
local btn_artefactcapture = handler.tab_respawn:GetButtonById("artefactcapture")
|
||||
btn_reinforcement:Enable (true)
|
||||
btn_artefactcapture:Enable (true)
|
||||
|
||||
|
||||
if GAME_TYPE.GAME_UNKNOWN ~= 0 then
|
||||
if GAME_TYPE.eGameIDDeathmatch == mode then
|
||||
handler.spin_friendly_fire:Enable(false)
|
||||
handler.check_auto_team_balance:Enable(false)
|
||||
handler.check_auto_team_swap:Enable(false)
|
||||
handler.spin_artefacts_num:Enable(false)
|
||||
handler.spin_artefact_delay:Enable(false)
|
||||
handler.spin_artefact_stay:Enable(false)
|
||||
handler.check_friendly_indicators:Enable(false)
|
||||
handler.check_friendly_names:Enable(false)
|
||||
handler.check_spec_teamonly:Enable(false)
|
||||
handler.spin_reinforcement:Enable(false)
|
||||
-- tab
|
||||
handler.tab_respawn:SetActiveTab("forcerespawn")
|
||||
btn_reinforcement:Enable(false)
|
||||
btn_artefactcapture:Enable(false)
|
||||
handler.spin_artreturn_time:Enable(false);
|
||||
handler.check_activated_return:Enable(false)
|
||||
elseif GAME_TYPE.eGameIDTeamDeathmatch == mode then
|
||||
handler.spin_artefacts_num:Enable(false)
|
||||
handler.spin_artefact_delay:Enable(false)
|
||||
handler.spin_artefact_stay:Enable(false)
|
||||
-- tab
|
||||
handler.tab_respawn:SetActiveTab("forcerespawn")
|
||||
btn_reinforcement:Enable(false)
|
||||
btn_artefactcapture:Enable(false)
|
||||
handler.spin_artreturn_time:Enable(false);
|
||||
handler.check_activated_return:Enable(false)
|
||||
elseif GAME_TYPE.eGameIDArtefactHunt == mode then
|
||||
handler.spin_frag_limit:Enable(false)
|
||||
handler.spin_artreturn_time:Enable(false);
|
||||
handler.check_activated_return:Enable(false)
|
||||
elseif GAME_TYPE.eGameIDCaptureTheArtefact == mode then
|
||||
handler.spin_artefact_delay:Enable(false)
|
||||
handler.spin_artefact_stay:Enable(false)
|
||||
handler.spin_frag_limit:Enable(false)
|
||||
end
|
||||
elseif GAME_TYPE.GAME_UNKNOWN == 0 then
|
||||
handler.spin_artreturn_time:Enable(false);
|
||||
handler.check_activated_return:Enable(false)
|
||||
if GAME_TYPE.GAME_DEATHMATCH == mode then
|
||||
handler.spin_friendly_fire:Enable(false)
|
||||
handler.check_auto_team_balance:Enable(false)
|
||||
handler.check_auto_team_swap:Enable(false)
|
||||
handler.spin_artefacts_num:Enable(false)
|
||||
handler.spin_artefact_delay:Enable(false)
|
||||
handler.spin_artefact_stay:Enable(false)
|
||||
handler.check_friendly_indicators:Enable(false)
|
||||
handler.check_friendly_names:Enable(false)
|
||||
handler.check_spec_teamonly:Enable(false)
|
||||
handler.spin_reinforcement:Enable(false)
|
||||
-- tab
|
||||
handler.tab_respawn:SetActiveTab("forcerespawn")
|
||||
btn_reinforcement:Enable(false)
|
||||
btn_artefactcapture:Enable(false)
|
||||
elseif GAME_TYPE.GAME_TEAMDEATHMATCH == mode then
|
||||
handler.spin_artefacts_num:Enable(false)
|
||||
handler.spin_artefact_delay:Enable(false)
|
||||
handler.spin_artefact_stay:Enable(false)
|
||||
-- tab
|
||||
handler.tab_respawn:SetActiveTab("forcerespawn")
|
||||
btn_reinforcement:Enable(false)
|
||||
btn_artefactcapture:Enable(false)
|
||||
elseif GAME_TYPE.GAME_ARTEFACTHUNT == mode then
|
||||
handler.spin_frag_limit:Enable(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
34
gamedata/scripts/ui_mm_opt_controls.script
Normal file
34
gamedata/scripts/ui_mm_opt_controls.script
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
class "opt_controls" (CUIWindow)
|
||||
|
||||
function opt_controls:__init() super()
|
||||
end
|
||||
|
||||
function opt_controls:__finalize()
|
||||
|
||||
end
|
||||
|
||||
function opt_controls:InitControls(x, y, xml, handler)
|
||||
|
||||
self:SetWndPos(vector2():set(x,y))
|
||||
self:SetWndSize(vector2():set(738,416))
|
||||
|
||||
self:SetAutoDelete(true)
|
||||
|
||||
-- self.bk = xml:InitFrame("frame", self)
|
||||
|
||||
xml:InitStatic ("tab_controls:cap_mousesens", self)
|
||||
xml:InitTrackBar ("tab_controls:track_mousesens", self)
|
||||
xml:InitStatic ("tab_controls:cap_mousesens_ui", self)
|
||||
xml:InitTrackBar ("tab_controls:track_mousesens_ui", self)
|
||||
xml:InitFrameLine ("tab_controls:cap_keyboardsetup", self)
|
||||
xml:InitFrameLine ("tab_controls:cap_keyboardsetup", self)
|
||||
xml:InitStatic ("tab_controls:cap_check_mouseinvert", self)
|
||||
xml:InitCheck ("tab_controls:check_mouseinvert", self)
|
||||
xml:InitKeyBinding ("tab_controls:key_binding", self)
|
||||
|
||||
local btn
|
||||
btn = xml:Init3tButton("tab_controls:btn_default", self)
|
||||
handler:Register(btn, "btn_keyb_default")
|
||||
|
||||
|
||||
end
|
||||
92
gamedata/scripts/ui_mm_opt_gameplay.script
Normal file
92
gamedata/scripts/ui_mm_opt_gameplay.script
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
class "opt_gameplay" (CUIWindow)
|
||||
|
||||
function opt_gameplay:__init() super()
|
||||
end
|
||||
|
||||
function opt_gameplay:__finalize()
|
||||
|
||||
end
|
||||
|
||||
function opt_gameplay:InitControls(x, y, xml, handler)
|
||||
|
||||
self:SetWndPos(vector2():set(x,y))
|
||||
self:SetWndSize(vector2():set(738,416))
|
||||
self:SetAutoDelete(true)
|
||||
self.scroll_v = xml:InitScrollView("main_dialog:scroll_v", self)
|
||||
|
||||
local _st
|
||||
local addControl = function(crl)
|
||||
self.scroll_v:AddWindow(crl, true)
|
||||
crl:SetAutoDelete(false)
|
||||
end
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_difficulty", _st)
|
||||
xml:InitComboBox("tab_gameplay:list_difficulty", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_lang", _st)
|
||||
xml:InitComboBox("tab_gameplay:list_lang", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_bobbing_factor", _st)
|
||||
xml:InitTrackBar("tab_gameplay:track_bobbing_factor", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_hit_slowmo", _st)
|
||||
xml:InitCheck("tab_gameplay:check_hit_slowmo", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_wpn_aim_toggle", _st)
|
||||
xml:InitCheck("tab_gameplay:check_wpn_aim_toggle", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_crosshair", _st)
|
||||
xml:InitCheck("tab_gameplay:check_crosshair", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_dyn_crosshair", _st)
|
||||
xml:InitCheck("tab_gameplay:check_dyn_crosshair", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_show_weapon", _st)
|
||||
xml:InitCheck("tab_gameplay:check_show_weapon", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_dist", _st)
|
||||
xml:InitCheck("tab_gameplay:check_dist", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_tips", _st)
|
||||
xml:InitCheck("tab_gameplay:check_tips", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_crouch_toggle", _st)
|
||||
xml:InitCheck("tab_gameplay:check_crouch_toggle", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_important_save", _st)
|
||||
xml:InitCheck("tab_gameplay:check_important_save", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_check_hud_draw", _st)
|
||||
xml:InitCheck("tab_gameplay:check_hud_draw", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_gameplay:cap_rs_fps_show", _st)
|
||||
xml:InitCheck("tab_gameplay:check_rs_fps_show", _st)
|
||||
addControl(_st)
|
||||
end
|
||||
353
gamedata/scripts/ui_mm_opt_main.script
Normal file
353
gamedata/scripts/ui_mm_opt_main.script
Normal file
|
|
@ -0,0 +1,353 @@
|
|||
class "options_dialog" (CUIScriptWnd)
|
||||
|
||||
function options_dialog:__init() super()
|
||||
|
||||
self.m_preconditions = {}
|
||||
self.m_deffer_ex = {}
|
||||
self:InitControls()
|
||||
self:InitCallBacks()
|
||||
self.tab:SetActiveTab ("video")
|
||||
end
|
||||
|
||||
function options_dialog:__finalize()
|
||||
|
||||
end
|
||||
|
||||
function options_dialog:InitControls()
|
||||
self:SetWndRect (Frect():set(0,0,1024,768))
|
||||
self:Enable (true)
|
||||
|
||||
local xml = CScriptXmlInit()
|
||||
xml:ParseFile ("ui_mm_opt.xml")
|
||||
|
||||
xml:InitStatic ("background", self)
|
||||
self.dialog = xml:InitStatic("main_dialog:dialog", self)
|
||||
|
||||
-- xml:InitStatic ("main_dialog:cap_options", self.dialog)
|
||||
|
||||
self.dlg_video = ui_mm_opt_video.opt_video()
|
||||
self.dlg_video:InitControls (0,0, xml, self)
|
||||
self.dlg_video:Show (false)
|
||||
self.dialog:AttachChild (self.dlg_video)
|
||||
xml:InitWindow ("tab_size", 0, self.dlg_video)
|
||||
|
||||
self.dlg_sound = ui_mm_opt_sound.opt_sound()
|
||||
self.dlg_sound:InitControls (0,0, xml, self)
|
||||
self.dlg_sound:Show (false)
|
||||
self.dialog:AttachChild (self.dlg_sound)
|
||||
xml:InitWindow ("tab_size", 0, self.dlg_sound)
|
||||
|
||||
self.dlg_gameplay = ui_mm_opt_gameplay.opt_gameplay()
|
||||
self.dlg_gameplay:InitControls(0,0, xml, self)
|
||||
self.dlg_gameplay:Show (false)
|
||||
self.dialog:AttachChild (self.dlg_gameplay)
|
||||
xml:InitWindow ("tab_size", 0, self.dlg_gameplay)
|
||||
|
||||
self.dlg_controls = ui_mm_opt_controls.opt_controls()
|
||||
self.dlg_controls:InitControls(0,0, xml, self)
|
||||
self.dlg_controls:Show (false)
|
||||
self.dialog:AttachChild (self.dlg_controls)
|
||||
xml:InitWindow ("tab_size", 0, self.dlg_controls)
|
||||
--[[
|
||||
self.dlg_con_cmd = ui_mm_opt_con_cmd.opt_con_cmd()
|
||||
self.dlg_con_cmd:InitControls(0,0, xml, self)
|
||||
self.dlg_con_cmd:Show (false)
|
||||
self.dialog:AttachChild (self.dlg_con_cmd)
|
||||
xml:InitWindow ("tab_size", 0, self.dlg_con_cmd)
|
||||
]]
|
||||
self.dlg_video_adv = ui_mm_opt_video_adv.opt_video_adv()
|
||||
self.dlg_video_adv:InitControls(0,0, xml, self)
|
||||
self.dlg_video_adv:Show (false)
|
||||
self.dialog:AttachChild (self.dlg_video_adv)
|
||||
xml:InitWindow ("tab_size", 0, self.dlg_video_adv)
|
||||
|
||||
local btn
|
||||
btn = xml:Init3tButton ("main_dialog:btn_accept", self.dialog)
|
||||
self:Register (btn, "btn_accept")
|
||||
btn = xml:Init3tButton ("main_dialog:btn_cancel", self.dialog)
|
||||
self:Register (btn, "btn_cancel")
|
||||
|
||||
self.tab = xml:InitTab("main_dialog:tab", self.dialog)
|
||||
self:Register (self.tab, "tab")
|
||||
|
||||
|
||||
self.message_box = CUIMessageBoxEx()
|
||||
self:Register (self.message_box, "mb")
|
||||
|
||||
self.b_restart_system_shown = false
|
||||
self.timer = nil
|
||||
|
||||
self.cap_download = xml:InitStatic ("download_static",self)
|
||||
self.text_download = xml:InitStatic ("download_text",self)
|
||||
self.download_progress = xml:InitProgressBar ("progress_download", self)
|
||||
self.btn_cancel_download = xml:Init3tButton ("btn_cancel_download", self)
|
||||
self:Register (self.btn_cancel_download, "btn_cancel_download")
|
||||
|
||||
end
|
||||
|
||||
function options_dialog:SetCurrentValues()
|
||||
local opt = COptionsManager()
|
||||
|
||||
opt:SetCurrentValues("mm_opt_video_preset")
|
||||
opt:SaveBackupValues("mm_opt_video_preset")
|
||||
|
||||
opt:SetCurrentValues("mm_opt_video")
|
||||
opt:SaveBackupValues("mm_opt_video")
|
||||
|
||||
opt:SetCurrentValues("mm_opt_video_adv")
|
||||
opt:SaveBackupValues("mm_opt_video_adv")
|
||||
|
||||
opt:SetCurrentValues("mm_opt_gameplay")
|
||||
opt:SaveBackupValues("mm_opt_gameplay")
|
||||
|
||||
opt:SetCurrentValues("mm_opt_sound")
|
||||
opt:SaveBackupValues("mm_opt_sound")
|
||||
|
||||
opt:SetCurrentValues("mm_opt_controls")
|
||||
opt:SaveBackupValues("mm_opt_controls")
|
||||
|
||||
opt:SetCurrentValues("key_binding")
|
||||
opt:SaveBackupValues("key_binding")
|
||||
|
||||
self:UpdateDependControls()
|
||||
end
|
||||
|
||||
function options_dialog:UpdateDependControls()
|
||||
self.scroll_v:Clear()
|
||||
|
||||
local current_id = self.combo_renderer:CurrentID()
|
||||
local value = self.combo_renderer:GetValueOf(current_id)
|
||||
|
||||
for _, j in pairs(self.m_preconditions) do
|
||||
if j.func(value) then
|
||||
self.scroll_v:AddWindow(j.control, true)
|
||||
j.control:SetAutoDelete(false)
|
||||
end
|
||||
end
|
||||
|
||||
for _, t in pairs(self.m_deffer_ex) do
|
||||
t.func(t.arg)
|
||||
end
|
||||
end
|
||||
|
||||
function options_dialog:InitCallBacks()
|
||||
self:AddCallback("tab", ui_events.TAB_CHANGED, self.OnTabChange, self)
|
||||
self:AddCallback("btn_advanced_graphic",ui_events.BUTTON_CLICKED, self.OnBtnAdvGraphic, self)
|
||||
self:AddCallback("btn_accept", ui_events.BUTTON_CLICKED, self.OnBtnAccept, self)
|
||||
self:AddCallback("btn_cancel", ui_events.BUTTON_CLICKED, self.OnBtnCancel, self)
|
||||
self:AddCallback("btn_default_graphic", ui_events.BUTTON_CLICKED, self.OnBtnDefGraph, self)
|
||||
self:AddCallback("btn_default_sound", ui_events.BUTTON_CLICKED, self.OnBtnDefSound, self)
|
||||
self:AddCallback("combo_preset", ui_events.LIST_ITEM_SELECT, self.OnPresetChanged, self)
|
||||
self:AddCallback("btn_simply_graphic", ui_events.BUTTON_CLICKED, self.OnSimplyGraphic, self)
|
||||
self:AddCallback("btn_keyb_default", ui_events.BUTTON_CLICKED, self.OnBtnKeybDefault, self)
|
||||
self:AddCallback("combo_renderer", ui_events.LIST_ITEM_SELECT, self.UpdateDependControls, self)
|
||||
self:AddCallback("btn_cancel_download", ui_events.BUTTON_CLICKED, self.OnBtn_CancelDownload, self)
|
||||
|
||||
self:AddCallback("mb", ui_events.MESSAGE_BOX_YES_CLICKED, self.OnApplyChanges, self)
|
||||
self:AddCallback("mb", ui_events.MESSAGE_BOX_NO_CLICKED, self.OnDiscardChanges,self)
|
||||
end
|
||||
|
||||
function options_dialog:OnBtnCheckUpdates()
|
||||
local console = get_console()
|
||||
console:execute ("check_for_updates 1")
|
||||
end
|
||||
|
||||
function options_dialog:OnBtnKeybDefault()
|
||||
local console = get_console()
|
||||
console:execute ("default_controls")
|
||||
|
||||
local opt = COptionsManager()
|
||||
opt:SetCurrentValues ("mm_opt_controls")
|
||||
opt:SetCurrentValues ("key_binding")
|
||||
end
|
||||
|
||||
function options_dialog:OnPresetChanged()
|
||||
local opt = COptionsManager()
|
||||
opt:SetCurrentValues ("mm_opt_video_adv")
|
||||
end
|
||||
|
||||
|
||||
function options_dialog:OnBtnDefGraph()
|
||||
local opt = COptionsManager()
|
||||
opt:SendMessage2Group("mm_opt_video","set_default_value")
|
||||
end
|
||||
|
||||
function options_dialog:OnBtnDefSound()
|
||||
local opt = COptionsManager()
|
||||
opt:SendMessage2Group("mm_opt_sound","set_default_value")
|
||||
end
|
||||
|
||||
function options_dialog:OnBtnAccept()
|
||||
|
||||
local opt = COptionsManager()
|
||||
local console = get_console()
|
||||
|
||||
console:execute("cfg_save tmp")
|
||||
|
||||
opt:SaveValues("mm_opt_video_preset")
|
||||
opt:SaveValues("key_binding")
|
||||
opt:SaveValues("mm_opt_video")
|
||||
opt:SaveValues("mm_opt_video_adv")
|
||||
opt:SaveValues("mm_opt_gameplay")
|
||||
opt:SaveValues("mm_opt_sound")
|
||||
opt:SaveValues("mm_opt_controls")
|
||||
|
||||
if opt:NeedVidRestart() then
|
||||
_G.b_discard_settings_shown = true
|
||||
self.message_box:InitMessageBox("message_box_yes_no")
|
||||
self.message_box:SetText(string.format("%s %d% s", game.translate_string("ui_mm_confirm_changes"), 15, game.translate_string("mp_si_sec")))
|
||||
self.message_box:ShowDialog(true)
|
||||
else
|
||||
self:OnApplyChanges()
|
||||
end
|
||||
|
||||
opt:OptionsPostAccept()
|
||||
|
||||
console:execute("cfg_save")
|
||||
end
|
||||
|
||||
function options_dialog:OnBtnCancel()
|
||||
local opt = COptionsManager()
|
||||
opt:UndoGroup ("mm_opt_video_preset")
|
||||
opt:UndoGroup ("mm_opt_video")
|
||||
opt:UndoGroup ("mm_opt_video_adv")
|
||||
opt:UndoGroup ("mm_opt_sound")
|
||||
opt:OptionsPostAccept ()
|
||||
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
end
|
||||
|
||||
function options_dialog:OnTabChange()
|
||||
self.dlg_video:Show (false)
|
||||
self.dlg_sound:Show (false)
|
||||
self.dlg_gameplay:Show (false)
|
||||
self.dlg_controls:Show (false)
|
||||
self.dlg_video_adv:Show (false)
|
||||
|
||||
local ids = self.tab:GetActiveId()
|
||||
if ids == "video" then
|
||||
self.dlg_video:Show(true)
|
||||
elseif ids == "sound" then
|
||||
self.dlg_sound:Show(true)
|
||||
elseif ids == "gameplay" then
|
||||
self.dlg_gameplay:Show(true)
|
||||
elseif ids == "controls" then
|
||||
self.dlg_controls:Show(true)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function options_dialog:OnBtnAdvGraphic()
|
||||
self.dlg_video:Show (false)
|
||||
self.dlg_video_adv:Show (true)
|
||||
end
|
||||
|
||||
function options_dialog:OnSimplyGraphic()
|
||||
self.dlg_video:Show (true)
|
||||
self.dlg_video_adv:Show (false)
|
||||
end
|
||||
|
||||
function options_dialog:OnKeyboard(dik, keyboard_action)
|
||||
local res = CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
|
||||
|
||||
if res==false then
|
||||
|
||||
local bind = dik_to_bind(dik)
|
||||
|
||||
if keyboard_action == ui_events.WINDOW_KEY_PRESSED then
|
||||
if dik == DIK_keys.DIK_ESCAPE then
|
||||
if self.dlg_video_adv:IsShown() then
|
||||
self.dlg_video_adv:Show (false)
|
||||
self.dlg_video:Show (true)
|
||||
else
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
function options_dialog:Update()
|
||||
CUIScriptWnd.Update(self)
|
||||
|
||||
local mm = main_menu.get_main_menu()
|
||||
local sss = mm:GetPatchProgress()
|
||||
|
||||
if sss:GetInProgress() then
|
||||
self.text_download:Show (true)
|
||||
self.cap_download:Show (true)
|
||||
self.download_progress:Show (true)
|
||||
local _progr = sss:GetProgress()
|
||||
self.download_progress:SetProgressPos (_progr)
|
||||
local str = string.format("%.0f%%(%s)",_progr,sss:GetFlieName())
|
||||
self.text_download:TextControl():SetText (str)
|
||||
self.btn_cancel_download:Show (true)
|
||||
else
|
||||
self.text_download:Show (false)
|
||||
self.cap_download:Show (false)
|
||||
self.download_progress:Show (false)
|
||||
self.btn_cancel_download:Show (false)
|
||||
end
|
||||
if(_G.b_discard_settings_shown) then
|
||||
local tg = math.floor(time_global_async()/1000)
|
||||
if(self.timer==nil) then
|
||||
self.timer = tg
|
||||
end
|
||||
self.message_box:SetText(string.format("%s %d %s", game.translate_string("ui_mm_confirm_changes"), 15-(tg-self.timer), game.translate_string("mp_si_sec")))
|
||||
if(tg-self.timer>=15) then
|
||||
self.message_box:HideDialog()
|
||||
self:OnDiscardChanges()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function options_dialog:OnBtn_CancelDownload()
|
||||
local mm = main_menu.get_main_menu()
|
||||
mm:CancelDownload()
|
||||
end
|
||||
|
||||
function options_dialog:OnApplyChanges()
|
||||
self.timer = nil
|
||||
_G.b_discard_settings_shown = false
|
||||
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
|
||||
if false==self.b_restart_system_shown then
|
||||
local opt = COptionsManager()
|
||||
if opt:NeedSystemRestart() then
|
||||
self.b_restart_system_shown = true
|
||||
self.message_box:InitMessageBox("message_box_restart_game")
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function options_dialog:OnDiscardChanges()
|
||||
self.timer = nil
|
||||
_G.b_discard_settings_shown = false
|
||||
|
||||
local c = get_console()
|
||||
c:execute("cfg_load tmp")
|
||||
|
||||
self:SetCurrentValues()
|
||||
|
||||
c:execute("vid_restart")
|
||||
c:execute("cfg_save")
|
||||
end
|
||||
|
||||
function options_dialog:OnMenuReloaded()
|
||||
if(_G.b_discard_settings_shown) then
|
||||
self.message_box:InitMessageBox("message_box_yes_no")
|
||||
self.message_box:SetText(string.format("%s %d% s", game.translate_string("ui_mm_confirm_changes"), 15, game.translate_string("mp_si_sec")))
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
end
|
||||
49
gamedata/scripts/ui_mm_opt_sound.script
Normal file
49
gamedata/scripts/ui_mm_opt_sound.script
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
class "opt_sound" (CUIWindow)
|
||||
|
||||
function opt_sound:__init() super()
|
||||
end
|
||||
|
||||
function opt_sound:__finalize()
|
||||
|
||||
end
|
||||
|
||||
function opt_sound:InitControls(x, y, xml, handler)
|
||||
|
||||
self:SetWndPos(vector2():set(x,y))
|
||||
self:SetWndSize(vector2():set(738,416))
|
||||
self:SetAutoDelete(true)
|
||||
self.scroll_v = xml:InitScrollView("main_dialog:scroll_v", self)
|
||||
|
||||
local _st
|
||||
local addControl = function(crl)
|
||||
self.scroll_v:AddWindow(crl, true)
|
||||
crl:SetAutoDelete(false)
|
||||
end
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_sound:cap_mastervolume", _st)
|
||||
xml:InitTrackBar("tab_sound:track_mastervolume", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_sound:cap_musicvolume", _st)
|
||||
xml:InitTrackBar("tab_sound:track_musicvolume", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_sound:cap_snd_device", _st)
|
||||
xml:InitComboBox("tab_sound:list_snd_device", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitCheck("tab_sound:check_dynamic_music", _st)
|
||||
xml:InitStatic("tab_sound:cap_check_dynamic_music", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_sound:cap_check_eax", _st)
|
||||
xml:InitCheck("tab_sound:check_eax", _st)
|
||||
addControl(_st)
|
||||
|
||||
|
||||
end
|
||||
77
gamedata/scripts/ui_mm_opt_video.script
Normal file
77
gamedata/scripts/ui_mm_opt_video.script
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
class "opt_video" (CUIWindow)
|
||||
|
||||
function opt_video:__init() super()
|
||||
end
|
||||
|
||||
function opt_video:__finalize()
|
||||
|
||||
end
|
||||
|
||||
function opt_video:InitControls(x, y, xml, handler)
|
||||
|
||||
self:SetWndPos(vector2():set(x,y))
|
||||
self:SetWndSize(vector2():set(738,416))
|
||||
self:SetAutoDelete(true)
|
||||
self.scroll_v = xml:InitScrollView("main_dialog:scroll_v", self)
|
||||
|
||||
local _st
|
||||
local addControl = function(crl)
|
||||
self.scroll_v:AddWindow(crl, true)
|
||||
crl:SetAutoDelete(false)
|
||||
end
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_renderer", _st)
|
||||
handler.combo_renderer = xml:InitComboBox("tab_video:list_renderer", _st)
|
||||
handler:Register(handler.combo_renderer, "combo_renderer")
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_preset", _st)
|
||||
handler.combo_preset = xml:InitComboBox("tab_video:list_presets", _st)
|
||||
handler:Register(handler.combo_preset, "combo_preset")
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_resolution",_st)
|
||||
xml:InitComboBox("tab_video:list_resolution",_st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_brightness", _st)
|
||||
xml:InitTrackBar("tab_video:track_brightness", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_contrast", _st)
|
||||
xml:InitTrackBar("tab_video:track_contrast", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_gamma", _st)
|
||||
xml:InitTrackBar("tab_video:track_gamma", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic ("tab_video:cap_fullscreen", _st)
|
||||
xml:InitCheck ("tab_video:check_fullscreen", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_rs_device_active", _st)
|
||||
xml:InitCheck("tab_video:check_rs_device_active", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_vsync", _st)
|
||||
xml:InitCheck("tab_video:check_vsync", _st)
|
||||
addControl(_st)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("tab_video:cap_screenshot_format", _st)
|
||||
xml:InitComboBox("tab_video:list_screenshot_format", _st)
|
||||
addControl(_st)
|
||||
|
||||
btn = xml:Init3tButton("tab_video:btn_advanced", self)
|
||||
handler:Register(btn, "btn_advanced_graphic")
|
||||
end
|
||||
414
gamedata/scripts/ui_mm_opt_video_adv.script
Normal file
414
gamedata/scripts/ui_mm_opt_video_adv.script
Normal file
|
|
@ -0,0 +1,414 @@
|
|||
class "opt_video_adv" (CUIWindow)
|
||||
function opt_video_adv:__init() super()
|
||||
end
|
||||
|
||||
function opt_video_adv:__finalize()
|
||||
end
|
||||
|
||||
function all_modes(render_id)
|
||||
return true
|
||||
end
|
||||
|
||||
function mode_1(id)
|
||||
return id == "renderer_r1"
|
||||
end
|
||||
|
||||
function mode_2(id)
|
||||
return id ~= "renderer_r1"
|
||||
end
|
||||
|
||||
function mode_4(id)
|
||||
return id == "renderer_r4"
|
||||
end
|
||||
|
||||
function opt_video_adv:InitControls(x, y, xml, handler)
|
||||
self:SetWndPos(vector2():set(x,y))
|
||||
self:SetWndSize(vector2():set(738,416))
|
||||
self:SetAutoDelete(true)
|
||||
|
||||
self.scroll_v = xml:InitScrollView("video_adv:scroll_v", self)
|
||||
handler.scroll_v = self.scroll_v
|
||||
|
||||
btn = xml:Init3tButton("video_adv:btn_to_simply", self)
|
||||
handler:Register(btn, "btn_simply_graphic")
|
||||
|
||||
local ctl = nil
|
||||
local _st = nil
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
local lineFrame = function (prec, text)
|
||||
local static = xml:InitStatic("video_adv:templ_item", nil)
|
||||
local temp = xml:InitFrameLine("video_adv:header_setup", static)
|
||||
local tempText = xml:InitTextWnd("video_adv:cap_header_setup", temp)
|
||||
table.insert(handler.m_preconditions, {func=prec, control=static})
|
||||
tempText:SetTextST(text)
|
||||
end
|
||||
|
||||
local reloadControls = function()
|
||||
local pos = handler.scroll_v:GetCurrentScrollPos()
|
||||
handler:UpdateDependControls()
|
||||
handler.scroll_v:SetScrollPos(pos)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(all_modes, "st_common_settings")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_detail_density", _st)
|
||||
xml:InitTrackBar("video_adv:track_detail_density", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_detail_radius", _st)
|
||||
xml:InitTrackBar("video_adv:track_detail_radius", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_vis_dist", _st)
|
||||
xml:InitTrackBar("video_adv:track_vis_dist", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_geometry_lod", _st)
|
||||
xml:InitTrackBar("video_adv:track_geometry_lod", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(all_modes, "st_surface_options")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_texture_lod", _st)
|
||||
ctl = xml:InitTrackBar("video_adv:track_texture_lod", _st)
|
||||
handler.texture_lod_track = ctl
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_aniso", _st)
|
||||
xml:InitTrackBar("video_adv:track_aniso", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r1_detail_textures", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r1_detail_textures", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_1, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_detail_bump", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r2_detail_bump", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_steep_parallax", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r2_steep_parallax", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r4_tessellation", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r4_tessellation", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(all_modes, "st_aa_options")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r_scale_mode", _st)
|
||||
ctl = xml:InitComboBox("video_adv:list_r_scale_mode", _st)
|
||||
|
||||
handler:Register(ctl, "scaleMode")
|
||||
handler.scaleMode = ctl
|
||||
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
handler:AddCallback("scaleMode", ui_events.LIST_ITEM_SELECT, reloadControls, nil)
|
||||
|
||||
local scalePresetPrec = function(id)
|
||||
if mode_4(id) then
|
||||
local current_id = handler.scaleMode:CurrentID()
|
||||
if current_id > 1 then
|
||||
return true
|
||||
end
|
||||
-- get_console():execute("vid_scale_preset st_scale_custom")
|
||||
-- handler.scalePreset:SetCurrentOptValue()
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r_scale_preset", _st)
|
||||
ctl = xml:InitComboBox("video_adv:list_r_scale_preset", _st)
|
||||
|
||||
handler:Register(ctl, "scalePreset")
|
||||
handler.scalePreset = ctl
|
||||
|
||||
table.insert(handler.m_preconditions, {func=scalePresetPrec, control=_st})
|
||||
handler:AddCallback("scalePreset", ui_events.LIST_ITEM_SELECT, reloadControls, nil)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_vid_scale", _st)
|
||||
ctl = xml:InitTrackBar("video_adv:track_vid_scale", _st)
|
||||
|
||||
local vidScalePrec = function(id)
|
||||
if mode_4(id) then
|
||||
local scale_mode = handler.scaleMode:CurrentID()
|
||||
if scale_mode > 1 then
|
||||
local scale_preset = handler.scalePreset:CurrentID()
|
||||
local value = handler.scalePreset:GetValueOf(scale_preset)
|
||||
return value == "st_scale_custom"
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
table.insert(handler.m_preconditions, {func=vidScalePrec, control=_st})
|
||||
|
||||
local typeAAPrec = function(id)
|
||||
if mode_4(id) then
|
||||
local current_id = handler.scaleMode:CurrentID()
|
||||
if current_id > 1 then
|
||||
handler.hashedAplha:Enable(true)
|
||||
return false
|
||||
end
|
||||
handler.hashedAplha:Enable(false)
|
||||
handler.hashedAplha:SetCheck(false)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r_type_aa", _st)
|
||||
ctl = xml:InitComboBox("video_adv:list_r_type_aa", _st)
|
||||
table.insert(handler.m_preconditions, {func=typeAAPrec, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_cas_sharpening", _st)
|
||||
xml:InitTrackBar("video_adv:track_cas_sharpening", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r4_hashed_aref", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r4_hashed_aref", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
handler.hashedAplha = ctl
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(all_modes, "st_lights_options")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_particles_distance", _st)
|
||||
ctl = xml:InitTrackBar("video_adv:track_particles_distance", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_light_distance", _st)
|
||||
ctl = xml:InitTrackBar("video_adv:track_light_distance", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_npc_torch", _st)
|
||||
xml:InitCheck("video_adv:check_npc_torch", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_volumetric_light", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_volumetric_light", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r4_hud_shadows", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r4_hud_shadows", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r_actor_shadow", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r_actor_shadow", _st)
|
||||
table.insert(handler.m_preconditions, {func=all_modes, control=_st})
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(mode_2, "st_sunlight_options")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_sun", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r2_sun", _st)
|
||||
|
||||
handler:Register(ctl, "enableSun")
|
||||
handler.enableSun = ctl
|
||||
|
||||
local sunTable = {}
|
||||
local enableSunFunc = function(id)
|
||||
if mode_2(id) then
|
||||
for _, control in pairs(sunTable) do
|
||||
control:Enable(handler.enableSun:GetCheck())
|
||||
if control.GetCheck then
|
||||
control:SetCheck(control:GetCheck() and handler.enableSun:GetCheck())
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
table.insert(handler.m_preconditions, {func=enableSunFunc, control=_st})
|
||||
handler:AddCallback("enableSun", ui_events.BUTTON_CLICKED, reloadControls, nil)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_sun_details", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r2_sun_details", _st)
|
||||
|
||||
table.insert(sunTable, ctl)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_lights_details", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r2_lights_details", _st)
|
||||
|
||||
table.insert(sunTable, ctl)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_cloud_shadows", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r2_cloud_shadows", _st)
|
||||
|
||||
table.insert(sunTable, ctl)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r2_sun_quality", _st)
|
||||
ctl = xml:InitComboBox("video_adv:list_r2_sun_quality", _st)
|
||||
|
||||
table.insert(sunTable, ctl)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_sun_shafts", _st)
|
||||
ctl = xml:InitComboBox("video_adv:combo_sun_shafts", _st)
|
||||
|
||||
table.insert(sunTable, ctl)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_smap_size", _st)
|
||||
ctl = xml:InitComboBox("video_adv:combo_smap_size", _st)
|
||||
handler.combo_smap_size = ctl
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(mode_2, "st_effects_options")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_ao", _st)
|
||||
ctl = xml:InitComboBox("video_adv:combo_ao_options", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_soft_water", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_soft_water", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_soft_particles", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_soft_particles", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r3_dynamic_wet_surfaces", _st)
|
||||
ctl = xml:InitCheck ("video_adv:check_r3_dynamic_wet_surfaces", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_sslr_water", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_sslr_water", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r3_volumetric_smoke", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r3_volumetric_smoke", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_r4_puddles", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_r4_puddles", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_4, control=_st})
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
lineFrame(mode_2, "st_postprocess_options")
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_vignette", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_vignette", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_aberration", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_aberration", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_saturation", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_saturation", _st)
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_dof", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_dof", _st)
|
||||
|
||||
handler:Register(ctl, "enableDof")
|
||||
handler.enableDof = ctl
|
||||
|
||||
table.insert(handler.m_preconditions, {func=mode_2, control=_st})
|
||||
handler:AddCallback("enableDof", ui_events.BUTTON_CLICKED, reloadControls, nil)
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_dof_reload", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_dof_reload", _st)
|
||||
handler.reloadDof = ctl
|
||||
|
||||
local enableReloadDofFunc = function(id)
|
||||
if mode_2(id) then
|
||||
handler.reloadDof:Enable(handler.enableDof:GetCheck())
|
||||
handler.reloadDof:SetCheck(handler.reloadDof:GetCheck() and handler.enableDof:GetCheck())
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
table.insert(handler.m_preconditions, {func=enableReloadDofFunc, control=_st})
|
||||
|
||||
_st = xml:InitStatic("video_adv:templ_item", nil)
|
||||
xml:InitStatic("video_adv:cap_dof_talk", _st)
|
||||
ctl = xml:InitCheck("video_adv:check_dof_talk", _st)
|
||||
handler.talkDof = ctl
|
||||
|
||||
local enableTalkDofFunc = function(id)
|
||||
if mode_2(id) then
|
||||
handler.talkDof:Enable(handler.enableDof:GetCheck())
|
||||
handler.talkDof:SetCheck(handler.talkDof:GetCheck() and handler.enableDof:GetCheck())
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
table.insert(handler.m_preconditions, {func=enableTalkDofFunc, control=_st})
|
||||
end
|
||||
628
gamedata/scripts/ui_mp_main.script
Normal file
628
gamedata/scripts/ui_mp_main.script
Normal file
|
|
@ -0,0 +1,628 @@
|
|||
-- file: UI_MP_MAIN.SCRIPT
|
||||
-- description: MP dialog with Join Game/Create Server/Options
|
||||
-- created: 26.04.2005
|
||||
-- author: Serge Vynnychenko
|
||||
-- mail: narrator@gsc-game.kiev.ua
|
||||
--
|
||||
-- copyright 2005 GSC Game World
|
||||
|
||||
class "mp_main" (CUIScriptWnd)
|
||||
|
||||
function mp_main:__init() super()
|
||||
self:InitControls()
|
||||
self:InitCallBacks()
|
||||
self.tab:SetActiveTab("client")
|
||||
end
|
||||
|
||||
function mp_main:__finalize()
|
||||
|
||||
end
|
||||
|
||||
|
||||
function mp_main:InitControls()
|
||||
|
||||
self:SetWndRect (Frect():set(0,0,1024,768))
|
||||
|
||||
local xml = CScriptXmlInit()
|
||||
xml:ParseFile ("ui_mm_mp.xml")
|
||||
|
||||
|
||||
local bk = xml:InitStatic("background", self)
|
||||
self:Enable (true)
|
||||
local wrk_area = CUIWindow()
|
||||
xml:InitWindow ("wrk_area", 0, wrk_area)
|
||||
wrk_area:SetAutoDelete (true)
|
||||
self:AttachChild (wrk_area)
|
||||
|
||||
self.player_name = xml:InitMPPlayerName("edit_player_name", wrk_area)
|
||||
xml:InitStatic ("cap_mode", wrk_area)
|
||||
|
||||
self.dlg_join = ui_mm_mp_join.mp_join()
|
||||
self.dlg_join:InitControls (0,0, xml, self)
|
||||
wrk_area:AttachChild (self.dlg_join)
|
||||
|
||||
self.dlg_options = ui_mm_mp_options.mp_options()
|
||||
self.dlg_options:InitControls (0,0, xml, self)
|
||||
self.dlg_options:Show (false)
|
||||
wrk_area:AttachChild (self.dlg_options)
|
||||
|
||||
self.dlg_server = ui_mm_mp_server.mp_server()
|
||||
self.dlg_server:InitControls (0,0, xml, self)
|
||||
self.dlg_server:Show (false)
|
||||
wrk_area:AttachChild (self.dlg_server)
|
||||
|
||||
self.dlg_demo = ui_mm_mp_demo.mp_demo()
|
||||
self.dlg_demo:InitControls (0,0, xml, self)
|
||||
self.dlg_demo:Show (false)
|
||||
wrk_area:AttachChild (self.dlg_demo)
|
||||
|
||||
|
||||
btn = xml:Init3tButton("btn_create", wrk_area)
|
||||
self:Register (btn, "btn_create")
|
||||
self.btn_create = btn
|
||||
btn:Enable (false)
|
||||
|
||||
btn = xml:Init3tButton("btn_play_demo", wrk_area)
|
||||
self:Register (btn, "btn_play_demo")
|
||||
self.btn_play_demo = btn
|
||||
btn:Enable (false)
|
||||
|
||||
btn = xml:Init3tButton("btn_join", wrk_area)
|
||||
self:Register (btn, "btn_join")
|
||||
self.btn_join = btn
|
||||
|
||||
btn = xml:Init3tButton("btn_cancel", wrk_area)
|
||||
self:Register (btn, "btn_cancel")
|
||||
|
||||
self.tab = xml:InitTab("tab",wrk_area)
|
||||
self:Register (self.tab, "tab")
|
||||
|
||||
self.message_box = CUIMessageBoxEx()
|
||||
self:Register (self.message_box, "msg_box")
|
||||
|
||||
self.cap_download = xml:InitStatic ("download_static", wrk_area)
|
||||
self.text_download = xml:InitStatic ("download_text", wrk_area)
|
||||
self.download_progress = xml:InitProgressBar ("progress_download", wrk_area)
|
||||
self.btn_cancel_download = xml:Init3tButton ("btn_cancel_download", wrk_area)
|
||||
self:Register (self.btn_cancel_download, "btn_cancel_download")
|
||||
|
||||
-- xml:InitStatic ("static_gs_logo",self)
|
||||
|
||||
local _ver = xml:InitStatic ("static_version",self)
|
||||
local mm = main_menu.get_main_menu()
|
||||
_ver:TextControl():SetText ("ver. " .. mm:GetGSVer())
|
||||
|
||||
self.player_name:SetText ( mm:GetPlayerName() )
|
||||
|
||||
self.server_list:SetConnectionErrCb(connect_error_cb(self, mp_main.OnConnectError))
|
||||
end
|
||||
|
||||
function mp_main:UpdateControls()
|
||||
local opt = COptionsManager()
|
||||
opt:SetCurrentValues("mm_mp_client")
|
||||
opt:SetCurrentValues("mm_mp_server")
|
||||
opt:SetCurrentValues("mm_mp_srv_filter")
|
||||
|
||||
opt:SaveBackupValues("mm_mp_client")
|
||||
opt:SaveBackupValues("mm_mp_server")
|
||||
opt:SaveBackupValues("mm_mp_srv_filter")
|
||||
|
||||
self.map_list:ClearList()
|
||||
self.map_list:OnModeChange()
|
||||
self.dlg_options:SetGameMode(self.map_list:GetCurGameType(), self)
|
||||
|
||||
local mm = main_menu.get_main_menu()
|
||||
|
||||
self.player_name:SetText ( mm:GetPlayerName() )
|
||||
|
||||
self:OnGameModeChange()
|
||||
|
||||
if( level.present() ) then
|
||||
self.btn_create:Enable (false)
|
||||
self.btn_join:Enable (false)
|
||||
self.btn_direct_ip:Enable(false)
|
||||
self.tab:Enable (false)
|
||||
self.cdkey:Enable (false)
|
||||
self.player_name:Enable (false)
|
||||
end
|
||||
end
|
||||
|
||||
function mp_main:InitCallBacks()
|
||||
self:AddCallback("btn_cancel", ui_events.BUTTON_CLICKED, self.OnBtn_Calncel, self)
|
||||
self:AddCallback("btn_create", ui_events.BUTTON_CLICKED, self.OnBtn_Create, self)
|
||||
self:AddCallback("btn_join", ui_events.BUTTON_CLICKED, self.OnBtn_Join, self)
|
||||
|
||||
self:AddCallback("check_empty", ui_events.BUTTON_CLICKED, self.OnFilterChange,self)
|
||||
self:AddCallback("check_full", ui_events.BUTTON_CLICKED, self.OnFilterChange,self)
|
||||
self:AddCallback("check_with_pass", ui_events.BUTTON_CLICKED, self.OnFilterChange,self)
|
||||
self:AddCallback("check_without_pass", ui_events.BUTTON_CLICKED, self.OnFilterChange,self)
|
||||
self:AddCallback("check_without_ff", ui_events.BUTTON_CLICKED, self.OnFilterChange,self)
|
||||
self:AddCallback("check_listen_servers",ui_events.BUTTON_CLICKED, self.OnFilterChange,self)
|
||||
|
||||
self:AddCallback("btn_direct_ip", ui_events.BUTTON_CLICKED, self.OnBtn_DirectIP,self)
|
||||
|
||||
-- ui_mm_mp_options
|
||||
self:AddCallback("spin_game_mode", ui_events.LIST_ITEM_SELECT, self.OnGameModeChange,self)
|
||||
|
||||
self:AddCallback("tab", ui_events.TAB_CHANGED, self.OnTabChange, self)
|
||||
-- ui_mm_mp_join
|
||||
self:AddCallback("btn_refresh", ui_events.BUTTON_CLICKED, self.OnBtn_Refresh, self)
|
||||
self:AddCallback("btn_quick_refresh", ui_events.BUTTON_CLICKED, self.OnBtn_RefreshQuick,self)
|
||||
self:AddCallback("btn_server_info", ui_events.BUTTON_CLICKED, self.OnBtn_SrvInfo,self)
|
||||
self:AddCallback("radio_net_conn", ui_events.TAB_CHANGED, self.OnRadio_NetChanged,self)
|
||||
|
||||
-- msg_box
|
||||
self:AddCallback("msg_box", ui_events.MESSAGE_BOX_YES_CLICKED, self.OnDirectIP_yes,self)
|
||||
|
||||
self:AddCallback("edit_cd_key", ui_events.EDIT_TEXT_COMMIT, self.OnCDKeyChanged, self)
|
||||
self:AddCallback("edit_player_name", ui_events.EDIT_TEXT_COMMIT, self.OnPlayerNameChanged, self)
|
||||
|
||||
self:AddCallback("btn_cancel_download", ui_events.BUTTON_CLICKED, self.OnBtn_CancelDownload, self)
|
||||
-- demo playing
|
||||
|
||||
self:AddCallback("demo_list_window", ui_events.LIST_ITEM_CLICKED, self.dlg_demo.SelectDemoFile, self.dlg_demo)
|
||||
self:AddCallback("demo_list_window", ui_events.WINDOW_LBUTTON_DB_CLICK, self.dlg_demo.PlaySelectedDemo, self.dlg_demo)
|
||||
|
||||
self:AddCallback("btn_play_demo", ui_events.BUTTON_CLICKED, self.dlg_demo.PlaySelectedDemo, self.dlg_demo)
|
||||
self:AddCallback("demo_file_name", ui_events.EDIT_TEXT_COMMIT, self.dlg_demo.OnRenameDemo, self.dlg_demo)
|
||||
self:AddCallback("demo_message_box", ui_events.MESSAGE_BOX_YES_CLICKED, self.dlg_demo.OnMsgBoxYes, self.dlg_demo)
|
||||
self:AddCallback("demo_message_box", ui_events.MESSAGE_BOX_OK_CLICKED, self.dlg_demo.OnMsgBoxYes, self.dlg_demo)
|
||||
|
||||
self:AddCallback("check_demosave", ui_events.BUTTON_CLICKED, self.OnDemoSaveChange, self)
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_DirectIP()
|
||||
|
||||
self.message_box:InitMessageBox("message_box_direct_ip")
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
|
||||
function mp_main:OnDirectIP_yes()
|
||||
|
||||
if (string.len(self.message_box:GetHost()) ~= 0) then
|
||||
local cmd = "start client(" .. self.message_box:GetHost() .. "/name=" .. self.player_name:GetText() .. "/psw=" .. self.message_box:GetPassword() .. ")"
|
||||
local console = get_console()
|
||||
console:execute(cmd)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function mp_main:OnCDKeyChanged()
|
||||
local cmdstr = ""
|
||||
tmp = self.cdkey:GetText()
|
||||
|
||||
if tmp=="" then
|
||||
tmp = "clear"
|
||||
end
|
||||
|
||||
cmdstr = "cdkey " .. tmp
|
||||
local console = get_console()
|
||||
console:execute(cmdstr)
|
||||
end
|
||||
|
||||
function mp_main:OnPlayerNameChanged()
|
||||
local tmp = self.player_name:GetText()
|
||||
local cmdstr = "name " .. tmp
|
||||
local console = get_console()
|
||||
console:execute(cmdstr)
|
||||
end
|
||||
|
||||
function mp_main:ChangeNickOperationResult(profile, descr)
|
||||
-- assert(profile)
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_SrvInfo()
|
||||
self.server_list:ShowServerInfo()
|
||||
end
|
||||
|
||||
function mp_main:OnGameModeChange()
|
||||
self.map_list:OnModeChange()
|
||||
self.dlg_options:SetGameMode(self.map_list:GetCurGameType(), self)
|
||||
end
|
||||
|
||||
function mp_main:OnFilterChange()
|
||||
local sf = SServerFilters()
|
||||
sf.empty = self.filters.btn_check_empty:GetCheck()
|
||||
sf.full = self.filters.btn_check_full:GetCheck()
|
||||
sf.with_pass = self.filters.btn_check_with_pass:GetCheck()
|
||||
sf.without_pass = self.filters.btn_check_without_pass:GetCheck()
|
||||
sf.without_ff = self.filters.btn_check_without_ff:GetCheck()
|
||||
sf.listen_servers = self.filters.btn_check_listen_servers:GetCheck()
|
||||
|
||||
self.server_list:SetFilters(sf)
|
||||
|
||||
end
|
||||
|
||||
function mp_main:OnDemoSaveChange()
|
||||
local console = get_console()
|
||||
if (self.check_demosave:GetCheck()) then
|
||||
console:execute("cl_mpdemosave 1")
|
||||
else
|
||||
console:execute("cl_mpdemosave 0")
|
||||
end
|
||||
end
|
||||
|
||||
function mp_main:OnTabChange()
|
||||
self.dlg_join:Show(false)
|
||||
self.dlg_options:Show(false)
|
||||
self.dlg_server:Show(false)
|
||||
self.dlg_demo:Show(false)
|
||||
|
||||
self.btn_join:Show(false)
|
||||
self.btn_create:Show(false)
|
||||
self.btn_play_demo:Show(false)
|
||||
|
||||
local i = self.tab:GetActiveId()
|
||||
if i == "client" then
|
||||
self.dlg_join:Show(true)
|
||||
self.btn_join:Show(true)
|
||||
elseif i == "options" then
|
||||
self.dlg_options:Show(true)
|
||||
self.btn_create:Show(true)
|
||||
elseif i == "server" then
|
||||
self.map_list:LoadMapList()
|
||||
self.map_list:OnModeChange()
|
||||
self.dlg_server:Show(true)
|
||||
self.btn_create:Show(true)
|
||||
elseif i == "demo" then
|
||||
self.dlg_demo:FillList()
|
||||
self.dlg_demo:Show(true)
|
||||
self.btn_play_demo:Show(true)
|
||||
end
|
||||
end
|
||||
|
||||
function mp_main:OnRadio_NetChanged()
|
||||
local i = self.radio_net_connection:GetActiveId()
|
||||
self.server_list:NetRadioChanged(i~="internet")
|
||||
|
||||
if i == "internet" then
|
||||
self.server_list:RefreshList(false)
|
||||
else
|
||||
self.server_list:RefreshList(true)
|
||||
end
|
||||
|
||||
self:OnFilterChange()
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_Refresh()
|
||||
local i = self.radio_net_connection:GetActiveId()
|
||||
if i == "internet" then
|
||||
self.server_list:RefreshList(false)
|
||||
else
|
||||
self.server_list:RefreshList(true)
|
||||
end
|
||||
self:OnFilterChange()
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_RefreshQuick()
|
||||
self.server_list:RefreshQuick()
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_Calncel()
|
||||
local opt = COptionsManager()
|
||||
opt:UndoGroup("mm_mp_client")
|
||||
opt:UndoGroup("mm_mp_server")
|
||||
opt:UndoGroup("mm_mp_srv_filter")
|
||||
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show (true)
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_Create()
|
||||
if self.map_list:IsEmpty() then
|
||||
self.message_box:InitMessageBox("select_map")
|
||||
self.message_box:ShowDialog(true)
|
||||
return
|
||||
end
|
||||
|
||||
local mm = main_menu.get_main_menu()
|
||||
|
||||
local opt = COptionsManager()
|
||||
local console = get_console()
|
||||
opt:SaveValues("mm_mp_server")
|
||||
opt:SaveValues("mm_mp_client")
|
||||
opt:SaveValues("mm_mp_srv_filter")
|
||||
self.map_list:SaveMapList()
|
||||
self:GatherServerData()
|
||||
if self.check_dedicated:GetCheck() then
|
||||
self.map_list:StartDedicatedServer()
|
||||
else
|
||||
local command = self.map_list:GetCommandLine(self.player_name:GetText())
|
||||
console:execute("main_menu off")
|
||||
console:execute(command)
|
||||
end
|
||||
end
|
||||
|
||||
function mp_main:GatherServerData()
|
||||
local cmdstr = ""
|
||||
local tmp;
|
||||
|
||||
-- server name ------------------------------------------------------------------
|
||||
tmp = self.edit_server_name:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = "/hname=" .. tmp
|
||||
end
|
||||
-- password ---------------------------------------------------------------------
|
||||
tmp = self.edit_password:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/psw=" .. tmp
|
||||
end
|
||||
-- max players ------------------------------------------------------------------
|
||||
tmp = self.spin_max_players:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/maxplayers=" .. tmp
|
||||
end
|
||||
-- public server ----------------------------------------------------------------
|
||||
tmp = self.check_public_server:GetCheck()
|
||||
if true == tmp then
|
||||
cmdstr = cmdstr .. "/public=1"
|
||||
end
|
||||
|
||||
tmp = self.spin_max_ping:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/maxping=" .. tmp
|
||||
end
|
||||
|
||||
-- spectator --------------------------------------------------------------------
|
||||
if self.check_spectator:GetCheck() then
|
||||
tmp = self.spin_spectator:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/spectr=" .. tmp
|
||||
end
|
||||
end
|
||||
|
||||
-- spectator options --
|
||||
tmp = 0;
|
||||
if self.check_spec_freefly:GetCheck() then
|
||||
tmp = tmp + 1
|
||||
end
|
||||
if self.check_spec_firsteye:GetCheck() then
|
||||
tmp = tmp + 2
|
||||
end
|
||||
if self.check_spec_lookat:GetCheck() then
|
||||
tmp = tmp + 4
|
||||
end
|
||||
if self.check_spec_freelook:GetCheck() then
|
||||
tmp = tmp + 8
|
||||
end
|
||||
if self.check_spec_teamonly:GetCheck() then
|
||||
tmp = tmp + 16
|
||||
end
|
||||
|
||||
cmdstr = cmdstr .. "/spectrmds=" .. tmp
|
||||
|
||||
-- allow voting ------------------------------------------------------------------
|
||||
tmp = self.check_allow_voting:GetCheck()
|
||||
if true == tmp then
|
||||
cmdstr = cmdstr .. "/vote=1"
|
||||
end
|
||||
-- damage block ------------------------------------------------------------------
|
||||
tmp = self.spin_damage_block:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/dmgblock=" .. tmp
|
||||
end
|
||||
if self.check_damage_block:GetCheck() then
|
||||
cmdstr = cmdstr .. "/dmbi=1"
|
||||
end
|
||||
-- frag limit ---------------------------------------------------------------------
|
||||
tmp = self.spin_frag_limit:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/fraglimit=" .. tmp
|
||||
end
|
||||
-- time limit ---------------------------------------------------------------------
|
||||
tmp = self.spin_time_limit:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/timelimit=" .. tmp
|
||||
end
|
||||
-- friendly fire ------------------------------------------------------------------
|
||||
tmp = self.spin_friendly_fire:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/ffire=" .. tmp
|
||||
end
|
||||
-- auto team balance --------------------------------------------------------------
|
||||
if self.check_auto_team_balance:GetCheck() then
|
||||
cmdstr = cmdstr .. "/abalance=1"
|
||||
end
|
||||
-- auto team swap --------------------------------------------------------------
|
||||
if self.check_auto_team_swap:GetCheck() then
|
||||
cmdstr = cmdstr .. "/aswap=1"
|
||||
end
|
||||
-- Force respawn --------------------------------------------------------------
|
||||
if self.tab_respawn:GetActiveId() == "reinforcement" then
|
||||
tmp = self.spin_force_respawn:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/frcrspwn=" .. tmp
|
||||
end
|
||||
end
|
||||
|
||||
-- ARTEFACTHUNT only ----------------------------------------------
|
||||
if GAME_TYPE.GAME_UNKNOWN ~= 0 then
|
||||
if self.map_list:GetCurGameType() == GAME_TYPE.eGameIDArtefactHunt then
|
||||
-- number of artefacts ---------------------------------------------------------
|
||||
tmp = self.spin_artefacts_num:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/anum=" .. tmp
|
||||
end
|
||||
-- aretefact delay --------------------------------------------------------------
|
||||
tmp = self.spin_artefact_delay:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/ardelta=" .. tmp
|
||||
end
|
||||
-- artefact stay ----------------------------------------------------------------
|
||||
tmp = self.spin_artefact_stay:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/astime=" .. tmp
|
||||
end
|
||||
|
||||
if self.tab_respawn:GetActiveId() == "artefactcapture" then -- artefact capture selected
|
||||
cmdstr = cmdstr .. "/reinf=-1"
|
||||
else
|
||||
tmp = self.spin_reinforcement:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/reinf=" .. tmp
|
||||
end
|
||||
end
|
||||
end
|
||||
-- CAPTURETHEARTEFACT only ----------------------------------------------
|
||||
if self.map_list:GetCurGameType() == GAME_TYPE.eGameIDCaptureTheArtefact then
|
||||
-- number of artefacts ---------------------------------------------------------
|
||||
tmp = self.spin_artefacts_num:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/anum=" .. tmp
|
||||
end
|
||||
|
||||
tmp = self.spin_reinforcement:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/reinf=" .. tmp
|
||||
end
|
||||
|
||||
tmp = self.spin_artreturn_time:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/artrettime=" .. tmp
|
||||
end
|
||||
|
||||
if self.check_activated_return:GetCheck() then
|
||||
cmdstr = cmdstr .. "/actret=1"
|
||||
end
|
||||
end
|
||||
elseif GAME_TYPE.GAME_UNKNOWN == 0 then
|
||||
if self.map_list:GetCurGameType() == GAME_TYPE.GAME_ARTEFACTHUNT then
|
||||
-- number of artefacts ---------------------------------------------------------
|
||||
tmp = self.spin_artefacts_num:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/anum=" .. tmp
|
||||
end
|
||||
-- aretefact delay --------------------------------------------------------------
|
||||
tmp = self.spin_artefact_delay:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/ardelta=" .. tmp
|
||||
end
|
||||
-- artefact stay ----------------------------------------------------------------
|
||||
tmp = self.spin_artefact_stay:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/astime=" .. tmp
|
||||
end
|
||||
|
||||
if self.tab_respawn:GetActiveId() == "artefactcapture" then -- artefact capture selected
|
||||
cmdstr = cmdstr .. "/reinf=-1"
|
||||
else
|
||||
tmp = self.spin_reinforcement:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/reinf=" .. tmp
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- friendly indicators --------------------------------------------------------------
|
||||
if self.check_friendly_indicators:GetCheck() then
|
||||
cmdstr = cmdstr .. "/fi=1" .. tmp
|
||||
end
|
||||
-- friendly indicators --------------------------------------------------------------
|
||||
if self.check_friendly_names:GetCheck() then
|
||||
cmdstr = cmdstr .. "/fn=1" .. tmp
|
||||
end
|
||||
-- anomaly time ---------------------------------------------------------------------
|
||||
if false == self.check_no_anmalies:GetCheck() then
|
||||
tmp = self.spin_anomaly_time:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/ans=1/anslen=" .. tmp
|
||||
end
|
||||
else
|
||||
cmdstr = cmdstr .. "/ans=0"
|
||||
end
|
||||
|
||||
-- pda hunt -------------------------------------------------------------------------
|
||||
if self.check_pda_hunt:GetCheck() then
|
||||
cmdstr = cmdstr .. "/pdahunt=1"
|
||||
end
|
||||
|
||||
-- warm up time ---------------------------------------------------------------------
|
||||
tmp = self.spin_warm_up_time:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/warmup=" .. tmp
|
||||
end
|
||||
-- rate of weather change -----------------------------------------------------------
|
||||
tmp = self.spin_rate_of_change:GetText()
|
||||
if string.len(tmp) > 0 then
|
||||
cmdstr = cmdstr .. "/etimef=" .. tmp
|
||||
end
|
||||
|
||||
self.map_list:SetServerParams(cmdstr)
|
||||
end
|
||||
|
||||
function mp_main:GoToProfileTab()
|
||||
self.tab:SetActiveTab("profile")
|
||||
end
|
||||
|
||||
function mp_main:OnConnectError(err_code, descr)
|
||||
self.message_box:InitMessageBox("message_box_error")
|
||||
if (descr == "") then
|
||||
descr = "mp_gp_connect_error"
|
||||
end
|
||||
self.message_box:SetText(game.translate_string(descr))
|
||||
|
||||
--if ((err_code == CServerList.ece_unique_nick_not_registred) or
|
||||
-- (err_code == CServerList.ece_unique_nick_expired)) then
|
||||
self:GoToProfileTab()
|
||||
self.message_box:ShowDialog(true)
|
||||
|
||||
end
|
||||
|
||||
function mp_main:OnBtn_Join()
|
||||
local opt = COptionsManager()
|
||||
opt:SaveValues("mm_mp_client")
|
||||
opt:SaveValues("mm_mp_server")
|
||||
opt:SaveValues("mm_mp_srv_filter")
|
||||
|
||||
self.server_list:SetPlayerName(self.player_name:GetText())
|
||||
self.server_list:ConnectToSelected()
|
||||
end
|
||||
|
||||
function mp_main:OnKeyboard(dik, keyboard_action)
|
||||
CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
|
||||
|
||||
local bind = dik_to_bind(dik)
|
||||
local console = get_console()
|
||||
|
||||
if keyboard_action == ui_events.WINDOW_KEY_PRESSED then
|
||||
if dik == DIK_keys.DIK_ESCAPE then
|
||||
self.owner:ShowDialog(true) --new(show main window)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function mp_main:Update()
|
||||
CUIScriptWnd.Update(self)
|
||||
|
||||
local mm = main_menu.get_main_menu()
|
||||
local sss = mm:GetPatchProgress()
|
||||
|
||||
if sss:GetInProgress() then
|
||||
self.text_download:Show (true)
|
||||
self.cap_download:Show (true)
|
||||
self.download_progress:Show (true)
|
||||
local _progr = sss:GetProgress()
|
||||
self.download_progress:SetProgressPos (_progr)
|
||||
local str = string.format("%.0f%%(%s)",_progr,sss:GetFlieName())
|
||||
self.text_download:TextControl():SetText(str)
|
||||
self.btn_cancel_download:Show (true)
|
||||
else
|
||||
self.text_download:Show (false)
|
||||
self.cap_download:Show (false)
|
||||
self.download_progress:Show (false)
|
||||
self.btn_cancel_download:Show (false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function mp_main:OnBtn_CancelDownload()
|
||||
local mm = main_menu.get_main_menu()
|
||||
mm:CancelDownload()
|
||||
end
|
||||
238
gamedata/scripts/ui_save_dialog.script
Normal file
238
gamedata/scripts/ui_save_dialog.script
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
-- File: UI_SAVE_DIALOG.SCRIPT
|
||||
-- Description: Save Dialog for STALKER
|
||||
-- Created: 27.9.2004
|
||||
-- Author: Serhiy Vynnychenko (narrator@gsc-game.kiev.ua)
|
||||
-- Copyright: 2004 GSC Game World
|
||||
-- Version: 1.0
|
||||
-- Modified: Serhiy Pryshchepa (peacemaker@gsc-game.kiev.ua)
|
||||
local saved_game_extension = ui_load_dialog.saved_game_extension
|
||||
|
||||
class "save_item" (CUIListBoxItem)
|
||||
|
||||
function save_item:__init(height) super(height)
|
||||
self:SetTextColor (GetARGB(255, 170, 170, 170))
|
||||
self.fn = self:GetTextItem()
|
||||
self.fn:SetFont (GetFontLetterica18Russian())
|
||||
self.fn:SetEllipsis (true)
|
||||
end
|
||||
|
||||
class "save_dialog" (CUIScriptWnd)
|
||||
|
||||
function save_dialog:__init() super()
|
||||
self:InitControls ()
|
||||
self:InitCallBacks ()
|
||||
self:FillList ()
|
||||
end
|
||||
|
||||
function save_dialog:__finalize()
|
||||
|
||||
end
|
||||
|
||||
function save_dialog:FillList()
|
||||
self.list_box:RemoveAll()
|
||||
local flist = getFS():file_list_open_ex("$game_saves$",FS.FS_ListFiles,"*"..saved_game_extension)
|
||||
local f_cnt = flist:Size()
|
||||
|
||||
flist:Sort(FS.FS_sort_by_modif_down)
|
||||
|
||||
for it=0, f_cnt-1 do
|
||||
local file = flist:GetAt(it)
|
||||
local file_name = string.sub(file:NameFull(), 0, (string.len(file:NameFull()) - string.len(saved_game_extension)))
|
||||
local date_time = "[" .. file:ModifDigitOnly() .. "]"
|
||||
--menu_item = ..
|
||||
self:AddItemToList(file_name, date_time)
|
||||
end
|
||||
end
|
||||
|
||||
function save_dialog:InitControls()
|
||||
self:SetWndRect(Frect():set(0,0,1024,768))
|
||||
|
||||
self.list_file_font = GetFontMedium()
|
||||
self.list_date_font = GetFontMedium()
|
||||
|
||||
local xml = CScriptXmlInit()
|
||||
xml:ParseFile("ui_mm_save_dlg.xml")
|
||||
|
||||
local ctrl
|
||||
|
||||
xml:InitWindow ("background", 0, self)
|
||||
|
||||
ctrl = CUIWindow()
|
||||
xml:InitWindow ("file_item:main", 0, ctrl)
|
||||
|
||||
self.file_item_main_sz = vector2():set(ctrl:GetWidth(),ctrl:GetHeight())
|
||||
|
||||
xml:InitWindow ("file_item:fn",0,ctrl)
|
||||
self.file_item_fn_sz = vector2():set(ctrl:GetWidth(),ctrl:GetHeight())
|
||||
|
||||
xml:InitWindow ("file_item:fd",0,ctrl)
|
||||
self.file_item_fd_sz = vector2():set(ctrl:GetWidth(),ctrl:GetHeight())
|
||||
|
||||
|
||||
self.form = xml:InitStatic ("form", self)
|
||||
|
||||
xml:InitTextWnd ("form:caption", self.form)
|
||||
|
||||
self.editbox = xml:InitEditBox("form:edit", self.form)
|
||||
self:Register (self.editbox, "edit_filename")
|
||||
|
||||
xml:InitFrame ("form:list_frame", self.form)
|
||||
|
||||
self.list_box = xml:InitListBox ("form:list", self.form)
|
||||
self.list_box:ShowSelectedItem (true)
|
||||
self:Register (self.list_box, "list_window")
|
||||
|
||||
ctrl = xml:Init3tButton ("form:btn_save", self.form)
|
||||
self:Register (ctrl, "button_ok")
|
||||
|
||||
ctrl = xml:Init3tButton ("form:btn_delete", self.form)
|
||||
self:Register (ctrl, "button_del")
|
||||
|
||||
ctrl = xml:Init3tButton ("form:btn_cancel", self.form)
|
||||
self:Register (ctrl, "button_cancel")
|
||||
|
||||
self.message_box = CUIMessageBoxEx()
|
||||
self:Register (self.message_box,"message_box")
|
||||
|
||||
self.mbox_mode = 0
|
||||
end
|
||||
|
||||
function save_dialog:InitCallBacks()
|
||||
-- main frame buttons
|
||||
self:AddCallback("button_ok", ui_events.BUTTON_CLICKED, self.OnButton_ok_clicked, self)
|
||||
self:AddCallback("button_cancel", ui_events.BUTTON_CLICKED, self.OnButton_cancel_clicked, self)
|
||||
self:AddCallback("button_del", ui_events.BUTTON_CLICKED, self.OnButton_del_clicked, self)
|
||||
|
||||
self:AddCallback("message_box", ui_events.MESSAGE_BOX_YES_CLICKED, self.OnMsgYes, self)
|
||||
self:AddCallback("list_window", ui_events.LIST_ITEM_CLICKED, self.OnListItemClicked, self)
|
||||
end
|
||||
|
||||
function save_dialog:OnListItemClicked()
|
||||
if self.list_box:GetSize()==0 then return end
|
||||
|
||||
local item = self.list_box:GetSelectedItem()
|
||||
|
||||
if item==nil then return end
|
||||
|
||||
local item_text = item.fn:GetText()
|
||||
self.editbox:SetText (item_text)
|
||||
end
|
||||
|
||||
function save_dialog:OnMsgYes()
|
||||
if self.mbox_mode == 1 then
|
||||
self:SaveFile(self.new_save)
|
||||
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
|
||||
elseif self.mbox_mode == 2 then
|
||||
self:delete_selected_file()
|
||||
end
|
||||
end
|
||||
|
||||
function save_dialog:OnButton_del_clicked()
|
||||
if self.list_box:GetSize()==0 then return end
|
||||
|
||||
local item = self.list_box:GetSelectedItem()
|
||||
if item == nil then return end
|
||||
|
||||
self.mbox_mode = 2
|
||||
self.message_box:InitMessageBox("message_box_delete_file_name")
|
||||
self.message_box:ShowDialog(true)
|
||||
end
|
||||
|
||||
function save_dialog:delete_selected_file()
|
||||
if self.list_box:GetSize()==0 then return end
|
||||
|
||||
local index = self.list_box:GetSelectedIndex()
|
||||
|
||||
if index == -1 then return end
|
||||
|
||||
local item = self.list_box:GetItemByIndex(index)
|
||||
local filename = item.fn:GetText()
|
||||
|
||||
ui_load_dialog.delete_save_game(filename)
|
||||
|
||||
self.list_box:RemoveItem(item)
|
||||
self:OnListItemClicked()
|
||||
end
|
||||
|
||||
function save_dialog:OnButton_ok_clicked()
|
||||
-- prepare message box
|
||||
|
||||
-- Get file name
|
||||
self.new_save = self.editbox:GetText()
|
||||
|
||||
-- check for empty name
|
||||
if string.len(self.new_save) == 0 then
|
||||
self.mbox_mode = 0
|
||||
self.message_box:InitMessageBox("message_box_empty_file_name")
|
||||
self.message_box:ShowDialog(true)
|
||||
return
|
||||
end
|
||||
|
||||
-- check for match name
|
||||
local f = getFS()
|
||||
local flist = f:file_list_open("$game_saves$",FS.FS_ListFiles)
|
||||
local file_struct = f:exist("$game_saves$", self.new_save .. saved_game_extension )
|
||||
|
||||
if file_struct ~= nil then
|
||||
self.mbox_mode = 1
|
||||
self.message_box:InitMessageBox("message_box_file_already_exist")
|
||||
self.message_box:ShowDialog(true)
|
||||
|
||||
flist:Free()
|
||||
return
|
||||
end
|
||||
flist:Free()
|
||||
self:SaveFile(self.new_save)
|
||||
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
end
|
||||
|
||||
function save_dialog:OnButton_cancel_clicked()
|
||||
self.owner:ShowDialog(true)
|
||||
self:HideDialog()
|
||||
self.owner:Show(true)
|
||||
end
|
||||
|
||||
function save_dialog:OnKeyboard(dik, keyboard_action) --virtual function
|
||||
CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
|
||||
local bind = dik_to_bind(dik)
|
||||
if bind == key_bindings.kQUIT then
|
||||
self:OnButton_cancel_clicked()
|
||||
else
|
||||
|
||||
DIK_RETURN = 40 -- IX-Ray: Fixed DIK_RETURN
|
||||
|
||||
if dik == DIK_RETURN and keyboard_action == ui_events.WINDOW_KEY_PRESSED then
|
||||
self:OnButton_ok_clicked()
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function save_dialog:AddItemToList(file_name, date_time)
|
||||
local _itm = save_item(self.file_item_main_sz.y)
|
||||
_itm:SetWndSize (self.file_item_main_sz)
|
||||
|
||||
_itm.fn:SetWndPos (vector2():set(0,0))
|
||||
_itm.fn:SetWndSize (self.file_item_fn_sz)
|
||||
_itm.fn:SetText (file_name)
|
||||
|
||||
_itm.fage = _itm:AddTextField(date_time, self.file_item_fd_sz.x)
|
||||
_itm.fage:SetFont (GetFontLetterica16Russian())
|
||||
_itm.fage:SetWndPos (vector2():set(self.file_item_fn_sz.x+4, 0))
|
||||
|
||||
self.list_box:AddExistingItem(_itm)
|
||||
end
|
||||
|
||||
function save_dialog:SaveFile(fileName)
|
||||
if nil~= fileName then
|
||||
local console = get_console()
|
||||
console:execute("save " .. fileName)
|
||||
end
|
||||
end
|
||||
266
gamedata/scripts/xr_animpoint_predicates.script
Normal file
266
gamedata/scripts/xr_animpoint_predicates.script
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
local smart_table = {
|
||||
"zat_stalker_base_smart",
|
||||
"jup_b41",
|
||||
"jup_a6",
|
||||
"pri_a16",
|
||||
}
|
||||
|
||||
local eatable_visuals = {
|
||||
["actors\\stalker_hero\\stalker_hero_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_novice_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_stalker_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_dolg_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_dolg_2"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_freedom_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_freedom_2"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_specops"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_military"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_neutral_nauchniy"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_cs_heavy"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_exo"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_face_1"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_mask"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_4"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_2_face_1"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_1_face_1"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_3_face_1"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_1_face_1"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_2_face_1"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_2_face_2"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_3"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_3_face_1"] = true,
|
||||
["actors\\stalker_monolith\\stalker_monolith_1_face_1"] = true,
|
||||
["actors\\stalker_nebo\\stalker_nebo_2_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1_face_2"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1_face_3"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_face_3"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_2"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_3"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_4"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_5"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_6"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_7"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_face_2"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_3_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_nauchniy_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_nauchniy_face_3"] = true,
|
||||
["actors\\stalker_soldier\\stalker_soldier_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_soldier_1_face_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_2"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_2_face_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_3_face_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_ecolog_face_1"] = true,
|
||||
["actors\\stalker_ucheniy\\stalker_ucheniy_1_face_1"] = true,
|
||||
["actors\\stalker_ucheniy\\stalker_ucheniy_1_face_2"] = true,
|
||||
["actors\\stalker_zombied\\stalker_zombied_1"] = true,
|
||||
["actors\\stalker_zombied\\stalker_zombied_3"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_nauchniy_face_2"] = true
|
||||
}
|
||||
|
||||
local harmonica_visuals = {
|
||||
["actors\\stalker_hero\\stalker_hero_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_novice_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_stalker_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_dolg_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_dolg_2"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_freedom_1"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_freedom_2"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_specops"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_military"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_neutral_nauchniy"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_cs_heavy"] = true,
|
||||
["actors\\stalker_hero\\stalker_hero_exo"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_1"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_2"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_face_1"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_mask"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_4"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_2_face_1"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_1_face_1"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_2_mask"] = true,
|
||||
["actors\\stalker_dolg\\stalker_dolg_3_face_1"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_1_face_1"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_2_face_1"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_2_face_2"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_2_mask"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_3"] = true,
|
||||
["actors\\stalker_freedom\\stalker_freedom_3_face_1"] = true,
|
||||
["actors\\stalker_monolith\\stalker_monolith_1_face_1"] = true,
|
||||
["actors\\stalker_nebo\\stalker_nebo_2_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1_face_2"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_1_face_3"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_face_3"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_2"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_3"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_4"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_5"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_6"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_face_7"] = true,
|
||||
["actors\\stalker_bandit\\stalker_bandit_3_face_2"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_2_mask"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_3_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_nauchniy_face_1"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_nauchniy_face_3"] = true,
|
||||
["actors\\stalker_soldier\\stalker_soldier_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_soldier_1_face_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_2"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_2_face_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_3_face_1"] = true,
|
||||
["actors\\stalker_soldier\\stalker_solider_ecolog_face_1"] = true,
|
||||
["actors\\stalker_ucheniy\\stalker_ucheniy_1_face_1"] = true,
|
||||
["actors\\stalker_ucheniy\\stalker_ucheniy_1_face_2"] = true,
|
||||
["actors\\stalker_zombied\\stalker_zombied_1"] = true,
|
||||
["actors\\stalker_zombied\\stalker_zombied_2"] = true,
|
||||
["actors\\stalker_zombied\\stalker_zombied_3"] = true,
|
||||
["actors\\stalker_zombied\\stalker_zombied_4"] = true,
|
||||
["actors\\stalker_neutral\\stalker_neutral_nauchniy_face_2"] = true
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Predicate functions for xr_animpoint actions --------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
function const_predicate_true(npc_id)
|
||||
return true
|
||||
end
|
||||
|
||||
function animpoint_predicate_bread(npc_id)
|
||||
if(db.storage[npc_id] and db.storage[npc_id].object and eatable_visuals[db.storage[npc_id].object:get_visual_name()] and db.storage[npc_id].object:object("bread")) == true then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function animpoint_predicate_kolbasa(npc_id)
|
||||
if(db.storage[npc_id] and db.storage[npc_id].object and eatable_visuals[db.storage[npc_id].object:get_visual_name()] and db.storage[npc_id].object:object("kolbasa")) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function animpoint_predicate_vodka(npc_id)
|
||||
if(db.storage[npc_id] and db.storage[npc_id].object and eatable_visuals[db.storage[npc_id].object:get_visual_name()] and db.storage[npc_id].object:object("vodka")) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function animpoint_predicate_energy(npc_id)
|
||||
if(db.storage[npc_id] and db.storage[npc_id].object and eatable_visuals[db.storage[npc_id].object:get_visual_name()] and db.storage[npc_id].object:object("energy_drink")) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function animpoint_predicate_guitar(npc_id, is_in_camp)
|
||||
--printf(" predicate_guitar %s", npc_id)
|
||||
--printf(" registred_camp %s", tostring(is_in_camp))
|
||||
if is_in_camp == true and db.storage[npc_id] and db.storage[npc_id].object and db.storage[npc_id].object:object("guitar_a") then
|
||||
--printf(" return true")
|
||||
return true
|
||||
end
|
||||
--printf(" return false")
|
||||
return false
|
||||
end
|
||||
|
||||
function animpoint_predicate_harmonica(npc_id, is_in_camp)
|
||||
--printf(" predicate_harmonica %s", npc_id)
|
||||
--printf(" registred_camp %s", tostring(is_in_camp))
|
||||
if is_in_camp == true and db.storage[npc_id] and db.storage[npc_id].object and harmonica_visuals[db.storage[npc_id].object:get_visual_name()] and db.storage[npc_id].object:object("harmonica_a") then
|
||||
--printf(" return true")
|
||||
return true
|
||||
end
|
||||
--printf(" return false")
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
function animpoint_predicate_weapon(npc_id)
|
||||
if(db.storage[npc_id] and db.storage[npc_id].object) then
|
||||
local smart = xr_gulag.get_npc_smart(db.storage[npc_id].object)
|
||||
if(smart) then
|
||||
for k,v in pairs(smart_table) do
|
||||
if smart:name() == v then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Associative table (smartcover - animation) ----------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
associations = {
|
||||
animpoint_stay_wall = {
|
||||
{name = "animpoint_stay_wall", predicate = xr_animpoint_predicates.const_predicate_true},
|
||||
{name = "animpoint_stay_wall_eat_bread", predicate = xr_animpoint_predicates.animpoint_predicate_bread},
|
||||
{name = "animpoint_stay_wall_eat_kolbasa", predicate = xr_animpoint_predicates.animpoint_predicate_kolbasa},
|
||||
{name = "animpoint_stay_wall_drink_vodka", predicate = xr_animpoint_predicates.animpoint_predicate_vodka},
|
||||
{name = "animpoint_stay_wall_drink_energy", predicate = xr_animpoint_predicates.animpoint_predicate_energy},
|
||||
-- {name = "animpoint_stay_wall_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
-- {name = "animpoint_stay_wall_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica},
|
||||
{name = "animpoint_stay_wall_weapon", predicate = xr_animpoint_predicates.animpoint_predicate_weapon},
|
||||
},
|
||||
animpoint_stay_table = {
|
||||
{name = "animpoint_stay_table", predicate = xr_animpoint_predicates.const_predicate_true},
|
||||
{name = "animpoint_stay_table_eat_bread", predicate = xr_animpoint_predicates.animpoint_predicate_bread},
|
||||
{name = "animpoint_stay_table_eat_kolbasa", predicate = xr_animpoint_predicates.animpoint_predicate_kolbasa},
|
||||
{name = "animpoint_stay_table_drink_vodka", predicate = xr_animpoint_predicates.animpoint_predicate_vodka},
|
||||
{name = "animpoint_stay_table_drink_energy", predicate = xr_animpoint_predicates.animpoint_predicate_energy},
|
||||
-- {name = "animpoint_stay_table_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
-- {name = "animpoint_stay_table_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica},
|
||||
{name = "animpoint_stay_table_weapon", predicate = xr_animpoint_predicates.animpoint_predicate_weapon},
|
||||
},
|
||||
animpoint_sit_high = {
|
||||
{name = "animpoint_sit_high", predicate = xr_animpoint_predicates.const_predicate_true},
|
||||
{name = "animpoint_sit_high_eat_bread", predicate = xr_animpoint_predicates.animpoint_predicate_bread},
|
||||
{name = "animpoint_sit_high_eat_kolbasa", predicate = xr_animpoint_predicates.animpoint_predicate_kolbasa},
|
||||
{name = "animpoint_sit_high_drink_vodka", predicate = xr_animpoint_predicates.animpoint_predicate_vodka},
|
||||
{name = "animpoint_sit_high_drink_energy", predicate = xr_animpoint_predicates.animpoint_predicate_energy},
|
||||
-- {name = "animpoint_sit_high_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
{name = "animpoint_sit_high_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica},
|
||||
-- {name = "animpoint_sit_high_weapon", predicate = xr_animpoint_predicates.animpoint_predicate_weapon},
|
||||
},
|
||||
animpoint_sit_normal = {
|
||||
{name = "animpoint_sit_normal", predicate = xr_animpoint_predicates.const_predicate_true},
|
||||
{name = "animpoint_sit_normal_eat_bread", predicate = xr_animpoint_predicates.animpoint_predicate_bread},
|
||||
{name = "animpoint_sit_normal_eat_kolbasa", predicate = xr_animpoint_predicates.animpoint_predicate_kolbasa},
|
||||
{name = "animpoint_sit_normal_drink_vodka", predicate = xr_animpoint_predicates.animpoint_predicate_vodka},
|
||||
{name = "animpoint_sit_normal_drink_energy", predicate = xr_animpoint_predicates.animpoint_predicate_energy},
|
||||
{name = "animpoint_sit_normal_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
-- {name = "animpoint_sit_normal_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica},
|
||||
-- {name = "animpoint_sit_normal_weapon", predicate = xr_animpoint_predicates.animpoint_predicate_weapon},
|
||||
},
|
||||
animpoint_sit_low = {
|
||||
{name = "animpoint_sit_low", predicate = xr_animpoint_predicates.const_predicate_true},
|
||||
{name = "animpoint_sit_low_eat_bread", predicate = xr_animpoint_predicates.animpoint_predicate_bread},
|
||||
{name = "animpoint_sit_low_eat_kolbasa", predicate = xr_animpoint_predicates.animpoint_predicate_kolbasa},
|
||||
{name = "animpoint_sit_low_drink_vodka", predicate = xr_animpoint_predicates.animpoint_predicate_vodka},
|
||||
{name = "animpoint_sit_low_drink_energy", predicate = xr_animpoint_predicates.animpoint_predicate_energy},
|
||||
{name = "animpoint_sit_low_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
{name = "animpoint_sit_low_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica},
|
||||
-- {name = "animpoint_sit_low_weapon", predicate = xr_animpoint_predicates.animpoint_predicate_weapon},
|
||||
},
|
||||
walker_camp = { {name = "play_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
{name = "play_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica}
|
||||
},
|
||||
-- START IX-Ray
|
||||
kamp = {
|
||||
{name = "kamp", predicate = xr_animpoint_predicates.const_predicate_true},
|
||||
{name = "kamp_eat_bread", predicate = xr_animpoint_predicates.animpoint_predicate_bread},
|
||||
{name = "kamp_eat_kolbasa", predicate = xr_animpoint_predicates.animpoint_predicate_kolbasa},
|
||||
{name = "kamp_drink_vodka", predicate = xr_animpoint_predicates.animpoint_predicate_vodka},
|
||||
{name = "kamp_drink_energy", predicate = xr_animpoint_predicates.animpoint_predicate_energy},
|
||||
{name = "kamp_guitar", predicate = xr_animpoint_predicates.animpoint_predicate_guitar},
|
||||
{name = "kamp_harmonica", predicate = xr_animpoint_predicates.animpoint_predicate_harmonica},
|
||||
},
|
||||
-- END IX-Ray
|
||||
}
|
||||
198
gamedata/scripts/xr_combat_ignore.script
Normal file
198
gamedata/scripts/xr_combat_ignore.script
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
--[[------------------------------------------------------------------------------------------------------------------
|
||||
Игнорирование врагов
|
||||
Чугай Александр
|
||||
--------------------------------------------------------------------------------------------------------------------]]
|
||||
local ignored_smart = {
|
||||
zat_stalker_base_smart = true,
|
||||
jup_b41 = true,
|
||||
jup_a6 = true,
|
||||
pri_a16 = true
|
||||
}
|
||||
|
||||
fighting_with_actor_npcs = {
|
||||
}
|
||||
|
||||
local smarts_by_no_assault_zones = {
|
||||
["zat_a2_sr_no_assault"] = "zat_stalker_base_smart",
|
||||
["jup_a6_sr_no_assault"] = "jup_a6",
|
||||
["jup_b41_sr_no_assault"] = "jup_b41"
|
||||
}
|
||||
|
||||
|
||||
function is_enemy(obj, enemy, st, not_check_sim)
|
||||
if not obj:alive() then
|
||||
return false
|
||||
end
|
||||
|
||||
if obj:critically_wounded() then
|
||||
return true
|
||||
end
|
||||
|
||||
if st.enabled == false then
|
||||
return true
|
||||
end
|
||||
|
||||
local overrides = st.overrides
|
||||
local obj_id = obj:id()
|
||||
local storage = db.storage[obj_id]
|
||||
if storage == nil then
|
||||
return true
|
||||
end
|
||||
storage.enemy_id = enemy:id()
|
||||
|
||||
--' Отсеиваем по зоне
|
||||
local active_sector = storage.active_sector
|
||||
if active_sector ~= nil then
|
||||
if sr_danger.check_danger_position(enemy:position(), active_sector) == false then
|
||||
-- obj:enable_memory_object( enemy, false )
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- Проверка на зоны комбат игнора возле баз:
|
||||
-- игнорировать если:
|
||||
-- враг не актер.
|
||||
-- сталкер находится в зоне.
|
||||
-- смарт в котором находится сталкер не в состоянии тревоги.
|
||||
if db.actor and enemy and enemy:id() ~= db.actor:id() then
|
||||
for k,v in pairs (smarts_by_no_assault_zones) do
|
||||
local zone = db.zone_by_name[k]
|
||||
if zone and (utils.npc_in_zone(obj, zone) or utils.npc_in_zone(enemy, zone)) then
|
||||
local smart = sim_board.get_sim_board():get_smart_by_name(v)
|
||||
if smart and smart.base_on_actor_control ~= nil and smart.base_on_actor_control.status ~= smart_terrain_control.ALARM then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local se_enemy = alife():object(enemy:id())
|
||||
if se_enemy ~= nil and se_enemy.m_smart_terrain_id ~= nil and se_enemy.m_smart_terrain_id ~= 65535 then
|
||||
local enemy_smart = alife():object(se_enemy.m_smart_terrain_id)
|
||||
local smart_name = enemy_smart:name()
|
||||
if ignored_smart[smart_name] == true then
|
||||
-- obj:enable_memory_object( enemy, false )
|
||||
return false
|
||||
end
|
||||
end
|
||||
--printf("checking combat_ignore for stalker[%s] enemy name [%s] in section[%s]",obj:name(), enemy:name(),storage.active_section)
|
||||
--' Если есть оверрайды, то работаем по ним.
|
||||
if overrides and
|
||||
overrides.combat_ignore
|
||||
then
|
||||
local ret_value = xr_logic.pick_section_from_condlist( enemy, obj, overrides.combat_ignore.condlist )
|
||||
if ret_value == "true" then
|
||||
--printf("pl:Disabling_memory_object[1] for stalker[%s] enemy name [%s] in section[%s]",obj:name(), enemy:name(),storage.active_section)
|
||||
-- obj:enable_memory_object( enemy, false )
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class "action_process_enemy"
|
||||
|
||||
function action_process_enemy:__init( obj, storage )
|
||||
self.object = obj
|
||||
self.st = storage
|
||||
end
|
||||
|
||||
function action_process_enemy:enemy_callback( obj, enemy )
|
||||
--' local obj_pos = self.object:position()
|
||||
--' local ene_pos = enemy:position()
|
||||
--' printf("FOUND ENEMY [%s](%s,%s,%s) -> [%s](%s,%s,%s)", self.object:name(), obj_pos.x, obj_pos.y, obj_pos.z,
|
||||
--' enemy:name(), ene_pos.x, ene_pos.y, ene_pos.z)
|
||||
if enemy:id() == db.actor:id() then
|
||||
fighting_with_actor_npcs[obj:id()] = true
|
||||
end
|
||||
|
||||
local is_obj_enemy = is_enemy( obj, enemy, self.st, false )
|
||||
if is_obj_enemy == true then
|
||||
local se_obj = alife():object(obj:id())
|
||||
if se_obj and se_obj.m_smart_terrain_id ~= 65535 then
|
||||
local smart_obj = alife():object(se_obj.m_smart_terrain_id)
|
||||
smart_obj:set_alarm()
|
||||
|
||||
if db.actor and enemy and enemy:id() == db.actor:id() and smart_obj.base_on_actor_control ~= nil then
|
||||
-- Fix start for detecting attacking of the base even when attacked npc is not near the base
|
||||
local base_pos = db.zone_by_name[smart_obj.base_on_actor_control.noweap_zone]:position()
|
||||
local distance = obj:position():distance_to(base_pos)
|
||||
if distance < 100 then
|
||||
smart_obj.base_on_actor_control:actor_attack()
|
||||
end
|
||||
-- Fix end for detecting attacking of the base even when attacked npc is not near the base
|
||||
end
|
||||
end
|
||||
local se_enemy = alife():object(enemy:id())
|
||||
if se_obj and se_enemy then
|
||||
local sim_obj_registry = simulation_objects.get_sim_obj_registry()
|
||||
if se_obj.group_id ~= 65535 and sim_obj_registry.objects[se_obj.group_id] ~= nil and
|
||||
se_enemy.group_id ~= 65535 and sim_obj_registry.objects[se_enemy.group_id] == nil and
|
||||
se_obj.position:distance_to_sqr(se_enemy.position) > 900 then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return is_obj_enemy
|
||||
end
|
||||
|
||||
function action_process_enemy:hit_callback(obj, amount, local_direction, who, bone_index)
|
||||
if who == nil then
|
||||
return
|
||||
end
|
||||
|
||||
-- printf("_bp: action_process_enemy: hit_callback(): obj='%s'", obj:name())
|
||||
if amount == 0 then
|
||||
-- Кто-то стрельнул в воздух
|
||||
return
|
||||
end
|
||||
|
||||
if who:id() == db.actor:id() then
|
||||
local overrides = self.st.overrides
|
||||
if not overrides or not overrides.combat_ignore_keep_when_attacked then
|
||||
--printf("_bp: action_process_enemy: hit_callback(): obj='%s': SCHEME DISABLED", obj:name())
|
||||
self.st.enabled = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
-- binder
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function add_to_binder( npc, ini, scheme, section, storage )
|
||||
local new_action = this.action_process_enemy( npc, storage )
|
||||
storage.action = new_action
|
||||
end
|
||||
|
||||
function set_combat_ignore_checker( npc, ini, scheme)
|
||||
local st = xr_logic.assign_storage_and_bind( npc, ini, scheme )
|
||||
end
|
||||
|
||||
function reset_combat_ignore_checker(npc, scheme, st, section)
|
||||
local storage = st.combat_ignore
|
||||
|
||||
npc:set_enemy_callback( storage.action.enemy_callback, storage.action )
|
||||
|
||||
-- Подписываемся на hit callback-и:
|
||||
xr_logic.subscribe_action_for_events( npc, storage, storage.action )
|
||||
|
||||
storage.overrides = xr_logic.generic_scheme_overrides(npc)
|
||||
|
||||
storage.enabled = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
function disable_scheme( npc, scheme )
|
||||
npc:set_enemy_callback()
|
||||
|
||||
-- Отписываемся от hit callback. Это делать обязательно, потому что иначе при переключении на другой набор
|
||||
-- схем, в котором нет перехвата боя, продолжится вызываться callback в старом подписанном action-е.
|
||||
local st = db.storage[npc:id()][scheme]
|
||||
if st then
|
||||
xr_logic.unsubscribe_action_from_events(npc, st, st.action)
|
||||
end
|
||||
end
|
||||
3384
gamedata/scripts/xr_effects.script
Normal file
3384
gamedata/scripts/xr_effects.script
Normal file
File diff suppressed because it is too large
Load diff
432
gamedata/scripts/xr_kamp.script
Normal file
432
gamedata/scripts/xr_kamp.script
Normal file
|
|
@ -0,0 +1,432 @@
|
|||
----------------------------------------------------------------------------------------------------------------------
|
||||
-- Схема лагерь. Чудак(и) у костра.
|
||||
-- автор: Диденко Руслан (Stohe)
|
||||
-- TODO:
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
--function printf()
|
||||
--end
|
||||
|
||||
local ActionToStateTable = {
|
||||
idle = {director = { "sit", "sit_ass", "sit_knee", "eat_bread", "eat_kolbasa", "eat_vodka", "eat_energy"}, listener = {"sit", "sit_ass", "sit_knee", "eat_bread", "eat_kolbasa", "eat_vodka", "eat_energy"}},
|
||||
harmonica = {director = {"harmonica"}, listener = {"sit", "sit_ass", "sit_knee", "eat_bread", "eat_kolbasa", "eat_vodka", "eat_energy"}},
|
||||
guitar = {director = {"guitar"}, listener = {"sit", "sit_ass", "sit_knee", "eat_bread", "eat_kolbasa", "eat_vodka", "eat_energy"}},
|
||||
story = {director = {"sit", "sit_ass", "sit_knee"}, listener = {"sit", "sit_ass", "sit_knee", "eat_bread", "eat_kolbasa", "eat_vodka", "eat_energy"}},
|
||||
}
|
||||
|
||||
local ActionAvailabilityTable = {
|
||||
eat_bread = "kamp_eat_bread",
|
||||
eat_kolbasa = "kamp_eat_kolbasa",
|
||||
eat_vodka = "kamp_drink_vodka",
|
||||
eat_energy = "kamp_drink_energy",
|
||||
}
|
||||
|
||||
local ActionTimingTable = {
|
||||
sit = {min = 60*2*1000,max = 60*10*1000},
|
||||
sit_ass = {min =60*2*1000,max = 60*10*1000},
|
||||
sit_knee = {min = 60*2*1000,max = 60*10*1000}
|
||||
}
|
||||
|
||||
|
||||
kamps = {}
|
||||
---------------------------------------------------------------------------------------------------------------------
|
||||
--Evaluators
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
--' Условие завершения скрипта
|
||||
class "evaluator_kamp_end" (property_evaluator)
|
||||
function evaluator_kamp_end:__init(name, storage) super (nil, name)
|
||||
self.a = storage
|
||||
end
|
||||
function evaluator_kamp_end:evaluate()
|
||||
return not xr_logic.is_active(self.object, self.a)
|
||||
end
|
||||
--' Находимся ли мы на заданной позиции
|
||||
class "evaluator_on_position" (property_evaluator)
|
||||
function evaluator_on_position:__init(name, storage) super (nil, name)
|
||||
self.a = storage
|
||||
end
|
||||
function evaluator_on_position:evaluate()
|
||||
if self.object:level_vertex_id() == self.a.pos_vertex then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
--Actions
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
--' Идет в заданную область
|
||||
class "action_go_position" (action_base)
|
||||
function action_go_position:__init (npc_name,action_name,storage) super (nil,action_name)
|
||||
self.a = storage
|
||||
end
|
||||
function action_go_position:initialize()
|
||||
action_base.initialize(self)
|
||||
-- self.object:set_node_evaluator()
|
||||
-- self.object:set_path_evaluator()
|
||||
self.object:set_desired_position()
|
||||
self.object:set_desired_direction()
|
||||
|
||||
self.a.pos_vertex = nil
|
||||
self.a.npc_position_num = nil
|
||||
self.a.signals = {}
|
||||
end
|
||||
function action_go_position:execute ()
|
||||
action_base.execute (self)
|
||||
|
||||
-- Спрашиваем где сидеть
|
||||
local tmp_pos_vertex, npc_position_num = kamps[self.a.center_point]:getDestVertex(self.object, self.a.radius)
|
||||
|
||||
if tmp_pos_vertex == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if self.a.npc_position_num ~= npc_position_num then
|
||||
self.a.npc_position_num = npc_position_num
|
||||
self.a.pos_vertex = tmp_pos_vertex
|
||||
|
||||
--' Определяем куда смотреть.
|
||||
self.a.pp = patrol(self.a.center_point):point(0)
|
||||
|
||||
local dir = vector():set(math.random(-1,1), 0, math.random(-1,1))
|
||||
dir:normalize()
|
||||
|
||||
local delta_dist = math.random(0,0.5)
|
||||
self.a.pp.x = self.a.pp.x + dir.x * delta_dist
|
||||
self.a.pp.z = self.a.pp.z + dir.z * delta_dist
|
||||
|
||||
|
||||
|
||||
self.object:set_dest_level_vertex_id(self.a.pos_vertex)
|
||||
--printf("vertex_position")
|
||||
local desired_direction = vector():sub(self.a.pp,level.vertex_position(self.a.pos_vertex))
|
||||
--printf("desired_direction = %s", vec_to_str(desired_direction))
|
||||
if desired_direction ~= nil and not utils.vector_cmp(desired_direction, vector():set(0,0,0)) then
|
||||
desired_direction:normalize()
|
||||
self.object:set_desired_direction(desired_direction)
|
||||
end
|
||||
self.object:set_path_type(game_object.level_path)
|
||||
state_mgr.set_state(self.object, self.a.def_state_moving)
|
||||
end
|
||||
end
|
||||
function action_go_position:finalize ()
|
||||
action_base.finalize (self)
|
||||
end
|
||||
|
||||
--' Просто сидит и втыкает
|
||||
class "action_wait" (action_base)
|
||||
function action_wait:__init (npc_name,action_name,storage) super (nil,action_name)
|
||||
self.a = storage
|
||||
end
|
||||
function action_wait:initialize()
|
||||
action_base.initialize(self)
|
||||
-- self.object:set_node_evaluator()
|
||||
-- self.object:set_path_evaluator()
|
||||
self.object:set_desired_position()
|
||||
self.object:set_desired_direction()
|
||||
|
||||
local avail_actions = xr_animpoint_predicates.associations[self.a.description]
|
||||
self.a.approved_actions = {}
|
||||
|
||||
for k,v in pairs(avail_actions) do
|
||||
-- Убираем те действия, которые не подходят по прекондишну
|
||||
if v.predicate(self.object:id(),true)==true then
|
||||
table.insert(self.a.approved_actions, v)
|
||||
kamps[self.a.center_point]:AddAvailableAction(self.object,v.name)
|
||||
end
|
||||
end
|
||||
|
||||
kamps[self.a.center_point]:increasePops(self.object)
|
||||
|
||||
end
|
||||
function action_wait:activate_scheme()
|
||||
self.a.signals = {}
|
||||
end
|
||||
function action_wait:execute()
|
||||
-- action_base.execute (self)
|
||||
|
||||
-- --' повернуть его лицом к центру
|
||||
-- state_mgr.set_state(self.object, "sit", nil, nil, {look_position = self.a.pp})
|
||||
|
||||
action_base.execute (self)
|
||||
local state = kamps[self.a.center_point]:updateNpc(self.object)
|
||||
|
||||
--' повернуть его лицом к центру
|
||||
state_mgr.set_state(self.object, state, nil, nil, {look_position = self.a.pp})
|
||||
end
|
||||
function action_wait:finalize()
|
||||
kamps[self.a.center_point]:decreasePops(self.object)
|
||||
action_base.finalize (self)
|
||||
end
|
||||
function action_wait:deactivate(npc)
|
||||
kamps[self.a.center_point]:removeNpc(npc)
|
||||
end
|
||||
function action_wait:death_callback(npc)
|
||||
kamps[self.a.center_point]:removeNpc(npc)
|
||||
end
|
||||
function action_wait:net_destroy(npc)
|
||||
kamps[self.a.center_point]:removeNpc(npc)
|
||||
end
|
||||
|
||||
|
||||
class "CKampManager"
|
||||
function CKampManager:__init(path)
|
||||
self.kamp_name = path
|
||||
self.patrol = patrol(path)
|
||||
--self.center = self.patrol:level_vertex_id(0)
|
||||
self.position = {{dir = vector():set(1, 0, 0), used = nil},
|
||||
{dir = vector():set(1, 0, 1), used = nil},
|
||||
{dir = vector():set(0, 0, 1), used = nil},
|
||||
{dir = vector():set(-1, 0, 1), used = nil},
|
||||
{dir = vector():set(-1, 0, 0), used = nil},
|
||||
{dir = vector():set(-1, 0, -1),used = nil},
|
||||
{dir = vector():set(0, 0, -1), used = nil},
|
||||
{dir = vector():set(1, 0, -1), used = nil}}
|
||||
self.npc = {}
|
||||
self.population = 0
|
||||
end
|
||||
function CKampManager:selectPosition(npc_id)
|
||||
-- создаем список доступных позиций
|
||||
--printf("KAMP. [%s] called select position", npc_id)
|
||||
local free = {}
|
||||
for k,v in pairs(self.position) do
|
||||
if v.used == nil then
|
||||
table.insert(free, k)
|
||||
end
|
||||
end
|
||||
--' затем из доступных позиций выбрать рандомно одну.
|
||||
if #free > 0 then
|
||||
--printf("KAMP [%s] free node > 0", npc_id)
|
||||
local rr = math.random(#free)
|
||||
self.position[free[rr]].used = npc_id
|
||||
self.npc[npc_id].position = free[rr]
|
||||
end
|
||||
--printf("KAMP [%s] npc table", npc_id)
|
||||
--print_table(self.npc)
|
||||
--printf("KAMP [%s] position table", npc_id)
|
||||
--print_table(self.position)
|
||||
end
|
||||
function CKampManager:getDestVertex(npc, radius)
|
||||
local npc_id = npc:id()
|
||||
--printf("get dest Vertex called [%s]", npc_id)
|
||||
if self.npc[npc_id].position == nil then
|
||||
--printf("-------debug_info------------- %s", self.kamp_name)
|
||||
--print_table(self.npc)
|
||||
--printf("-------debug_info------------- %s", self.kamp_name)
|
||||
--print_table(self.position)
|
||||
--printf("-------debug_info------------- %s", self.kamp_name)
|
||||
abort("get dest Vertex: nil [%s]", npc_id)
|
||||
return nil
|
||||
end
|
||||
|
||||
-- высчитываем вертех по направлению
|
||||
-- Берем позицию в заданном направлении, затем берем ниарест точку от нее.
|
||||
|
||||
local pp = self.patrol:point(0)
|
||||
local dir = self.position[self.npc[npc_id].position].dir
|
||||
|
||||
-- Считаем рандомное отклонение направления.
|
||||
dir.x = dir.x + math.random(-1,1)/5
|
||||
dir.z = dir.z + math.random(-1,1)/5
|
||||
dir:normalize()
|
||||
|
||||
radius = radius + math.random(-0.3,0.3)
|
||||
|
||||
local dest_vertex = 4294967295
|
||||
|
||||
while dest_vertex == 4294967295 do
|
||||
local tmp_pos = vector():set(0,0,0)
|
||||
tmp_pos.x = pp.x + dir.x * radius
|
||||
tmp_pos.z = pp.z + dir.z * radius
|
||||
tmp_pos.y = pp.y
|
||||
dest_vertex = level.vertex_id(tmp_pos)
|
||||
if dest_vertex == 4294967295 then
|
||||
if radius < 1 then
|
||||
SemiLog("Invalid AI map at kamp point ["..self.kamp_name.."]")
|
||||
return nil
|
||||
else
|
||||
radius = radius - 0.5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not npc:accessible(dest_vertex) then
|
||||
--printf("vertex_position %s", tostring(dest_vertex))
|
||||
local vp = level.vertex_position(dest_vertex)
|
||||
--printf("Nearest for npc[%s] kamp [%s] position [%s:%s:%s]", npc:name(), tostring(self.kamp_name),tostring(vp.x), tostring(vp.y), tostring(vp.z))
|
||||
local nearest_vertex = npc:accessible_nearest(vp, vector():set(0,0,0))
|
||||
--printf("Nearest for npc[%s] kamp [%s] position [%s:%s:%s]", npc:name(), tostring(self.kamp_name), vec_to_str(nearest_vertex))
|
||||
return nearest_vertex, self.npc[npc_id].position
|
||||
end
|
||||
|
||||
return dest_vertex, self.npc[npc_id].position
|
||||
end
|
||||
|
||||
function CKampManager:updateNpc(npc)
|
||||
|
||||
local tbl = {}
|
||||
local npc_id = npc:id()
|
||||
local camp_action, is_director
|
||||
|
||||
if not self.camp then
|
||||
camp_action = "idle"
|
||||
is_director = false
|
||||
else
|
||||
camp_action, is_director = self.camp:get_camp_action(npc_id)
|
||||
end
|
||||
|
||||
|
||||
if(is_director) then
|
||||
tbl = ActionToStateTable[camp_action].director
|
||||
else
|
||||
tbl = ActionToStateTable[camp_action].listener
|
||||
end
|
||||
|
||||
if self.npc[npc_id].begin == nil or time_global() - self.npc[npc_id].begin >= self.npc[npc_id].state_idle or self.npc[npc_id].is_director ~= is_director then
|
||||
self.npc[npc_id].begin = time_global()
|
||||
if (self.npc[npc_id].camp_action == "story" or self.npc[npc_id].camp_action == "idle") and (camp_action =="idle" or camp_action == "story") and self.npc[npc_id].is_director ~= is_director then
|
||||
self.npc[npc_id].is_director = is_director
|
||||
self.npc[npc_id].camp_action = camp_action
|
||||
return self.npc[npc_id].state_selected
|
||||
end
|
||||
local Action = "kamp"
|
||||
repeat
|
||||
local rnd = math.random(#tbl)
|
||||
self.npc[npc_id].state_selected = tbl[rnd]
|
||||
if ActionAvailabilityTable[self.npc[npc_id].state_selected] then
|
||||
Action = ActionAvailabilityTable[self.npc[npc_id].state_selected]
|
||||
else
|
||||
Action = "kamp"
|
||||
end
|
||||
until self.npc[npc_id].AvailableActions[Action]
|
||||
|
||||
if ActionTimingTable[self.npc[npc_id].state_selected] ~= nil then
|
||||
self.npc[npc_id].state_idle = math.random(ActionTimingTable[self.npc[npc_id].state_selected].min,ActionTimingTable[self.npc[npc_id].state_selected].max)
|
||||
else
|
||||
self.npc[npc_id].state_idle = math.random(15*1000,60*1000)
|
||||
end
|
||||
self.npc[npc_id].is_director = is_director
|
||||
self.npc[npc_id].camp_action = camp_action
|
||||
end
|
||||
return self.npc[npc_id].state_selected
|
||||
|
||||
end
|
||||
|
||||
function CKampManager:addNpc(npc)
|
||||
if self.npc[npc:id()] ~= nil then
|
||||
return
|
||||
end
|
||||
|
||||
self.npc[npc:id()] = {name = npc:name(), position = nil, AvailableActions = {}}
|
||||
self:selectPosition(npc:id())
|
||||
|
||||
end
|
||||
function CKampManager:removeNpc(npc)
|
||||
local npc_id = npc:id()
|
||||
if self.npc[npc_id] ~= nil then
|
||||
self.position[self.npc[npc_id].position].used = nil
|
||||
self.npc[npc_id] = nil
|
||||
end
|
||||
|
||||
if self.camp ~= nil then
|
||||
self.camp:unregister_npc(npc:id())
|
||||
end
|
||||
end
|
||||
|
||||
function CKampManager:increasePops(npc)
|
||||
self.population = self.population + 1
|
||||
|
||||
if not self.camp then
|
||||
self.camp = sr_camp.get_current_camp(self.patrol:point(0))
|
||||
end
|
||||
|
||||
if self.camp ~= nil then
|
||||
self.camp:register_npc(npc:id())
|
||||
end
|
||||
-- local campfire = bind_campfire.campfire_table[self.kamp_name.."_campfire"]
|
||||
-- if self.population > 0 and campfire ~= nil and not campfire:is_on() then
|
||||
-- campfire:turn_on()
|
||||
-- end
|
||||
end
|
||||
function CKampManager:decreasePops(npc)
|
||||
self.population = self.population - 1
|
||||
-- local campfire = bind_campfire.campfire_table[self.kamp_name.."_campfire"]
|
||||
-- if self.population < 1 and campfire ~= nil and campfire:is_on() then
|
||||
-- campfire:turn_off()
|
||||
-- end
|
||||
end
|
||||
|
||||
function CKampManager:AddAvailableAction(NPC,StateName)
|
||||
self.npc[NPC:id()].AvailableActions[StateName] = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
--Kamp binder
|
||||
----------------------------------------------------------------------------------------------------------------------
|
||||
function add_to_binder(object, ini, scheme, section, storage)
|
||||
local operators = {}
|
||||
local properties = {}
|
||||
|
||||
local manager = object:motivation_action_manager()
|
||||
|
||||
properties["kamp_end"] = xr_evaluators_id.stohe_kamp_base + 1
|
||||
properties["on_position"] = xr_evaluators_id.stohe_kamp_base + 2
|
||||
properties["contact"] = xr_evaluators_id.stohe_meet_base + 1
|
||||
|
||||
operators["go_position"] = xr_actions_id.stohe_kamp_base + 1
|
||||
operators["wait"] = xr_actions_id.stohe_kamp_base + 3
|
||||
properties["state_mgr_logic_active"] = xr_evaluators_id.state_mgr + 4
|
||||
|
||||
-- Evaluators
|
||||
manager:add_evaluator (properties["kamp_end"], this.evaluator_kamp_end ("kamp_end", storage, "kamp_end"))
|
||||
manager:add_evaluator (properties["on_position"], this.evaluator_on_position ("kamp_on_position", storage, "kamp_on_position"))
|
||||
|
||||
-- Actions
|
||||
local action = this.action_wait (object:name(),"action_kamp_wait", storage)
|
||||
action:add_precondition (world_property(stalker_ids.property_alive, true))
|
||||
action:add_precondition (world_property(stalker_ids.property_danger,false))
|
||||
action:add_precondition (world_property(stalker_ids.property_enemy, false))
|
||||
action:add_precondition (world_property(stalker_ids.property_anomaly,false))
|
||||
xr_motivator.addCommonPrecondition(action)
|
||||
action:add_precondition (world_property(properties["on_position"], true))
|
||||
action:add_effect (world_property(properties["kamp_end"], true))
|
||||
action:add_effect (world_property(properties["state_mgr_logic_active"], false))
|
||||
manager:add_action (operators["wait"], action)
|
||||
xr_logic.subscribe_action_for_events(object, storage, action)
|
||||
|
||||
action = this.action_go_position (object:name(),"action_go_kamp", storage)
|
||||
action:add_precondition (world_property(stalker_ids.property_alive, true))
|
||||
action:add_precondition (world_property(stalker_ids.property_danger,false))
|
||||
action:add_precondition (world_property(stalker_ids.property_enemy, false))
|
||||
action:add_precondition (world_property(stalker_ids.property_anomaly,false))
|
||||
xr_motivator.addCommonPrecondition(action)
|
||||
action:add_precondition (world_property(properties["on_position"], false))
|
||||
action:add_effect (world_property(properties["on_position"], true))
|
||||
action:add_effect (world_property(properties["state_mgr_logic_active"], false))
|
||||
manager:add_action (operators["go_position"], action)
|
||||
|
||||
action = manager:action (xr_actions_id.alife)
|
||||
action:add_precondition (world_property(properties["kamp_end"], true))
|
||||
|
||||
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)
|
||||
|
||||
st.center_point = utils.cfg_get_string(ini, section, "center_point", npc, true, gulag_name)
|
||||
st.radius = utils.cfg_get_number(ini, section, "radius", npc, false, 2)
|
||||
st.description = "kamp"
|
||||
st.base_action = "kamp"
|
||||
|
||||
|
||||
|
||||
if kamps[st.center_point] == nil then
|
||||
kamps[st.center_point] = CKampManager(st.center_point)
|
||||
end
|
||||
kamps[st.center_point]:addNpc(npc)
|
||||
st.pos_vertex = nil
|
||||
|
||||
st.def_state_moving = utils.cfg_get_string(ini, section, "def_state_moving", npc, false, "", "walk")
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue