diff --git a/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon_FireSpew.xml b/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon_FireSpew.xml new file mode 100644 index 0000000..f239743 --- /dev/null +++ b/1.6/1.6/Defs/Thing_Misc/Weapons/ARA_Weapon_FireSpew.xml @@ -0,0 +1,81 @@ + + + + + ARA_RW_Basic_FireSpewer_Gun + + 阿拉克涅虫群督虫使用基础远程武装器官,可以加压喷出热熔气团。瞬间伤害路径范围内的所有敌人。 + Normal + Animal + + ARA_Cocoon_Weapon + + + ArachnaeSwarm/Weapon/ARA_RW_Basic_Acid_Bladder_Gun + Graphic_Single + 1.2 + + SpitterSpawn + + + ARA_Technology_7VXI + UnfinishedWeapon + + + 1300 + + 3.5 + 0.5 + 0.6 + 0.45 + 0.3 + 2.5 + + +
  • + ArachnaeSwarm.Verb_ShootFireSpew + true + 1.5 + 16 + 12 + 3 + Shot_MiniFlameblaster + GunTail_Medium + 9 + + + 15 + ARA_AcidBurn + 20 + Filth_SpentAcid + Fire_Spew + 0.8 + 0 + true +
  • +
    + + 50 + + +
  • ARA_Armed_Organ
  • +
  • ARA_Armed_Organ_Ranged
  • +
  • ARA_Armed_Organ_T1
  • +
    + +
  • RewardStandardQualitySuper
  • +
    + +
  • + +
  • ARA_Weapon_Damage_Acid
  • + + + 1 + 1 + + +
    +
    + +
    \ No newline at end of file diff --git a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml index cf6dae2..bce3dc9 100644 --- a/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml +++ b/1.6/1.6/Defs/Thing_building/ARA_NutrientNetworkBuilding.xml @@ -231,7 +231,7 @@ Building Impassable 150 - 0.7 + 1.0 250 2000 diff --git a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj index c491768..38b2ea5 100644 --- a/Source/ArachnaeSwarm/ArachnaeSwarm.csproj +++ b/Source/ArachnaeSwarm/ArachnaeSwarm.csproj @@ -228,6 +228,8 @@ + + diff --git a/Source/ArachnaeSwarm/Verbs/VerbProperties_FireSpew.cs b/Source/ArachnaeSwarm/Verbs/VerbProperties_FireSpew.cs new file mode 100644 index 0000000..ea33b2d --- /dev/null +++ b/Source/ArachnaeSwarm/Verbs/VerbProperties_FireSpew.cs @@ -0,0 +1,23 @@ +using RimWorld; +using Verse; + +namespace ArachnaeSwarm +{ + public class VerbProperties_FireSpew : VerbProperties + { + public float degrees = 26f; // Default based on original Verb_SpewFire (13 * 2) + public DamageDef damageDef; + public int damageAmount = -1; + public float armorPenetration = -1f; + public ThingDef filthDef; + public EffecterDef effecterDef; + public float propagationSpeed = -1f; // Speed of the explosion spread + public float chanceToStartFire = -1f; // Chance to start a fire + public bool avoidFriendlyFire = true; // Avoids damaging non-hostile targets + + public VerbProperties_FireSpew() + { + this.verbClass = typeof(Verb_ShootFireSpew); + } + } +} \ No newline at end of file diff --git a/Source/ArachnaeSwarm/Verbs/Verb_ShootFireSpew.cs b/Source/ArachnaeSwarm/Verbs/Verb_ShootFireSpew.cs new file mode 100644 index 0000000..afd2300 --- /dev/null +++ b/Source/ArachnaeSwarm/Verbs/Verb_ShootFireSpew.cs @@ -0,0 +1,131 @@ +using RimWorld; +using UnityEngine; +using Verse; +using System.Collections.Generic; // Added for List and HashSet + +namespace ArachnaeSwarm +{ + public class Verb_ShootFireSpew : Verb + { + protected override int ShotsPerBurst => base.BurstShotCount; + + public override void WarmupComplete() + { + base.WarmupComplete(); + } + + protected override bool TryCastShot() + { + if (currentTarget.HasThing && currentTarget.Thing.Map != caster.Map) + { + return false; + } + + if (this.verbProps is not VerbProperties_FireSpew verbPropsFireSpew) + { + return false; + } + + if (base.EquipmentSource != null) + { + base.EquipmentSource.GetComp()?.Notify_ProjectileLaunched(); + base.EquipmentSource.GetComp()?.UsedOnce(); + } + + IntVec3 position = caster.Position; + float num = Mathf.Atan2(-(currentTarget.Cell.z - position.z), currentTarget.Cell.x - position.x) * 57.29578f; + + float halfAngle = verbPropsFireSpew.degrees / 2f; + FloatRange value = new FloatRange(num - halfAngle, num + halfAngle); + + IntVec3 center = position; + Map mapHeld = caster.Map; // Use Caster.Map for consistency + float effectiveRange = EffectiveRange; + + DamageDef damage = verbPropsFireSpew.damageDef ?? DamageDefOf.Flame; + ThingDef filth = verbPropsFireSpew.filthDef ?? ThingDefOf.Filth_FlammableBile; + int damageAmount = verbPropsFireSpew.damageAmount > 0 ? verbPropsFireSpew.damageAmount : damage.defaultDamage; + float armorPenetration = verbPropsFireSpew.armorPenetration >= 0 ? verbPropsFireSpew.armorPenetration : damage.defaultArmorPenetration; + float propagationSpeed = verbPropsFireSpew.propagationSpeed >= 0 ? verbPropsFireSpew.propagationSpeed : 0.6f; + float chanceToStartFire = verbPropsFireSpew.chanceToStartFire >= 0f ? verbPropsFireSpew.chanceToStartFire : 0f; + + List ignoredThings = null; + if (verbPropsFireSpew.avoidFriendlyFire) + { + ignoredThings = new List(); + var affectedCells = new HashSet(GenRadial.RadialCellsAround(center, effectiveRange, true)); + foreach (IntVec3 cell in affectedCells) + { + if (cell.InBounds(mapHeld)) + { + List thingList = mapHeld.thingGrid.ThingsListAt(cell); + for (int i = 0; i < thingList.Count; i++) // Corrected .Count usage + { + Thing t = thingList[i]; + if (!ignoredThings.Contains(t) && t.Faction != null && !t.HostileTo(caster)) + { + ignoredThings.Add(t); + } + } + } + } + } + + FloatRange? affectedAngle = value; + GenExplosion.DoExplosion( + center: center, + map: mapHeld, + radius: effectiveRange, + damType: damage, + instigator: caster, + damAmount: damageAmount, + armorPenetration: armorPenetration, + explosionSound: null, + weapon: base.EquipmentSource?.def, + projectile: this.verbProps.defaultProjectile, + intendedTarget: null, + postExplosionSpawnThingDef: filth, + postExplosionSpawnChance: 1f, + postExplosionSpawnThingCount: 1, + applyDamageToExplosionCellsNeighbors: false, + preExplosionSpawnThingDef: null, + preExplosionSpawnChance: 0f, + preExplosionSpawnThingCount: 1, + chanceToStartFire: chanceToStartFire, + damageFalloff: false, + direction: null, + ignoredThings: ignoredThings, // Correct position for ignoredThings + affectedAngle: affectedAngle, + doVisualEffects: false, + propagationSpeed: propagationSpeed, + screenShakeFactor: 0f, + doSoundEffects: false + ); + + if (verbPropsFireSpew.effecterDef != null) + { + AddEffecterToMaintain(verbPropsFireSpew.effecterDef.Spawn(caster.Position, currentTarget.Cell, caster.Map), caster.Position, currentTarget.Cell, 14, caster.Map); + } + + lastShotTick = Find.TickManager.TicksGame; + return true; + } + + public override bool Available() + { + if (!base.Available()) + { + return false; + } + if (CasterIsPawn) + { + Pawn casterPawn = CasterPawn; + if (casterPawn.Faction != Faction.OfPlayer && casterPawn.mindState.MeleeThreatStillThreat && casterPawn.mindState.meleeThreat.Position.AdjacentTo8WayOrInside(casterPawn.Position)) + { + return false; + } + } + return true; + } + } +} \ No newline at end of file