Mod update

Kinda got sidetracked

Projectile Trajectory Fix See it on the ModDB

Projectile Trajectory Fix, small addon, out now

Well, yeah, i was practicing with some APIs i'd never touched and just having fun (kinda, i struggled with some code for a while, then realised i was being an idiot) when i saw someone on the official VS Discord asking for a trajectory mod for spears and such.

Someone suggested Projectile Trajectory, but it turned out to be broken on 1.22.7... i had to try it.

So i did. It seemed to work, but bows were offset wrongly.

Luckily the mod's source was available, so i did some digging and found the problem pretty quickly, the bow offset was calculated the same way as the spear one, which is a little higher and to the right (you throw a spear from the shoulder, after all), but bows should be calculated from the center.

Sooooo... yeah, easy fix, right?

Wrong.

The bow thing

Instead of correcting the guess, i just stopped guessing. The game already has a function that works out where a projectile starts and which way it goes, spears call it with "shoulder, a bit in front of you" and bows call it with "straight from the eyes, a bit behind".

So now the line asks the game the same way the game asks itself.

While i was in there i also found the spread was being applied upside down, and that went away with the same change.

Then the line was still short

Okay, but why do long shots still land before the line ends?

Two things, as it turns out.

  • Draw strength was ignored. Some traits and gear make you shoot harder, the game uses that and the line didn't, so the more buffed you were, the more wrong it got.
  • There was extra gravity the game doesn't have. The mod's default physics have an extra falloff that vanilla doesn't do, so long shots landed short. Its Combat Overhaul physics mode doesn't have that, and it matches vanilla much better.

So yes, vanilla spears and bows now use the Combat Overhaul physics. Sounds wrong, lands right.

Combat Overhaul on 1.22.7

The mod hasn't been updated for 1.22.7 yet, and at least on 1.22.7 "Combat Overhaul" means the Combat Overhaul Forked, the one that's maintained for now, not the original.

The mod looks for Combat Overhaul by its library name, and the fork keeps that code under a different name, so it didn't find it. A small patch that swaps the name fixes it.

Once it could see CO again, a few more things showed up.

  • The fork aims a little above the crosshair (1.5° by default), and the line didn't know about that.
  • Speeds and gravity were eyeballed for the old CO, now they're read straight from the weapon and from the projectile itself, which also means CO's spears_thrown_distance setting gets picked up without doing anything extra.
  • It logged a warning every tick while you held a bow, so i moved that to verbose debug.

And the small stuff

  • The log messages were in Spanish, nothing wrong with Spanish, but the rest of the log is English, so i swapped them.
  • The mod's start-up did nothing but print "Hello from template mod", so that's gone.
  • i also tried patching one more of its start-up methods and the game just crashed, turns out touching that one breaks how the mod loads its own patches... so i don't touch it.

Why an addon and not a fork

The original mod has no license, so i couldn't just fork it and publish a fixed version.

It's a separate client-side addon instead, you install it next to the original and it patches things while the game runs, no server install needed.

And well... that was my "quick detour" from Time Flies By. Back to dust and moss now.

If the line is still off with some weapon or mod combo, tell me and i'll take a look.

React 45 views

All updates

Follow along: RSS feed Ko-fi