Skip to content

feature(misc-changes): Miscellaneous Changes#61

Merged
themrdemonized merged 11 commits intothemrdemonized:all-in-one-vs2022-wpofrom
nltp-ashes:all-in-one-vs2022-wpo
Aug 18, 2024
Merged

feature(misc-changes): Miscellaneous Changes#61
themrdemonized merged 11 commits intothemrdemonized:all-in-one-vs2022-wpofrom
nltp-ashes:all-in-one-vs2022-wpo

Conversation

@nltp-ashes
Copy link
Contributor

@nltp-ashes nltp-ashes commented Aug 18, 2024

Hello,

This PR brings a couple of unrelated changes, mainly due to the fact that VS git integration sucks, and I'm scared to lose my changes. Sorry in advance.

Summary

  • LTX-based patrol paths definitions
  • Support for custom first shot sound effect in CWeaponMagazined
  • Support for inventory boxes in CScriptGameObject::GetObjectByName
  • Fix for ActorMenu_on_item_after_move callback sending nil values in obj argument
  • Fix for actor_on_item_take_from_box callback not firing when item is moved from a slot

LTX based patrol paths definitions

As the name suggests, this allows for defining patrol paths in a config file, instead of having to define them in SDK.

New patrol paths must be defined in a file gamedata/configs/patrol_paths.ltx. The file can be empty. Patrol paths in this file can be defined the same way they are in level.spawn or all.spawn. Here is an example :

[ashes_patrol_path]
points = p0,p1,p2,p3,p4

p0:name = ashes_path_0
p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:game_vertex_id = 58
p0:level_vertex_id = 358250
p0:links = p4(1)

p1:name = ashes_path_1
p1:position = 339.404693603516,7.83200216293335,-77.1159210205078
p1:game_vertex_id = 58
p1:level_vertex_id = 4294967295
p1:links = p2(1),p3(1),p4(1)

p2:name = ashes_path_2
p2:position = 330.119689941406,7.67243385314941,-85.4553375244141
p2:game_vertex_id = 58
p2:level_vertex_id = 353402
p2:links = p0(1)

p3:name = ashes_path_3
p3:position = 345.357116699219,7.85000419616699,-85.7749176025391
p3:game_vertex_id = 58
p3:level_vertex_id = 363610
p3:links = p0(1),p1(1),p4(1)

p4:name = ashes_path_4
p4:position = 336.210662841797,8.79472923278809,-82.2809219360352
p4:game_vertex_id = 45
p4:level_vertex_id = 356777
p4:links = p1(1),p3(1),p2(1)

Here is a set of patrol paths that will cause the engine to Crash To Desktop. These can be used to test proper functioning of engine-side handled exceptions. When the engine crashes, it prints a custom message, the name of the faulty patrol path, and sometimes an extra argument, depending on context.

; Test : Duplicated patrol path
[bloodsucker_01_way_1]
points = p0,p1
p0:name = wp00
p0:position = -17.3474063873291,1.29224097728729,464.643005371094
p0:game_vertex_id = 37104
p0:level_vertex_id = 4294967295
p0:links = p1(1)

p1:name = wp01
p1:position = -30.7962455749512,1.00885403156281,461.276977539063
p1:game_vertex_id = 301
p1:level_vertex_id = 128000
; Test : Missing points
[test_missing_points]

p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:game_vertex_id = 58
p0:level_vertex_id = 358250
; Test : Missing name
[test_missing_name]
points = p0

p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:game_vertex_id = 58
p0:level_vertex_id = 358250
; Test : Missing position
[test_missing_pos]
points = p0

p0:name = ashes_path_0
p0:game_vertex_id = 58
p0:level_vertex_id = 358250
; Test : Missing level vertex id
[test_missing_lvid]
points = p0

p0:name = ashes_path_0
p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:game_vertex_id = 58
; Test : Missing game vertex id
[test_missing_gvid]
points = p0

p0:name = ashes_path_0
p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:level_vertex_id = 358250
; Test : Bad format for link
[test_bad_format_for_link]
points = p0,p1

p0:name = ashes_path_0
p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:game_vertex_id = 58
p0:level_vertex_id = 358250
p0:links = p1(1)

p1:name = ashes_path_1
p1:position = 339.404693603516,7.83200216293335,-77.1159210205078
p1:game_vertex_id = 58
p1:level_vertex_id = 4294967295
p1:links = p0(1
; Test : Missing patrol point link target
[test_missing_patrol_point_link_target]
points = p0

p0:name = ashes_path_0
p0:position = 337.945922851563,7.83200407028198,-93.6010437011719
p0:game_vertex_id = 58
p0:level_vertex_id = 358250
p0:links = p4(1)

Support for custom first shot sound effect in CWeaponMagazined

This change allows people to define a custom sound effect that will be used for the first shot in a burst. If the key is not defined, it uses the same behavior as before the change.

Here is an example :

![wpn_pkm]
snd_shoot_actor_first             = path\to\my_sfx
snd_silncer_shoot_actor_first     = path\to\my_sln_sfx

Support for inventory boxes in CScriptGameObject::GetObjectByName

When executing game_object:object(string section), this function would only work on InventoryOwner, and not on InventoryBox. This change allows this function to be called on InventoryBox and return the desired result.

There are three functions of this kind in engine, and with this change, only two support InventoryBox objects. I don't know enough to extend this behavior to the third one, so I am leaving it as is.

Fix for ActorMenu_on_item_after_move callback sending nil values in obj argument

This one is rather simple. The ActorMenu_on_item_after_move callback can send nil values (I think it happens when moving multiple items at once with CTRL+Double Click). This change makes sure that the callback is only fired when the object is not nil.

Fix for actor_on_item_take_from_box callback not firing when item is moved from a slot

This one is also simple. The actor_on_item_take_from_box callback does not fire when an item is moved from a slot. It does fire normally when the item is moved from the inventory. By piggybacking the ActorMenu_on_item_after_move callback, and narrowing down the conditions for the missing call, we can "artificially" fire the callback when it should have.

image

@themrdemonized themrdemonized merged commit 6a0ff40 into themrdemonized:all-in-one-vs2022-wpo Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants