naev 0.10.4
nlua_outfit.c
Go to the documentation of this file.
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
10#include <lauxlib.h>
11
12#include "naev.h"
15#include "nlua_outfit.h"
16
17#include "array.h"
18#include "log.h"
19#include "damagetype.h"
20#include "nlua_faction.h"
21#include "nlua_pilot.h"
22#include "nlua_ship.h"
23#include "nlua_tex.h"
24#include "nluadef.h"
25#include "player.h"
26#include "rng.h"
27#include "slots.h"
28
29/* Outfit metatable methods. */
30static int outfitL_eq( lua_State *L );
31static int outfitL_get( lua_State *L );
32static int outfitL_getAll( lua_State *L );
33static int outfitL_name( lua_State *L );
34static int outfitL_nameRaw( lua_State *L );
35static int outfitL_type( lua_State *L );
36static int outfitL_typeBroad( lua_State *L );
37static int outfitL_cpu( lua_State *L );
38static int outfitL_mass( lua_State *L );
39static int outfitL_slot( lua_State *L );
40static int outfitL_limit( lua_State *L );
41static int outfitL_icon( lua_State *L );
42static int outfitL_price( lua_State *L );
43static int outfitL_description( lua_State *L );
44static int outfitL_summary( lua_State *L );
45static int outfitL_unique( lua_State *L );
46static int outfitL_getShipStat( lua_State *L );
47static int outfitL_weapStats( lua_State *L );
48static int outfitL_specificStats( lua_State *L );
49static int outfitL_illegality( lua_State *L );
50static int outfitL_tags( lua_State *L );
51static const luaL_Reg outfitL_methods[] = {
52 { "__tostring", outfitL_name },
53 { "__eq", outfitL_eq },
54 { "get", outfitL_get },
55 { "getAll", outfitL_getAll },
56 { "name", outfitL_name },
57 { "nameRaw", outfitL_nameRaw },
58 { "type", outfitL_type },
59 { "typeBroad", outfitL_typeBroad },
60 { "cpu", outfitL_cpu },
61 { "mass", outfitL_mass },
62 { "slot", outfitL_slot },
63 { "limit", outfitL_limit },
64 { "icon", outfitL_icon },
65 { "price", outfitL_price },
66 { "description", outfitL_description },
67 { "summary", outfitL_summary },
68 { "unique", outfitL_unique },
69 { "shipstat", outfitL_getShipStat },
70 { "weapstats", outfitL_weapStats },
71 { "specificstats", outfitL_specificStats },
72 { "illegality", outfitL_illegality },
73 { "tags", outfitL_tags },
74 {0,0}
75};
83int nlua_loadOutfit( nlua_env env )
84{
85 nlua_register(env, OUTFIT_METATABLE, outfitL_methods, 1);
86 return 0;
87}
88
110const Outfit* lua_tooutfit( lua_State *L, int ind )
111{
112 return *((const Outfit**) lua_touserdata(L,ind));
113}
121const Outfit* luaL_checkoutfit( lua_State *L, int ind )
122{
123 if (lua_isoutfit(L,ind))
124 return lua_tooutfit(L,ind);
125 luaL_typerror(L, ind, OUTFIT_METATABLE);
126 return NULL;
127}
135const Outfit* luaL_validoutfit( lua_State *L, int ind )
136{
137 const Outfit *o;
138
139 if (lua_isoutfit(L, ind))
140 o = luaL_checkoutfit(L,ind);
141 else if (lua_isstring(L, ind))
142 o = outfit_get( lua_tostring(L, ind) );
143 else {
144 luaL_typerror(L, ind, OUTFIT_METATABLE);
145 return NULL;
146 }
147
148 if (o == NULL)
149 NLUA_ERROR(L, _("Outfit is invalid."));
150
151 return o;
152}
160const Outfit** lua_pushoutfit( lua_State *L, const Outfit *outfit )
161{
162 const Outfit **o = (const Outfit**) lua_newuserdata(L, sizeof(Outfit*));
163 *o = outfit;
164 luaL_getmetatable(L, OUTFIT_METATABLE);
165 lua_setmetatable(L, -2);
166 return o;
167}
175int lua_isoutfit( lua_State *L, int ind )
176{
177 int ret;
178
179 if (lua_getmetatable(L,ind)==0)
180 return 0;
181 lua_getfield(L, LUA_REGISTRYINDEX, OUTFIT_METATABLE);
182
183 ret = 0;
184 if (lua_rawequal(L, -1, -2)) /* does it have the correct mt? */
185 ret = 1;
186
187 lua_pop(L, 2); /* remove both metatables */
188 return ret;
189}
190
201static int outfitL_eq( lua_State *L )
202{
203 const Outfit *a, *b;
204 a = luaL_checkoutfit(L,1);
205 b = luaL_checkoutfit(L,2);
206 if (a == b)
207 lua_pushboolean(L,1);
208 else
209 lua_pushboolean(L,0);
210 return 1;
211}
212
222static int outfitL_get( lua_State *L )
223{
224 const Outfit *o = luaL_validoutfit(L,1);
225 lua_pushoutfit(L, o);
226 return 1;
227}
228
235static int outfitL_getAll( lua_State *L )
236{
237 const Outfit *outfits = outfit_getAll();
238 lua_newtable(L); /* t */
239 for (int i=0; i<array_size(outfits); i++) {
240 lua_pushoutfit( L, (Outfit*) &outfits[i] );
241 lua_rawseti( L, -2, i+1 );
242 }
243 return 1;
244}
245
259static int outfitL_name( lua_State *L )
260{
261 const Outfit *o = luaL_validoutfit(L,1);
262 lua_pushstring(L, _(o->name));
263 return 1;
264}
265
279static int outfitL_nameRaw( lua_State *L )
280{
281 const Outfit *o = luaL_validoutfit(L,1);
282 lua_pushstring(L, o->name);
283 return 1;
284}
285
295static int outfitL_type( lua_State *L )
296{
297 const Outfit *o = luaL_validoutfit(L,1);
298 lua_pushstring(L, outfit_getType(o));
299 return 1;
300}
301
313static int outfitL_typeBroad( lua_State *L )
314{
315 const Outfit *o = luaL_validoutfit(L,1);
316 lua_pushstring(L, outfit_getTypeBroad(o));
317 return 1;
318}
319
329static int outfitL_cpu( lua_State *L )
330{
331 const Outfit *o = luaL_validoutfit(L,1);
332 lua_pushnumber(L, outfit_cpu(o));
333 return 1;
334}
335
345static int outfitL_mass( lua_State *L )
346{
347 const Outfit *o = luaL_validoutfit(L,1);
348 lua_pushnumber(L, o->mass);
349 return 1;
350}
351
365static int outfitL_slot( lua_State *L )
366{
367 const Outfit *o = luaL_validoutfit(L,1);
368 lua_pushstring(L, outfit_slotName(o));
369 lua_pushstring(L, outfit_slotSize(o));
370 lua_pushstring(L, sp_display( o->slot.spid ));
371 lua_pushboolean(L, sp_required( o->slot.spid ));
372 lua_pushboolean(L, sp_exclusive( o->slot.spid ));
373 return 5;
374}
375
383static int outfitL_limit( lua_State *L )
384{
385 const Outfit *o = luaL_validoutfit(L,1);
386 if (o->limit) {
387 lua_pushstring(L,o->limit);
388 return 1;
389 }
390 return 0;
391}
392
402static int outfitL_icon( lua_State *L )
403{
404 const Outfit *o = luaL_validoutfit(L,1);
406 return 1;
407}
408
418static int outfitL_price( lua_State *L )
419{
420 const Outfit *o = luaL_validoutfit(L,1);
421 lua_pushnumber(L, o->price);
422 return 1;
423}
424
435static int outfitL_description( lua_State *L )
436{
437 const Outfit *o = luaL_validoutfit(L,1);
438 if (lua_ispilot(L,2))
439 lua_pushstring(L, pilot_outfitDescription( luaL_validpilot(L,2), o ) );
440 else
441 lua_pushstring(L, pilot_outfitDescription( player.p, o ) );
442 return 1;
443}
444
456static int outfitL_summary( lua_State *L )
457{
458 const Outfit *o = luaL_validoutfit(L,1);
459 int noname = lua_toboolean(L,3);
460 if (lua_ispilot(L,2))
461 lua_pushstring(L, pilot_outfitSummary( luaL_validpilot(L,2), o, !noname ) );
462 else
463 lua_pushstring(L, pilot_outfitSummary( player.p, o, !noname ) );
464 return 1;
465}
466
476static int outfitL_unique( lua_State *L )
477{
478 const Outfit *o = luaL_validoutfit(L,1);
479 lua_pushboolean(L, outfit_isProp(o, OUTFIT_PROP_UNIQUE));
480 return 1;
481}
482
492static int outfitL_getShipStat( lua_State *L )
493{
494 ShipStats ss;
495 const Outfit *o = luaL_validoutfit(L,1);
496 ss_statsInit( &ss );
497 ss_statsModFromList( &ss, o->stats );
498 const char *str = luaL_optstring(L,2,NULL);
499 int internal = lua_toboolean(L,3);
500 ss_statsGetLua( L, &ss, str, internal );
501 return 1;
502}
503
518static int outfitL_weapStats( lua_State *L )
519{
520 double eps, dps, disable, shots;
521 double mod_energy, mod_damage, mod_shots;
522 double sdmg, admg;
523 const Damage *dmg;
524 const Outfit *o = luaL_validoutfit( L, 1 );
525 Pilot *p = (lua_ispilot(L,2)) ? luaL_validpilot(L,2) : NULL;
526
527 /* Just return 0 for non-wapons. */
528 if (o->slot.type != OUTFIT_SLOT_WEAPON)
529 return 0;
530
531 /* Special case beam weapons .*/
532 if (outfit_isBeam(o)) {
533 if (p) {
534 /* Special case due to continuous fire. */
535 if (o->type == OUTFIT_TYPE_BEAM) {
536 mod_energy = p->stats.fwd_energy;
537 mod_damage = p->stats.fwd_damage;
538 mod_shots = 1. / p->stats.fwd_firerate;
539 }
540 else {
541 mod_energy = p->stats.tur_energy;
542 mod_damage = p->stats.tur_damage;
543 mod_shots = 1. / p->stats.tur_firerate;
544 }
545 }
546 else {
547 mod_energy = 1.;
548 mod_damage = 1.;
549 mod_shots = 1.;
550 }
551 shots = outfit_duration(o);
552 mod_shots = shots / (shots + mod_shots * outfit_delay(o));
553 dmg = outfit_damage(o);
554 /* Modulate the damage by average of damage types. */
555 if (dtype_raw( dmg->type, &sdmg, &admg, NULL ) != 0)
556 NLUA_ERROR(L, _("Outfit has invalid damage type."));
557 mod_damage *= 0.5*(sdmg+admg);
558 /* Calculate good damage estimates. */
559 dps = mod_shots * mod_damage * dmg->damage;
560 disable = mod_shots * mod_damage * dmg->disable;
561 eps = mod_shots * mod_energy * outfit_energy(o);
562 lua_pushnumber( L, dps );
563 lua_pushnumber( L, disable );
564 lua_pushnumber( L, eps );
565 lua_pushnumber( L, outfit_range(o) );
566 return 4;
567 }
568
569 if (p) {
570 switch (o->type) {
571 case OUTFIT_TYPE_BOLT:
572 mod_energy = p->stats.fwd_energy;
573 mod_damage = p->stats.fwd_damage;
574 mod_shots = 1. / p->stats.fwd_firerate;
575 break;
576 case OUTFIT_TYPE_TURRET_BOLT:
577 mod_energy = p->stats.tur_energy;
578 mod_damage = p->stats.tur_damage;
579 mod_shots = 1. / p->stats.tur_firerate;
580 break;
581 case OUTFIT_TYPE_LAUNCHER:
582 case OUTFIT_TYPE_TURRET_LAUNCHER:
583 mod_energy = 1.;
584 mod_damage = p->stats.launch_damage;
585 mod_shots = 1. / p->stats.launch_rate;
586 break;
587 case OUTFIT_TYPE_BEAM:
588 case OUTFIT_TYPE_TURRET_BEAM:
589 default:
590 return 0;
591 }
592 }
593 else {
594 mod_energy = 1.;
595 mod_damage = 1.;
596 mod_shots = 1.;
597 }
598
599 shots = 1. / (mod_shots * outfit_delay(o));
600 /* Special case: Ammo-based weapons. */
601 dmg = outfit_damage(o);
602 if (dmg==NULL)
603 return 0;
604 /* Modulate the damage by average of damage types. */
605 dtype_raw( dmg->type, &sdmg, &admg, NULL );
606 mod_damage *= 0.5*(sdmg+admg);
607 /* Calculate good damage estimates. */
608 dps = shots * mod_damage * dmg->damage;
609 disable = shots * mod_damage * dmg->disable;
610 eps = shots * mod_energy * MAX( outfit_energy(o), 0. );
611
612 lua_pushnumber( L, dps );
613 lua_pushnumber( L, disable );
614 lua_pushnumber( L, eps );
615 lua_pushnumber( L, outfit_range(o) );
616 lua_pushnumber( L, outfit_trackmin(o) );
617 lua_pushnumber( L, outfit_trackmax(o) );
618 if (outfit_isLauncher(o)) {
619 lua_pushnumber( L, o->u.lau.lockon );
620 lua_pushnumber( L, o->u.lau.iflockon );
621 lua_pushboolean( L, o->u.lau.ai!=AMMO_AI_UNGUIDED );
622 return 9;
623 }
624 return 6;
625}
626
627#define SETFIELD( name, value ) \
628 lua_pushnumber( L, value ); \
629 lua_setfield( L, -2, name )
630#define SETFIELDI( name, value ) \
631 lua_pushinteger( L, value ); \
632 lua_setfield( L, -2, name )
633#define SETFIELDB( name, value ) \
634 lua_pushboolean( L, value ); \
635 lua_setfield( L, -2, name )
642static int outfitL_specificStats( lua_State *L )
643{
644 const Outfit *o = luaL_validoutfit( L, 1 );
645 lua_newtable(L);
646 switch (o->type) {
647 case OUTFIT_TYPE_AFTERBURNER:
648 SETFIELD( "thrust", o->u.afb.thrust );
649 SETFIELD( "speed", o->u.afb.speed );
650 SETFIELD( "energy", o->u.afb.energy );
651 SETFIELD( "mass_limit", o->u.afb.mass_limit );
652 SETFIELD( "heatup", o->u.afb.heatup );
653 SETFIELD( "heat", o->u.afb.heat );
654 SETFIELD( "heat_cap", o->u.afb.heat_cap );
655 SETFIELD( "heat_base", o->u.afb.heat_cap );
656 break;
657
658 case OUTFIT_TYPE_FIGHTER_BAY:
659 lua_pushship( L, ship_get( o->u.bay.ship ) );
660 lua_setfield( L, -2, "ship" );
661 SETFIELD( "delay", o->u.bay.delay );
662 SETFIELDI("amount", o->u.bay.amount );
663 SETFIELD( "reload_time",o->u.bay.reload_time );
664 break;
665
666 case OUTFIT_TYPE_TURRET_BOLT:
667 SETFIELDB("isturret", 1 );
668 FALLTHROUGH;
669 case OUTFIT_TYPE_BOLT:
670 SETFIELD( "delay", o->u.blt.delay );
671 SETFIELD( "speed", o->u.blt.speed );
672 SETFIELD( "range", o->u.blt.range );
673 SETFIELD( "falloff", o->u.blt.falloff );
674 SETFIELD( "energy", o->u.blt.energy );
675 SETFIELD( "heatup", o->u.blt.heatup );
676 SETFIELD( "heat", o->u.blt.heat );
677 SETFIELD( "trackmin", o->u.blt.trackmin );
678 SETFIELD( "trackmax", o->u.blt.trackmax );
679 SETFIELD( "swivel", o->u.blt.swivel );
680 /* Damage stuff. */
681 SETFIELD( "penetration",o->u.blt.dmg.penetration );
682 SETFIELD( "damage", o->u.blt.dmg.damage );
683 SETFIELD( "disable", o->u.blt.dmg.disable );
684 break;
685
686 case OUTFIT_TYPE_TURRET_BEAM:
687 SETFIELDB("isturret", 1 );
688 FALLTHROUGH;
689 case OUTFIT_TYPE_BEAM:
690 SETFIELD( "delay", o->u.bem.delay );
691 SETFIELD( "warmup", o->u.bem.warmup );
692 SETFIELD( "duration", o->u.bem.duration );
693 SETFIELD( "min_duration",o->u.bem.min_duration );
694 SETFIELD( "range", o->u.bem.range );
695 SETFIELD( "turn", o->u.bem.turn );
696 SETFIELD( "energy", o->u.bem.energy );
697 SETFIELD( "heatup", o->u.bem.heatup );
698 SETFIELD( "heat", o->u.bem.heat );
699 /* Damage stuff. */
700 SETFIELD( "penetration",o->u.bem.dmg.penetration );
701 SETFIELD( "damage", o->u.bem.dmg.damage );
702 SETFIELD( "disable", o->u.bem.dmg.disable );
703 break;
704
705 case OUTFIT_TYPE_TURRET_LAUNCHER:
706 SETFIELDB("isturret", 1 );
707 FALLTHROUGH;
708 case OUTFIT_TYPE_LAUNCHER:
709 SETFIELD( "delay", o->u.lau.delay );
710 SETFIELDI("amount", o->u.lau.amount );
711 SETFIELD( "reload_time",o->u.lau.reload_time );
712 SETFIELD( "lockon", o->u.lau.lockon );
713 SETFIELD( "iflockon", o->u.lau.iflockon );
714 SETFIELD( "trackmin", o->u.lau.trackmin );
715 SETFIELD( "trackmax", o->u.lau.trackmax );
716 SETFIELD( "arc", o->u.lau.arc );
717 SETFIELD( "swivel", o->u.lau.swivel );
718 /* Ammo stuff. */
719 SETFIELD( "duration", o->u.lau.duration );
720 SETFIELD( "speed", o->u.lau.speed );
721 SETFIELD( "speed_max", o->u.lau.speed_max );
722 SETFIELD( "turn", o->u.lau.turn );
723 SETFIELD( "thrust", o->u.lau.thrust );
724 SETFIELD( "energy", o->u.lau.energy );
725 SETFIELDB("seek", o->u.lau.ai!=AMMO_AI_UNGUIDED );
726 SETFIELDB("smart", o->u.lau.ai==AMMO_AI_SMART );
727 /* Damage stuff. */
728 SETFIELD( "penetration",o->u.lau.dmg.penetration );
729 SETFIELD( "damage", o->u.lau.dmg.damage );
730 SETFIELD( "disable", o->u.lau.dmg.disable );
731 break;
732
733 default:
734 break;
735 }
736 return 1;
737}
738#undef SETFIELD
739#undef SETFIELDI
740#undef SETFIELDB
741
749static int outfitL_illegality( lua_State *L )
750{
751 const Outfit *o = luaL_validoutfit(L,1);
752 lua_newtable(L);
753 for (int i=0; i<array_size(o->illegalto); i++) {
754 lua_pushfaction( L, o->illegalto[i] );
755 lua_rawseti( L, -2, i+1 );
756 }
757 return 1;
758}
759
769static int outfitL_tags( lua_State *L )
770{
771 const Outfit *o = luaL_validoutfit(L,1);
772 lua_newtable(L);
773 for (int i=0; i<array_size(o->tags); i++) {
774 lua_pushstring(L,o->tags[i]);
775 lua_pushboolean(L,1);
776 lua_rawset(L,-3);
777 }
778 return 1;
779}
Provides macros to work with dynamic arrays.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
Definition: array.h:168
int dtype_raw(int type, double *shield, double *armour, double *knockback)
Gets the raw modulation stats of a damage type.
Definition: damagetype.c:233
Header file with generic functions and naev-specifics.
#define MAX(x, y)
Definition: naev.h:39
LuaFaction * lua_pushfaction(lua_State *L, LuaFaction faction)
Pushes a faction on the stack.
Definition: nlua_faction.c:192
static int outfitL_limit(lua_State *L)
Gets the limit string of the outfit. Only one outfit can be equipped at the same time for each limit ...
Definition: nlua_outfit.c:383
static int outfitL_mass(lua_State *L)
Gets the mass of an outfit.
Definition: nlua_outfit.c:345
static int outfitL_illegality(lua_State *L)
Gets the factions to which the outfit is illegal to.
Definition: nlua_outfit.c:749
const Outfit * luaL_validoutfit(lua_State *L, int ind)
Makes sure the outfit is valid or raises a Lua error.
Definition: nlua_outfit.c:135
static int outfitL_cpu(lua_State *L)
Gets the cpu usage of an outfit.
Definition: nlua_outfit.c:329
static int outfitL_slot(lua_State *L)
Gets the slot name, size and property of an outfit.
Definition: nlua_outfit.c:365
int nlua_loadOutfit(nlua_env env)
Loads the outfit library.
Definition: nlua_outfit.c:83
static int outfitL_tags(lua_State *L)
Gets the outfit tags.
Definition: nlua_outfit.c:769
static int outfitL_typeBroad(lua_State *L)
Gets the broad type of an outfit.
Definition: nlua_outfit.c:313
static int outfitL_specificStats(lua_State *L)
Returns raw data specific to each outfit type.
Definition: nlua_outfit.c:642
static int outfitL_summary(lua_State *L)
Gets the summary of an outfit (translated).
Definition: nlua_outfit.c:456
static int outfitL_type(lua_State *L)
Gets the type of an outfit.
Definition: nlua_outfit.c:295
static int outfitL_icon(lua_State *L)
Gets the store icon for an outfit.
Definition: nlua_outfit.c:402
static int outfitL_getShipStat(lua_State *L)
Gets a shipstat from an Outfit by name, or a table containing all the ship stats if not specified.
Definition: nlua_outfit.c:492
static int outfitL_getAll(lua_State *L)
Gets all the outfits.
Definition: nlua_outfit.c:235
static int outfitL_nameRaw(lua_State *L)
Gets the raw (untranslated) name of the outfit.
Definition: nlua_outfit.c:279
static int outfitL_get(lua_State *L)
Gets a outfit.
Definition: nlua_outfit.c:222
static int outfitL_description(lua_State *L)
Gets the description of an outfit (translated).
Definition: nlua_outfit.c:435
static int outfitL_name(lua_State *L)
Gets the translated name of the outfit.
Definition: nlua_outfit.c:259
const Outfit * luaL_checkoutfit(lua_State *L, int ind)
Gets outfit at index or raises error if there is no outfit at index.
Definition: nlua_outfit.c:121
static int outfitL_weapStats(lua_State *L)
Computes statistics for weapons.
Definition: nlua_outfit.c:518
static int outfitL_price(lua_State *L)
Gets the price of an outfit.
Definition: nlua_outfit.c:418
static const luaL_Reg outfitL_methods[]
Definition: nlua_outfit.c:51
const Outfit ** lua_pushoutfit(lua_State *L, const Outfit *outfit)
Pushes a outfit on the stack.
Definition: nlua_outfit.c:160
static int outfitL_eq(lua_State *L)
Checks to see if two outfits are the same.
Definition: nlua_outfit.c:201
int lua_isoutfit(lua_State *L, int ind)
Checks to see if ind is a outfit.
Definition: nlua_outfit.c:175
static int outfitL_unique(lua_State *L)
Gets whether or not an outfit is unique.
Definition: nlua_outfit.c:476
const Outfit * lua_tooutfit(lua_State *L, int ind)
Lua bindings to interact with outfits.
Definition: nlua_outfit.c:110
Pilot * luaL_validpilot(lua_State *L, int ind)
Makes sure the pilot is valid or raises a Lua error.
Definition: nlua_pilot.c:478
int lua_ispilot(lua_State *L, int ind)
Checks to see if ind is a pilot.
Definition: nlua_pilot.c:510
const Ship ** lua_pushship(lua_State *L, const Ship *ship)
Pushes a ship on the stack.
Definition: nlua_ship.c:164
glTexture ** lua_pushtex(lua_State *L, glTexture *texture)
Pushes a texture on the stack.
Definition: nlua_tex.c:130
glTexture * gl_dupTexture(const glTexture *texture)
Duplicates a texture.
Definition: opengl_tex.c:809
double outfit_trackmin(const Outfit *o)
Gets the outfit's minimal tracking.
Definition: outfit.c:782
int outfit_isBeam(const Outfit *o)
Checks if outfit is a beam type weapon.
Definition: outfit.c:488
const Outfit * outfit_getAll(void)
Gets the array (array.h) of all outfits.
Definition: outfit.c:141
double outfit_cpu(const Outfit *o)
Gets the outfit's cpu usage.
Definition: outfit.c:703
const Outfit * outfit_get(const char *name)
Gets an outfit by name.
Definition: outfit.c:118
int outfit_isLauncher(const Outfit *o)
Checks if outfit is a weapon launcher.
Definition: outfit.c:498
const char * outfit_getTypeBroad(const Outfit *o)
Gets the outfit's broad type.
Definition: outfit.c:910
double outfit_range(const Outfit *o)
Gets the outfit's range.
Definition: outfit.c:711
const char * outfit_getType(const Outfit *o)
Gets the outfit's specific type.
Definition: outfit.c:879
double outfit_trackmax(const Outfit *o)
Gets the outfit's minimal tracking.
Definition: outfit.c:794
const Damage * outfit_damage(const Outfit *o)
Gets the outfit's damage.
Definition: outfit.c:647
double outfit_duration(const Outfit *o)
Gets the outfit's duration.
Definition: outfit.c:851
const char * outfit_slotName(const Outfit *o)
Gets the name of the slot type of an outfit.
Definition: outfit.c:279
const char * outfit_slotSize(const Outfit *o)
Gets the name of the slot size of an outfit.
Definition: outfit.c:330
double outfit_energy(const Outfit *o)
Gets the outfit's energy usage.
Definition: outfit.c:681
double outfit_delay(const Outfit *o)
Gets the outfit's delay.
Definition: outfit.c:658
const char * pilot_outfitDescription(const Pilot *p, const Outfit *o)
Gets the description of an outfit for a given pilot.
const char * pilot_outfitSummary(const Pilot *p, const Outfit *o, int withname)
Gets the summary of an outfit for a give pilot.
Player_t player
Definition: player.c:73
static const double a[]
Definition: rng.c:247
static const double b[]
Definition: rng.c:256
const Ship * ship_get(const char *name)
Gets a ship based on its name.
Definition: ship.c:73
int ss_statsModFromList(ShipStats *stats, const ShipStatList *list)
Updates a stat structure from a stat list.
Definition: shipstats.c:543
int ss_statsGetLua(lua_State *L, const ShipStats *s, const char *name, int internal)
Gets a ship stat value by name and pushes it to Lua.
Definition: shipstats.c:967
int ss_statsInit(ShipStats *stats)
Initializes a stat structure.
Definition: shipstats.c:347
const char * sp_display(unsigned int spid)
Gets the display name of a slot property (in English).
Definition: slots.c:150
int sp_required(unsigned int spid)
Gets whether or not a slot property is required.
Definition: slots.c:170
int sp_exclusive(unsigned int spid)
Gets whether or not a slot property is exclusive.
Definition: slots.c:180
Core damage that an outfit does.
Definition: outfit.h:111
int type
Definition: outfit.h:112
double disable
Definition: outfit.h:115
double penetration
Definition: outfit.h:113
double damage
Definition: outfit.h:114
double energy
Definition: outfit.h:164
double heatup
Definition: outfit.h:166
double duration
Definition: outfit.h:158
double warmup
Definition: outfit.h:157
Damage dmg
Definition: outfit.h:165
double min_duration
Definition: outfit.h:159
double turn
Definition: outfit.h:163
double heat
Definition: outfit.h:167
double range
Definition: outfit.h:162
double delay
Definition: outfit.h:156
double heat
Definition: outfit.h:129
double trackmin
Definition: outfit.h:130
double falloff
Definition: outfit.h:125
double range
Definition: outfit.h:124
double delay
Definition: outfit.h:122
double swivel
Definition: outfit.h:132
double heatup
Definition: outfit.h:128
Damage dmg
Definition: outfit.h:127
double trackmax
Definition: outfit.h:131
double speed
Definition: outfit.h:123
double energy
Definition: outfit.h:126
double reload_time
Definition: outfit.h:271
double trackmax
Definition: outfit.h:196
double iflockon
Definition: outfit.h:194
double speed_max
Definition: outfit.h:210
double reload_time
Definition: outfit.h:190
double trackmin
Definition: outfit.h:195
double duration
Definition: outfit.h:205
OutfitAmmoAI ai
Definition: outfit.h:207
unsigned int spid
Definition: outfit.h:102
OutfitSlotType type
Definition: outfit.h:104
A ship outfit, depends radically on the type.
Definition: outfit.h:304
char ** tags
Definition: outfit.h:338
credits_t price
Definition: outfit.h:322
char * limit
Definition: outfit.h:317
OutfitLauncherData lau
Definition: outfit.h:373
OutfitBeamData bem
Definition: outfit.h:372
OutfitBoltData blt
Definition: outfit.h:371
OutfitType type
Definition: outfit.h:369
glTexture * gfx_store
Definition: outfit.h:328
OutfitSlot slot
Definition: outfit.h:311
OutfitAfterburnerData afb
Definition: outfit.h:375
int * illegalto
Definition: outfit.h:318
OutfitFighterBayData bay
Definition: outfit.h:376
ShipStatList * stats
Definition: outfit.h:335
double mass
Definition: outfit.h:315
union Outfit::@22 u
char * name
Definition: outfit.h:305
The representation of an in-game pilot.
Definition: pilot.h:210
Pilot * p
Definition: player.h:101
Represents ship statistics, properties ship can use.
Definition: shipstats.h:198