- Za ten post max1071 otrzymał następujące punkty reputacji:
- caleb59, Marcus_Polonus, Pangia, Cromm Cruac.
local repairPercent=1.0
function god_repair(slot)
self:repairInSlot(slot,true)
end
function load_rep_menu(what)
if has_alife_info("ui_inventory") then
local obj_name = what:name()
if (string.find(obj_name, "repair_kit")) then
local gui_win = nil
gui_win = repair_kit_ui(get_hud())
level.start_stop_menu(gui_win, true)
end
end
end
class "repair_kit_ui" (CUIScriptWnd)
function repair_kit_ui:__init(owner) super()
self.owner=owner
self:InitControls()
self:InitCallBacks()
end
function repair_kit_ui:__finalize() end
function repair_kit_ui:InitControls()
self:SetWndRect(Frect():set(50,407,344,574))
local xml=CScriptXmlInit()
xml:ParseFile("ui_repair_kit.xml")
if db.actor:item_in_slot(6) and db.actor:item_in_slot(6):condition()<1 then
self:Register(xml:Init3tButton("btn_suit",self),"btn_suit")
end
if db.actor:item_in_slot(1) and db.actor:item_in_slot(1):condition()<1 then
self:Register(xml:Init3tButton("btn_leftweapon",self),"btn_leftweapon")
end
if db.actor:item_in_slot(2) and db.actor:item_in_slot(2):condition()<1 then
self:Register(xml:Init3tButton("btn_rightweapon",self),"btn_rightweapon")
end
self:Register(xml:Init3tButton("btn_exit",self),"btn_exit")
end
function repair_kit_ui:InitCallBacks()
self:AddCallback("btn_suit",ui_events.BUTTON_CLICKED,self.onSuit,self)
self:AddCallback("btn_leftweapon",ui_events.BUTTON_CLICKED,self.onLeftWeapon,self)
self:AddCallback("btn_rightweapon",ui_events.BUTTON_CLICKED,self.onRightWeapon,self)
self:AddCallback("btn_exit",ui_events.BUTTON_CLICKED,self.onExit,self)
end
function repair_kit_ui:repairInSlot(slot,on_god)
if on_god then
db.actor:item_in_slot(slot):set_condition(1)
else
local newCondition=db.actor:item_in_slot(slot):condition()+repairPercent
db.actor:item_in_slot(slot):set_condition(newCondition<1 and newCondition or 1)
self:hideGUI()
end
end
function repair_kit_ui:onSuit()
self:repairInSlot(6)
end
function repair_kit_ui:onLeftWeapon()
self:repairInSlot(1)
end
function repair_kit_ui:onRightWeapon()
self:repairInSlot(2)
end
function repair_kit_ui:onExit()
alife():create("repair_kit",db.actor:position(),db.actor:level_vertex_id(),db.actor:game_vertex_id(),db.actor:id())
self:hideGUI()
end
function repair_kit_ui:hideGUI()
self:GetHolder():start_stop_menu(self,true)
end
function repair_kit_ui:OnKeyboard(dik, keyboard_action)
CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
if keyboard_action == ui_events.WINDOW_KEY_PRESSED then
if dik == DIK_keys.DIK_ESCAPE then
self:onExit()
end
end
return true
end
<repair_kit_ui>
<btn_suit x="157" y="20" width="117" height="29" stretch="1">
<texture_e>ui_button_ordinary_e</texture_e>
<texture_t>ui_button_ordinary_t</texture_t>
<texture_h>ui_button_ordinary_h</texture_h>
<text font="graffiti19" r="238" g="155" b="23">Pancerz</text>
</btn_suit>
<btn_leftweapon x="20" y="69" width="117" height="29" stretch="1">
<texture_e>ui_button_ordinary_e</texture_e>
<texture_t>ui_button_ordinary_t</texture_t>
<texture_h>ui_button_ordinary_h</texture_h>
<text font="graffiti19" r="238" g="155" b="23">Lewa Broń</text>
</btn_leftweapon>
<btn_rightweapon x="157" y="69" width="117" height="29" stretch="1">
<texture_e>ui_button_ordinary_e</texture_e>
<texture_t>ui_button_ordinary_t</texture_t>
<texture_h>ui_button_ordinary_h</texture_h>
<text font="graffiti19" r="238" g="155" b="23">Prawa Broń</text>
</btn_rightweapon>
<btn_exit x="89" y="118" width="117" height="29" stretch="1">
<texture_e>ui_button_ordinary_e</texture_e>
<texture_t>ui_button_ordinary_t</texture_t>
<texture_h>ui_button_ordinary_h</texture_h>
<text font="graffiti19" r="238" g="155" b="23">Wyjdź</text>
</btn_exit>
</repair_kit_ui>
[repair_kit]:identity_immunities
GroupControlSection = spawn_group
discovery_dependency =
$spawn = "devices\quest_items\repair_kit"
$prefetch = 32
class = II_ANTIR
cform = skeleton
visual = equipments\item_merger.ogf
radius = 1
description = enc_equipment_repairkit
inv_name = repairkit
inv_name_short = repairkit
inv_weight = 1.0
quest_item = false
inv_grid_width = 2
inv_grid_height = 2
inv_grid_x = 10
inv_grid_y = 33
cost = 1500
eat_health = 0
eat_satiety = 0
eat_power = 0
eat_radiation = 0
eat_alcohol = 0
wounds_heal_perc = 0
eat_portions_num = 1
animation_slot = 4
<string id="repairkit">
<text>Narzędzia Naprawcze</text>
</string>
<string id="enc_equipment_repairkit">
<text>Wykorzystuje się je do naprawy wyposażenia (Pistoletów, Strzelb, Karabinów, Pancerzy).</text>
</string>
function isGameOn()
if level.present() and db.actor ~= nil and db.actor:alive() then
return true
end
return false
end
function actor_binder:on_item_drop (obj)
level_tasks.proceed(self.object)
if(obj) then
if isGameOn() then
if has_alife_info("ui_inventory") then
repair_kit.load_rep_menu(obj)
end
end
end
--game_stats.update_drop_item (obj, self.object)
end
Użytkownicy przeglądający to forum: Brak zarejestrowanych użytkowników oraz 1 gość