Skip to content

Commit 7a6ae61

Browse files
authored
Merge branch 'themrdemonized:all-in-one-vs2022-wpo' into script_attachments
2 parents 4c84ab2 + 756ba48 commit 7a6ae61

20 files changed

+396
-251
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ How to compile exes:
184184
6. For successful compilation, **the latest build tools with MFC and ATL libraries is required**
185185
186186
## Changelog
187+
**2025.03.15**
188+
* `obj:list_bones(bHud = false)` to return a table of all bones of an object in `[bone_id] = bone_name` form. If `bHud` is true, then use hud model
189+
* damoldavskiy: Repaired MAS for Script Attachments (https://github.com/themrdemonized/xray-monolith/pull/144)
190+
191+
**2025.03.14**
192+
* `use_separate_ubgl_keybind` to enable separate UBGL keybind or return to vanilla system
193+
* damoldavskiy: Modular Attachment System: alt positions, zoom step count (https://github.com/themrdemonized/xray-monolith/pull/143)
194+
* Lucy: Script Attachments (https://github.com/themrdemonized/xray-monolith/pull/140)
195+
187196
**2025.03.13**
188197
* Bence7661: Enable freelook while reloading (https://github.com/themrdemonized/xray-monolith/pull/139)
189198

gamedata/configs/text/eng/ui_mm_modded_exes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@
165165
<string id="ui_mm_modded_exes_qol_crash_save_count">
166166
<text>Crash Saves Count (crash_save_count)</text>
167167
</string>
168+
<string id="ui_mm_modded_exes_qol_use_separate_ubgl_keybind">
169+
<text>Use Separate UBGL Keybind (use_separate_ubgl_keybind)</text>
170+
</string>
168171
<string id="ui_mm_modded_exes_qol_aimmode_remember">
169172
<text>Aimmode remember (aimmode_remember)</text>
170173
</string>

gamedata/configs/text/rus/ui_mm_modded_exes.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,14 @@
162162
<string id="ui_mm_modded_exes_qol_crash_save_count">
163163
<text>Ñåéâû âî âðåìÿ âûëåòîâ Êîë-âî (crash_save_count)</text>
164164
</string>
165+
<string id="ui_mm_modded_exes_qol_use_separate_ubgl_keybind">
166+
<text>Îòäåëüíàÿ êíîïêà äëÿ ïîäñòâîëà (use_separate_ubgl_keybind)</text>
167+
</string>
165168
<string id="ui_mm_modded_exes_qol_aimmode_remember">
166-
<text>Ðåæèì ïðèöåëèâàíèÿ çàïîìíèòü (aimmode_remember)</text>
169+
<text>Çàïîìíèòü ïðèöåë ïåðåä ïåðåêëþ÷åíèåì íà ïîäñòâîë (aimmode_remember)</text>
167170
</string>
168171
<string id="ui_mm_modded_exes_qol_freelook_while_reloading">
169-
<text>Ñâîáîäíûéâçãëÿä ïðè ïåðåçàðÿäêå (freelook_while_reloading)</text>
172+
<text>Ñâîáîäíûé âçãëÿä ïðè ïåðåçàðÿäêå (freelook_while_reloading)</text>
170173
</string>
171174

172175
<!-- Sounds -->

gamedata/scripts/lua_help_ex.script

Lines changed: 167 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@
5050
apply_pdm_to_ads // Enables PDM (handling) values to be applied properly during ADS
5151
smooth_ads_transition // Smoothly applies the ADS accuracy bonus instead of only being applied when fully ADS
5252
allow_silencer_hide_tracer // Controls wether or not silencers can hide tracers at all
53+
use_separate_ubgl_keybind // Use separate keybind for switching to UBGL, or use vanilla system
5354
aimmode_remember // When switching to UBGL the weapon will remember what mode you switched from and will put you back in that mode
5455
freelook_while_reloading // // Allows freelook during reload animations
55-
56-
viewport_near [0.0, 1.0] // Adjust the camera near value
56+
57+
viewport_near [0.0, 1.0] // Adjust the camera near value
5758

5859
print_bone_warnings // Print warnings when using bone_position and bone_direction functions and encounter invalid bones
5960

@@ -375,13 +376,15 @@
375376
function set_bone_visible(u16 id, bool bVisibility, bool bRecursive, bool bHud)
376377
function set_bone_visible(string bone_name, bool bVisibility, bool bRecursive, bool bHud)
377378

379+
function list_bones(bool bHud = false)
380+
378381
// Torch
379382
function update_torch()
380-
381-
// Script Attachments
382-
function add_attachment(number, string);
383-
function get_attachment(number);
384-
function remove_attachment(number);
383+
384+
// Script Attachments
385+
function add_attachment(number, string);
386+
function get_attachment(number);
387+
function remove_attachment(number);
385388
}
386389

387390
class CArtefact : CGameObject {
@@ -549,161 +552,161 @@
549552
["flSlowDown"] = bit.lshift(1, 31),
550553
}
551554

552-
// Child class of script_light - used specifically to attach it to script_attachments
553-
// set_position and set_direction work as an offset to the parent attachment position/direction
554-
class attachment_script_light : script_light {
555-
property color;
556-
property enabled;
557-
property hud_mode;
558-
property lanim;
559-
property lanim_brightness;
560-
property range;
561-
property shadow;
562-
property texture;
563-
property type;
564-
property volumetric;
565-
property volumetric_distance;
566-
property volumetric_intensity;
567-
property volumetric_quality;
568-
569-
attachment_script_light ();
570-
571-
function set_direction(vector);
572-
function set_direction(vector, vector);
573-
function set_direction(number, number, number);
574-
function set_position(vector);
575-
function set_position(number, number, number);
576-
}
577-
578-
class ScriptAttachment {
579-
function add_attachment(number, string);
580-
function attach_light(attachment_script_light*);
581-
function bone_callback(number, number, boolean);
582-
function bone_callback(number, const function<matrix>&, boolean);
583-
function detach_light();
584-
function get_attachment(number);
585-
function get_bone_matrix(number);
586-
function get_bone_visible(number);
587-
function get_center();
588-
function get_flags();
589-
function get_light();
590-
function get_model();
591-
function get_origin();
592-
function get_parent();
593-
function get_parent_bone();
594-
function get_position();
595-
function get_rotation();
596-
function get_scale();
597-
function get_transform();
598-
function get_ui();
599-
function get_ui_bone();
600-
function get_ui_rotation();
601-
function play_motion(string, boolean, number);
602-
function remove_attachment(number);
603-
function remove_bone_callback(number);
604-
function set_bone_visible(number, boolean);
605-
function set_flags(number);
606-
function set_model(string, boolean);
607-
function set_origin(vector);
608-
function set_origin(number, number, number);
609-
function set_parent(ScriptAttachment*);
610-
function set_parent(game_object*);
611-
function set_parent_bone(number);
612-
function set_position(vector);
613-
function set_position(number, number, number);
614-
function set_rotation(vector);
615-
function set_rotation(number, number, number);
616-
function set_scale(vector);
617-
function set_scale(number, number, number);
618-
function set_scale(number);
619-
function set_ui(string);
620-
function set_ui_bone(number);
621-
function set_ui_position(vector);
622-
function set_ui_position(number, number, number);
623-
function set_ui_position();
624-
function set_ui_rotation(vector);
625-
function set_ui_rotation(number, number, number);
626-
}
627-
628-
flags:
629-
["eSA_RenderHUD"] = 1,
630-
["eSA_RenderWorld"] = 2,
631-
["eSA_CamAttached"] = 4,
632-
633-
Script Attachment examples:
634-
635-
-- adds script attachment with model gamedata\meshes\test\box.ogf to the actor's current active item in slot 1 (slots range from 0 to 65535)
636-
local att = db.actor:active_item():add_attachment(1, "test\\box")
637-
638-
-- setting attachment parameters
639-
640-
-- functions accept both vectors or three values, scale even accepts one value
641-
att:set_position(0,1,2)
642-
att:set_rotation(vector():set(0,90,0))
643-
att:set_scale(0.9)
644-
645-
-- render both on hud and world model (default is 2 -> only on world model)
646-
att:set_flags(3)
647-
648-
-- create an attachment_script_light (can use script_light functions and properties)
649-
-- ! make sure to keep a reference to the script light or it will be garbage collected !
650-
att_light = attachment_script_light()
651-
att_light.type = 2
652-
att_light.hud_mode = true
653-
654-
-- attachment_script_light position and direction work as an offset to the attachment position/direction
655-
att_light:set_position(0,0,2)
656-
att_light:set_direction(0,90,0)
657-
att_light:set_cone(math.rad(0.5))
658-
att_light.color = fcolor():set(1,0,0,1)
659-
660-
-- attach it to the script attachment
661-
att:attach_light(att_light)
662-
663-
664-
-- attach the model to the actor instead of their active item
665-
att:set_parent(db.actor)
666-
667-
-- make it a camera attachment
668-
att:set_flags(4)
669-
670-
-- you can attach attachments to other attachments
671-
att2 = att:add_attachment(0, "test\\box2")
672-
att3 = att2:add_attachment(0, "test\\box2")
673-
674-
-- and transfer the whole chain of attachments to another parent
675-
-- this will transfer att and its child attachments to the new parent
676-
att:set_parent(db.actor:active_item())
677-
678-
-- same for child attachments
679-
att3:set_parent(npc)
680-
681-
-- it's also possible to change the model at any time
682-
-- the boolean tells the engine if existing bone callbacks should be kept in place or if they should be removed
683-
att3:set_model("armor\\boots", false)
684-
685-
-- bone callbacks can be added like this
686-
-- there are two types of bone callbacks
687-
-- this makes the bone 1 of the attachment model follow the position of bone 6 of its parent object, the boolean tells the engine to overwrite any animation positions
688-
-- same with bone 2 of the attachment model to bone 10 of the parent object
689-
att3:bone_callback(1, 6, false)
690-
att3:bone_callback(2, 10, false)
691-
692-
-- the second type of bone callbacks uses a script callback to change the position of a bone in real time
693-
local lock = db.actor:add_attachment(1234, "interface\\lockpick\\lock3")
694-
lock:set_flags(4)
695-
lock:set_rotation(90,0,0)
696-
lock:set_position(0,0,0.09)
697-
-- the callback function "cylinder_callback" will be used to adjust the position of bone 1
698-
lock:bone_callback(1, cylinder_callback, false)
699-
700-
-- example callback function
701-
-- this will adjust the rotation of the bone
702-
function cylinder_callback(mat)
703-
local temp = mat.c
704-
local hpb = mat:getHPB()
705-
mat:setHPB(hpb.x, hpb.y + cylinder_rotation, hpb.z)
706-
mat.c = temp
707-
return mat
708-
end
555+
// Child class of script_light - used specifically to attach it to script_attachments
556+
// set_position and set_direction work as an offset to the parent attachment position/direction
557+
class attachment_script_light : script_light {
558+
property color;
559+
property enabled;
560+
property hud_mode;
561+
property lanim;
562+
property lanim_brightness;
563+
property range;
564+
property shadow;
565+
property texture;
566+
property type;
567+
property volumetric;
568+
property volumetric_distance;
569+
property volumetric_intensity;
570+
property volumetric_quality;
571+
572+
attachment_script_light ();
573+
574+
function set_direction(vector);
575+
function set_direction(vector, vector);
576+
function set_direction(number, number, number);
577+
function set_position(vector);
578+
function set_position(number, number, number);
579+
}
580+
581+
class ScriptAttachment {
582+
function add_attachment(number, string);
583+
function attach_light(attachment_script_light*);
584+
function bone_callback(number, number, boolean);
585+
function bone_callback(number, const function<matrix>&, boolean);
586+
function detach_light();
587+
function get_attachment(number);
588+
function get_bone_matrix(number);
589+
function get_bone_visible(number);
590+
function get_center();
591+
function get_flags();
592+
function get_light();
593+
function get_model();
594+
function get_origin();
595+
function get_parent();
596+
function get_parent_bone();
597+
function get_position();
598+
function get_rotation();
599+
function get_scale();
600+
function get_transform();
601+
function get_ui();
602+
function get_ui_bone();
603+
function get_ui_rotation();
604+
function play_motion(string, boolean, number);
605+
function remove_attachment(number);
606+
function remove_bone_callback(number);
607+
function set_bone_visible(number, boolean);
608+
function set_flags(number);
609+
function set_model(string, boolean);
610+
function set_origin(vector);
611+
function set_origin(number, number, number);
612+
function set_parent(ScriptAttachment*);
613+
function set_parent(game_object*);
614+
function set_parent_bone(number);
615+
function set_position(vector);
616+
function set_position(number, number, number);
617+
function set_rotation(vector);
618+
function set_rotation(number, number, number);
619+
function set_scale(vector);
620+
function set_scale(number, number, number);
621+
function set_scale(number);
622+
function set_ui(string);
623+
function set_ui_bone(number);
624+
function set_ui_position(vector);
625+
function set_ui_position(number, number, number);
626+
function set_ui_position();
627+
function set_ui_rotation(vector);
628+
function set_ui_rotation(number, number, number);
629+
}
630+
631+
flags:
632+
["eSA_RenderHUD"] = 1,
633+
["eSA_RenderWorld"] = 2,
634+
["eSA_CamAttached"] = 4,
635+
636+
Script Attachment examples:
637+
638+
-- adds script attachment with model gamedata\meshes\test\box.ogf to the actor's current active item in slot 1 (slots range from 0 to 65535)
639+
local att = db.actor:active_item():add_attachment(1, "test\\box")
640+
641+
-- setting attachment parameters
642+
643+
-- functions accept both vectors or three values, scale even accepts one value
644+
att:set_position(0,1,2)
645+
att:set_rotation(vector():set(0,90,0))
646+
att:set_scale(0.9)
647+
648+
-- render both on hud and world model (default is 2 -> only on world model)
649+
att:set_flags(3)
650+
651+
-- create an attachment_script_light (can use script_light functions and properties)
652+
-- ! make sure to keep a reference to the script light or it will be garbage collected !
653+
att_light = attachment_script_light()
654+
att_light.type = 2
655+
att_light.hud_mode = true
656+
657+
-- attachment_script_light position and direction work as an offset to the attachment position/direction
658+
att_light:set_position(0,0,2)
659+
att_light:set_direction(0,90,0)
660+
att_light:set_cone(math.rad(0.5))
661+
att_light.color = fcolor():set(1,0,0,1)
662+
663+
-- attach it to the script attachment
664+
att:attach_light(att_light)
665+
666+
667+
-- attach the model to the actor instead of their active item
668+
att:set_parent(db.actor)
669+
670+
-- make it a camera attachment
671+
att:set_flags(4)
672+
673+
-- you can attach attachments to other attachments
674+
att2 = att:add_attachment(0, "test\\box2")
675+
att3 = att2:add_attachment(0, "test\\box2")
676+
677+
-- and transfer the whole chain of attachments to another parent
678+
-- this will transfer att and its child attachments to the new parent
679+
att:set_parent(db.actor:active_item())
680+
681+
-- same for child attachments
682+
att3:set_parent(npc)
683+
684+
-- it's also possible to change the model at any time
685+
-- the boolean tells the engine if existing bone callbacks should be kept in place or if they should be removed
686+
att3:set_model("armor\\boots", false)
687+
688+
-- bone callbacks can be added like this
689+
-- there are two types of bone callbacks
690+
-- this makes the bone 1 of the attachment model follow the position of bone 6 of its parent object, the boolean tells the engine to overwrite any animation positions
691+
-- same with bone 2 of the attachment model to bone 10 of the parent object
692+
att3:bone_callback(1, 6, false)
693+
att3:bone_callback(2, 10, false)
694+
695+
-- the second type of bone callbacks uses a script callback to change the position of a bone in real time
696+
local lock = db.actor:add_attachment(1234, "interface\\lockpick\\lock3")
697+
lock:set_flags(4)
698+
lock:set_rotation(90,0,0)
699+
lock:set_position(0,0,0.09)
700+
-- the callback function "cylinder_callback" will be used to adjust the position of bone 1
701+
lock:bone_callback(1, cylinder_callback, false)
702+
703+
-- example callback function
704+
-- this will adjust the rotation of the bone
705+
function cylinder_callback(mat)
706+
local temp = mat.c
707+
local hpb = mat:getHPB()
708+
mat:setHPB(hpb.x, hpb.y + cylinder_rotation, hpb.z)
709+
mat.c = temp
710+
return mat
711+
end
709712
--]]

0 commit comments

Comments
 (0)