diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 61d0cad1..918fd4d8 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml b/1.6/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml index 130e3935..f7d58d99 100644 --- a/1.6/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml +++ b/1.6/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml @@ -62,7 +62,10 @@ WULA_Colony_License_LV1_Technology - + + +
  • WULA_Cube_Productor_Cleanzone
  • +
    false @@ -1420,7 +1462,7 @@ Recipe_RemoveHediff 正在重启合成人。 {0} 成功重启了 {1}。 - WULA_Charge_Cube + Wula/UI/Commands/WULA_Synth_Power_On WULA_Shutdown_Synth_Hediff diff --git a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml index 6e819762..10c191ef 100644 --- a/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml +++ b/1.6/1.6/Defs/PawnKinds/PawnKinds_Wula.xml @@ -4,7 +4,6 @@ Wula_PawnKind WulaSpecies - PlayerColony
  • @@ -47,9 +46,8 @@ Mech_WULA_Cat - + Mech_WULA_Cat - PlayerColony False
  • @@ -85,7 +83,7 @@ Mech_WULA_Cat_Constructor - + Mech_WULA_Cat_Constructor
  • Wula_Constructor_Cat_Weapon
  • @@ -105,7 +103,7 @@ Mech_WULA_Cat_Assault - + Mech_WULA_Cat_Assault 500 diff --git a/1.6/1.6/Defs/RecipeDefs/Recipes_WULA.xml b/1.6/1.6/Defs/RecipeDefs/Recipes_WULA.xml index a3ba0a08..98ce6df6 100644 --- a/1.6/1.6/Defs/RecipeDefs/Recipes_WULA.xml +++ b/1.6/1.6/Defs/RecipeDefs/Recipes_WULA.xml @@ -187,60 +187,12 @@ 100 -
  • WULA_Colony_License_LV1_Technology
  • +
  • WULA_Synth_Charge_Cube_Technology
  • - - Make_WULA_Charge_Cube_Group - - 制造4块乌拉帝国能源核心,包括可复冲的电容器与供给机械运转的能量,这是机械乌拉唯一可接受的外部输入性能量来源,也是多种乌拉帝国产物的前体。 - 正在制造乌拉帝国能源核心 - GeneralLaborSpeed - - Smith - Recipe_Smith - - true - -
  • - - -
  • Steel
  • - - - 8 - -
  • - - -
  • Chemfuel
  • - - - 8 - -
  • - - -
  • ComponentIndustrial
  • - - - 4 - -
    - - 4 - - Crafting - 100 - - -
  • WULA_Colony_License_LV1_Technology
  • -
    -
    - Recharge_WULA_Charge_Cube - + 使用化合燃料,将被使用过的失去能量的乌拉帝国能源核心重新充能。 正在为乌拉帝国能源核心充能 GeneralLaborSpeed @@ -283,53 +235,13 @@ 100 -
  • WULA_Colony_License_LV1_Technology
  • +
  • WULA_Synth_Charge_Cube_Technology
  • - Recharge_WULA_Charge_Cube_Energy - - 使用电力,将被使用过的失去能量的乌拉帝国能源核心重新充能。 - 正在为乌拉帝国能源核心充能 - GeneralLaborSpeed - - Smith - Recipe_Smith - 300 - - true - -
  • - - -
  • Steel
  • - - - 2 - -
  • - - -
  • WULA_Charge_Cube_No_Power
  • - - - 1 - -
    - - 1 - - Crafting - 100 - - -
  • WULA_Colony_License_LV1_Technology
  • -
    -
    - - Recharge_WULA_Charge_Cube_Energy_Group + Recharge_WULA_Charge_Cube_Group - 使用电力,将被使用过的失去能量的乌拉帝国能源核心重新充能。 + 使用化合燃料,将被使用过的失去能量的乌拉帝国能源核心重新充能。 正在为乌拉帝国能源核心充能 GeneralLaborSpeed @@ -339,6 +251,14 @@ true +
  • + + +
  • Chemfuel
  • + + + 8 +
  • @@ -363,7 +283,7 @@ 100 -
  • WULA_Colony_License_LV1_Technology
  • +
  • WULA_Synth_Charge_Cube_Technology
  • @@ -416,4 +336,40 @@ WULA_Synth_Productor_Technology + + WULA_Build_Mech_WULA_Cat + + 建造一台CAt-11"猫猫"。 + + 1 + + + Mech_WULA_Cat + + WULA_Bunker_Drop_Technology + + + WULA_Build_Mech_WULA_Cat_Constructor + + 建造一台CAt-86"猫猫劳工"。 + + 1 + + + Mech_WULA_Cat_Constructor + + WULA_Bunker_Drop_Technology + + + WULA_Build_Mech_WULA_Cat_Assault + + 建造一台CAt-46"猫猫冲锋队"。 + + 1 + + + Mech_WULA_Cat_Assault + + WULA_Bunker_Drop_Technology + \ No newline at end of file diff --git a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml index 46fa7b04..5e141295 100644 --- a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml +++ b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml @@ -517,6 +517,20 @@
  • WULA_Colony_License_LV3_Technology
  • + + WULA_Synth_Charge_Cube_Technology + 6.00 + 1.50 + + 获取构建能源核心的知识,用以在脱离充电站的情况下为机械乌拉补充能量。 + 800 + +
  • WULA_Synth_Addons_Technology
  • +
    + +
  • WULA_Colony_License_LV2_Technology
  • +
    +
    + WULA_Fake_Mothership_Beacon_Building @@ -57,7 +57,7 @@ WULA_MotherShip_Entity 1 - + true 1 true @@ -87,6 +87,7 @@ PassThroughOnly 1 (3,3) + Wula/Building/WULA_Fake_BattleShip_Beacon_Building true (0.56, 0.62, 0.9) @@ -121,20 +122,12 @@ true -
  • - - true - false -
  • WULA_BattleShip_Entity 1 - - true - 1 - true - false + + false
  • @@ -203,7 +196,7 @@ WULA_AircraftCarrier_Entity 1 - + true 1 true @@ -233,6 +226,7 @@ PassThroughOnly 1 (3,3) + Wula/Building/WULA_Fake_ConstructionShip_Beacon_Building true (0.56, 0.62, 0.9) @@ -260,9 +254,6 @@ RealtimeOnly ConstructMetal true - -
  • WULA_Aircraft_Carrier_Technology
  • -
    false BuildingDestroyed_Metal_Big @@ -279,7 +270,7 @@ WULA_ConstructionShip_Entity 1 - + true 1 true @@ -342,7 +333,7 @@ --> - + WULA_Fake_Fighter_Drone_Building @@ -398,7 +389,7 @@ WULA_Fighter_Drone_Entity 1 WULA_Fighter_Drone_Leaving - + false @@ -514,7 +505,7 @@ WULA_Striker_Entity 1 - + false @@ -585,7 +576,7 @@ WULA_Bomber_Entity 1 - + false @@ -596,4 +587,139 @@ 什么?这是个记录数量用的thingdef,你不应该在任何场合下看到这个。 Thing + + + WULA_Holographic_Flag_Building + + 乌拉帝国行星封锁机关的全息旗帜,没什么用但是可以宣示乌拉帝国的主权。 + WulaFallenEmpire.Building_ExtraGraphics + true + BuildingOnTop + 50 + true + PassThroughOnly + 1 + (1,1) + true + (0.56, 0.62, 0.9) + Wula/Building/Flag/WULA_Flag_Building_A + false + + Wula/Building/Flag/WULA_Flag_Building_Mount + Graphic_Single + (1,1) + + + 600 + 0.5 + 1000 + 125 + 0.65 + + Normal + true + false + North + true + Light + BulletImpact_Metal + true + RealtimeOnly + ConstructMetal + true + WULA_Buildings + + false + BuildingDestroyed_Metal_Big + true + true + + +
  • + 0 + 0 + + +
  • + Wula/Building/Flag/WULA_Flag_Building_A + (3,3) + 0 + (0,0,3) + 1.5 + 0.2 + 0 +
  • +
  • + Wula/Building/Flag/WULA_Flag_Building_Mount + (1,1) + 1 + (0,0,0) + 0 + 0 + 0 +
  • + + +
    + +
  • + 3 + (120,240,252,0) +
  • +
    +
    + + WULA_Wall_Flag_Building + + 乌拉帝国行星封锁机关的旗帜,没什么用但是可以宣示乌拉帝国的主权。 + Building + Building + Building + PassThroughOnly + WULA_Buildings + true + 0.20 + 14 + false + BulletImpact_Metal + Wula/Building/Flag/WULA_Flag_Building_B_north + true + true + + Wula/Building/Flag/WULA_Flag_Building_B + Graphic_Multi + (0.7,0.75) + (0,0,0.7) + (0,0,-0.7) + (-0.6,0,0.1) + (0.6,0,0.1) + + false + + + BuildingOnTop + + 15 + + + 50 + 1.0 + 330 + 35 + 2 + + 2991 + Standable + + 0 + North + (0, 0, 0.2) + + false + true + + +
  • Placeworker_AttachedToWall
  • +
    +
    \ No newline at end of file diff --git a/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml b/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml index bcfad259..7340478f 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/WULA_Flyover_Item.xml @@ -72,7 +72,7 @@ WULA_Striker_Escort - 300 + 1000 20 1 @@ -116,7 +116,7 @@ WULA_Bomber_Escort - 750 + 1350 10 1 @@ -372,6 +372,95 @@
  • HarborFacility
  • + +
  • + WULA_Striker_Escort + + + 1000 + 20 + 1 + + + 0 + 100 + 5 + true + 10 + 70 + + + 8 + 10 + false + + + true + false + true + + + true + + + + 0.3 + 0.6 + + + + true + + 0.6 + 0.8 + + (0.7,0.85,1.0,1.0) + 1.3 +
  • +
  • + WULA_Bomber_Escort + + + 1350 + 10 + 1 + + + 0 + 130 + 5 + true + 10 + 70 + + + 5 + 10 + false + + + true + false + true + + + true + + + + 0.3 + 0.6 + + + + true + + 0.6 + 0.8 + + (0.7,0.85,1.0,1.0) + 1.3 +
  • diff --git a/1.6/1.6/Defs/ThingDefs_Misc/WULA_Item.xml b/1.6/1.6/Defs/ThingDefs_Misc/WULA_Item.xml index bca2d957..70dcf662 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/WULA_Item.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/WULA_Item.xml @@ -5,7 +5,7 @@ 由乌拉帝国工艺加工得到的高密度合金,是许多乌拉帝国装备的原材料。 - Wula/Item/WULA_Neutronium + Wula/Item/WULA_Alloy Graphic_Single None diff --git a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml index ca71421b..1a69c17c 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/Weapons/WULA_FE_Manpack_Weapon.xml @@ -2174,7 +2174,7 @@ WULA_MW_Cheat_Weapon_Ability 使得目标立刻被放逐——无视一切保护措施,将其从存档中永远擦除。 - Wula/UI/Abilities/WULA_MW_Cheat_Weapon_Ability + Wula/UI/Abilities/WULA_RW_Auto_GL_Smoke_Ability True False Misc11 diff --git a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml index 2fd7956f..34f0886e 100644 --- a/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml +++ b/1.6/1.6/Defs/ThingDefs_Races/Races_Wulaspecies.xml @@ -727,9 +727,7 @@ 6 - -
  • WULA_WeaponArmor_Productor
  • -
    + WULA_Synth_Productor_Technology
    @@ -882,6 +880,7 @@ 5 + 1500 0 @@ -897,6 +896,9 @@ 1~2 + + WULA_Bunker_Drop_Technology +
  • Mech_WULA_Cat_Cute @@ -953,7 +955,7 @@ Mech_WULA_Cat_Assault - 乌拉帝国的一种小型自律机械体,无需监管者,可以执行搬运、狩猎和割除任务,身着轻甲,装备了一把DLa-4"云母"突击步枪附下挂刺刀,可以给敌方造成不小的麻烦。 + 乌拉帝国的一种小型自律机械体,无需监管者,可以执行搬运、狩猎和割除任务,身着轻甲,装备了一把DLa-1"页岩",可以给敌方造成不小的麻烦。 Wula/Things/WULA_Assault_Cat/WULA_Cat_Thin_south diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png new file mode 100644 index 00000000..55580033 Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_A.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_north.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_north.png new file mode 100644 index 00000000..55506c98 Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_north.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_south.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_south.png new file mode 100644 index 00000000..3fd49621 Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_south.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_west.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_west.png new file mode 100644 index 00000000..17865390 Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_B_west.png differ diff --git a/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_Mount.png b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_Mount.png new file mode 100644 index 00000000..b47702ce Binary files /dev/null and b/Content/Textures/Wula/Building/Flag/WULA_Flag_Building_Mount.png differ diff --git a/Content/Textures/Wula/Building/WULA_Fake_BattleShip_Beacon_Building.png b/Content/Textures/Wula/Building/WULA_Fake_BattleShip_Beacon_Building.png new file mode 100644 index 00000000..76c6b393 Binary files /dev/null and b/Content/Textures/Wula/Building/WULA_Fake_BattleShip_Beacon_Building.png differ diff --git a/Content/Textures/Wula/Building/WULA_Fake_ConstructionShip_Beacon_Building.png b/Content/Textures/Wula/Building/WULA_Fake_ConstructionShip_Beacon_Building.png new file mode 100644 index 00000000..b80a13e3 Binary files /dev/null and b/Content/Textures/Wula/Building/WULA_Fake_ConstructionShip_Beacon_Building.png differ diff --git a/Content/Textures/Wula/FlyoverThing/WULA_AircraftCarrier_Shadow.png b/Content/Textures/Wula/FlyoverThing/WULA_AircraftCarrier_Shadow.png new file mode 100644 index 00000000..3bea31c4 Binary files /dev/null and b/Content/Textures/Wula/FlyoverThing/WULA_AircraftCarrier_Shadow.png differ diff --git a/Content/Textures/Wula/FlyoverThing/WULA_BattleShip_Shadow.png b/Content/Textures/Wula/FlyoverThing/WULA_BattleShip_Shadow.png index 31a6d373..9997e31d 100644 Binary files a/Content/Textures/Wula/FlyoverThing/WULA_BattleShip_Shadow.png and b/Content/Textures/Wula/FlyoverThing/WULA_BattleShip_Shadow.png differ diff --git a/Content/Textures/Wula/FlyoverThing/WULA_ConstructionShip_Shadow.png b/Content/Textures/Wula/FlyoverThing/WULA_ConstructionShip_Shadow.png index 23b351fc..9145f540 100644 Binary files a/Content/Textures/Wula/FlyoverThing/WULA_ConstructionShip_Shadow.png and b/Content/Textures/Wula/FlyoverThing/WULA_ConstructionShip_Shadow.png differ diff --git a/Content/Textures/Wula/Item/WULA_Alloy.png b/Content/Textures/Wula/Item/WULA_Alloy.png new file mode 100644 index 00000000..e57703ba Binary files /dev/null and b/Content/Textures/Wula/Item/WULA_Alloy.png differ diff --git a/Content/Textures/Wula/Item/WULA_Charge_Cube.png b/Content/Textures/Wula/Item/WULA_Charge_Cube.png index a362dbe2..09fed2dd 100644 Binary files a/Content/Textures/Wula/Item/WULA_Charge_Cube.png and b/Content/Textures/Wula/Item/WULA_Charge_Cube.png differ diff --git a/Content/Textures/Wula/Item/WULA_Charge_Cube_Without_Power.png b/Content/Textures/Wula/Item/WULA_Charge_Cube_Without_Power.png index c2573526..6d140184 100644 Binary files a/Content/Textures/Wula/Item/WULA_Charge_Cube_Without_Power.png and b/Content/Textures/Wula/Item/WULA_Charge_Cube_Without_Power.png differ diff --git a/Content/Textures/Wula/Item/WULA_Dark_Matter_Item.png b/Content/Textures/Wula/Item/WULA_Dark_Matter_Item.png index 0860ce09..ec048b34 100644 Binary files a/Content/Textures/Wula/Item/WULA_Dark_Matter_Item.png and b/Content/Textures/Wula/Item/WULA_Dark_Matter_Item.png differ diff --git a/Content/Textures/Wula/Item/WULA_Default_Item.png b/Content/Textures/Wula/Item/WULA_Default_Item.png deleted file mode 100644 index d0263620..00000000 Binary files a/Content/Textures/Wula/Item/WULA_Default_Item.png and /dev/null differ diff --git a/Content/Textures/Wula/Item/WULA_MechRepairKit.png b/Content/Textures/Wula/Item/WULA_MechRepairKit.png deleted file mode 100644 index 1b7099f6..00000000 Binary files a/Content/Textures/Wula/Item/WULA_MechRepairKit.png and /dev/null differ diff --git a/Content/Textures/Wula/Item/WULA_Neutronium.png b/Content/Textures/Wula/Item/WULA_Neutronium.png index 3f62ce6b..d37f1111 100644 Binary files a/Content/Textures/Wula/Item/WULA_Neutronium.png and b/Content/Textures/Wula/Item/WULA_Neutronium.png differ diff --git a/Content/Textures/Wula/UI/Commands/WULA_Shutdown_Synth.png b/Content/Textures/Wula/UI/Commands/WULA_Shutdown_Synth.png new file mode 100644 index 00000000..e792b9b4 Binary files /dev/null and b/Content/Textures/Wula/UI/Commands/WULA_Shutdown_Synth.png differ diff --git a/Content/Textures/Wula/UI/Commands/WULA_Synth_Power_On.png b/Content/Textures/Wula/UI/Commands/WULA_Synth_Power_On.png new file mode 100644 index 00000000..396d4753 Binary files /dev/null and b/Content/Textures/Wula/UI/Commands/WULA_Synth_Power_On.png differ diff --git a/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs b/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs new file mode 100644 index 00000000..3b692756 --- /dev/null +++ b/Source/WulaFallenEmpire/BuildingComp/Building_ExtraGraphics.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using RimWorld; +using UnityEngine; +using Verse; +using System.Linq; + +namespace WulaFallenEmpire +{ + public class Building_ExtraGraphics : Building + { + // 通过 ModExtension 配置的图形数据 + private ExtraGraphicsExtension modExtension; + + // 图形缓存 + private Dictionary graphicsCache = new Dictionary(); + + // 动画状态 - 每个图层的独立浮动 + private Dictionary layerHoverOffsets = new Dictionary(); + private Dictionary layerAnimationTimes = new Dictionary(); + private int lastTick = -1; + + public ExtraGraphicsExtension ModExtension + { + get + { + if (modExtension == null) + { + modExtension = def.GetModExtension(); + if (modExtension == null) + { + Log.Error($"Building_ExtraGraphics: No ExtraGraphicsExtension found for {def.defName}"); + // 创建默认配置避免空引用 + modExtension = new ExtraGraphicsExtension(); + } + } + return modExtension; + } + } + + // 重写 Graphic 属性返回 null,完全自定义渲染 + public override Graphic Graphic => null; + + // 获取缓存的图形 + private Graphic GetCachedGraphic(string texturePath, Vector2 scale, Color color) + { + string cacheKey = $"{texturePath}_{scale.x}_{scale.y}_{color}"; + + if (!graphicsCache.TryGetValue(cacheKey, out Graphic graphic)) + { + graphic = GraphicDatabase.Get( + texturePath, + ShaderDatabase.TransparentPostLight, + scale, + color); + graphicsCache[cacheKey] = graphic; + } + + return graphic; + } + + // 完全重写 DrawAt 方法,实现自定义渲染系统 + protected override void DrawAt(Vector3 drawLoc, bool flip = false) + { + // 不调用基类的 DrawAt,完全自定义渲染 + + // 更新悬浮动画 + UpdateHoverAnimation(); + + // 绘制所有配置的图形层 + DrawGraphicLayers(drawLoc, flip); + } + + // 绘制所有图形层 + private void DrawGraphicLayers(Vector3 baseDrawPos, bool flip) + { + if (ModExtension.graphicLayers == null || ModExtension.graphicLayers.Count == 0) + { + Log.Warning($"Building_ExtraGraphics: No graphic layers configured for {def.defName}"); + return; + } + + // 按层级排序,确保正确的绘制顺序 + var sortedLayers = ModExtension.graphicLayers.OrderBy(layer => layer.drawOrder).ToList(); + + foreach (var layer in sortedLayers) + { + DrawGraphicLayer(baseDrawPos, flip, layer); + } + } + + // 绘制单个图形层 + private void DrawGraphicLayer(Vector3 baseDrawPos, bool flip, GraphicLayerData layer) + { + if (string.IsNullOrEmpty(layer.texturePath)) + { + Log.Warning($"Building_ExtraGraphics: Empty texture path in layer for {def.defName}"); + return; + } + + // 获取图形 + Graphic graphic = GetCachedGraphic(layer.texturePath, layer.scale, layer.color); + + // 计算图层浮动偏移 + float hoverOffset = 0f; + if (layer.enableHover) + { + int layerIndex = ModExtension.graphicLayers.IndexOf(layer); + if (layerHoverOffsets.ContainsKey(layerIndex)) + { + hoverOffset = layerHoverOffsets[layerIndex]; + } + } + + // 最终绘制位置 = 基础位置 + 图层偏移 + 浮动偏移 + Vector3 drawPos = baseDrawPos + layer.offset; + drawPos.z += hoverOffset; + + // 绘制图形 + graphic.Draw(drawPos, flip ? base.Rotation.Opposite : base.Rotation, this, 0f); + } + + // 更新每个图层的独立悬浮动画 + private void UpdateHoverAnimation() + { + int currentTick = Find.TickManager.TicksGame; + + if (currentTick != lastTick) + { + // 更新每个图层的动画 + for (int i = 0; i < ModExtension.graphicLayers.Count; i++) + { + var layer = ModExtension.graphicLayers[i]; + + if (layer.enableHover) + { + // 初始化动画时间 + if (!layerAnimationTimes.ContainsKey(i)) + { + layerAnimationTimes[i] = 0f; + } + + // 更新动画时间 + layerAnimationTimes[i] += Time.deltaTime; + + // 计算该图层的悬浮偏移 + float hoverSpeed = layer.hoverSpeed > 0 ? layer.hoverSpeed : ModExtension.globalHoverSpeed; + float hoverIntensity = layer.hoverIntensity > 0 ? layer.hoverIntensity : ModExtension.globalHoverIntensity; + + float hoverOffset = Mathf.Sin(layerAnimationTimes[i] * hoverSpeed + layer.hoverPhase) * hoverIntensity; + layerHoverOffsets[i] = hoverOffset; + } + } + + lastTick = currentTick; + } + } + + // 保存和加载 + public override void ExposeData() + { + base.ExposeData(); + // 保存自定义状态(如果需要) + } + } + + // 主要的 ModExtension 定义 + public class ExtraGraphicsExtension : DefModExtension + { + // 全局悬浮参数(作为默认值) + public float globalHoverSpeed = 2f; // 全局悬浮速度 + public float globalHoverIntensity = 0.1f; // 全局悬浮强度 + + // 图形层配置 + public List graphicLayers = new List(); + + public ExtraGraphicsExtension() + { + // 默认配置,避免空列表 + if (graphicLayers == null) + { + graphicLayers = new List(); + } + } + } + + // 单个图形层的配置数据 + public class GraphicLayerData + { + // 基础配置 + public string texturePath; // 纹理路径(必需) + public Vector2 scale = Vector2.one; // 缩放比例 + public Color color = Color.white; // 颜色 + public int drawOrder = 0; // 绘制顺序(数字小的先绘制) + + // 位置配置 - 使用环世界坐标系 + // X: 左右偏移, Y: 图层深度, Z: 上下偏移 + public Vector3 offset = Vector3.zero; + + // 独立悬浮配置 + public bool enableHover = true; // 是否启用悬浮 + public float hoverSpeed = 0f; // 悬浮速度(0表示使用全局速度) + public float hoverIntensity = 0f; // 悬浮强度(0表示使用全局强度) + public float hoverPhase = 0f; // 悬浮相位(用于错开浮动) + } +} diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs b/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs index b705581b..c5f9ce93 100644 --- a/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs +++ b/Source/WulaFallenEmpire/GlobalWorkTable/Building_GlobalWorkTable.cs @@ -312,71 +312,118 @@ namespace WulaFallenEmpire return validSpots; } - - // 新增:分配物品到空投舱,包含材质处理 + // 在 Building_GlobalWorkTable.cs 中修改 DistributeItemsToPods 方法 private List> DistributeItemsToPods(GlobalStorageWorldComponent storage, int podCount) { List> podContents = new List>(); - // 初始化空投舱内容列表 for (int i = 0; i < podCount; i++) { podContents.Add(new List()); } - // 获取所有输出物品并转换为Thing列表 List allItems = new List(); + + // 首先处理机械体,因为需要特殊处理 foreach (var kvp in storage.outputStorage.ToList()) { if (kvp.Value <= 0) continue; - ThingDef thingDef = kvp.Key; int remainingCount = kvp.Value; - // 如果是Pawn,需要特殊处理 if (thingDef.race != null) { + Log.Message($"[Airdrop] Processing {remainingCount} pawns of type {thingDef.defName}"); + // 对于Pawn,每个单独生成 for (int i = 0; i < remainingCount; i++) { PawnKindDef randomPawnKind = GetRandomPawnKindForType(thingDef); if (randomPawnKind != null) { - Pawn pawn = PawnGenerator.GeneratePawn(randomPawnKind, Faction.OfPlayer); - allItems.Add(pawn); + try + { + Pawn pawn = PawnGenerator.GeneratePawn(randomPawnKind, Faction.OfPlayer); + // 确保Pawn处于活跃状态 + if (pawn != null) + { + // 设置Pawn为可用的状态 + pawn.health.Reset(); + pawn.drafter = new Pawn_DraftController(pawn); + + allItems.Add(pawn); + Log.Message($"[Airdrop] Successfully generated pawn: {pawn.Label}"); + } + else + { + Log.Error("[Airdrop] Generated pawn is null"); + } + } + catch (System.Exception ex) + { + Log.Error($"[Airdrop] Error generating pawn: {ex}"); + } + } + else + { + Log.Error($"[Airdrop] Could not find suitable PawnKindDef for {thingDef.defName}"); } } + + // 立即从存储中移除已处理的机械体 + storage.RemoveFromOutputStorage(thingDef, remainingCount); } - else + } + // 然后处理普通物品 + foreach (var kvp in storage.outputStorage.ToList()) + { + if (kvp.Value <= 0) continue; + ThingDef thingDef = kvp.Key; + int remainingCount = kvp.Value; + // 跳过已经处理的机械体 + if (thingDef.race != null) continue; + Log.Message($"[Airdrop] Processing {remainingCount} items of type {thingDef.defName}"); + // 对于普通物品,按照堆叠限制分割 + while (remainingCount > 0) { - // 对于普通物品,按照堆叠限制分割 - while (remainingCount > 0) + int stackSize = Mathf.Min(remainingCount, thingDef.stackLimit); + Thing thing = CreateThingWithMaterial(thingDef, stackSize); + if (thing != null) { - int stackSize = Mathf.Min(remainingCount, thingDef.stackLimit); - Thing thing = CreateThingWithMaterial(thingDef, stackSize); allItems.Add(thing); remainingCount -= stackSize; } + else + { + Log.Error($"[Airdrop] Failed to create thing: {thingDef.defName}"); + break; + } } + + // 从存储中移除已处理的物品 + storage.RemoveFromOutputStorage(thingDef, kvp.Value); } - if (allItems.Count == 0) + { + Log.Message("[Airdrop] No items to distribute"); return podContents; - + } + Log.Message($"[Airdrop] Total items to distribute: {allItems.Count}"); // 平均分配物品到空投舱 int currentPod = 0; foreach (Thing item in allItems) { - podContents[currentPod].Add(item); - currentPod = (currentPod + 1) % podCount; + if (item != null) + { + podContents[currentPod].Add(item); + currentPod = (currentPod + 1) % podCount; + } } - - // 从存储中移除已分配的物品 - foreach (var kvp in storage.outputStorage.ToList()) + // 记录分配结果 + for (int i = 0; i < podContents.Count; i++) { - storage.outputStorage[kvp.Key] = 0; + Log.Message($"[Airdrop] Pod {i} contains {podContents[i].Count} items"); } - return podContents; } @@ -431,94 +478,127 @@ namespace WulaFallenEmpire return defaultThing; } - // 在 Building_GlobalWorkTable.cs 中修改 GetRandomPawnKindForType 方法 + // 改进 GetRandomPawnKindForType 方法 private PawnKindDef GetRandomPawnKindForType(ThingDef pawnType) { - if (pawnType.race == null) return null; - - // 获取建筑拥有者派系 - Faction buildingFaction = this.Faction; - if (buildingFaction == null) + if (pawnType.race == null) { - Log.Warning("Building has no faction, cannot select appropriate pawn kind"); + Log.Error($"[Airdrop] GetRandomPawnKindForType: {pawnType.defName} is not a pawn type"); return null; } - + // 获取工作台的派系 + Faction workTableFaction = this.Faction; + if (workTableFaction == null) + { + Log.Error($"[Airdrop] Work table has no faction"); + return null; + } + Log.Message($"[Airdrop] Work table faction: {workTableFaction.def.defName}"); // 获取该种族的所有PawnKindDef var availableKinds = DefDatabase.AllDefs .Where(kind => kind.race == pawnType) .ToList(); - - if (availableKinds.Count == 0) return null; - - // 按优先级分组 + if (availableKinds.Count == 0) + { + Log.Error($"[Airdrop] No PawnKindDef found for race: {pawnType.defName}"); + return null; + } + Log.Message($"[Airdrop] Found {availableKinds.Count} PawnKindDefs for {pawnType.defName}"); + // 最高优先级:与工作台派系完全相同的PawnKind var matchingFactionKinds = availableKinds .Where(kind => kind.defaultFactionDef != null && - kind.defaultFactionDef == buildingFaction.def) + kind.defaultFactionDef == workTableFaction.def) .ToList(); - + if (matchingFactionKinds.Count > 0) + { + var selected = matchingFactionKinds.RandomElement(); + Log.Message($"[Airdrop] Selected matching faction PawnKind: {selected.defName} (faction: {workTableFaction.def.defName})"); + return selected; + } + // 次高优先级:玩家派系的PawnKind(如果工作台是玩家派系) + if (workTableFaction.IsPlayer) + { + var playerFactionKinds = availableKinds + .Where(kind => kind.defaultFactionDef != null && + (kind.defaultFactionDef == FactionDefOf.PlayerColony || + kind.defaultFactionDef == FactionDefOf.PlayerTribe)) + .ToList(); + if (playerFactionKinds.Count > 0) + { + var selected = playerFactionKinds.RandomElement(); + Log.Message($"[Airdrop] Selected player faction PawnKind: {selected.defName}"); + return selected; + } + } + // 备选:没有特定派系的PawnKind var noFactionKinds = availableKinds .Where(kind => kind.defaultFactionDef == null) .ToList(); - - // 排除与建筑派系不同的PawnKind - var excludedKinds = availableKinds - .Where(kind => kind.defaultFactionDef != null && - kind.defaultFactionDef != buildingFaction.def) - .ToList(); - - // 优先级选择 - PawnKindDef selectedKind = null; - - // 1. 最高优先级:与建筑派系相同的PawnKind - if (matchingFactionKinds.Count > 0) + if (noFactionKinds.Count > 0) { - selectedKind = matchingFactionKinds.RandomElement(); + var selected = noFactionKinds.RandomElement(); + Log.Message($"[Airdrop] Selected no-faction PawnKind: {selected.defName}"); + return selected; } - // 2. 备选:没有defaultFactionDef的PawnKind - else if (noFactionKinds.Count > 0) - { - selectedKind = noFactionKinds.RandomElement(); - } - // 3. 没有符合条件的PawnKind - else - { - Log.Warning($"No suitable PawnKind found for {pawnType.defName} with building faction {buildingFaction.def.defName}"); - return null; - } - + // 最后选择任何可用的PawnKind + var selectedKind = availableKinds.RandomElement(); + Log.Message($"[Airdrop] Selected fallback PawnKind: {selectedKind.defName}"); return selectedKind; } - // 新增:创建空投舱 + // 修改 CreateDropPod 方法 private bool CreateDropPod(IntVec3 dropCell, List contents) { try { if (contents == null || contents.Count == 0) - return false; - - // 创建空投舱信息 - ActiveTransporterInfo dropPodInfo = new ActiveTransporterInfo(); - - // 添加所有物品到空投舱 - foreach (Thing thing in contents) { - dropPodInfo.innerContainer.TryAdd(thing, true); + Log.Warning("[Airdrop] CreateDropPod: contents is null or empty"); + return false; } - - // 设置空投舱参数 + Log.Message($"[Airdrop] Creating drop pod at {dropCell} with {contents.Count} items"); + // 检查目标单元格是否有效 + if (!dropCell.IsValid || !dropCell.InBounds(Map)) + { + Log.Error($"[Airdrop] Invalid drop cell: {dropCell}"); + return false; + } + // 创建空投舱信息 - 使用 DropPodInfo 而不是 ActiveTransporterInfo + ActiveTransporterInfo dropPodInfo = new ActiveTransporterInfo(); dropPodInfo.openDelay = 180; // 3秒后打开 dropPodInfo.leaveSlag = true; + // 创建容器并添加物品 + ThingOwner container = new ThingOwner(); + foreach (Thing thing in contents) + { + if (thing != null) + { + if (!container.TryAdd(thing, true)) + { + Log.Error($"[Airdrop] Failed to add {thing.Label} to drop pod"); + } + else + { + Log.Message($"[Airdrop] Added {thing.Label} to drop pod"); + } + } + } + if (container.Count == 0) + { + Log.Warning("[Airdrop] No items were successfully added to drop pod"); + return false; + } + dropPodInfo.innerContainer = container; // 生成空投舱 DropPodUtility.MakeDropPodAt(dropCell, Map, dropPodInfo); - + + Log.Message($"[Airdrop] Successfully created drop pod at {dropCell}"); return true; } catch (System.Exception ex) { - Log.Error($"Failed to create drop pod at {dropCell}: {ex}"); + Log.Error($"[Airdrop] Failed to create drop pod at {dropCell}: {ex}"); return false; } } diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index a4149d50..357129fe 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -86,6 +86,7 @@ + diff --git a/mod.vdf b/mod.vdf new file mode 100644 index 00000000..b643ab48 --- /dev/null +++ b/mod.vdf @@ -0,0 +1,11 @@ + +"workshopitem" +{ + "appid" "294100" + "contentfolder" "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\WulaFallenEmpireTest" + "previewfile" "E:\\SteamLibrary\\steamapps\\common\\RimWorld\\Mods\\WulaFallenEmpireTest\\About\\Preview.png" + "visibility" "0" + "title" "WulaFallenEmpire V2" + "changenote" "1.6" + "publishedfileid" "3604325124" +} \ No newline at end of file diff --git a/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 b/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 new file mode 100644 index 00000000..608b93a1 Binary files /dev/null and b/美术与文本源文件/Wula/Building/WULA_Flag_Building_1.sai2 differ diff --git a/美术与文本源文件/Wula/Building/WULA_Flyover_Beacon.sai2 b/美术与文本源文件/Wula/Building/WULA_Flyover_Beacon.sai2 index 39720ead..5b4772a2 100644 Binary files a/美术与文本源文件/Wula/Building/WULA_Flyover_Beacon.sai2 and b/美术与文本源文件/Wula/Building/WULA_Flyover_Beacon.sai2 differ diff --git a/美术与文本源文件/Wula/Building/WULA_Turret_Component.sai2 b/美术与文本源文件/Wula/Building/WULA_Turret_Component.sai2 index 47c97f2b..d8757bce 100644 Binary files a/美术与文本源文件/Wula/Building/WULA_Turret_Component.sai2 and b/美术与文本源文件/Wula/Building/WULA_Turret_Component.sai2 differ diff --git a/美术与文本源文件/Wula/Flyover/WULA_AircraftCarrier_Shadow.sai2 b/美术与文本源文件/Wula/Flyover/WULA_AircraftCarrier_Shadow.sai2 new file mode 100644 index 00000000..651849b8 Binary files /dev/null and b/美术与文本源文件/Wula/Flyover/WULA_AircraftCarrier_Shadow.sai2 differ diff --git a/美术与文本源文件/Wula/Flyover/WULA_BattleShip_Shadow.sai2 b/美术与文本源文件/Wula/Flyover/WULA_BattleShip_Shadow.sai2 index 660849e9..01c239bf 100644 Binary files a/美术与文本源文件/Wula/Flyover/WULA_BattleShip_Shadow.sai2 and b/美术与文本源文件/Wula/Flyover/WULA_BattleShip_Shadow.sai2 differ diff --git a/美术与文本源文件/Wula/Flyover/WULA_ConstructionShip_Shadow.sai2 b/美术与文本源文件/Wula/Flyover/WULA_ConstructionShip_Shadow.sai2 index 4c29dd45..8b59a0dd 100644 Binary files a/美术与文本源文件/Wula/Flyover/WULA_ConstructionShip_Shadow.sai2 and b/美术与文本源文件/Wula/Flyover/WULA_ConstructionShip_Shadow.sai2 differ diff --git a/美术与文本源文件/Wula/Item/WULA_Charge_Cube_No_Power.sai2 b/美术与文本源文件/Wula/Item/WULA_Charge_Cube_No_Power.sai2 deleted file mode 100644 index 9a6dff54..00000000 Binary files a/美术与文本源文件/Wula/Item/WULA_Charge_Cube_No_Power.sai2 and /dev/null differ diff --git a/美术与文本源文件/Wula/Item/WULA_Dark_Matter_Item.sai2 b/美术与文本源文件/Wula/Item/WULA_Dark_Matter_Item.sai2 index 50f3f508..f4285829 100644 Binary files a/美术与文本源文件/Wula/Item/WULA_Dark_Matter_Item.sai2 and b/美术与文本源文件/Wula/Item/WULA_Dark_Matter_Item.sai2 differ diff --git a/美术与文本源文件/Wula/Item/WULA_Neutronium.sai2 b/美术与文本源文件/Wula/Item/WULA_Neutronium.sai2 index 2568b5f6..0c344cce 100644 Binary files a/美术与文本源文件/Wula/Item/WULA_Neutronium.sai2 and b/美术与文本源文件/Wula/Item/WULA_Neutronium.sai2 differ diff --git a/美术与文本源文件/Wula/Item/WULA_charge_cube.sai2 b/美术与文本源文件/Wula/Item/WULA_charge_cube.sai2 index b72ecda1..c444f43e 100644 Binary files a/美术与文本源文件/Wula/Item/WULA_charge_cube.sai2 and b/美术与文本源文件/Wula/Item/WULA_charge_cube.sai2 differ