"generic" damage

Freeform discussion about anything related to modding Transcendence.
Post Reply
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

3. Added "generic" damage type


whats the syntax to use generic damage in

Code: Select all

(shpDamageArmor gplayership 0 0 20)
i tried using

Code: Select all

(shpDamageArmor gplayership 0 16 20)
it returned true but did not damage the armor
yet when i use

Code: Select all

(shpDamageArmor gplayership 0 15 20)
it does damage the armor
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
Arisaya
Fleet Admiral
Fleet Admiral
Posts: 5535
Joined: Tue Feb 05, 2008 1:10 am
Location: At the VSS Shipyards in the frontier, designing new ships.

did you try negative 1?
(shpOrder gPlayership 'barrelRoll)

<New tutorials, modding resources, and official extension stuff coming to this space soon!>
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

It is indeed -1.

In the future (maybe someone can write a ticket) those functions should take a string value:

'laser
'particle
...
'generic
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

george moromisato wrote:It is indeed -1.

In the future (maybe someone can write a ticket) those functions should take a string value:

'laser
'particle
...
'generic
I have updated the wiki with this info.

Regarding the functions. Could we not just have a set of functions for converting between the integer and text representations? A'la (intToDamageType ..) and (damageTypeToInt ..)

Perhaps that is the wrong perspective, but it seems to me it is wrong to be able to input integers and strings on one side, and only get integers out on the other... the interface would benefit from being consistent in this case
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I would like to eventually deprecate all uses of magic numbers. I think strings will be much more robust (and the performance cost is minimal).

It is hard to deprecate functions that return a magic number. We would have to replace them with a new function.

But it is pretty easy to have a function accept both ints and string.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Hmm, right... it would be nice to move away from magic numbers. Adding new functions to work with strings, and deprecating the current ones is a solution, but eventually the api becomes really muddled (imo).

How about introducing backwards breaking changes in the 2.0 release? Is that even something you would consider? You could potentially clean up some of the inconsistencies with sta/shp/obj functions, and perhaps also the arm* functions.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

what if the current functions could accept both magic numbers and strings ? They would remain backward compatible.
In the future, when eventually more strings will be added, the numbers could be removed from the functions.
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

digdug wrote:what if the current functions could accept both magic numbers and strings ? They would remain backward compatible.
In the future, when eventually more strings will be added, the numbers could be removed from the functions.
george moromisato wrote:...

But it is pretty easy to have a function accept both ints and string.
I think the problem was not being able to return both a string and an int from the same function.
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

alterecco wrote:How about introducing backwards breaking changes in the 2.0 release? Is that even something you would consider? You could potentially clean up some of the inconsistencies with sta/shp/obj functions, and perhaps also the arm* functions.
That's definitely an option. Since Extensions have a version number we could use that to determine whether to use the 1.0 behavior or the 2.0 behavior.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

That's definitely an option. Since Extensions have a version number we could use that to determine whether to use the 1.0 behavior or the 2.0 behavior.
I like that idea! Would you like that we started a topic related to this deprecation? Perhaps we should wait and do it later on?
Post Reply