Скрипт ui script — S.T.A.L.K.E.R. Inside Wiki

Скрипт ui script

Материал из S.T.A.L.K.E.R. Inside Wiki

Перейти к: навигация, поиск

Скрипт ui_cheat.script к статье Назначение скриптам горячих кнопок. Часть 1. Скрипт

class "cheat" (CUIScriptWnd)
 
function cheat:__init(owner) super()
self.owner = owner
self:InitControls()
self:InitCallBacks()
end
 
function cheat:__finalize() end
 
function cheat:InitControls() end
 
function cheat:InitCallBacks() end
 
function cheat:on_quit()
local console = get_console()
self:GetHolder():start_stop_menu (self.owner, true)
self:GetHolder():start_stop_menu (self,true)
self.owner:Show (true)
if level.present() and (db.actor ~= nil) and db.actor:alive() then
console:execute("main_menu off")
end
end
 
function cheat:OnKeyboard(dik, keyboard_action)
CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
if keyboard_action == ui_events.WINDOW_KEY_PRESSED then
self:on_quit()
if dik == DIK_keys.DIK_ESCAPE then
elseif dik == DIK_keys.DIK_NUMPAD0 then
elseif dik == DIK_keys.DIK_NUMPAD1 then self:cheat1()
elseif dik == DIK_keys.DIK_NUMPAD2 then self:cheat2()
elseif dik == DIK_keys.DIK_NUMPAD3 then self:cheat3()
elseif dik == DIK_keys.DIK_NUMPAD4 then self:cheat4()
elseif dik == DIK_keys.DIK_NUMPAD5 then
elseif dik == DIK_keys.DIK_NUMPAD6 then
elseif dik == DIK_keys.DIK_NUMPAD7 then
elseif dik == DIK_keys.DIK_NUMPAD8 then
elseif dik == DIK_keys.DIK_NUMPAD9 then
end
end
return true
end
 
function cheat:spawn_item(spawn_item, dist)
local pos = db.actor:position()
local dir = db.actor:direction()
pos = pos:add(dir:mul(dist))
alife():create(spawn_item, pos, 1, db.actor:game_vertex_id())
end
 
function cheat:cheat1()
self:spawn_item("wpn_groza", 3)
end
function cheat:cheat2()
self:spawn_item("ammo_9x39_sp5", 3)
end
function cheat:cheat3()
self:spawn_item("ven_niva", 7)
end
function cheat:cheat4()
self:spawn_item("dog_weak", 20)
end
Другие места
LANGUAGE