What if I'd use/create small ID system for this type of weapon? Comp is created only once and ThingDef everytime an object is created?
I was thinking about some simple array in Comp that would check which one is spawned. ThingDef would have just it's own ID. If something is spawned then ThingDef with this one ID would get boost only for itself.
Problems that I noticed about this idea are I'd need to know which one is spawned and I'm not sure if I can make this type of interaction between Comp and ThingDef.
Do you think it's possible without bigger problems?
About your first approach, I'm looking in ThingComp and there is nothing even connected to ,,damage" stats.(power stat of tool inside a weapon) I was thinking before about using PostPreApplyDamage(DamageInfo dinfo, out bool absorbed) and changing DamageInfo before the damage was dealt(probably misunderstood what is this method for) but DamageInfo objects and read-only.
Thing Comp doesn't also contain any class that is connected to something that has Tool class list(not even single Tool class) inside.
ThingComp's parent is ThingWithComps, which has this method:
I am not sure yet and it might be reverse to what I think, I mean Comp created every time object is created and ThingDef one for all. If so I maybe could use above method somehow to call every ThingComp of all this type objects separately. (or no because it would anyway change power of one ,,global" ThingDef which may result in having +x*amount of copies damage bonus)
About the second option. It's nice but it feels for me like escaping from the problem and making solution around of it. Then I may have problem if I'd want to allow few of them possible but also extremaly rare.
Your code gives me an idea I didn't think about before, why not just add item to the game without using xml at all? Am I right it would be then much easier to manage them?
I am yet a little confused and trying to understand your note written under the code fragment.
Anyway, why doesn't ThingWithComps have any ThingDef inside by default? And does creating one really work without any issues? By default are ThingWithComps' not having any representation as an item lying on the ground? (is it that what ThingDef does?)
Approach 3, as I see tools have their ID's. Maybe that's the easiest way if it would work. (but this ID variable is under [unsaved] tag in ILSpy, I am not sure what does it mean and if I could use it as I want)
I was thinking about some simple array in Comp that would check which one is spawned. ThingDef would have just it's own ID. If something is spawned then ThingDef with this one ID would get boost only for itself.
Problems that I noticed about this idea are I'd need to know which one is spawned and I'm not sure if I can make this type of interaction between Comp and ThingDef.
Do you think it's possible without bigger problems?
About your first approach, I'm looking in ThingComp and there is nothing even connected to ,,damage" stats.(power stat of tool inside a weapon) I was thinking before about using PostPreApplyDamage(DamageInfo dinfo, out bool absorbed) and changing DamageInfo before the damage was dealt(probably misunderstood what is this method for) but DamageInfo objects and read-only.
Thing Comp doesn't also contain any class that is connected to something that has Tool class list(not even single Tool class) inside.
ThingComp's parent is ThingWithComps, which has this method:
I am not sure yet and it might be reverse to what I think, I mean Comp created every time object is created and ThingDef one for all. If so I maybe could use above method somehow to call every ThingComp of all this type objects separately. (or no because it would anyway change power of one ,,global" ThingDef which may result in having +x*amount of copies damage bonus)
About the second option. It's nice but it feels for me like escaping from the problem and making solution around of it. Then I may have problem if I'd want to allow few of them possible but also extremaly rare.
Your code gives me an idea I didn't think about before, why not just add item to the game without using xml at all? Am I right it would be then much easier to manage them?
I am yet a little confused and trying to understand your note written under the code fragment.
Anyway, why doesn't ThingWithComps have any ThingDef inside by default? And does creating one really work without any issues? By default are ThingWithComps' not having any representation as an item lying on the ground? (is it that what ThingDef does?)
Approach 3, as I see tools have their ID's. Maybe that's the easiest way if it would work. (but this ID variable is under [unsaved] tag in ILSpy, I am not sure what does it mean and if I could use it as I want)