Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: AndrewofDoom on January 31, 2010, 10:03:20 am

Title: Semi-auto fire for Weapons
Post by: AndrewofDoom on January 31, 2010, 10:03:20 am
Would it be possible to add such a flag to the weapons table? You know, so the user has to keep pressing to fire more. The fire wait would be the reload time of the gun then (which would hopefully be low and all, but...). I'd like this, as the Feather 2's gun for the mod I'm helping to make was always semi-auto in the old games, and we wish to keep it that way.
Title: Re: Semi-auto fire for Weapons
Post by: chief1983 on January 31, 2010, 07:26:37 pm
Sounds like it's more of a ship thing than a weapon trait then.  It should be possible, just gotta find a coder who can implement it.
Title: Re: Semi-auto fire for Weapons
Post by: Nuke on January 31, 2010, 07:41:01 pm
semi-auto seems more like a weapons thing to me.
Title: Re: Semi-auto fire for Weapons
Post by: The E on January 31, 2010, 07:41:57 pm
Agreed. This is an attribute of the weapon, not the ship it's mounted on.
Title: Re: Semi-auto fire for Weapons
Post by: Nuke on January 31, 2010, 08:07:24 pm
if you need a weapon to have a different effect on a particular ship, you could just make an alternate version with a #something (cyclops#short and hornet#weak comes to mind) appended to the name.

speeking of those is there any way to make the loadout screen represent # defined alternate versions with the same icon as their standard version? say you have a cyclops and a cyclops#short, and i make a new bomber that i only want to carry the #short version. is there any way to only display one cyclops icon in the loadout, and have the engine pick the most compatable version while perfering the one without a # character in the name, but will take whatever works.
Title: Re: Semi-auto fire for Weapons
Post by: Wanderer on February 01, 2010, 03:18:07 am
Burst fire type weapons can already be implemented. Semi automatic appears to have been idea of 'non-stream' weapons but i don't remember those ever having worked like that.
Title: Re: Semi-auto fire for Weapons
Post by: Dragon on February 01, 2010, 06:00:16 pm
I recall that "stream" flag does something with sounds, not the weapons firing.
Title: Re: Semi-auto fire for Weapons
Post by: Nuke on February 01, 2010, 07:58:15 pm
^ thats what ive always thought. its so that sounds for rapid fire weapons loop rather than use a different sound channel.
Title: Re: Semi-auto fire for Weapons
Post by: Wanderer on February 01, 2010, 11:41:41 pm
There seems to be many legends about the "stream" flag floating around... perhaps those ought to be cleared...

Code: [Select]
#define  WIF_STREAM (1 << 31) // handled by "trigger down/trigger up" instead of "fire - wait - fire - wait"
Code: [Select]
// if we're firing stream weapons, but the trigger is not down, do nothing
if(stream_weapons && !(shipp->flags & SF_TRIGGER_DOWN)){
return 0;
}
 ..
// if we're firing stream weapons and this is a non stream weapon, skip it
if(stream_weapons && !(winfo_p->wi_flags & WIF_STREAM)){
continue;
}
// if we're firing non stream weapons and this is a stream weapon, skip it
if(!stream_weapons && (winfo_p->wi_flags & WIF_STREAM)){
continue;
}

In short, "stream" flag:
Title: Re: Semi-auto fire for Weapons
Post by: Woolie Wool on February 02, 2010, 12:30:09 am
Is this something for joysticks then?
Title: Re: Semi-auto fire for Weapons
Post by: Wanderer on February 02, 2010, 12:41:02 am
No... The "stream" flag does pretty much nothing, apart from making the code run the fire primary function twice instead of just once.
Title: Re: Semi-auto fire for Weapons
Post by: Colonol Dekker on February 02, 2010, 07:29:10 am
Burst fire seems a more appropriate term. . .
Title: Re: Semi-auto fire for Weapons
Post by: chief1983 on February 02, 2010, 09:38:12 am
So either way, there is no way to implement what was requested.  So it's still valid.  Plus, that comment in the code about 'stream' seems awfully misleading too, almost like it says that it is a semi-auto function, which would be even more inappropriately named.
Title: Re: Semi-auto fire for Weapons
Post by: Sushi on February 02, 2010, 01:29:00 pm
No... The "stream" flag does pretty much nothing, apart from making the code run the fire primary function twice instead of just once.

If this is the case, why not just remove it?

So either way, there is no way to implement what was requested.  So it's still valid.

Maybe a "semiauto" weapon flag?
Title: Re: Semi-auto fire for Weapons
Post by: Nuke on February 02, 2010, 02:10:33 pm
after looking at the burst options in the wiki, i noticed that it had its own flags section. i would put the semi-auto flag there. if not set burst would function normally, if set then you would have to release the trigger before you could fire another burst. of course for a single shot semi-auto, your burst shots would be one. you could also do the m16 3 shots stop and youd have to pull again to fire another burst. if used in the weapon flags instead it should work with burst.
Title: Re: Semi-auto fire for Weapons
Post by: chief1983 on February 02, 2010, 02:56:20 pm
As long as the cooldown works as expected with burst, having a burst of one sounds like it should work fine.