Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support vee construction data #1452

Merged
merged 86 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
35a41f0
Merge branch 'master' of /home/cwspain/IdeaProjects/megamek with conf…
neoancient Feb 4, 2019
ef3ee41
Merge remote-tracking branch 'origin/master'
neoancient Feb 4, 2019
409ad6e
Merge branch 'master' of https://github.com/MegaMek/megamek
neoancient Feb 14, 2019
9fecefe
Merge branch 'master' of https://github.com/MegaMek/megamek
neoancient Feb 18, 2019
9ea7d40
Merge remote-tracking branch 'origin/master'
neoancient Mar 19, 2019
37e8c09
Created enums for handling support vee chassis mod construction data.
neoancient Mar 27, 2019
626343c
Added enums for engine construction data.
neoancient Mar 28, 2019
dfad378
Merge branch 'support_vee' of ../megamek-all into support_vee
neoancient Mar 28, 2019
d26d913
Added some tech advancement data for SV components.
neoancient Mar 30, 2019
20b7abd
Changed intro date on WiGE support vee to ES (TM, p. 287).
neoancient Mar 30, 2019
052ed31
Added lookup methods for SVType and SVEngine.
neoancient Mar 31, 2019
92b00e5
Fixed validation for steam and maglev engines.
neoancient Mar 31, 2019
75fb4ee
Account for minimum weights for support vee engines.
neoancient Mar 31, 2019
437dbbe
Fuel weight calculations for fixed wing and airship support vehicles.
neoancient Apr 1, 2019
3a317f0
Changed TestSupportVehicle to extend TestEntity instead of TestTank.
neoancient Apr 1, 2019
94e940b
Added turret weight calculations.
neoancient Apr 1, 2019
52f8931
Added slot calculations.
neoancient Apr 1, 2019
04ab258
Added transport and crew slot calculations.
neoancient Apr 2, 2019
9c9c221
Fixed Engine validation and name problems with Steam and MagLev.
neoancient Apr 8, 2019
905d8a2
Validate engine type against support vehicle type.
neoancient Apr 9, 2019
6d6d45e
Weight class categories for fixed wing.
neoancient Apr 9, 2019
652653d
Method to check chassis mod compatibility
neoancient May 1, 2019
1dd4d57
short names for sv chassis mods
neoancient May 1, 2019
83ff623
Merge remote-tracking branch 'origin/master'
neoancient May 7, 2019
a953503
Changed TestSupportVehicle#ChassisModification
neoancient May 7, 2019
cb2c320
Slot calculations.
neoancient May 8, 2019
f4ef7d8
Override isSupportVehicle to return true for FixedWingSupport
neoancient May 8, 2019
732b919
Track base chassis fire control weight for omni support vehicles.
neoancient May 18, 2019
7f495d7
Advanced armor filtering for support vees.
neoancient May 25, 2019
f3346b4
Support vee armor calculation convenience methods.
neoancient May 27, 2019
12d2153
Calculate support vee armor weight correctly on load.
neoancient May 28, 2019
83702f3
Cleanup in TestSupportVehicle advanced armors.
neoancient May 28, 2019
4542135
Fixed logic in calculating armor weight.
neoancient May 28, 2019
ae3216b
Added support vehicle crew calculations.
neoancient May 31, 2019
51903fd
Merge remote-tracking branch 'origin/master'
neoancient Jun 7, 2019
ff3c94e
Merge remote-tracking branch 'origin/master'
neoancient Jun 10, 2019
a20abc8
Merge branch 'master' into support_vee
neoancient Jun 10, 2019
5d0e22b
Fixed chassis mod lookup test.
neoancient Jun 10, 2019
a71508b
Corrected premature rounding on SV ejection seat.
neoancient Jun 24, 2019
20c50d1
Cleaned up SV seating classes.
neoancient Jun 24, 2019
6d8e72c
Created SV ejection seat as transporter.
neoancient Jun 24, 2019
303e0f0
Adjust tech advancement for ratings B and C.
neoancient Jun 25, 2019
e540433
Added crew quarters constructors for number of crew rather than weight.
neoancient Jun 25, 2019
16543db
Fixed crew quarters slot calculations.
neoancient Jun 26, 2019
71a6641
FLeshed out SV fuel calculations.
neoancient Jul 1, 2019
be9d3a6
/.idea
neoancient Aug 2, 2019
e97123b
Merge remote-tracking branch 'origin/master'
neoancient Aug 2, 2019
a6de03c
removed /.idea
neoancient Aug 2, 2019
06d92fa
Merge branch 'master' into support_vee
neoancient Aug 2, 2019
b7ce527
Added field for omnivehicle sponson/pintle turret fixed weight.
neoancient Aug 7, 2019
a47fe6e
Updated TestSupportVehicle
neoancient Aug 7, 2019
358e251
Merge branch 'master' into support_vee
neoancient Aug 9, 2019
1fc2455
Account for omni base chassis weight in sponson/pintle tonnage calcul…
neoancient Aug 13, 2019
1f8d1eb
Added boolean field to Tank to mark trailer status.
neoancient Aug 13, 2019
8fa62e7
Added external engine type.
neoancient Aug 19, 2019
d99e783
Support for trailers with no engine.
neoancient Aug 19, 2019
ba066f4
Added method to determine when chassis mod is required.
neoancient Aug 19, 2019
50838c4
Fixed rail engine weight calculation.
neoancient Aug 19, 2019
0d4d758
Added rail as allowable non-engine trailer units.
neoancient Aug 19, 2019
8cddf99
Added missing String resources.
neoancient Aug 20, 2019
d1bb421
Handle saving and loading pod mounted bays and quarters.
neoancient Aug 20, 2019
e0e58d3
Separate spinners for pod-mounted quarters.
neoancient Aug 20, 2019
26763d7
Added some rail sprites to keep MM from barfing.
neoancient Aug 20, 2019
37fb42e
Added field for vehicle ICE fuel type.
neoancient Aug 21, 2019
4335bf6
Merge branch 'master' into support_vee
neoancient Aug 21, 2019
906ca29
Replaced string literals with constants for chassis mod lookup names.
neoancient Aug 21, 2019
1623b40
Added tech advancement to SVType.
neoancient Aug 21, 2019
128a4d2
Remove unused imports.
neoancient Aug 21, 2019
97c36b2
# WARNING: head commit changed in the meantime
neoancient Aug 21, 2019
9169f12
Fix small support vee chassis weight rounding.
neoancient Aug 21, 2019
883c015
Include fuel in SV weight calculation.
neoancient Aug 21, 2019
57a4c3b
Take floating point errors into account when rounding kg up.
neoancient Aug 22, 2019
8ac5886
Save support vehicle fuel tonnage.
neoancient Aug 22, 2019
365e4dd
Don't require base crew for SV trailers with no engine.
neoancient Aug 22, 2019
8553de9
Cleanup for FixedWingSupport
neoancient Aug 22, 2019
80ee8df
Merge remote-tracking branch 'origin/master' into support_vee
neoancient Sep 2, 2019
1702de4
Show BAR armor in SV weight breakdown.
neoancient Sep 2, 2019
391a7a2
Fix SV engine weight rounding.
neoancient Sep 3, 2019
1db8514
Apply hydrofoil SV MP boost.
neoancient Sep 3, 2019
e2d9dd3
Set max weight of 100 tons for hydrofoil chassis mod.
neoancient Sep 3, 2019
fb30731
Removed incorrect smallOnly flag from convertible chassis mod.
neoancient Sep 4, 2019
713931e
Override Entity#hasArmoredChassis in FixedWingSupport.
neoancient Sep 7, 2019
47ef9e5
Merge branch 'master' into support_vee
neoancient Oct 8, 2019
db7c30b
Merge remote-tracking branch 'origin/master' into support_vee
neoancient Oct 8, 2019
693d1fc
Added missing imports.
neoancient Oct 8, 2019
576e174
Added null check
neoancient Oct 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#building block data file
<BlockVersion>
1
</BlockVersion>

##Write the version number just in case...
<Version>
MAM0
</Version>

<UnitType>
LargeSupportTank
</UnitType>

<Name>
Adelante Passenger-Cargo Train
</Name>

<Model>
(Standard)
</Model>

<year>
2919
</year>

<originalBuildYear>
2919
</originalBuildYear>

<type>
IS Level 4
</type>

<motion_type>
Rail
</motion_type>

<transporters>
crewquarters:35.0:0
cargobay:28.0:1:2
</transporters>

<cruiseMP>
12
</cruiseMP>

<engine_type>
0
</engine_type>

<internal_type>
-1
</internal_type>

<armor>
40
35
35
35
35
20
</armor>

<Body Equipment>
SV Chassis Mod [Tractor]
</Body Equipment>

<Front Equipment>
</Front Equipment>

<Front Right Equipment>
</Front Right Equipment>

<Front Left Equipment>
</Front Left Equipment>

<Rear Right Equipment>
</Rear Right Equipment>

<Rear Left Equipment>
</Rear Left Equipment>

<Rear Equipment>
Hitch
</Rear Equipment>

<barrating>
7
</barrating>

<structural_tech_rating>
3
</structural_tech_rating>

<source>
TRO:Vehicle Annex
</source>

<tonnage>
600.0
</tonnage>

Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#building block data file
<BlockVersion>
1
</BlockVersion>

##Write the version number just in case...
<Version>
MAM0
</Version>

<UnitType>
SupportTank
</UnitType>

<Name>
TGV Omni Railcar
</Name>

<Model>
Primary Configuration
</Model>

<year>
3062
</year>

<originalBuildYear>
3062
</originalBuildYear>

<type>
IS Level 3
</type>

<motion_type>
Rail
</motion_type>

<transporters>
1stclassquarters:90.0:0:omni
2ndclassquarters:7.0:0:omni
cargobay:4.5:1:3:omni
BattleArmorHandles - troopers:-1
</transporters>

<cruiseMP>
0
</cruiseMP>

<engine_type>
8
</engine_type>

<internal_type>
-1
</internal_type>

<omni>
1
</omni>

<armor>
16
16
16
15
</armor>

<Body Equipment>
SV Chassis Mod [Trailer]
SV Chassis Mod [Tractor]
OmniChassisMod
</Body Equipment>

<Front Equipment>
</Front Equipment>

<Right Equipment>
</Right Equipment>

<Left Equipment>
</Left Equipment>

<Rear Equipment>
Hitch
</Rear Equipment>

<barrating>
9
</barrating>

<structural_tech_rating>
5
</structural_tech_rating>

<source>
TRO: Vehicle Annex
</source>

<tonnage>
120.0
</tonnage>

<baseChassisFireConWeight>
0.0
</baseChassisFireConWeight>

5 changes: 4 additions & 1 deletion megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,10 @@ MovementType.Aerodyne=Aerodyne
MovementType.Spheroid=Spheroid
MovementType.AirMech=AirMech
MovementType.Fighter=Fighter

MovementType.Rail=Rail
MovementType.MagLev=MagLev
MovementType.Airship=Airship
MovementType.StationKeeping=Station Keeping
#Map/Hex Notes
NoteDialog.action=Create/Edit Note
NoteDialog.Done=Done
Expand Down
8 changes: 7 additions & 1 deletion megamek/i18n/megamek/common/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Engine.invalidSphereOnly=Light/Fission engines Inner Sphere only
Engine.Large=\ Large
Engine.Light=\ Light
Engine.Vehicle=\ [Vehicle]
Engine.Fusion=\ Fusion
Engine.XL=\ XL
Engine.XXL=\ XXL
Engine.Fission=\ Fission
Expand All @@ -40,6 +41,8 @@ Engine.None=\ None
Engine.Steam=\ Steam
Engine.Battery=\ Battery
Engine.Solar=\ Solar
Engine.MagLev=\ MagLev
Engine.External=\ External
Entity.sensor_range_vs_ground_target=Air to Ground Range
EntityWeightClass.0=Ultra Light/PA(L)/Exoskeleton
EntityWeightClass.1=Light
Expand Down Expand Up @@ -430,4 +433,7 @@ MovementType.Aerodyne=Aerodyne
MovementType.Spheroid=Spheroid
MovementType.AirMech=AirMech
MovementType.Fighter=Fighter

MovementType.Rail=Rail
MovementType.MagLev=MagLev
MovementType.Airship=Airship
MovementType.StationKeeping=Station Keeping
4 changes: 4 additions & 0 deletions megamek/src/megamek/common/Aero.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ public int getRightThrustHits() {
return rightThrustHits;
}

public int getOriginalFuel() {
return fuel;
}

public int getFuel() {
if ((getPartialRepairs().booleanOption("aero_asf_fueltank_crit"))
|| (getPartialRepairs().booleanOption("aero_fueltank_crit"))) {
Expand Down
114 changes: 113 additions & 1 deletion megamek/src/megamek/common/Compute.java
Original file line number Diff line number Diff line change
Expand Up @@ -6808,6 +6808,8 @@ public static int getTotalGunnerNeeds(Entity entity) {
}
}
return nCapitalW + (int) Math.ceil(nStandardW / 6.0);
} else if (entity.isSupportVehicle()) {
return getSupportVehicleGunnerNeeds(entity);
} else if (entity instanceof Tank) {
return (getFullCrewSize(entity) - 1);
} else if (entity instanceof Infantry) {
Expand Down Expand Up @@ -6837,9 +6839,119 @@ public static int getAeroCrewNeeds(Entity entity) {
return 0;
}

/**
* Calculates the base crew requirements for support vehicles.
*
* @param entity The support vehicle
* @return The minimum base crew
*/
public static int getSVBaseCrewNeeds(Entity entity) {
if (entity.isTrailer() && (entity.getEngine().getEngineType() == Engine.NONE)) {
return 0;
}
final boolean naval = entity.getMovementMode().equals(EntityMovementMode.NAVAL)
|| entity.getMovementMode().equals(EntityMovementMode.HYDROFOIL)
|| entity.getMovementMode().equals(EntityMovementMode.SUBMARINE);
int crew;
if (entity.getWeightClass() == EntityWeightClass.WEIGHT_SMALL_SUPPORT) {
crew = 1;
} else if (entity.getWeightClass() == EntityWeightClass.WEIGHT_MEDIUM_SUPPORT) {
if (naval || entity.getMovementMode().equals(EntityMovementMode.AIRSHIP)) {
crew = 4;
} else {
crew = 2;
}
} else {
crew = 3;
if (naval) {
crew += (int) Math.ceil(entity.getWeight() / 5000);
} else if (entity.getMovementMode().equals(EntityMovementMode.AIRSHIP)) {
crew += (int) Math.ceil(entity.getWeight() / 500);
}
}
return crew;
}

/**
* Calculates number of gunners required for a support vehicle. See TM, 131.
*
* @param entity The support vehicle
* @return The number of gunners required.
*/
public static int getSupportVehicleGunnerNeeds(Entity entity) {
final boolean advFireCon = entity.hasMisc(MiscType.F_ADVANCED_FIRECONTROL);
final boolean basicFireCon = !advFireCon && entity.hasMisc(MiscType.F_BASIC_FIRECONTROL);
if (entity.getWeightClass() == EntityWeightClass.WEIGHT_SMALL_SUPPORT) {
if (!advFireCon && !basicFireCon) {
// No fire control requires one gunner per weapon.
return entity.getWeaponList().size();
} else {
// Otherwise we require one gunner per facing, with turrets and pintle mounts counting
// as separate facings
Set<Integer> facings = new HashSet<>();
int pintles = 0;
for (Mounted m : entity.getWeaponList()) {
if (m.isPintleTurretMounted()) {
pintles++;
} else {
facings.add(m.getLocation());
}
}
if (advFireCon) {
// Advanced fire control lets the driver count as a gunner, so one fewer dedicated gunners is needed.
return Math.max(0, pintles + facings.size() - 1);
} else {
return pintles + facings.size();
}
}
} else {
// Medium and large support vehicle gunner requirements are based on weapon tonnage
double tonnage = entity.getWeaponList().stream().filter(m -> !m.getType().hasFlag(WeaponType.F_AMS))
.mapToDouble(m -> m.getType().getTonnage(entity)).sum();
if (advFireCon) {
return (int) Math.ceil(tonnage / 4.0);
} else if (basicFireCon) {
return (int) Math.ceil(tonnage / 3.0);
} else {
return (int) Math.ceil(tonnage / 2.0);
}
}
}

/**
* Calculates addiontal crew required by support vehicles and advanced aerospace vessels
* for certain misc equipment.
*
* @param entity The unit
* @return The number of additional crew required
*/
public static int getAdditionalNonGunner(Entity entity) {
int crew = 0;
for (Mounted m : entity.getMisc()) {
if (m.getType().hasFlag(MiscType.F_COMMUNICATIONS)) {
crew += (int) m.getType().getTonnage(entity);
} else if (m.getType().hasFlag(MiscType.F_FIELD_KITCHEN)) {
crew += 3;
} else if (m.getType().hasFlag(MiscType.F_MASH)
|| m.getType().hasFlag(MiscType.F_MASH_EXTRA)
|| m.getType().hasFlag(MiscType.F_MOBILE_FIELD_BASE)) {
crew += 5;
}
}
return crew;
}

// Taken from MekHQ, assumptions are whatever Taharqa made for there - Dylan
public static int getFullCrewSize(Entity entity) {
if (entity instanceof Tank) {
if (entity.isSupportVehicle()) {
int crew = getSVBaseCrewNeeds(entity) + getSupportVehicleGunnerNeeds(entity)
+ getAdditionalNonGunner(entity);
// Add officers. Older editions of the rules give the officer ratio as 1:6 and 4 as the threshold to require officers
if (crew < 5) {
return crew;
}
return (int) Math.ceil(crew * 1.2);
} else if (entity instanceof Tank) {
return (int) Math.ceil(entity.getWeight() / 15.0);
} else if (entity instanceof BattleArmor) {
int ntroopers = 0;
Expand Down
Loading