SourceCodeSamurai
Chieftain
- Joined
- Jul 9, 2021
- Messages
- 2
I am trying to write a small mod that targets the issue with the combat experience of aircraft carriers. I got a mod set up, got the event hook for the combat initialized but the object that the event provides is not really helpful at the moment.
Thanks to this event documentation I have an idea of what to expect.
I hoped to access the object attributes like object.COMBAT_TYPE or object["COMBAT_TYPE"] but these do not exist (nil). So I looped over the table to checked what keys and values are being provided and instead of proper key-names the table only provides some strange integer numbers. I assume they are ids for some kind of reference table (though negative numbers are usually never used for reference ids...). But for the death of me, I can't find the connection.
Is there a method (something like object[getRefIndexFor("COMBAT_TYPE")] or similar) to translate these numbers into proper key names? Does someone know about a mod where the source code is available that had solved that issue already so I could learn from it?
Thank you in advance!
Combat Object example:
Thanks to this event documentation I have an idea of what to expect.
I hoped to access the object attributes like object.COMBAT_TYPE or object["COMBAT_TYPE"] but these do not exist (nil). So I looped over the table to checked what keys and values are being provided and instead of proper key-names the table only provides some strange integer numbers. I assume they are ids for some kind of reference table (though negative numbers are usually never used for reference ids...). But for the death of me, I can't find the connection.
Is there a method (something like object[getRefIndexFor("COMBAT_TYPE")] or similar) to translate these numbers into proper key names? Does someone know about a mod where the source code is available that had solved that issue already so I could learn from it?
Thank you in advance!
Combat Object example:
Code:
{
954462304 = false,
865706498 = true,
432821635 = true,
1431908133 = {
126272016 = 0,
-746205821 = 100,
853003252 = -1,
-958805242 = 34,
-1522214634 = 0,
1930175143 = 34,
-1263136305 = 0,
236175385 = -1,
1472654640 = {
type = 1,
player = 0,
id = 131073,
},
-1351684353 = 5,
-1779249298 = {
y = 16,
x = 9,
},
-1306278355 = 20,
1838009406 = 0,
1116922831 = 5,
},
-1480090105 = -1,
-1632097141 = {
126272016 = 0,
-746205821 = 100,
853003252 = -1,
-958805242 = 21,
-1522214634 = 34,
1930175143 = 21,
-1263136305 = 0,
236175385 = -1,
1472654640 = {
type = 1,
player = 63,
id = 196610,
},
-1351684353 = 3,
-1779249298 = {
y = 17,
x = 9,
},
-1306278355 = 25,
1838009406 = 0,
1116922831 = 9,
},
-278393875 = false,
-1779249298 = {
y = 17,
x = 9,
},
469286896 = 0,
433239030 = 0,
598597112 = true,
493520281 = {
126272016 = 0,
-746205821 = 0,
853003252 = -1,
-958805242 = 0,
-1522214634 = 0,
1930175143 = 0,
-1263136305 = 0,
236175385 = -1,
1472654640 = {
type = 0,
player = -1,
id = -1,
},
-1351684353 = 0,
-1779249298 = {
y = -9999,
x = -9999,
},
-1306278355 = 0,
1838009406 = 0,
1116922831 = 0,
},
-5828522 = true,
-77002069 = {
y = -9999,
x = -9999,
},
-2102924904 = 748940753,
-247326915 = -1,
705738904 = -1507201801,
787125023 = {
126272016 = 0,
-746205821 = 0,
853003252 = -1,
-958805242 = 0,
-1522214634 = 0,
1930175143 = 0,
-1263136305 = 0,
236175385 = -1,
1472654640 = {
type = 0,
player = -1,
id = -1,
},
-1351684353 = 0,
-1779249298 = {
y = -9999,
x = -9999,
},
-1306278355 = 0,
1838009406 = 0,
1116922831 = 0,
},
}