Skip to content
This repository has been archived by the owner on Apr 14, 2020. It is now read-only.

Commit

Permalink
Updated modal dialogues (#220)
Browse files Browse the repository at this point in the history
- Added modal dialog when changing ammo settings for the first time, warning the player that doing so on an existing colony is unsupported.
- Refactored all previous modal dialogues into opportunistic learning concepts, so no more message spam with the tutor disabled
  • Loading branch information
NoImageAvailable authored Jun 5, 2017
1 parent 3625b66 commit aa43475
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 35 deletions.
Binary file modified Assemblies/CombatExtended.dll
Binary file not shown.
28 changes: 28 additions & 0 deletions Defs/Tutor/Concepts_NotedOpportunistic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,33 @@
<needsOpportunity>True</needsOpportunity>
<helpText>Shields can provide protection against projectiles and melee attacks at the cost of being unable to use two-handed weapons. They are divided into two categories: regular shields and ballistic shields.\n\nRegular shields will deflect projectiles impacting the torso and have a chance to deflect melee attacks depending on the attacker's and defender's melee skills.\n\nBallistic shields are large and cumbersome, inflicting penalties to melee and ranged combat but they also cover the entire head area and can be crouched behind to protect most of the legs.\n\nShields don't make you invincible however, taking offensive actions will expose the weapon arm while high-penetration rounds will punch through or damage the shield. Don't expect a wooden shield to deflect gunfire!</helpText>
</ConceptDef>

<ConceptDef>
<defName>CE_ArmorSystem</defName>
<label>CE: New armor system</label>
<priority>50</priority>
<helpText>Combat Extended replaces the vanilla armor system with a penetration-based model. Blunt and sharp type weapons have armor penetration values which determine how much their damage is reduced by armor.\n\nA weapon hitting armor equal to its penetration will do 50% damage. If armor is twice the penetration it will do no damage, if it is half the penetration the full damage goes through.\n\nSharp damage additionally needs to check against deflection. If penetration is equal to armor there is a 50% chance for deflection. Deflected attacks are converted into blunt damage, preventing bleeding and internal organ damage.\n\nEnvironmental damage such as fire/electricity has no penetration and is simply reduced by the % of armor against that type.</helpText>
</ConceptDef>

<ConceptDef>
<defName>CE_SuppressionReaction</defName>
<label>CE: Suppression</label>
<priority>50</priority>
<helpText>All humans have a suppression meter, based on their mental break threshold and current mood. Any time gunfire passes by them, it will add to the meter based on projectile power and (lack of) worn armor. \n\nWhen someone's suppression threshold is reached they will panic, run for the nearest cover and become incapable of using aimed shot mode, making it a good tool to break up melee charges or reduce sniper accuracy. It will also impart a mood penalty, making them easier to suppress in the future.\n\nYou can recognize suppressed pawns by the yellow downwards arrow they're emitting.</helpText>
</ConceptDef>

<ConceptDef>
<defName>CE_Hunkering</defName>
<label>CE: Hunkering</label>
<priority>50</priority>
<helpText>If someone's suppression meter maxes out they will hunker in panic. This causes them to run for the nearest cover and lie down, unable to shoot back or take any action until their suppression ticks down, essentially removing them from the fight.\n\nHunkering pawns are marked by an orange downwards arrow.</helpText>
</ConceptDef>

<ConceptDef>
<defName>CE_WornBulk</defName>
<label>CE: Bulky clothing</label>
<priority>50</priority>
<helpText>Certain clothing items are very bulky and will hinder your colonists in their daily tasks, lowering work speed when worn. These items include things like armor and regular clothing made from certain materials such as hyperweave.\n\nYou can check the info-menu of a particular apparel to see its 'worn bulk' stat to see how much bulk it adds when equipped on a colonist.</helpText>
</ConceptDef>

</Defs>
27 changes: 3 additions & 24 deletions Defs/Tutor/Concepts_TriggeredModal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<!--=============== Concepts taught in modal dialogs ===========-->

<ConceptDef>
<defName>CE_ArmorSystem</defName>
<label>CE: New armor system</label>
<defName>CE_AmmoSettings</defName>
<label>Ammo settings changed</label>
<priority>-1000</priority>
<helpText>Combat Extended replaces the vanilla armor system with a penetration-based model. Blunt and sharp type weapons have armor penetration values which determine how much their damage is reduced by armor.\n\nA weapon hitting armor equal to its penetration will do 50% damage. If armor is twice the penetration it will do no damage, if it is half the penetration the full damage goes through.\n\nSharp damage additionally needs to check against deflection. If penetration is equal to armor there is a 50% chance for deflection. Deflected attacks are converted into blunt damage, preventing bleeding and internal organ damage.\n\nEnvironmental damage such as fire/electricity has no penetration and is simply reduced by the % of armor against that type.</helpText>
<helpText>WARNING: You have changed the ammo settings. It is highly recommended you start a new colony with these settings.\n\nChanging the ammo settings on an existing colony is not supported and might result in game-breaking bugs, do so at your own risk.</helpText>
</ConceptDef>

<!--<ConceptDef>
Expand All @@ -17,25 +17,4 @@
<helpText>Warning: The ammo you picked up has a very low armor penetration value. It will have trouble penetrating even basic synthread clothing. If you plan on taking on spacers you should acquire better ammo quickly.</helpText>
</ConceptDef>-->

<ConceptDef>
<defName>CE_SuppressionReaction</defName>
<label>CE: Suppression</label>
<priority>-1000</priority>
<helpText>All humans have a suppression meter, based on their mental break threshold and current mood. Any time gunfire passes by them, it will add to the meter based on projectile power and (lack of) worn armor. \n\nWhen someone's suppression threshold is reached they will panic, run for the nearest cover and become incapable of using aimed shot mode, making it a good tool to break up melee charges or reduce sniper accuracy. It will also impart a mood penalty, making them easier to suppress in the future.\n\nYou can recognize suppressed pawns by the yellow downwards arrow they're emitting.</helpText>
</ConceptDef>

<ConceptDef>
<defName>CE_Hunkering</defName>
<label>CE: Hunkering</label>
<priority>-1000</priority>
<helpText>If someone's suppression meter maxes out they will hunker in panic. This causes them to run for the nearest cover and lie down, unable to shoot back or take any action until their suppression ticks down, essentially removing them from the fight.\n\nHunkering pawns are marked by an orange downwards arrow.</helpText>
</ConceptDef>

<ConceptDef>
<defName>CE_WornBulk</defName>
<label>CE: Bulky clothing</label>
<priority>-1000</priority>
<helpText>Certain clothing items are very bulky and will hinder your colonists in their daily tasks, lowering work speed when worn. These items include things like armor and regular clothing made from certain materials such as hyperweave.\n\nYou can check the info-menu of a particular apparel to see its 'worn bulk' stat to see how much bulk it adds when equipped on a colonist.</helpText>
</ConceptDef>

</Defs>
2 changes: 0 additions & 2 deletions Source/CombatExtended/CombatExtended/ArmorUtilityCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ private static DamageInfo GetDeflectDamageInfo(DamageInfo dinfo, BodyPartRecord
newDinfo.SetInstantOldInjury(dinfo.InstantOldInjury);
newDinfo.SetAllowDamagePropagation(dinfo.AllowDamagePropagation);

TutorUtility.DoModalDialogIfNotKnown(CE_ConceptDefOf.CE_ArmorSystem); // Inform the player about armor deflection

return newDinfo;
}

Expand Down
3 changes: 2 additions & 1 deletion Source/CombatExtended/CombatExtended/Comps/CompInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ public void UpdateInventory()
float apparelWeight = apparel.GetStatValue(StatDefOf.Mass);
newBulk += apparelBulk;
newWeight += apparelWeight;
if (apparelBulk > 0 && (parentPawn?.IsColonist ?? false)) TutorUtility.DoModalDialogIfNotKnown(CE_ConceptDefOf.CE_WornBulk);
if (apparelBulk > 0 && parentPawn != null && parentPawn.IsColonist && parentPawn.Spawned)
LessonAutoActivator.TeachOpportunity(CE_ConceptDefOf.CE_WornBulk, OpportunityType.GoodToKnow);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,13 @@ public void AddSuppression(float amount, IntVec3 origin)
if (reactJob == null && IsHunkering)
{
reactJob = new Job(CE_JobDefOf.HunkerDown, pawn);
LessonAutoActivator.TeachOpportunity(CE_ConceptDefOf.CE_Hunkering, pawn, OpportunityType.Critical);
}
if (reactJob != null && reactJob.def != pawn.CurJob?.def)
{
pawn.jobs.StartJob(reactJob, JobCondition.InterruptForced, null, true);
LessonAutoActivator.TeachOpportunity(CE_ConceptDefOf.CE_SuppressionReaction, pawn, OpportunityType.Critical);
}
if (reactJob != null && reactJob.def != pawn.CurJob?.def) pawn.jobs.StartJob(reactJob, JobCondition.InterruptForced, null, true);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private void ApplyDamageToPart(DamageInfo dinfo, Pawn pawn, ref DamageWorker_Add
&& exactPartFromDamageInfo != postArmorDinfo.ForceHitPart)
{
exactPartFromDamageInfo = postArmorDinfo.ForceHitPart; // If the shot was deflected, update our body part
//dinfo.SetForcedHitPart(postArmorDinfo.ForceHitPart);
if (pawn.Spawned) LessonAutoActivator.TeachOpportunity(CE_ConceptDefOf.CE_ArmorSystem, OpportunityType.Critical); // Inform the player about armor deflection
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ namespace CombatExtended
public class CE_ConceptDefOf
{
// *** Modal dialog concepts ***
public static ConceptDef CE_ArmorSystem;
public static ConceptDef CE_SuppressionReaction;
public static ConceptDef CE_Hunkering;
public static ConceptDef CE_WornBulk;
public static ConceptDef CE_AmmoSettings;

// *** Self-activated concepts ***
public static ConceptDef CE_InventoryWeightBulk;
Expand All @@ -30,5 +27,9 @@ public class CE_ConceptDefOf
public static ConceptDef CE_Spotting;
public static ConceptDef CE_MortarDirectFire;
public static ConceptDef CE_Stabilizing;
public static ConceptDef CE_ArmorSystem;
public static ConceptDef CE_SuppressionReaction;
public static ConceptDef CE_Hunkering;
public static ConceptDef CE_WornBulk;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protected override Job TryGiveJob(Pawn pawn)
{
return null;
}
TutorUtility.DoModalDialogIfNotKnown(CE_ConceptDefOf.CE_Hunkering);
return new Job(CE_JobDefOf.HunkerDown, pawn);
}
}
Expand Down
1 change: 1 addition & 0 deletions Source/CombatExtended/CombatExtended/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public void DoWindowContents(Rect canvas)
{
AmmoInjector.Inject();
lastAmmoSystemStatus = enableAmmoSystem;
TutorUtility.DoModalDialogIfNotKnown(CE_ConceptDefOf.CE_AmmoSettings);
}
}

Expand Down
1 change: 0 additions & 1 deletion Source/CombatExtended/CombatExtended/SuppressionUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static Job GetRunForCoverJob(Pawn pawn)

//Tell pawn to move to position
pawn.Map.pawnDestinationManager.ReserveDestinationFor(pawn, coverPosition);
TutorUtility.DoModalDialogIfNotKnown(CE_ConceptDefOf.CE_SuppressionReaction);
return new Job(CE_JobDefOf.RunForCover, coverPosition)
{
locomotionUrgency = LocomotionUrgency.Sprint,
Expand Down

0 comments on commit aa43475

Please sign in to comment.