Lua Callbacks - ixray-team/ixray-1.6-stcop GitHub Wiki

Binder Callbacks

[!IMPORTANT]
Статус: Поддерживается Минимальная версия: 1.1

CGameObject

item_to_belt(obj) -- предмет переместился на пояс
item_to_slot(obj) -- предмет переместился в слот 
item_to_ruck(obj) -- предмет переместился в инвентарь 

on_foot_step(power, b_play, b_ground, b_hud_view)

weapon_jammed(owner, weapon)
weapon_fired(owner, weapon, ammo_elapsed, ammo_type)
weapon_zoom_in(owner, weapon)
weapon_zoom_out(owner, weapon)

CActor

weapon_magazine_empty(weapon, ammo_count)
hud_animation_end(hud_obj, hud_obj_section, current_motion, state, anim_slot)
actor_before_death(killer_id)

Static Callbacks

Статические колбеки - это функции, которые не привязаны к игровым объектам, а являются глобальными.

Для их активации перейдите в файл game_global.ltx и раскомментируйте нужные вам

Call of Chernobyl

  • OnCanTake
function CInventoryBox_CanTake(inv_box, item)
	return true
end
  • OnBeforeHit
-- Called before actor hit callback
-- returning false will ignore the hit completely
function CActor__BeforeHitCallback(actor,shit,bone_id)
	return true
end
  • OnUnregister
-- called in CSE_ALifeDynamicObject::on_unregister()
-- good place to remove ids from persistent tables
function CSE_ALifeDynamicObject_on_unregister(id)
end
  • OnInventoryEat
-- called when an inventory item is eaten/used
-- returning false will prevent the item from being used
function CInventory__eat(npc,item)
	return true
end
  • OnBeforeChangeLevel
function CALifeUpdateManager__on_before_change_level(packet)
	return true
end
  • OnItemDropped
--[[
 Refers to when an icon is dragged onto another icon in Actor Inventory Menu
 
 passed parameters:
	itm1 is the object being dragged; may be nil
	itm2 is the object the item is being dragged onto; may be nil
	from_slot is the number value of the slot itm1 is being dragged from;  0 or EDDListType.iInvalid is invalid 
	to_slot is the number value of the slot itm2 is occupying;  0 or EDDListType.iInvalid is invalid 
	
from_slot and to_slot values:
	EDDListType.iInvalid			= 0
	EDDListType.iActorSlot			= 1
	EDDListType.iActorBag			= 2
	EDDListType.iActorBelt			= 3

	EDDListType.iActorTrade			= 4
	EDDListType.iPartnerTradeBag	= 5
	EDDListType.iPartnerTrade		= 6
	EDDListType.iDeadBodyBag		= 7
	EDDListType.iQuickSlot			= 8
	EDDListType.iTrashSlot			= 9
--]]
function CUIActorMenu_OnItemDropped(itm1,itm2,from_slot,to_slot)
	return true
end