Spring.EmitWeapon

Spring.EmitWeapon

Requests for features in the spring code.

Moderator: Moderators

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Spring.EmitWeapon

Post by smoth » 28 Feb 2013, 19:04

Spring.EmitWeapon(weaponName, x,y,z, dx, dy, dz)

Just a call to fire a weapon as though it was fired by a unit at a designated point in a designated vector.

INBEFORE KNORKE SAYS HACKY SPAWNING OF A UNIT IS ACCEPTABLE. It isn't.

Can we please have this? As it stand right now certain things we cannot cleanly do without such a call and resorting to hacks which result in a menagerie of sideeffects.

it can be weaponname or weapondefid I don't care.
0 x

Kloot
Spring Developer
Posts: 1865
Joined: 08 Oct 2006, 16:58

Re: Spring.EmitWeapon

Post by Kloot » 28 Feb 2013, 19:33

No, you can't have it in this proposed form because firing a weapon requires an instance and weapon instances are owned by units.

EmitWeapon(unitID, weaponID, ...) would be possible, but not much more useful than what you imagined knorke's response to be.
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 28 Feb 2013, 19:48

can we at least get it for unit scripts? Those are part of a unit but in order to emit a weapon it has to be part of a unit def.
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Spring.EmitWeapon

Post by Jools » 28 Feb 2013, 19:52

How were meteors spawned in OTA? Meteor is a weapon and not a unit, so I assume the functionality to emit weapns without having a unit already exists somewhere in the code, but maybe it has fallen into oblivion?

The weapon can be found in weapons.tdf, line 5420.
0 x

Kloot
Spring Developer
Posts: 1865
Joined: 08 Oct 2006, 16:58

Re: Spring.EmitWeapon

Post by Kloot » 28 Feb 2013, 19:55

smoth wrote:can we at least get it for unit scripts? Those are part of a unit but in order to emit a weapon it has to be part of a unit def.
Unavoidable, a unit can not have a weapon (let alone fire it) that is not listed in its unitdef. I suppose EmitSfx doesn't meet your needs either then...
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 28 Feb 2013, 20:05

Kloot wrote:
smoth wrote:can we at least get it for unit scripts?
Does EmitSfx not meet your needs?
It doesn't. Say I have a unit ability(firing a missile salvo from a pod). This means I have to go in the script and put 2048+num in the script. This is bad because it makes generalized scripts a problem.
Kloot wrote:
smoth wrote:Those are part of a unit but in order to emit a weapon it has to be part of a unit def.
Unavoidable, a unit can not have a weapon (let alone fire it) that is not listed in its unitdef.
So this is some engine limitation?
0 x

Kloot
Spring Developer
Posts: 1865
Joined: 08 Oct 2006, 16:58

Re: Spring.EmitWeapon

Post by Kloot » 28 Feb 2013, 20:24

Jools wrote:How were meteors spawned in OTA? Meteor is a weapon and not a unit, so I assume the functionality to emit weapns without having a unit already exists somewhere in the code, but maybe it has fallen into oblivion?
I can't say how OTA did it (probably by spawning hidden units equipped with that weapon). I can say there is no OTA code in Spring to have "fallen into oblivion".
smoth wrote:Say I have a unit ability(firing a missile salvo from a pod). This means I have to go in the script and put 2048+num in the script. This is bad because it makes generalized scripts a problem.
I either don't understand what you have in mind fully or why you think it is a problem. The '2048' is a named constant in Lua (COB.FIRE_WEAPON), and you can easily create a table that holds which weapons are "special abilities" for each unit type. Hardcoding 2048+num anywhere is not necessary.
smoth wrote:So this is some engine limitation?
It is simply a use-case that has never been thought of or designed for.
0 x

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6107
Joined: 29 Apr 2005, 01:14

Re: Spring.EmitWeapon

Post by FLOZi » 28 Feb 2013, 20:42

Spring.UnitEmitWeapon(unitID, weaponNum, [targetID | {x, y, z} [, aimAnim]]) would still be useful imo.
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Spring.EmitWeapon

Post by gajop » 28 Feb 2013, 21:57

FLOZi wrote:Spring.UnitEmitWeapon(unitID, weaponNum, [targetID | {x, y, z} [, aimAnim]]) would still be useful imo.
Could we do Spring.UnitEmitWeapon(unitDefID, weaponNum, { originX, originY, originZ } ,[targetID | {x, y, z} [, aimAnim]]) instead reasonably easy?
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 28 Feb 2013, 22:01

UnitId would be what is needed because it it is for a specific unit
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 28 Feb 2013, 23:55

Kloot wrote:
smoth wrote:Say I have a unit ability(firing a missile salvo from a pod). This means I have to go in the script and put 2048+num in the script. This is bad because it makes generalized scripts a problem.
I either don't understand what you have in mind fully or why you think it is a problem. The '2048' is a named constant in Lua (COB.FIRE_WEAPON), and you can easily create a table that holds which weapons are "special abilities" for each unit type. Hardcoding 2048+num anywhere is not necessary.
because having the weapondef in the unit def seems silly when it is part of an ability. the original request was not so limited in utility.
0 x

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Spring.EmitWeapon

Post by CarRepairer » 01 Mar 2013, 00:27

0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 01 Mar 2013, 01:55

that's nice, detail what you did and how you did it rather than posting a tantalizing image. Otherwise the solution you are proposing might as well not exist.
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 01 Mar 2013, 02:27

Kloot wrote:No, you can't have it in this proposed form because firing a weapon requires an instance and weapon instances are owned by units.
Why DO weapons require an instance anyway?
0 x

User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2695
Joined: 25 Aug 2004, 13:31

Re: Spring.EmitWeapon

Post by bobthedinosaur » 01 Mar 2013, 02:40

Seriously Car, mind explaining how you pulled that off. I know you've been working on chain lightning for over a year now, but does it use some kind of invisible placehoder unit or something else?
0 x

User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Spring.EmitWeapon

Post by CarRepairer » 01 Mar 2013, 05:02

Spawn fake units. It's ugly.
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14588
Joined: 17 Nov 2005, 02:43

Re: Spring.EmitWeapon

Post by Forboding Angel » 01 Mar 2013, 11:14

Jools wrote:How were meteors spawned in OTA? Meteor is a weapon and not a unit, so I assume the functionality to emit weapns without having a unit already exists somewhere in the code, but maybe it has fallen into oblivion?

The weapon can be found in weapons.tdf, line 5420.
Dude... Spring was not made from the OTA source. Spring was coded from scratch. Assuming that something that existed in OTA would exist in spring simply because of the abundance of ripped off OTA content in spring, would be folly.
0 x

Kloot
Spring Developer
Posts: 1865
Joined: 08 Oct 2006, 16:58

Re: Spring.EmitWeapon

Post by Kloot » 01 Mar 2013, 14:32

smoth wrote: Why DO weapons require an instance [to fire] anyway?
You are a programmer familiar with OOP concepts so that really should be obvious...

Every weapon is an object with its own internal state (which unit owns it, what is it aiming at, etc) and associated logic (aim / fire / etc) to change that state. You cannot apply said logic when there is no object aka instance present. It's like asking "why do units require an instance to move?"
0 x

User avatar
Anarchid
Posts: 1380
Joined: 30 Nov 2008, 04:31

Re: Spring.EmitWeapon

Post by Anarchid » 01 Mar 2013, 14:41

Rephrasing the original feature request as "emitProjectile" probably would get somewhat closer, but of course wouldn't emit bursts or timed beams.

I'm pretty convinced i had made a continuous-fire laser back in 2009 which was lol because used some emit thing to just keep shooting as it aimed, hilariously scything foe and friend alike (intentional).

Can i hijack this thread with a request for a call to change a projectile target? Like Spring.SetProjectileTarget(pID, unitID|{x,y,z})? Dauntless guidance for AA missiles for the win, yes?
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Spring.EmitWeapon

Post by smoth » 01 Mar 2013, 18:27

So it has to do with the way the weapon class is defined as part of an inheritance chain? can that NOT be refactored to allow for an alternate class like a unit to be spawned with less methods and features?
0 x

Post Reply

Return to “Feature Requests”