feat(defs): add WULA_AreaTeleportBeacon and refactor csproj configuration
- Add WULA_AreaTeleportBeacon definition in WULA_Misc_Buildings.xml - Update .csproj to use wildcard inclusion for source files - Remove unused classes (PrefabSpawner, Letter_EventChoice, QuestNode_Root_EventLetter) - Update assembly binary
This commit is contained in:
@@ -1,94 +0,0 @@
|
||||
using RimWorld;
|
||||
using RimWorld.QuestGen;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class Letter_EventChoice : ChoiceLetter
|
||||
{
|
||||
// These fields are now inherited from the base Letter class
|
||||
// public string letterLabel;
|
||||
// public string letterTitle;
|
||||
// public string letterText;
|
||||
public List<QuestNode_Root_EventLetter.Option> options;
|
||||
public new Quest quest;
|
||||
|
||||
public override IEnumerable<DiaOption> Choices
|
||||
{
|
||||
get
|
||||
{
|
||||
if (options.NullOrEmpty())
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
foreach (var optionDef in options)
|
||||
{
|
||||
var currentOption = optionDef;
|
||||
Action choiceAction = delegate
|
||||
{
|
||||
if (!currentOption.optionEffects.NullOrEmpty())
|
||||
{
|
||||
foreach (var conditionalEffect in currentOption.optionEffects)
|
||||
{
|
||||
string reason;
|
||||
if (AreConditionsMet(conditionalEffect.conditions, out reason))
|
||||
{
|
||||
conditionalEffect.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quest != null && !quest.hidden && !quest.Historical)
|
||||
{
|
||||
quest.End(QuestEndOutcome.Success);
|
||||
}
|
||||
Find.LetterStack.RemoveLetter(this);
|
||||
};
|
||||
|
||||
var diaOption = new DiaOption(currentOption.label.Translate())
|
||||
{
|
||||
action = choiceAction,
|
||||
resolveTree = true
|
||||
};
|
||||
yield return diaOption;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanDismissWithRightClick => false;
|
||||
|
||||
private bool AreConditionsMet(List<Condition> conditions, out string reason)
|
||||
{
|
||||
reason = "";
|
||||
if (conditions.NullOrEmpty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var condition in conditions)
|
||||
{
|
||||
if (!condition.IsMet(out string singleReason))
|
||||
{
|
||||
reason = singleReason;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
base.ExposeData();
|
||||
// Scribe_Values.Look(ref letterLabel, "letterLabel"); // Now uses base.label
|
||||
// Scribe_Values.Look(ref letterTitle, "letterTitle"); // Now uses base.title
|
||||
// Scribe_Values.Look(ref letterText, "letterText"); // Now uses base.text
|
||||
Scribe_Collections.Look(ref options, "options", LookMode.Deep);
|
||||
if (Scribe.mode != LoadSaveMode.Saving || quest != null)
|
||||
{
|
||||
Scribe_References.Look(ref quest, "quest");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using RimWorld;
|
||||
using RimWorld.QuestGen;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class QuestNode_Root_EventLetter : QuestNode
|
||||
{
|
||||
// Fields to be set from the QuestScriptDef XML
|
||||
public SlateRef<string> letterLabel;
|
||||
public SlateRef<string> letterTitle;
|
||||
public SlateRef<string> letterText;
|
||||
public List<Option> options = new List<Option>();
|
||||
|
||||
// This is a root node, so it doesn't have a parent signal.
|
||||
// It runs immediately when the quest starts.
|
||||
protected override void RunInt()
|
||||
{
|
||||
// Get the current slate
|
||||
Slate slate = QuestGen.slate;
|
||||
|
||||
var letter = (Letter_EventChoice)LetterMaker.MakeLetter(DefDatabase<LetterDef>.GetNamed("Wula_EventChoiceLetter"));
|
||||
letter.Label = letterLabel.GetValue(slate);
|
||||
letter.title = letterTitle.GetValue(slate);
|
||||
letter.Text = letterText.GetValue(slate);
|
||||
letter.options = options;
|
||||
letter.quest = QuestGen.quest;
|
||||
letter.lookTargets = slate.Get<LookTargets>("lookTargets");
|
||||
|
||||
Find.LetterStack.ReceiveLetter(letter);
|
||||
}
|
||||
|
||||
protected override bool TestRunInt(Slate slate)
|
||||
{
|
||||
// This node can always run as long as the slate refs are valid.
|
||||
// We can add more complex checks here if needed.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Inner class to hold option data from XML
|
||||
public class Option
|
||||
{
|
||||
public string label;
|
||||
public List<ConditionalEffects> optionEffects;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user