1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef MOD_INFO_H
4 #define MOD_INFO_H
5 
6 #include <string>
7 #include "Sim/Path/PFSTypes.h"
8 
9 class CModInfo
10 {
11 public:
CModInfo()12 	CModInfo()
13 		: allowAircraftToLeaveMap(true)
14 		, allowAircraftToHitGround(true)
15 		, allowPushingEnemyUnits(false)
16 		, allowCrushingAlliedUnits(false)
17 		, allowUnitCollisionDamage(false)
18 		, allowUnitCollisionOverlap(true)
19 		, allowGroundUnitGravity(true)
20 		, allowHoverUnitStrafing(true)
21 		, useClassicGroundMoveType(false)
22 		, constructionDecay(true)
23 		, constructionDecayTime(1000)
24 		, constructionDecaySpeed(1.0f)
25 		, multiReclaim(1)
26 		, reclaimMethod(1)
27 		, reclaimUnitMethod(1)
28 		, reclaimUnitEnergyCostFactor(0.0f)
29 		, reclaimUnitEfficiency(1.0f)
30 		, reclaimFeatureEnergyCostFactor(0.0f)
31 		, reclaimAllowEnemies(true)
32 		, reclaimAllowAllies(true)
33 		, repairEnergyCostFactor(0.0f)
34 		, resurrectEnergyCostFactor(0.5f)
35 		, captureEnergyCostFactor(0.0f)
36 		, paralyzeOnMaxHealth(true)
37 		, transportGround(1)
38 		, transportHover(0)
39 		, transportShip(0)
40 		, transportAir(0)
41 		, targetableTransportedUnits(0)
42 		, fireAtKilled(1)
43 		, fireAtCrashing(1)
44 		, flankingBonusModeDefault(0)
45 		, losMipLevel(0)
46 		, airMipLevel(0)
47 		, losMul(1.0f)
48 		, airLosMul(1.0f)
49 		, requireSonarUnderWater(true)
50 		, featureVisibility(FEATURELOS_NONE)
51 		, pathFinderSystem(PFS_TYPE_DEFAULT)
52 		, pfUpdateRate(0.0f)
53 	{}
54 
55 
56 	void Init(const char* modArchive);
57 
58 	/**
59 	 * The archive file name.
60 	 * examples: "Supreme Annihilation U32 V1.0.sdz", "BA704.sd7", "133855d253e657e9406122f346cfe8f1.sdp"
61 	 */
62 	std::string filename;
63 
64 	/**
65 	 * The human readable name (including version).
66 	 * The lower-case version of this is used for dependency checking.
67 	 * examples: "Supreme Annihilation U32 V1.0", "Balanced Annihilation V7.04", "Balanced Annihilation V7.11"
68 	 */
69 	std::string humanName;
70 	std::string humanNameVersioned;
71 	/**
72 	 * The short name (not including version).
73 	 * examples: "SA", "BA", "BA"
74 	 */
75 	std::string shortName;
76 	/**
77 	 * The version
78 	 * examples: "U32 V1.0", "7.04", "7.11"
79 	 */
80 	std::string version;
81 	std::string mutator;
82 	std::string description;
83 
84 	// Movement behaviour
85 	bool allowAircraftToLeaveMap;    // determines if gunships are allowed to leave map boundaries
86 	bool allowAircraftToHitGround;   // determines if aircraft (both types) can collide with terrain
87 	bool allowPushingEnemyUnits;     // determines if enemy (ground-)units can be pushed during collisions
88 	bool allowCrushingAlliedUnits;   // determines if allied (ground-)units can be crushed during collisions
89 	bool allowUnitCollisionDamage;   // determines if units take damage from (skidding) collisions
90 	bool allowUnitCollisionOverlap;  // determines if unit footprints are allowed to semi-overlap during collisions
91 	bool allowGroundUnitGravity;     // determines if (ground-)units experience gravity during regular movement
92 	bool allowHoverUnitStrafing;     // determines if (hover-)units carry their momentum sideways when turning
93 	bool useClassicGroundMoveType;   // determines if (ground-)units use the CClassicGroundMoveType path-follower
94 
95 	// Build behaviour
96 	/// Should constructions without builders decay?
97 	bool constructionDecay;
98 	/// How long until they start decaying?
99 	int constructionDecayTime;
100 	/// How fast do they decay?
101 	float constructionDecaySpeed;
102 
103 	// Reclaim behaviour
104 	/// 0 = 1 reclaimer per feature max, otherwise unlimited
105 	int multiReclaim;
106 	/// 0 = gradual reclaim, 1 = all reclaimed at end, otherwise reclaim in reclaimMethod chunks
107 	int reclaimMethod;
108 	/// 0 = Revert to wireframe and gradual reclaim, 1 = Subtract HP and give full metal at end, default 1
109 	int reclaimUnitMethod;
110 	/// How much energy should reclaiming a unit cost, default 0.0
111 	float reclaimUnitEnergyCostFactor;
112 	/// How much metal should reclaim return, default 1.0
113 	float reclaimUnitEfficiency;
114 	/// How much should energy should reclaiming a feature cost, default 0.0
115 	float reclaimFeatureEnergyCostFactor;
116 	/// Allow reclaiming enemies? default true
117 	bool reclaimAllowEnemies;
118 	/// Allow reclaiming allies? default true
119 	bool reclaimAllowAllies;
120 
121 	// Repair behaviour
122 	/// How much should energy should repair cost, default 0.0
123 	float repairEnergyCostFactor;
124 
125 	// Resurrect behaviour
126 	/// How much should energy should resurrect cost, default 0.5
127 	float resurrectEnergyCostFactor;
128 
129 	// Capture behaviour
130 	/// How much should energy should capture cost, default 0.0
131 	float captureEnergyCostFactor;
132 
133 	// Paralyze behaviour
134 	/// paralyze unit depending on maxHealth? if not depending on current health, default true
135 	bool paralyzeOnMaxHealth;
136 
137 	// Transportation behaviour
138 	/// 0 = all ground units cannot be transported, 1 = all ground units can be transported (mass and size restrictions still apply). Defaults to 1.
139 	int transportGround;
140 	/// 0 = all hover units cannot be transported, 1 = all hover units can be transported (mass and size restrictions still apply). Defaults to 0.
141 	int transportHover;
142 	/// 0 = all naval units cannot be transported, 1 = all naval units can be transported (mass and size restrictions still apply). Defaults to 0.
143 	int transportShip;
144 	/// 0 = all air units cannot be transported, 1 = all air units can be transported (mass and size restrictions still apply). Defaults to 0.
145 	int transportAir;
146 	/// 0 = transported units cannot be manually or automatically targeted
147 	int targetableTransportedUnits;
148 
149 	// Fire-on-dying-units behaviour
150 	/// 1 = units fire at enemies running Killed() script, 0 = units ignore such enemies
151 	int fireAtKilled;
152 	/// 1 = units fire at crashing aircrafts, 0 = units ignore crashing aircrafts
153 	int fireAtCrashing;
154 
155 	/// 0=no flanking bonus;  1=global coords, mobile;  2=unit coords, mobile;  3=unit coords, locked
156 	int flankingBonusModeDefault;
157 
158 	// Sensor behaviour
159 	/// miplevel for los
160 	int losMipLevel;
161 	/// miplevel to use for airlos
162 	int airMipLevel;
163 	/// units sightdistance will be multiplied with this, for testing purposes
164 	float losMul;
165 	/// units airsightdistance will be multiplied with this, for testing purposes
166 	float airLosMul;
167 	/// when underwater, units are not in LOS unless also in sonar
168 	bool requireSonarUnderWater;
169 
170 	enum {
171 		FEATURELOS_NONE = 0, FEATURELOS_GAIAONLY, FEATURELOS_GAIAALLIED, FEATURELOS_ALL,
172 	};
173 	/// feature visibility style: 0 - no LOS for features, 1 - gaia features visible
174 	/// 2 - gaia/allied features visible, 3 - all features visible
175 	int featureVisibility;
176 
177 	// Path Finder
178 	/// which pathfinder system (DEFAULT/legacy or QTPFS) the mod will use
179 	int pathFinderSystem;
180 	float pfUpdateRate;
181 };
182 
183 extern CModInfo modInfo;
184 
185 #endif // MOD_INFO_H
186 
187