-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor turrets (part 2) #17160
Refactor turrets (part 2) #17160
Conversation
f9ba08e
to
79753b6
Compare
When setting targets the UI now shows which turrets are in range and will be affected |
{ | ||
item &gun = pt.base; | ||
if( !gun.is_gun() || gun.ammo_type() == "NULL" || | ||
gun.ammo_current() == "null" || gun.ammo_remaining() == 0 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary here, just noting:
ammo_type() == "NULL"
and ammo_current() == "null"
are repeated a lot in the code and are rather ugly.
It would be much better if they looked like ammo_type().is_null()
and ammo_current().is_null()
.
The fact that they use different capitalization adds to the confusion and has resulted in at least one bug, as far as I recall.
Possible sources of bugs: There needs to be an option to designate a gun as mounted-only. Also other bugs that should be fixed here, or at least kept in mind when designing: #17071, #17022, #12801 |
As of 948a262 turrets start with automatic targeting disabled. Combined with the fix for destroyed turrets still being usable this stops wreckage spamming debug messages about sufficient ammo. This is a fairly hefty refactor which sets the stage for part 3 which will tackle a lot of the deficiencies in the interface for targeting individual turrets. No further changes to this PR anticipated excluding review/fixes. |
few blazemod issues |
Not a regression from this specific PR. Firing modes are part 3
Was always the case with that prompt
Can you be more specific and is this a regression from this specific PR? |
Flamethrower can't use napalm ammo, only gasoline. |
break; | ||
|
||
case turret_status::no_power: | ||
add_msg( m_bad, string_format( _( "The %s is not powered" ), pt.name().c_str() ).c_str() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Period at the end of the sentence - here and above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why the weird formatting? Why string_format
inside add_msg
which already does formatting?
Turrets now fire at extreme ranges where they can't hit anything. |
|
Three options:
Propose option 1 as temporary fix (defacto how it was before) and then 3 |
Not sure why though. No obvious problems in |
I'd go with this one, it worked well before.
Balancing wouldn't be trivial (AoE ammo, burst fire), but later on it could use something like NPC range estimation. |
I've gone with a hard-limit for now as every turret used 12 anyway. |
More info about ammo types: EDIT: Found it - quantity of ammo isn't checked until it is set, after which the function returns. |
Makes sense, need some system of specifying ammo preference |
Ammo preference should wait for another PR, for now just fixes should be enough. |
@Coolthulhu see f644083 |
Empty is a bit too lenient. Consider |
True, see better fix in 83380a6 |
Napalm tank is spelled "naplm" |
Waiting for #16959 and will then be rebasedturret.cpp
.vehicle::turrets()
accessorImplementation:
vehicle::turret_query
can be used to check a turret statusturret_reload
before firingStill
WIP
but everything else will build upon 79753b6 without further rebase so comments requested