diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 6987661f..11d1c469 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 a074935c..c3dfa114 100644 --- a/1.6/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml +++ b/1.6/1.6/Defs/HediffDefs/Hediffs_BodyParts_WULA.xml @@ -62,9 +62,7 @@ WULA_Colony_License_LV1_Technology - -
  • WULA_Cube_Productor_Energy
  • -
    +
    + false + + -1 + 0 + + + Things/Item/Health/HealthItem + Graphic_Single + + + +
  • + CompUsableImplant + UseItem + 安装隐藏式天线 + +
  • +
  • +
  • + WULA_Addons_Antenna_Hediff_Base + Brain + false + 1 +
  • +
    + WULA_Addons_Antenna_Hediff_Base Hediff_Mechlink @@ -10,7 +42,7 @@ false false true - WULA_Addons_Antenna_Bodypart + Brain
  • @@ -21,6 +53,7 @@ 频道:{0} 查看当前频率的详细信息 +
  • Wula_FM_Switc_None
  • Wula_FM_Switc_Fleet
  • Wula_FM_Switc_Artillery
  • Wula_FM_Switc_Aircraft
  • @@ -32,6 +65,23 @@
    + + Wula_FM_Switc_None + + 关闭所有的调频,免得技能栏太挤 + Hediff_High + false + false + True + false + +
  • + false +
  • +
    + + +
    Wula_FM_Switc_Fleet diff --git a/1.6/1.6/Defs/PrefabDefs/WULA_ShuttlePrefab.xml b/1.6/1.6/Defs/PrefabDefs/WULA_ShuttlePrefab.xml index b91bec8f..3454bbef 100644 --- a/1.6/1.6/Defs/PrefabDefs/WULA_ShuttlePrefab.xml +++ b/1.6/1.6/Defs/PrefabDefs/WULA_ShuttlePrefab.xml @@ -45,10 +45,6 @@ (7, 0, 9) - - (6, 0, 1) - Opposite -
  • (5,5,6,5)
  • diff --git a/1.6/1.6/Defs/QuestScriptDefs/Wula_Base_Events.xml b/1.6/1.6/Defs/QuestScriptDefs/Wula_Base_Events.xml index ed330b36..b7ee190e 100644 --- a/1.6/1.6/Defs/QuestScriptDefs/Wula_Base_Events.xml +++ b/1.6/1.6/Defs/QuestScriptDefs/Wula_Base_Events.xml @@ -6,6 +6,7 @@ WULA_Intro_Spy 0 + WULA_Intro_Spy 1 @@ -18,14 +19,10 @@ -
  • questName->the [adjAny] [asker_royalTitleInCurrentFaction]
  • +
  • questName->[QuestName]
  • -
  • adjAny->hunted
  • -
  • adjAny->fleeing
  • -
  • adjAny->solitary
  • -
  • adjAny->ambushed
  • - +
  • QuestName->hunted
  • @@ -33,8 +30,7 @@
  • QuestHospitalityCommon
  • -
  • questDescription->[asker_nameFull], a [asker_royalTitleInCurrentFaction] of [asker_faction_name] is calling from nearby. [asker_possessive] guards were killed in an ambush. [asker_pronoun] escaped, but is now being followed by (*Threat)a manhunting [animalKindDef_label](/Threat).\n\n[asker_nameDef] wants you to keep [asker_objective] safe at [map_definite] for a few hours until [asker_possessive] shuttle can come pick [asker_objective] up. -\n[asker_pronoun] will bestow [royalFavorReward] [asker_faction_royalFavorLabel] on whoever accepts this quest. This is enough [asker_faction_royalFavorLabel] to receive the royal title of Novice, and all benefits that come with it - including the first level of psychic powers.
  • +
  • questDescription->[asker_nameFull], a [asker_royalTitleInCurrentFaction] of [asker_faction_name] is calling from nearby. [asker_possessive] guards were killed in an ambush. [asker_pronoun] escaped, but is now being followed by (*Threat)a manhunting [animalKindDef_label](/Threat).\n\n[asker_nameDef] wants you to keep [asker_objective] safe at [map_definite] for a few hours until [asker_possessive] shuttle can come pick [asker_objective] up.\n[asker_pronoun] will bestow [royalFavorReward] [asker_faction_royalFavorLabel] on whoever accepts this quest. This is enough [asker_faction_royalFavorLabel] to receive the royal title of Novice, and all benefits that come with it - including the first level of psychic powers.
  • @@ -42,43 +38,26 @@
  • - Wula_UI_Legion_1 + Wula_Intro_Spy_UI_1
  • -
  • questName->乌拉的呼唤
  • +
  • questName->掩护帝国密探
  • -
  • questDescription->一个强大的心灵实体将它的意志强加于你的意识之中。
  • +
  • questDescription->乌拉帝国行星封锁机关的总控AI向殖民地发送了一个请求。一位乌拉帝国密探已经暴露,正在遭受未知派系追杀——密探手无寸铁且携带重要信息,殖民地需要掩护它直到乌拉帝国的穿梭机抵达并将其接走。袭击不会太剧烈,密探已经甩掉了大部分敌人。
  • - -
  • - 乌拉需要你的注意 - 乌拉需要你的注意 - 一个强大的心灵实体将它的意志强加于你的意识之中。它自称为“乌拉”,并要求你阅览它的消息。这股力量是压倒性的,不容拒绝。 - -
  • - - -
  • - -
  • - Wula_UI_Legion_1 -
  • - - - - - - +
  • + Util_RandomizePointsChallengeRating +
  • @@ -87,6 +66,21 @@
  • + +
  • + true + true + enemyFaction +
  • + + + - - 1 - Manhunting [animalKindDef_label] - The [animalKindDef_label] which was following [asker_nameFull] has arrived in the area. + + Util_Raid + raid + + $inSignal + $map + $points + $enemyFaction + $walkInSpot + {BASELABEL} chasing [../asker_nameDef] + {BASETEXT} + \nThe [enemyFaction_pawnsPlural] have come to get [../asker_nameDef]. + @@ -381,9 +384,23 @@ $royalFavorReward true --> - +
  • + pickupShipThing.SentSatisfied + Wula_Intro_Spy_UI_End_1 +
  • +
  • pickupShipThing.SentSatisfied + + + Success + true + +
  • + +
  • + pickupShipThing.SentSatisfied + Success true @@ -411,4 +428,207 @@ + + Wula_Intro_Spy_UI_1 + + Wula/Events/Portraits/WULA_Legion_2 + 未知通讯 + +
  • 殖民地的居民们,这里是乌拉帝国舰队。我们有一个临时请求,现在需要你们的协助。\n\n我们的一名情报密探在执行侦察任务时暴露了身份,正遭到敌对势力的追捕。这名密探手无寸铁,但携带着至关重要的战略信息——我们需要你们提供临时庇护,保护密探安全直到我们的穿梭机抵达。作为交换,我们将提供相应的报酬,并在未来考虑与你们建立更正式的关系。
  • + + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • +
  • + Wula_Intro_Spy_UI_2 +
  • + + + + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • +
  • + Wula_Intro_Spy_UI_3 +
  • + + + + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • + +
  • + + +
    + + + Wula_Intro_Spy_UI_2 + + Wula/Events/Portraits/WULA_Legion_1 + 未知通讯 + +
  • 我们是乌拉帝国开发署的先遣力量——行星封锁机关P.I.A,负责控制调度帝国在你们星球轨道上的先锋舰队。\n\n帝国开发署的使命是在银河系中寻找有价值的殖民地并进行整合。我们不是来摧毁你们的,而是来建立秩序。\n\n这次请求是试探你们合作意愿的机会。如果你们证明了自己值得信任,未来可能会有更多互惠互利的机会。拒绝合作不会带来任何好处,但合作可能会为你们在这个危险星球上的生存带来转机。
  • +
    + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • +
  • + Wula_Intro_Spy_UI_1 +
  • + + + + +
    +
    + + Wula_Intro_Spy_UI_3 + + Wula/Events/Portraits/WULA_Legion_2 + 未知通讯 + +
  • 务实的问题。成功的合作将为你们带来:\n\n1. 技术数据访问权限 - 有限度地开放部分基础科技信息\n2. 舰队调度许可 - 我们将允许你们获得一份植入物,使你们的一名殖民者获得向帝国舰队发送信号请求炮击增援、空投、战机近地支援等能力\n3. 政治考量加分 - 在帝国对你们星球的最终评估中获得正面评价\n\n记住,这只是一个开始。乌拉帝国对待合作伙伴的态度取决于他们的表现。如果这次任务顺利完成,更多实质性的利益将会随之而来。
  • +
    + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • +
  • + Wula_Intro_Spy_UI_1 +
  • + + + + +
    +
    + + Wula_Intro_Spy_UI_End_1 + + Wula/Events/Portraits/WULA_Legion_1 + 未知通讯 + +
  • 任务完成。你们的合作态度令人满意。密探已安全撤离,携带的情报将对帝国在你们星球上的行动规划起到关键作用。\n\n作为对你们协助的回报,我们向你们提供以下技术资产:\n\n1. 乌拉帝国技术系统接入许可 - 允许你们访问初步访问乌拉帝国的数据库\n\n2. 神经链接植入物 - 使一名殖民者能够直接与我们舰队建立通讯连接,可请求轨道支援\n\n3. 通讯终端 - 一套专用通讯设备,用于和乌拉帝国舰队生产设施进行通讯以下达订单——如果你们需要一些别的帮助,也可以通过这个通讯台联络我\n\n这些只是开始。如果你们继续证明自己的价值,更多先进的帝国技术将会向你们开放。记住,合作是双向的——我们对忠诚的合作伙伴从不吝啬。
  • +
    + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • +
  • + Wula_Intro_Spy_UI_End_2 +
  • + + + + +
    + +
  • + +
  • + 来自乌拉帝国的谢礼已抵达,此外,乌拉帝国科技树已经开放 +
  • +
  • + WULA_WeaponArmor_Productor_Incoming + 1 + true + 3 + 空投建筑 + 乌拉帝国的空投建筑正在路上,注意落点! +
  • +
  • + WULA_Addons_Antenna_Hide + 1 +
  • +
  • + WULA_Fake_Mothership_Beacon_Building + 1 +
  • +
  • + WULA_Colony_License_LV1_Technology +
  • + + +
    +
    + + Wula_Intro_Spy_UI_End_2 + + Wula/Events/Portraits/WULA_Legion_3 + 「军团」,P.I.A + +
  • 名字?我是乌拉帝国行星封锁机关的中控AI,你们就叫我「军团」吧。
  • +
    + +
  • + + true + (226,191,195,195) + (226,191,195,185) + (255,255,255,255) + (255,255,255,255) + +
  • + +
  • + +
  • + + +
    +
    \ No newline at end of file diff --git a/1.6/1.6/Defs/QuestScriptDefs/Wula_ScheduledEvents.xml b/1.6/1.6/Defs/QuestScriptDefs/Wula_ScheduledEvents.xml deleted file mode 100644 index 32a34ca8..00000000 --- a/1.6/1.6/Defs/QuestScriptDefs/Wula_ScheduledEvents.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - Wula_Quest_ExampleEvent - - 一个强大的心灵实体将它的意志强加于你的意识之中。 - - -
  • - - -
  • questName->乌拉的呼唤
  • - - - -
  • - - -
  • questDescription->一个强大的心灵实体将它的意志强加于你的意识之中。
  • - - - -
  • - 乌拉需要你的注意 - 乌拉需要你的注意 - 一个强大的心灵实体将它的意志强加于你的意识之中。它自称为“乌拉”,并要求你阅览它的消息。这股力量是压倒性的,不容拒绝。 - -
  • - - -
  • - -
  • - Wula_UI_Anisia_1 -
  • - - - - -
  • - - -
  • - -
  • - Wula_UI_Anisia_1 -
  • -
  • - 你试图抵抗心灵入侵,但这股力量过于强大。无论如何,消息还是涌入了你的脑海。 - NegativeEvent -
  • - - - - - - -
    -
    -
    -
    \ 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 3e81701b..589b6329 100644 --- a/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml +++ b/1.6/1.6/Defs/ResearchProjectDefs/WULA_ResearchProjects_Remake.xml @@ -14,6 +14,12 @@ 10000 0.00 3.20 + 1 + 0 + 999999 + +
  • Wula_PIA_Legion_Faction
  • +
  • Electricity
  • diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml index ff9bd3e5..6e92f916 100644 --- a/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml +++ b/1.6/1.6/Defs/ThingDefs_Buildings/WULA_Misc_Buildings.xml @@ -16,7 +16,7 @@ true (0.56, 0.62, 0.9) - Wula/Building/WULA_Flyover_Beacon + Wula/Weapon/WULA_Weapon_Empty Graphic_Single TransparentPostLight (1,1) @@ -42,11 +42,17 @@ ConstructMetal true + false BuildingDestroyed_Metal_Big true true +
  • + + true + false +
  • WULA_MotherShip_Entity 1 diff --git a/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml b/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml index bce1d2fc..b9be6ef6 100644 --- a/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml +++ b/1.6/1.6/Defs/ThingDefs_Misc/Apperals/WULA_Apparel.xml @@ -178,6 +178,113 @@
  • + + Spacer + Normal + +
  • ApparelArmor
  • +
    + + 105 + UnfinishedTechArmor + +
  • WULA_Cube_Productor_Energy
  • +
    + false +
    + + Graphic_Single + CutoutComplex + + +
  • Metallic
  • +
    + + +
  • Wula_Apparel
  • +
  • Wula_Armor
  • +
    + +
  • Torso
  • +
  • Neck
  • +
  • Shoulders
  • +
  • Arms
  • +
  • Legs
  • +
    + +
  • Middle
  • +
  • Shell
  • +
    + true + Wear_PowerArmor + Remove_PowerArmor + false + false + false + true +
    + Apparel + +
  • + + +
  • RewardStandardHighFreq
  • + + + 0.6 + 0.25 + 0.25 + +
    + + Spacer + +
  • ApparelArmor
  • +
    + + 105 + UnfinishedTechArmor + +
  • WULA_Cube_Productor_Energy
  • +
    +
    + + Graphic_Single + CutoutComplex + + + +
  • None
  • +
    + false + +
  • Wula_Apparel
  • +
  • Wula_Armor
  • +
    + +
  • FullHead
  • +
    + +
  • Overhead
  • +
    + ApparelHead + true + Wear_PowerArmor + Remove_PowerArmor + true +
    + +
  • Metallic
  • +
    + +
  • RewardStandardHighFreq
  • +
    + + 0.6 + 0.25 + 0.25 + +
    @@ -301,113 +408,6 @@ - - Spacer - Normal - -
  • ApparelArmor
  • -
    - - 105 - UnfinishedTechArmor - -
  • WULA_Cube_Productor_Energy
  • -
    - false -
    - - Graphic_Single - CutoutComplex - - -
  • Metallic
  • -
    - - -
  • Wula_Apparel
  • -
  • Wula_Armor
  • -
    - -
  • Torso
  • -
  • Neck
  • -
  • Shoulders
  • -
  • Arms
  • -
  • Legs
  • -
    - -
  • Middle
  • -
  • Shell
  • -
    - true - Wear_PowerArmor - Remove_PowerArmor - false - false - false - true -
    - Apparel - -
  • - - -
  • RewardStandardHighFreq
  • - - - 0.6 - 0.25 - 0.25 - -
    - - Spacer - -
  • ApparelArmor
  • -
    - - 105 - UnfinishedTechArmor - -
  • WULA_Cube_Productor_Energy
  • -
    -
    - - Graphic_Single - CutoutComplex - - - -
  • None
  • -
    - false - -
  • Wula_Apparel
  • -
  • Wula_Armor
  • -
    - -
  • FullHead
  • -
    - -
  • Overhead
  • -
    - ApparelHead - true - Wear_PowerArmor - Remove_PowerArmor - true -
    - -
  • Metallic
  • -
    - -
  • RewardStandardHighFreq
  • -
    - - 0.6 - 0.25 - 0.25 - -
    WULA_Knight_PowerArmor 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 1c0fc208..b132bda8 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 @@ -1739,7 +1739,7 @@ -
  • WULA_Cube_Productor_Energy
  • +
  • WULA_Cube_Productor
  • WULA_Synth_Weapon_1_Missile_Technology UnfinishedWeapon diff --git a/1.6/1.6/Defs/WorkGivers/Wula_WorkGivers.xml b/1.6/1.6/Defs/WorkGivers/Wula_WorkGivers.xml index 7c8ae49b..07343ca4 100644 --- a/1.6/1.6/Defs/WorkGivers/Wula_WorkGivers.xml +++ b/1.6/1.6/Defs/WorkGivers/Wula_WorkGivers.xml @@ -8,7 +8,7 @@ Smithing 75 -
  • WULA_Cube_Productor_Energy
  • +
  • WULA_Cube_Productor
  • 工作于 工作于 diff --git a/1.6/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml b/1.6/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml index 257a266d..01a08bc3 100644 --- a/1.6/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml +++ b/1.6/1.6/Defs/WulaMiscSettingDefs/EventUIConfig.xml @@ -9,7 +9,7 @@ Wula/Events/tile_large_bg - (600,850) + (600,900) true @@ -25,7 +25,7 @@ (600,400) (600,40) (600,30) - (500,150) + (560,200) (600,200) (500,150) @@ -33,11 +33,11 @@ (0,10) (10,0) (10,0) - (10,20) - (10,0) + (10,10) + (5,0) - (10,25) + (0,0) (20,20) @@ -46,7 +46,7 @@ 20 - false + true false Medium diff --git a/1.6/1.6/Defs/WulaMiscSettingDefs/LetterDefs/EventLetter.xml b/1.6/1.6/Defs/WulaMiscSettingDefs/LetterDefs/EventLetter.xml deleted file mode 100644 index 789cea86..00000000 --- a/1.6/1.6/Defs/WulaMiscSettingDefs/LetterDefs/EventLetter.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - Wula_EventChoiceLetter - WulaFallenEmpire.Letter_EventChoice - LetterArrive_Good - (120, 150, 255) - - \ No newline at end of file diff --git a/1.6/1.6/Patches/Patch.xml b/1.6/1.6/Patches/Patch.xml index a724c670..19ac26aa 100644 --- a/1.6/1.6/Patches/Patch.xml +++ b/1.6/1.6/Patches/Patch.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Source/Documentation/EventSystem_Documentation.md b/Source/Documentation/EventSystem_Documentation.md index 950e41f2..d55a609a 100644 --- a/Source/Documentation/EventSystem_Documentation.md +++ b/Source/Documentation/EventSystem_Documentation.md @@ -480,6 +480,20 @@ MechanoidGoodwill ``` + +### `Effect_CallSkyfaller` +在玩家殖民地附近呼叫一个skyfaller。 +- **checkClearance**: 确保落点附近X格内净空。 +```xml +
  • + DropPodIncoming + 180 + true + 4 + 空投舱已呼叫 + 轨道空投舱已在途中,预计3秒后抵达。 +
  • +``` --- ## 4. 可用的条件 (`Condition`) diff --git a/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs new file mode 100644 index 00000000..d09f35e2 --- /dev/null +++ b/Source/WulaFallenEmpire/EventSystem/Effect/Effect_CallSkyfaller.cs @@ -0,0 +1,129 @@ +using System.Collections.Generic; +using Verse; +using RimWorld; +using UnityEngine; + +namespace WulaFallenEmpire +{ + public class Effect_CallSkyfaller : EffectBase + { + public ThingDef skyfallerDef; + public int delayTicks = 120; + public bool checkClearance = true; + public int clearanceRadius = 3; + public string letterLabel; + public string letterText; + public LetterDef letterDef; + + public override void Execute(Window dialog = null) + { + Map currentMap = Find.CurrentMap; + if (currentMap == null) + { + Log.Error("[WulaFallenEmpire] Effect_CallSkyfaller cannot execute without a current map."); + return; + } + + if (skyfallerDef == null) + { + Log.Error("[WulaFallenEmpire] Effect_CallSkyfaller has a null skyfallerDef."); + return; + } + + // 寻找合适的掉落点 + IntVec3 dropCenter; + if (checkClearance) + { + dropCenter = FindDropSpotWithClearance(currentMap, clearanceRadius); + } + else + { + dropCenter = DropCellFinder.RandomDropSpot(currentMap); + } + + if (!dropCenter.IsValid) + { + Log.Error("[WulaFallenEmpire] Effect_CallSkyfaller could not find a valid drop spot."); + return; + } + + // 创建延时召唤 + CallSkyfallerDelayed(dropCenter, currentMap); + + // 发送通知信件 + if (!string.IsNullOrEmpty(letterLabel) && !string.IsNullOrEmpty(letterText)) + { + Find.LetterStack.ReceiveLetter(letterLabel, letterText, letterDef ?? LetterDefOf.NeutralEvent); + } + + Log.Message($"[WulaFallenEmpire] Scheduled skyfaller '{skyfallerDef.defName}' at {dropCenter} with {delayTicks} ticks delay"); + } + + private IntVec3 FindDropSpotWithClearance(Map map, int radius) + { + // 优先在殖民地附近寻找 + IntVec3 result; + if (RCellFinder.TryFindRandomCellNearTheCenterOfTheMapWith( + (IntVec3 c) => IsValidDropSpotWithClearance(c, map, radius) && map.reachability.CanReachColony(c), + map, out result)) + { + return result; + } + + // 如果找不到,放宽条件 + if (CellFinder.TryFindRandomCellNear(map.Center, map, Mathf.Max(map.Size.x / 4, 10), + (IntVec3 c) => IsValidDropSpotWithClearance(c, map, radius), out result)) + { + return result; + } + + // 最后尝试任何有效位置 + if (CellFinder.TryFindRandomCellNear(map.Center, map, map.Size.x / 2, + (IntVec3 c) => IsValidDropSpotWithClearance(c, map, radius), out result)) + { + return result; + } + + return IntVec3.Invalid; + } + + private bool IsValidDropSpotWithClearance(IntVec3 center, Map map, int radius) + { + // 检查中心点是否有效 + if (!center.IsValid || !center.InBounds(map) || !center.Standable(map) || center.Fogged(map)) + return false; + + // 检查指定半径内的所有单元格 + foreach (IntVec3 cell in GenRadial.RadialCellsAround(center, radius, true)) + { + if (!cell.InBounds(map) || !cell.Walkable(map) || cell.Fogged(map)) + return false; + + // 检查是否有建筑物阻挡 + Building building = cell.GetEdifice(map); + if (building != null && building.def.passability == Traversability.Impassable) + return false; + + // 检查是否有屋顶(可选,根据需求调整) + if (cell.Roofed(map)) + return false; + } + + return true; + } + + private void CallSkyfallerDelayed(IntVec3 targetCell, Map map) + { + // 获取或创建延时组件 + var delayedComponent = map.GetComponent(); + if (delayedComponent == null) + { + delayedComponent = new MapComponent_SkyfallerDelayed(map); + map.components.Add(delayedComponent); + } + + // 安排延时召唤 + delayedComponent.ScheduleSkyfaller(skyfallerDef, targetCell, delayTicks); + } + } +} diff --git a/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs new file mode 100644 index 00000000..17a0217d --- /dev/null +++ b/Source/WulaFallenEmpire/EventSystem/QuestNode/QuestNode_EventLetter.cs @@ -0,0 +1,98 @@ +using RimWorld; +using RimWorld.QuestGen; +using System; +using Verse; + +namespace WulaFallenEmpire +{ + public class QuestNode_EventLetter : QuestNode + { + [NoTranslate] + public SlateRef inSignal; + + public SlateRef eventDefName; + + protected override bool TestRunInt(Slate slate) + { + return true; + } + + protected override void RunInt() + { + Slate slate = QuestGen.slate; + string signal = inSignal.GetValue(slate); + string defName = eventDefName.GetValue(slate); + + if (defName.NullOrEmpty()) + { + Log.Error("[WulaFallenEmpire] QuestNode_EventLetter: eventDefName is not specified."); + return; + } + + // 关键:使用 HardcodedSignalWithQuestID 处理信号 + string processedSignal = QuestGenUtility.HardcodedSignalWithQuestID(signal) ?? slate.Get("inSignal"); + + QuestPart_EventLetter questPart = new QuestPart_EventLetter(); + questPart.inSignal = processedSignal; + questPart.eventDefName = defName; + + QuestGen.quest.AddPart(questPart); + } + } + + public class QuestPart_EventLetter : QuestPart + { + public string inSignal; + public string eventDefName; + + public override void Notify_QuestSignalReceived(Signal signal) + { + base.Notify_QuestSignalReceived(signal); + + Log.Message($"[WulaFallenEmpire] QuestPart_EventLetter received signal: '{signal.tag}', waiting for: '{inSignal}'"); + + if (signal.tag == inSignal) + { + Log.Message($"[WulaFallenEmpire] Signal matched! Opening EventDef: {eventDefName}"); + OpenEventDefWindow(eventDefName); + } + } + + private void OpenEventDefWindow(string defName) + { + try + { + EventDef eventDef = DefDatabase.GetNamed(defName, false); + if (eventDef == null) + { + Log.Error($"[WulaFallenEmpire] EventDef '{defName}' not found in DefDatabase."); + return; + } + + if (eventDef.windowType == null) + { + Log.Error($"[WulaFallenEmpire] EventDef '{defName}' has null windowType."); + return; + } + + Log.Message($"[WulaFallenEmpire] Creating window instance for {defName} with type {eventDef.windowType}"); + Window window = (Window)Activator.CreateInstance(eventDef.windowType, eventDef); + + Log.Message($"[WulaFallenEmpire] Adding window to WindowStack"); + Find.WindowStack.Add(window); + Log.Message($"[WulaFallenEmpire] Successfully opened EventDef window: {defName}"); + } + catch (Exception ex) + { + Log.Error($"[WulaFallenEmpire] Error opening EventDef window '{defName}': {ex}"); + } + } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref inSignal, "inSignal"); + Scribe_Values.Look(ref eventDefName, "eventDefName"); + } + } +} diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 612709db..63e7eece 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -106,9 +106,11 @@ + +