Layered Icons
- New fields for item sections:
- 1icon_layer ; must equal name of a section that contains inv_grid_width, inv_grid_height, inv_grid_x and inv_grid_y -- can be existing item section
- 1icon_layer_x ; offset x
- 1icon_layer_y ; offset y
- 1icon_layer_scale ; optional: defaults to 1.0
... repeatable up to as many as you need
Example:
Code: Select all
1icon_layer = wpn_pm
1icon_layer_x = 0
1icon_layer_y = 0
1icon_layer_scale = 1.0
2icon_layer = medkit
2icon_layer_x = 0
2icon_layer_y = 0
3icon_layer = wpn_pm
3icon_layer_x = 0
3icon_layer_y = 0
Scripted Context Menu Actions
New item section fields
Code: Select all
use1_functor
use1_action_functor
use2_functor
use2_action_functor
use3_functor
use3_action_functor
use4_functor
use4_action_functor
Example Item Section usage:
[test_itm]:booster
...
use1_functor = some_script.some_function
use1_action_functor = some_script.some_action_function
Example functions in a scripted called [b]some_script.script for use with above:[/b]
Code: Select all
function some_function(itm)
-- if something is true then we return a string for a context menu action
if (something = true) then
return game.translate_string("st_some_string")
end
-- returning nil means this will not show up as a context menu option
end
-- This function will only execute when context menu option is selected. That means some_function, above, needs to return a string.
function some_action_function(itm)
-- do something here
end
Actor Menu Inventory Item Drag & Drop Callback:
- Refers to when an icon is dragged onto another icon in Actor Inventory Menu
- 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 is invalid
- to_slot is the number value of the slot itm2 is occupying; 0 is invalid
- 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
passed parameters:
from_slot and to_slot values:
These might be confusing if you are used to 'slots' as they are defined in configs. ActorBag is the main inventory window, while ActorSlot is weapon, helmet and outfit slots. ActorBelt is where artefacts go. PartnerTradeBag is the window of whomever the actor is currently trading with, while ActorTrade is like ActorBag but when in trade menu. The rest should be self-explanatory now.
Example:
Code: Select all
function on_game_start()
RegisterScriptCallback("CUIActorMenu_OnItemDropped",on_drag_drop)
end
function on_drag_drop(itm1,itm2,from_slot,to_slot)
-- We only want to know when an item within actor's rucksack to another item in rucksack; not to a slot
if (from_slot == to_slot and to_slot == EDDListType.iActorBag) then
-- example on how to make a crafting system; sorry these functions don't really exist!
if ( can_combine(itm1:section(),itm2:section()) ) then
craft_new_item( itm1:section(), itm2:section() )
-- TODO: release itm1 and itm2
end
end
end
CUIActorMenu exports:
- ActorMenu.get_actor_menu()
- ActorMenu.get_actor_menu():highlight_section_in_slot("section_name",CUIActorMenu.iActorBag)
- ActorMenu.get_actor_menu():get_drag_item()
- ActorMenu.get_actor_menu():ShowDialog(false)
- if to_slot == EDDListType.iActorBag then
Code: Select all
module(L)
[
class_< enum_exporter<EDDListType> >("EDDListType")
.enum_("EDDListType")
[
value("iActorBag", int(EDDListType::iActorBag)),
value("iActorBelt", int(EDDListType::iActorBelt)),
value("iActorSlot", int(EDDListType::iActorSlot)),
value("iActorTrade", int(EDDListType::iActorTrade)),
value("iDeadBodyBag", int(EDDListType::iDeadBodyBag)),
value("iInvalid", int(EDDListType::iInvalid)),
value("iPartnerTrade", int(EDDListType::iPartnerTrade)),
value("iPartnerTradeBag", int(EDDListType::iPartnerTradeBag)),
value("iQuickSlot", int(EDDListType::iQuickSlot)),
value("iTrashSlot", int(EDDListType::iTrashSlot))
],
class_< CUIActorMenu, CUIDialogWnd, CUIWndCallback>("CUIActorMenu")
.def(constructor<>())
.def("get_drag_item", &CUIActorMenu::GetCurrentItemAsGameObject)
.def("highlight_section_in_slot", &CUIActorMenu::HighlightSectionInSlot)
.def("refresh_current_cell_item", &CUIActorMenu::RefreshCurrentItemCell)
.def("IsShown", &CUIActorMenu::IsShown)
.def("ShowDialog", &CUIActorMenu::ShowDialog)
.def("HideDialog", &CUIActorMenu::HideDialog)
];
module(L, "ActorMenu")
[
def("get_actor_menu", &GetActorMenu),
def("get_menu_mode", &GrabMenuMode)
];
examples:
Callbacks:
- Actor:
- key_press
key_release
key_hold
actor_before_death
on_attach_vehicle
on_detach_vehicle
on_use_vehicle
item_to_belt
item_to_slot
item_to_ruck
weapon_jammed
weapon_zoom_in
weapon_zoom_out
Game Object Exports:
Code: Select all
//For Car
attach_vehicle(game_object) ----- C++ &CScriptGameObject::AttachVehicle(CScriptGameObject car)
detach_vehicle() ----- C++ &CScriptGameObject::DetachVehicle()
get_attached_vehicle() ----- C++ &CScriptGameObject::GetAttachedVehicle()
iterate_feel_touch(functor) ----- C++ &CScriptGameObject::IterateFeelTouch(luabind::functor funct)
get_luminocity_hemi() ----- C++ &CScriptGameObject::GetLuminocityHemi()
get_luminocity() ----- C++ &CScriptGameObject::GetLuminocity()
bone_visible() ----- C++ &CScriptGameObject::IsBoneVisible()
set_bone_visible() ----- C++ &CScriptGameObject::SetBoneVisible(LPCSTR bone_name)
set_health_ex(number) ----- C++ &CScriptGameObject::SetHealthEx(u8 value)
force_set_position(vector3) ----- C++ &CScriptGameObject::ForceSetPosition(FVector3 position)
set_spatial_type(number) ----- C++ &CScriptGameObject::SetSpatialType(u8 type)
get_spatial_type() ----- C++ &CScriptGameObject::GetSpatialType()
//For Weapons
weapon_addon_attach(game_object) ----- C++ &CScriptGameObject::Weapon_AddonAttach(CScriptGameObject addon)
weapon_addon_detach(section) ----- C++ &CScriptGameObject::Weapon_AddonDetach()
//For Weapon & Outfit
install_upgrade(string) ----- C++ &CScriptGameObject::InstallUpgrade(LPCSTR section_name)
has_upgrade(string) ----- C++ &CScriptGameObject::HasUpgrade(LPCSTR section_name)
iterate_installed_upgrades(functor) ----- C++ &CScriptGameObject::IterateInstalledUpgrades(luabind::functor funct)
// For CHudItem
play_hud_motion(string name, bool mixIn, number state) ----- C++ &CScriptGameObject::PlayHudMotion(LPCSTR motion, bool bMixIn, u8 state)
switch_state(number) ----- C++ &CScriptGameObject::SwitchState(u8 value)
get_state() ----- C++ &CScriptGameObject::GetState()
// For EatableItem
set_remaining_uses(number) ----- C++ &CScriptGameObject::SetRemainingUses(u8 value)
get_remaining_uses() ----- C++ &CScriptGameObject::GetRemainingUses()
get_max_uses() ----- C++ &CScriptGameObject::GetMaxUses()
// Phantom
phantom_set_enemy(game_object) ----- C++ &CScriptGameObject::PhantomSetEnemy(CScriptGameObject enemy)
// Actor
set_character_icon(string) ----- C++ &CScriptGameObject::SetCharacterIcon(LPCSTR texture_name)
game_object:get_attached_vehicle() {return game_object}
game_object:add_upgrade(section) {void}
game_object:has_upgrade(section) {return bool}
game_object:iterate_installed_upgrades(lua_function,game_object) -- passes section and given game_object
game_object:play_hud_motion(anim_section,bMixIn,game_object:get_state()) {return number} -- animation length
game_object:switch_state(number)
game_object:get_state() {return number}
game_object:activate_hud_item()
game_object:deactivate_hud_item()
Weapon Sounds
- Ability to set individual actor sounds (For stereo sound!):
- snd_shoot_actor
snd_silncer_shot_actor
- Exampe:
Code: Select all
snd_shoot = ak74_shoot
[ak74_shoot]
snd_1_layer = weapons\ak74\ak74_bass
snd_2_layer = weapons\ak74\ak74_shoot, 1, 0.01
snd_2_layer1 = weapons\ak74\ak74_shoot1, 1, 0.01
snd_2_layer2 = weapons\ak74\ak74_shoot2, 1, 0.01
snd_2_layer3 = weapons\ak74\ak74_shoot, 1.3, 0.012
snd_2_layer4 = weapons\ak74\ak74_shoot1, 1.1, 0.008
snd_2_layer5 = weapons\ak74\ak74_shoot2, 1.5, 0.014
snd_3_layer = weapons\ak74\ak74_mech, 1.5
snd_3_layer1 = weapons\ak74\ak74_mech1, 1.5
snd_3_layer2 = weapons\ak74\ak74_mech2, 1.5
snd_3_layer3 = weapons\ak74\ak74_mech, 1
snd_3_layer4 = weapons\ak74\ak74_mech1, 1.25
snd_3_layer5 = weapons\ak74\ak74_mech2, 1.8
snd_4_layer = weapons\ak74\ak74_reflect, 1, 0.015
snd_4_layer1 = weapons\ak74\ak74_reflect1, 1, 0.015
snd_4_layer2 = weapons\ak74\ak74_reflect2, 1, 0.015
snd_4_layer3 = weapons\ak74\ak74_reflect, 1.2, 0.012
snd_4_layer4 = weapons\ak74\ak74_reflect1, 1, 0.019
snd_4_layer5 = weapons\ak74\ak74_reflect2, 1.4, 0.01
Check the GITHUB wiki for incomplete and not up-to-date info:
https://github.com/revolucas/xray-16/wi ... of-Changes