Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upManual turret aiming #10575
Conversation
kevingranade
added
the
unknown
label
Dec 21, 2014
This comment has been minimized.
This comment has been minimized.
|
I had posted this as a suggestion about a year or a year and a half ago. Glad to see someone do this. |
KA101
self-assigned this
Dec 23, 2014
This comment has been minimized.
This comment has been minimized.
|
Good news: it works. Bad news: the M2 Browning on my APC blew out my torso when on single-shot automatic acquisition, after I targeted a spitter that (with the fact I was in motion) moved into my line. Folks are not gonna be happy about that, ignoring IFF or no. |
KA101
removed their assignment
Dec 23, 2014
This comment has been minimized.
This comment has been minimized.
|
How did it all look like before your M2 gunned you down? How close were you to it? Did it try to shoot through you or just included you in its cone of fire when it shouldn't? I didn't change the automatic targeting code, so I don't see how could it happen. I can't reproduce it on my side either. How fast were you going? Is it possible that it was just the recoil from a fast moving vehicle caused this? I'm pretty sure that (in mainline) low-accuracy turrets (tested with humvee GL) can friendly-fire when the player is close. Since recoil and dispersion are pretty much interchangeable here and moving vehicles have positive recoil, this could be just bad luck. It should work like this: manual target acquisition costs some time. If you're fast, you can aim and then do something else. Turret will shoot as soon as vehicle gets processed (I think just after player's turn). The target is a point, so it doesn't track any possible moving entities. After it executes the shot, it goes back to automatic acquisition that doesn't differ from mainline. |
This comment has been minimized.
This comment has been minimized.
|
APC-MG, I was facing roughly 45 degrees (so northeast) and aiming the turret via the gap that comes up at that point. Turret's located in the middle of the unit, practically adjacent to the controls, and, so far as I can tell, tried to shoot through me to hit the spitter I'd targeted. Was traveling about 19 MPH or so, and am pretty confident the APC moved before the turret fired. Bad luck or no, players instakilling themselves this way is gonna get all sorts of clamor going on the forum, so it's gonna need fixed or worked around if this is to merge. ("No turret within two or three tiles of the controls on stock vehicles and a note in the help as to why" would be one, but I'm not sure if it's the most effective one.) Basically, you shouldn't be able to kill yourself with your own turrets. |
This comment has been minimized.
This comment has been minimized.
|
Would asking the player "this shot looks dangerous, do you still want to execute it?" be enough? Then the only ways to kill self with turrets would be agreeing to be shot through, skidding just before shooting or standing in such a bad spot that the existing (mainlined) turret targeting would also kill the player. If the turret moves after aiming, its line of fire doesn't rotate - it is the same exact line of fire except translated by the difference in car's position. So if a shot is not dangerous before vehicle movement, it will not become dangerous after it (barring collisions that cause skidding). The other solution I see would be making turrets more realistic: forbid them from shooting and damaging anything standing on vehicle parts that are inside (turrets are on the roof) or even just a any part of the vehicle. Defenses for the inside of the vehicle could be added later. |
This comment has been minimized.
This comment has been minimized.
|
OK, so now the turret can't hit the player inside the same vehicle the turret is a part of. It will not damage the player who is a part of the vehicle, even if there is no roof above them. This is more for convenience, but also because it should only happen to players who specifically aim the turret (and thus avoid aiming at self) or stand at the very edge of IFF range, where things get iffy due to number rounding. Also, the survivor in a vehicle is probably not standing straight, but hunched over or even sitting, making stray shots hitting them make even less sense. Targeting will now avoid monsters who are standing on the vehicle. Those under the roof wouldn't be damaged anyway (and realistically seen by the turret), those on unroofed areas get it for free (and because turrets can't damage own vehicle). |
KA101
self-assigned this
Dec 24, 2014
Coolthulhu
added some commits
Dec 24, 2014
This comment has been minimized.
This comment has been minimized.
|
Looks like a git-side issue, so I'll take a look. |
This comment has been minimized.
This comment has been minimized.
|
Compiles fine, but now the M2 Browning won't shoot at a bio-op directly in front of the APC. (By "directly" I mean anywhere from 12 tiles directly in front of the weapon, to right up on the APC's bumper.) Goes for manual and auto targeting. :-( |
KA101
removed their assignment
Dec 24, 2014
This comment has been minimized.
This comment has been minimized.
|
Was it with the newest commit? I did some really stupid mistakes in the ones just before it (comparing vehicle to null rather than to other vehicle). |
This comment has been minimized.
This comment has been minimized.
|
Yep, I manually targeted the op and it kept saying the M2 couldn't shoot it. What vehicle were you using to test? I'm wondering if turrets "inside" the vehicle (as in, not on the immediate outside edge) are getting blocked by their own vehicle. |
This comment has been minimized.
This comment has been minimized.
|
Kept saying it couldn't shoot? I'll change the description and try to prevent ammo-less turrets from being aimed. |
This comment has been minimized.
This comment has been minimized.
|
Last time I checked APC turrets (at least when debug-spawned) came loaded. It had no problem shooting when it one-shot my test char earlier. ;-) |
This comment has been minimized.
This comment has been minimized.
|
Well, not all do. Apparently it's random. You mean the APC named "Armored Personnel Carrier" with id "apc" under number 4 in debug spawn menu? I spawned 10. 2 of them had no ammo. I mean, I seriously can't find any other explanation. The "failed to shoot" message can only happen when it's a non-turret firing, a turret with non-gun weapon item, a turret firing non-ammo, a turret with no ammo or a turret trying to fire ammo with negative charges or 0 charges. |
KA101
self-assigned this
Dec 24, 2014
KA101
merged commit 438a403
into
CleverRaven:master
Dec 25, 2014
1 check passed
This comment has been minimized.
This comment has been minimized.
|
Thanks Santa! |
This comment has been minimized.
This comment has been minimized.
|
FYI: this seems to break down at nighttime and/or underground: M249s (test-mounted on a quad or RV, or preinstalled on an armored car) all have max range 0 in such circumstances. M2s on the APC retain range 45. The faux-ammo thing is the likely culprit but that wouldn't explain the daylight-only aspect, I'd think. :-/ |
This comment has been minimized.
This comment has been minimized.
|
Nice catch, though the explanation is much simpler: I didn't include ammo range in calculation. It only uses gun range, which in M2 is 45 and in M249 is 0. |
This comment has been minimized.
This comment has been minimized.
|
Bloody hell. >_< KA101 has been on this for a While now |
This comment has been minimized.
This comment has been minimized.
|
I'll PR a fix in few minutes. Got normal turrets covered, but CHARGE ones need a tiny bit of extra care. EDIT: #10641 |
Coolthulhu commentedDec 21, 2014
A new option for turreted vehicles: aim a turret.
Forces a target for the turret rather than letting it pick one automatically.
Modifies and uses game::target, but in a way that doesn't affect existing uses. Makes game::target public.
Target is referred to by location. Uses the "std::pair<point,point> target" originally declared for jumper cables. Second point of the pair is original location of the turret - if it changes, the vehicles "sights" have moved and so will the target (not sure if it's possible for a vehicle to move between player's turn and turret handling).
Currently no support for burst fire/single fire selection - if the turret is configured for single fire, manual aiming will fire once. If not (off or burst) it will fire a burst. If it was off before manual aim, will turn it off after firing.
Will force turret_mode on if it wasn't.
Doesn't respect player's safety or warn about possible friendly fire.
Doesn't respect the hardcoded distance limit of 12 (or 5 in case of gasoline fuel) that automatic target acquirement has.
Checks for tag: "MANUAL". Turrets with this tag will not acquire targets by themselves and can't be configured.