Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: fightermedic on November 09, 2013, 07:02:32 am

Title: [feature request] excluding weapons from linked fire penalty
Post by: fightermedic on November 09, 2013, 07:02:32 am
as you know with
$disable linked fire penalty:                        NO
you can have linked weapons fire with lower rate of fire, as in fs1
could we get a weapon flag to exclude a weapon from this? i'd like for some purely ballistic weapons to not be affected by this, while energy based weapons still are
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Trivial Psychic on November 10, 2013, 07:56:04 am
So you'd want a way so that ballistic+ballistic or ballistic+energy = no linked penalty, but energy+energy = linked penalty.  It sounds like there'd need to be a list of weapon types each can be paired with without penalty, either on a per-weapon basis in the weapons table, or in the ai_profiles table.  It might also be prudent to incorporate a means of dictating exactly how much linking penalty delay is present on a per-weapon basis (in theory weapons with higher energy drain may cause greater delay) and a way to cause further delay if a ship has more than 2 primary weapon bays and the player links all 3 of them together.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: mjn.mixael on November 10, 2013, 08:10:01 am
So you'd want a way so that ballistic+ballistic or ballistic+energy = no linked penalty, but energy+energy = linked penalty.  It sounds like there'd need to be a list of weapon types each can be paired with without penalty, either on a per-weapon basis in the weapons table, or in the ai_profiles table.  It might also be prudent to incorporate a means of dictating exactly how much linking penalty delay is present on a per-weapon basis (in theory weapons with higher energy drain may cause greater delay) and a way to cause further delay if a ship has more than 2 primary weapon bays and the player links all 3 of them together.

While that would make the request much more robust, it's also far and away more complicated. The original request is simply 'does this weapon get any linked penalty?'. You've changed it to 'under what circumstances might this weapon be exempt from linked penalty'.

It's almost like you've tacked on a whole new set of requests.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Wanderer on November 10, 2013, 08:14:15 am
Looking at the code... Code checks through armed weapon banks and then determines the penalty to the firewait (i.e. time between shots). Given how the code works it seems that normal weapon flag would be the most prudent method for implementing such an option.

So in essence what you want is:
Normal weapon + Flagged weapon = normal waits between shots on both
Normal weapon + Normal weapon + Flagged weapon = Linked wait between shots with normal weapons, normal wait between shots on flagged weapon

Or did i misunderstood anything?

EDIT:
What is needed (should i even consider implementing this) is a DEFINITE DESCRIPTION as to what it should accomplish.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: The E on November 10, 2013, 08:16:08 am
fightermedic's request has a lot of merit (and is actually a more elegant way of doing things than the rather clumsy global setting), and shouldn't be that hard to do. Adding additional settings here just sounds like a lot of granularity for something that isn't really going to matter all that much during gameplay.

Looking at the code... Code checks through armed weapon banks and then determines the penalty to the firewait (i.e. time between shots). Given how the code works it seems that normal weapon flag would be the most prudent method for implementing such an option.

So in essence what you want is:
Normal weapon + Flagged weapon = normal waits between shots on both
Normal weapon + Normal weapon + Flagged weapon = Linked wait between shots with normal weapons, normal wait between shots on flagged weapon

Or did i misunderstood anything?

That's what I'm thinking too.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: headdie on November 10, 2013, 11:24:14 am
that looks good to me, it adds a good deal of flexibility without making things overly complicated from a modding perspective and would allow fightermedic to implement the scenario outlined
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: fightermedic on November 10, 2013, 12:15:45 pm
yo, thanks for considering this
just to make it clear, this is what i'm looking for:
flagged + flagged = no penalty
flagged + normal = no penalty
flagged + flagged + normal = no penalty
flagged + normal + normal = no penalty for the flagged one, penalty as if only 2 weapons are linked for the normal

however, it might be easier to implement it like this, which wouldn't be ideal, but ok:
flagged + normal = no penalty for flagged, penalty as if linked for the normal one
flagged + normal + normal = no penalty for the flagged one, penalty as if 3 weapons are linked for the normal
flagged + flagged + normal = no penalty for the flagged ones, penalty as if 3 weapons are linked for the normal

in a perfect world, we would have 2 flags, making both variants possible
one flag to exlude a weapon from being counted towards linking penalties at all
and one to not apply linking pnealties to this specific weapon
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Wanderer on November 10, 2013, 01:58:49 pm
Something like this (which is totally untested) could do the trick... Comments? I'll test it later (tomorrow possibly) but it wouldn't hurt to have an opinion on it beforehand.

Code: [Select]
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp (revision 10047)
+++ code/ship/ship.cpp (working copy)
@@ -10128,11 +10128,11 @@
  polymodel *pm = model_get( sip->model_num );
 
  // Goober5000 (thanks to _argv[-1] for the original idea)
- if (!(The_mission.ai_profile->flags & AIPF_DISABLE_LINKED_FIRE_PENALTY))
+ if ( !((winfo_p->wi_flags3 & WIF3_NO_LINKED_PENALTY) || (The_mission.ai_profile->flags & AIPF_DISABLE_LINKED_FIRE_PENALTY)) )
  {
  int effective_primary_banks = 0;
  for (int it = 0; it < num_primary_banks; it++)
- if (Weapon_info[swp->primary_bank_weapons[it]].wi_flags3 & WIF3_NOLINK)
+ if (Weapon_info[swp->primary_bank_weapons[it]].wi_flags3 & (WIF3_NOLINK | WIF3_NO_LINKED_PENALTY))
  continue;
  else
  effective_primary_banks++;
Index: code/weapon/weapon.h
===================================================================
--- code/weapon/weapon.h (revision 10047)
+++ code/weapon/weapon.h (working copy)
@@ -115,6 +115,7 @@
 
 #define WIF3_NOLINK (1 << 0) // This weapon can not be linked with others
 #define WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS (1 << 1) // override MAX_TURRET_DISRUPT_TIME in emp.cpp - Goober5000
+#define WIF3_NO_LINKED_PENALTY (1 << 2) // This weapon does not count into linked firing penalty
 
 
 #define WIF_HOMING (WIF_HOMING_HEAT | WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
Index: code/weapon/weapons.cpp
===================================================================
--- code/weapon/weapons.cpp (revision 10047)
+++ code/weapon/weapons.cpp (working copy)
@@ -648,6 +648,8 @@
  weaponp->wi_flags3 |= WIF3_NOLINK;
  else if (!stricmp(NOX("same emp time for capships"), weapon_strings[i]))
  weaponp->wi_flags3 |= WIF3_USE_EMP_TIME_FOR_CAPSHIP_TURRETS;
+ else if (!stricmp(NOX("no primary linked penalty"), weapon_strings[i]))
+ weaponp->wi_flags3 |= WIF3_NO_LINKED_PENALTY;
  else
  Warning(LOCATION, "Bogus string in weapon flags: %s\n", weapon_strings[i]);
  }
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: fightermedic on November 11, 2013, 06:42:19 pm
cool stuff, from what i do understand of the code this would be the first behaviour described by me?
 keep it up!
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Wanderer on November 12, 2013, 11:08:00 am
cool stuff, from what i do understand of the code this would be the first behaviour described by me?
Yes
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Sushi on November 12, 2013, 03:47:56 pm
If you end up implementing this, you should probably update the wiki to discourage use of the AI profiles flag in favor of the weapon flag.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Dragon on November 12, 2013, 04:29:58 pm
AIP flag is more global, which suits mods that don't intend to use the penalty at all, though. I don't see why to discourage it's use.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: AdmiralRalwood on November 12, 2013, 07:36:48 pm
AIP flag is more global, which suits mods that don't intend to use the penalty at all, though. I don't see why to discourage it's use.
I concur. Maybe a note should be added mentioning the weapon flag, but I see no reason to discourage the AIP flag just because you can do the same thing by adding this flag to every weapon.
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: Wanderer on November 22, 2013, 12:17:41 pm
New option committed to the code in r10147

"no primary linked penalty" - weapon flag
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: fightermedic on November 22, 2013, 05:04:24 pm
YES!
hooray
thanks a ton
Title: Re: [feature request] excluding weapons from linked fire penalty
Post by: headdie on November 22, 2013, 05:20:16 pm
awesome stuff