diff --git a/Patches/Tables.xml b/Patches/Tables.xml new file mode 100644 index 0000000..96c538b --- /dev/null +++ b/Patches/Tables.xml @@ -0,0 +1,35 @@ + + + + + +
  • + Defs/ThingDef[@Name="TableBase"]/comps + + Defs/ThingDef[@Name="TableBase"] + + + + +
  • +
  • + Defs/ThingDef[@Name="TableBase"]/comps + +
  • + TableToggle.EatableComp +
  • + + +
    +
    +
    diff --git a/Source/EatableComp.cs b/Source/EatableComp.cs new file mode 100644 index 0000000..fcd5a3f --- /dev/null +++ b/Source/EatableComp.cs @@ -0,0 +1,52 @@ +/* +Copyright 2025 Maciej Pawłowski + +This file is part of "Table Eating Toggle". + +"Table Eating Toggle" is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +"Table Eating Toggle" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with "Table Eating Toggle". If not, see . +*/ + +using System.Collections.Generic; +using RimWorld; +using Verse; + +namespace TableToggle; + +public class EatableComp : ThingComp +{ + public bool EatableFrom = true; + public override IEnumerable CompGetGizmosExtra() + { + foreach (Gizmo item in base.CompGetGizmosExtra()) + { + yield return item; + } + if (parent.Faction == Faction.OfPlayer) + { + Command_Toggle command_Toggle = new() + { + icon = TexCommand.ForbidOff, + isActive = () => EatableFrom, + defaultLabel = "eating", + defaultDesc = "Colonists will eat from this table.", + toggleAction = delegate + { + EatableFrom = !EatableFrom; + } + }; + if (!EatableFrom) + { + command_Toggle.defaultDesc = "Colonists will not eat from this table."; + } + yield return command_Toggle; + } + } + public override void PostExposeData() + { + Scribe_Values.Look(ref EatableFrom, "eatable", defaultValue: true); + } +} diff --git a/Source/TableToggle.csproj b/Source/TableToggle.csproj new file mode 100644 index 0000000..9d66a97 --- /dev/null +++ b/Source/TableToggle.csproj @@ -0,0 +1,45 @@ + + + + + ../Assemblies + net48 + enable + + false + false + latest + + + true + full + false + + + none + true + ../Assemblies + + + + + ../../../RimWorldLinux_Data/Managed/Assembly-CSharp.dll + False + + + ../../../RimWorldLinux_Data/Managed/UnityEngine.CoreModule.dll + False + + + +