mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added Spelopede
This commit is contained in:
parent
697e3ba7fb
commit
6777861903
8 changed files with 171 additions and 26 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -3,11 +3,22 @@
|
|||
Changes:
|
||||
|
||||
- Cocoon Weaver Gene
|
||||
- Spawn Spelopede Gene (Can re changed to spawn Megascarabs or other insects)
|
||||
|
||||
Internal:
|
||||
|
||||
- Renamed Abilities to have _ability_ in their name, to not exactly match the gene-defnames.
|
||||
|
||||
Fixes:
|
||||
|
||||
- Cockeater Ability has now Icon of Cockeater Gene
|
||||
- Cockeater now leaves a bite wound!
|
||||
- Pythokin-Patch checks for Licentialabs (#30)
|
||||
|
||||
ToDo:
|
||||
|
||||
- Icons: Cocoon, Spelopede Spawn
|
||||
- Sound: Spelopede Spawn
|
||||
|
||||
# 1.1.4
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<AbilityDef ParentName="AbilityTouchBase">
|
||||
<defName>rjw_genes_cocoonweaver</defName>
|
||||
<defName>rjw_genes_ability_cocoonweaver</defName>
|
||||
<label>Cocoon</label>
|
||||
<description>Weaves the victim into a (self-sustaining) cocoon. The victim cannot move, but can be bred.</description>
|
||||
<iconPath>Things/Mote/Heart</iconPath>
|
||||
|
|
37
Common/Defs/AbilityDefs/Ability_SpawnSpelopede.xml
Normal file
37
Common/Defs/AbilityDefs/Ability_SpawnSpelopede.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<AbilityDef>
|
||||
<defName>rjw_genes_ability_spawn_spelopede</defName>
|
||||
<label>Insect Ally</label>
|
||||
<description>Generates a tame spelopede, ready to serve their master.</description>
|
||||
<iconPath>World/WorldObjects/Expanding/Insects</iconPath>
|
||||
|
||||
<displayGizmoWhileUndrafted>true</displayGizmoWhileUndrafted>
|
||||
<disableGizmoWhileUndrafted>false</disableGizmoWhileUndrafted>
|
||||
|
||||
<verbProperties>
|
||||
<verbClass>Verb_CastAbility</verbClass>
|
||||
<warmupTime>3</warmupTime>
|
||||
<drawAimPie>False</drawAimPie>
|
||||
<requireLineOfSight>False</requireLineOfSight>
|
||||
<range>2</range>
|
||||
<targetParams>
|
||||
<canTargetPawns>False</canTargetPawns>
|
||||
<canTargetLocations>True</canTargetLocations>
|
||||
</targetParams>
|
||||
</verbProperties>
|
||||
|
||||
<canUseAoeToGetTargets>False</canUseAoeToGetTargets>
|
||||
<cooldownTicksRange>1800000</cooldownTicksRange>
|
||||
|
||||
<comps>
|
||||
<li Class = "RJW_Genes.CompProperties_AbilitySpawnSpelopede">
|
||||
<compClass>RJW_Genes.CompAbilityEffect_SpawnSpelopede</compClass>
|
||||
<pawnKindDef>Spelopede</pawnKindDef>
|
||||
<tamed>true</tamed>
|
||||
<sensitivityMultiplier>1.00</sensitivityMultiplier>
|
||||
</li>
|
||||
</comps>
|
||||
</AbilityDef>
|
||||
|
||||
</Defs>
|
|
@ -10,13 +10,30 @@
|
|||
<displayOrderInCategory>11</displayOrderInCategory>
|
||||
<displayCategory>rjw_genes_hive</displayCategory>
|
||||
<abilities>
|
||||
<li>rjw_genes_cocoonweaver</li>
|
||||
<li>rjw_genes_ability_cocoonweaver</li>
|
||||
</abilities>
|
||||
<descriptionHyperlinks>
|
||||
<AbilityDef>rjw_genes_cocoonweaver</AbilityDef>
|
||||
<AbilityDef>rjw_genes_ability_cocoonweaver</AbilityDef>
|
||||
</descriptionHyperlinks>
|
||||
<biostatCpx>1</biostatCpx>
|
||||
<biostatMet>-1</biostatMet>
|
||||
</GeneDef>
|
||||
|
||||
<GeneDef>
|
||||
<defName>rjw_genes_spawn_spelopede</defName>
|
||||
<label>Spelopede Dispenser</label>
|
||||
<labelShortAdj>cocooner</labelShortAdj>
|
||||
<description>Carriers of this gene can generate tame spelopedes. Higher psychic-sensitivity will spawn more spelopedes.</description>
|
||||
<iconPath>World/WorldObjects/Expanding/Insects</iconPath>
|
||||
<displayOrderInCategory>11</displayOrderInCategory>
|
||||
<displayCategory>rjw_genes_hive</displayCategory>
|
||||
<abilities>
|
||||
<li>rjw_genes_ability_spawn_spelopede</li>
|
||||
</abilities>
|
||||
<descriptionHyperlinks>
|
||||
<AbilityDef>rjw_genes_ability_spawn_spelopede</AbilityDef>
|
||||
</descriptionHyperlinks>
|
||||
<biostatCpx>1</biostatCpx>
|
||||
<biostatMet>-1</biostatMet>
|
||||
</GeneDef>
|
||||
</Defs>
|
|
@ -127,26 +127,3 @@ namespace RJW_Genes
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Exception in Verse.AI.ThinkNode_Priority TryIssueJobPackage: System.NullReferenceException: Object reference not set to an instance of an object
|
||||
at RJW_Genes.GeneUtility.HasLowLifeForce (Verse.Pawn pawn) [0x00014] in < 881b7541af8144a78a14c9dad08e43c7 >:0
|
||||
at RJW_Genes.ThinkNode_ConditionalLowLifeForce.Satisfied(Verse.Pawn p) [0x00000] in < 881b7541af8144a78a14c9dad08e43c7 >:0
|
||||
at Verse.AI.ThinkNode_Conditional.TryIssueJobPackage(Verse.Pawn pawn, Verse.AI.JobIssueParams jobParams) [0x00000] in < 38562b1a2ab64eacb931fb5df05ca994 >:0
|
||||
at Verse.AI.ThinkNode_Priority.TryIssueJobPackage(Verse.Pawn pawn, Verse.AI.JobIssueParams jobParams) [0x00022] in < 38562b1a2ab64eacb931fb5df05ca994 >:0
|
||||
UnityEngine.StackTraceUtility:ExtractStackTrace()
|
||||
Verse.Log:Error(string)
|
||||
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Verse.Pawn, Verse.AI.JobIssueParams)
|
||||
Verse.AI.ThinkNode_SubtreesByTag:TryIssueJobPackage(Verse.Pawn, Verse.AI.JobIssueParams)
|
||||
Verse.AI.ThinkNode_Priority:TryIssueJobPackage(Verse.Pawn, Verse.AI.JobIssueParams)
|
||||
Verse.AI.Pawn_JobTracker:DetermineNextJob(Verse.ThinkTreeDef &)
|
||||
Verse.AI.Pawn_JobTracker:TryFindAndStartJob()
|
||||
Verse.AI.Pawn_JobTracker:EndCurrentJob(Verse.AI.JobCondition, bool, bool)
|
||||
Verse.AI.Pawn_JobTracker:JobTrackerTick()
|
||||
Verse.Pawn:Tick()
|
||||
Verse.TickList:Tick()
|
||||
(wrapper dynamic - method) Verse.TickManager:Verse.TickManager.DoSingleTick_Patch2(Verse.TickManager)
|
||||
Verse.TickManager:TickManagerUpdate()
|
||||
Verse.Game:UpdatePlay()
|
||||
Verse.Root_Play:Update()
|
||||
*/
|
|
@ -0,0 +1,80 @@
|
|||
using Verse;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using RimWorld.Planet;
|
||||
using System;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
/// <summary>
|
||||
/// Spawns tame spelopedes at the caster.
|
||||
///
|
||||
/// TODO: Play some sound? I think this can be done with some CompProperties.
|
||||
/// </summary>
|
||||
public class CompAbilityEffect_SpawnSpelopede : CompAbilityEffect
|
||||
{
|
||||
public CompProperties_AbilitySpawnSpelopede Props => (CompProperties_AbilitySpawnSpelopede) this.props;
|
||||
|
||||
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
|
||||
{
|
||||
base.Apply(target, dest);
|
||||
|
||||
|
||||
int spelopedesToSpawn = CalculateSpelopedeAmount();
|
||||
if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"Using Spelopede Spawn, spawning {spelopedesToSpawn}");
|
||||
|
||||
for (int i = 0; i < spelopedesToSpawn; i++) {
|
||||
var request = new PawnGenerationRequest(
|
||||
this.Props.pawnKindDef,
|
||||
faction: this.parent.pawn.Faction,
|
||||
forceGenerateNewPawn: true,
|
||||
fixedBiologicalAge: 0.0f,
|
||||
fixedChronologicalAge: 0.0f,
|
||||
canGeneratePawnRelations: false,
|
||||
colonistRelationChanceFactor: 0.0f
|
||||
);
|
||||
|
||||
|
||||
Pawn insect = PawnGenerator.GeneratePawn(request);
|
||||
PawnUtility.TrySpawnHatchedOrBornPawn(insect, this.parent.pawn);
|
||||
|
||||
if (Props.tamed)
|
||||
{
|
||||
insect.training.Train(TrainableDefOf.Tameness, this.parent.pawn, true);
|
||||
insect.training.Train(TrainableDefOf.Obedience, this.parent.pawn, true);
|
||||
insect.training.Train(TrainableDefOf.Release, this.parent.pawn, true);
|
||||
|
||||
// I could do bonding here, but I think it's nicer if the queen is not "bonded" to their offspring.
|
||||
}
|
||||
}
|
||||
|
||||
MakeDirt(1);
|
||||
|
||||
if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message("Finished Spelopede Spawn");
|
||||
|
||||
}
|
||||
|
||||
private int CalculateSpelopedeAmount()
|
||||
{
|
||||
Pawn caster = this.parent.pawn;
|
||||
float spelopedes = Props.sensitivityMultiplier * caster.psychicEntropy.PsychicSensitivity;
|
||||
return (spelopedes > 1.49f) ? (int)Math.Round(spelopedes) : 1;
|
||||
}
|
||||
|
||||
private void MakeDirt(int multiplier = 1)
|
||||
{
|
||||
Pawn caster = this.parent.pawn;
|
||||
|
||||
FilthMaker.TryMakeFilth(caster.Position, caster.Map, ThingDefOf.Filth_AmnioticFluid, caster.LabelIndefinite(), count: Rand.Range(5,5*multiplier));
|
||||
}
|
||||
|
||||
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
|
||||
{
|
||||
if (!target.Cell.Filled(this.parent.pawn.Map) && (target.Cell.GetEdifice(this.parent.pawn.Map) == null))
|
||||
return true;
|
||||
if (throwMessages)
|
||||
Messages.Message((string)("CannotUseAbility".Translate((NamedArgument)this.parent.def.label) + ": " + "AbilityOccupiedCells".Translate()), (LookTargets)target.ToTargetInfo(this.parent.pawn.Map), MessageTypeDefOf.RejectInput, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
|
||||
namespace RJW_Genes
|
||||
{
|
||||
public class CompProperties_AbilitySpawnSpelopede : CompProperties_AbilityEffect
|
||||
{
|
||||
public PawnKindDef pawnKindDef;
|
||||
public float sensitivityMultiplier;
|
||||
public bool tamed;
|
||||
public CompProperties_AbilitySpawnSpelopede()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_SpawnSpelopede);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -87,7 +87,9 @@
|
|||
<Compile Include="Genes\Genitalia\Gene_DemonicGenitalia.cs" />
|
||||
<Compile Include="Genes\Genitalia\Gene_EquineGenitalia.cs" />
|
||||
<Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
|
||||
<Compile Include="Genes\Hive\Abilities\CompAbilityEffect_SpawnSpelopede.cs" />
|
||||
<Compile Include="Genes\Hive\Abilities\CompAbilityEffect_CocoonWeaver.cs" />
|
||||
<Compile Include="Genes\Hive\Abilities\CompProperties_AbilitySpawnSpelopede.cs" />
|
||||
<Compile Include="Genes\Hive\Abilities\CompProperties_AbilityCocoonWeaver.cs" />
|
||||
<Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
|
||||
<Compile Include="Genes\Life_Force\UI\Alert_LowFertilin.cs" />
|
||||
|
|
Loading…
Reference in a new issue