We did it!
[b]Taking weapon drawSize into account is Vanilla Rimworld now.[/b]
Known issues in 1.6
- Rimworld now also uses the drawsize for the weapon button imagine on the pawn, making some weapons bigger than the button.
- Rimworld now throws a config error if the weapon has offsets. This is harmless but annoying. It can be circumvented with setting "rotatable" to "true" in the weapon def, but i don't know what impact this has on other things the game does with weapon rendering.
What does this mod do now?
What is left of this mod is making the game take offSets into account when rendering carried equipment. [b] Does nothing on it's own. [/b]
Maybe this will also be implemented in Vanilla Rimworld after the next DLC, who knows.
This mod is extremly lightweight as it literally only changes a single variable in the PawnRenderer.DrawEquipmentAiming function.
For Modders
The first 2 screenshots are an example on what you can do. All you need to do is set drawSize (optional) and/or offsets (also optional) in the graphicData xml node. Don't copy the dll into your mod, this will break the transpiler, because patching the same line in code doesn't work if the line gets replaced. Just add a dependency in your steam mod page. Loading order doesn't matter.
Why use this over JecsTools' Oversized Weapon? (Obsolete!)
[b]- Better perfromance:[/b] This mod doesn't use extra comps. No comp list needs to be searched which would add up if modded weapons get alot of comps. JecsTools' Oversized Weapon searches every comp list of every drawn weapon every frame. Even if not all the weapons use JecsTools' Oversized Weapon, they still need to be searched. Imagine having a hundred rendered pawns with all their weapons drawn searched every single frame.
[b]- Your mod doesn't break if you remove or forget to activate Enable Oversized Weapons:[/b] All you did was modify the already existing graphicData which vanilla Rimworld has, but ignores. There will be no errors. Worst case if you remove the mod: your weapons are now as tiny as vanilla Rimworld would render them. If a new Rimworld version would come (1.4 for example), you can even update your weapon mods without this mod being updated, because you are not depending on any code. This gives you the possibility to start updating from day one.
[b]- Higher compability:[/b] Enable Oversized Weapons doesn't skip the vanilla Rimworld method. Other mods that use a Prefix or make a Transpiler will still get executed.
Example Size
Makes weapons bigger or smaller.
<drawSize>2.0</drawSize>
above 1 = bigger, below 1 = smaller
[b]or[/b]
<drawSize>(2.0, 2.0)</drawSize>
If you want to stretch the weapon use different values.
first value = horizontal
second value = vertical
Example Offset
Offsets move the weapon in certain directions. For example you could move a sword more to the right when the pawn is facing right to position the handle exactly where the pawn's hand would be.
Every single offset is optional.
drawOffsetNorth: when the pawn looks up
drawOffsetEast when the pawn looks right
drawOffsetSouth when the pawn looks down
drawOffsetWest when the pawn looks left
offset direction values:
each offset has 3 values which determine in which direction the weapon gets moved
[b]<drawOffsetNorth>(left/right, background/foreground, up/down)</drawOffsetNorth>[/b]
left < 0 < right
background < 0 < foreground
down < 0 < up
[b]<drawOffsetEast>(1.0, 0.0, 1.0)</drawOffsetEast>[/b] would move the weapon a whole tile to the right and a whole tile up when the pawn looks right, like you can see in the screenshot. This is quite alot. You probably want to work with smaller numbers like -0.33 or +0.25
Keep in mind, that when a weapon lies on the ground, the drawOffsetNorth will get applied to the render position. This mod removes that from primary equipment, so the weapon is centered again (this can be turned off in the mod options). This is also done via a Harmony Transpiler and it only adjusts a single variable. Having it enabled should have close to none performance impact.
Compatibility
There should be no issues.
Loading order doesn't matter. (just somewhere after Harmony)
Safe to add or remove anytime.
Mods that skip DrawEquipmentAiming will also skip what this mod does.
Other transpilers that patch DrawEquipmentAiming should still all work without issues.
Other transpilers that patch Graphic.Print should still all work without issues.
Uses Harmony.
Github: [url=https://steamcommunity.com/linkfilter/?u=https%3A%2F%2Fgithub.com%2Fsplincore%2FEnable-Oversized-Weapons]https://github.com/splincore/Enable-Oversized-Weapons[/url]