Skip to content

Commit

Permalink
v5.0-beta.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerbu committed Mar 15, 2023
1 parent 32a760e commit e5463fb
Show file tree
Hide file tree
Showing 341 changed files with 19,015 additions and 1,560 deletions.
2 changes: 2 additions & 0 deletions Constructor5.Base/Constructor5.Base.csproj
Expand Up @@ -236,8 +236,10 @@
<Compile Include="PropertyTypes\STBLString.cs" />
<Compile Include="PropertyTypes\Threshold.cs" />
<Compile Include="PropertyTypes\ThresholdComparison.cs" />
<Compile Include="Python\GlobalTraitPythonStep.cs" />
<Compile Include="Python\ImportTraitPickerPythonStep.cs" />
<Compile Include="Python\MergeLootPythonStep.cs" />
<Compile Include="Python\MergeZoneDirectorPythonStep.cs" />
<Compile Include="Python\ObjectInteractionsPythonStep.cs" />
<Compile Include="Python\PythonBuilder.cs" />
<Compile Include="Python\PythonBuildStep.cs" />
Expand Down
5 changes: 0 additions & 5 deletions Constructor5.Base/DebugCommandSystem/CreateElementCommand.cs
@@ -1,10 +1,5 @@
using Constructor5.Base.ElementSystem;
using Constructor5.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Constructor5.Base.DebugCommandSystem
{
Expand Down
8 changes: 4 additions & 4 deletions Constructor5.Base/ElementSystem/ElementManager.cs
Expand Up @@ -17,10 +17,10 @@ public static class ElementManager

public static Element FocusedElement { get; set; }

public static Element Create(Type type, string label, bool isContextSpecific = false)
public static Element Create(Type type, string label, bool isContextSpecific = false, string guidOverride = null)
{
var result = (Element)Reflection.CreateObject(type);
result.Guid = GenerateGuid();
result.Guid = guidOverride != null ? guidOverride : GenerateGuid();
result.UserFacingId = !isContextSpecific ? GenerateID(label) : GenerateID(result.Guid);
result.IsContextSpecific = isContextSpecific;
if (isContextSpecific)
Expand All @@ -38,9 +38,9 @@ public static Element Create(Type type, string label, bool isContextSpecific = f
return result;
}

public static T CreateTemporary<T>() where T : Element
public static T CreateTemporary<T>(string guidOverride = null) where T : Element
{
var result = (T)Create(typeof(T), null, true);
var result = (T)Create(typeof(T), null, true, guidOverride);
result.IsTemporary = true;
return result;
}
Expand Down
75 changes: 75 additions & 0 deletions Constructor5.Base/LocalizationSystem/LocalizableTextStringsXML.xml
Expand Up @@ -1224,4 +1224,79 @@ It is recommended you include your creator name in custom tags, to prevent confl

<String Key="ImageImportError">There was an error importing the custom image. This can happen when DDSPanel, the library used for converting images to the game-recognized DDS format, fails. Try applying an effect or resizing the image to a power of 2 number (8x8, 16x16, 32x32, 64x64, etc)</String>

<String Key="AdditionalUserSelectionFilter">Additional User Selection Filter</String>
<String Key="AdditionalUserSelectionFilterNotice">In addition to the main filter, Sims must meet this filter to be selectable in the Plan a Social Event UI. This does not apply to auto invited or hired Sims.</String>
<String Key="MainFilter">Main Filter</String>

<String Key="IsOptional">Is Optional</String>
<String Key="IsOptionalHelp">If checked, the game will prefer Sims that match this term, but can still use other Sims if there are no existing Sims that match it.</String>

<String Key="IdealValue">Ideal Value</String>

<String Key="BanAllCelebrities">Ban All Celebrities</String>

<String Key="FullySimulateOffLot">Fully Simulate Off Lot</String>
<String Key="FullySimulateOffLotHelp">If checked, the value of the commodity will actively change in the background, even if the Sim is not instanced. This should only be used if you need to access the value without instancing the Sim, otherwise "Decay Off Lot" will be enough.</String>

<String Key="IsGlobalTrait">Global Trait</String>
<String Key="IsGlobalTraitHelp">If checked, the trait will automatically be added to all Sims who meet the age requirements. This requires the player to have Script Mods enabled. These traits should generally be set to hidden.</String>

<String Key="TemporaryTrait">Temporary Trait</String>
<String Key="TemporaryTraitHelp">If set, the defined trait will be added when the buff is added, and removed when it is removed. You can use this to access features that aren't available on buffs, such as blocked emotions, or just to make the trait appear in the UI. Temporary traits should usually have "Non Persisted" checked in "Special Cases" (this is done by default for traits created with the + button).</String>

<String Key="AddShift">Add Shift</String>
<String Key="RemoveShift">Remove Shift</String>
<String Key="StartHour">Start Hour</String>
<String Key="MinAmount">Min Amount</String>
<String Key="MaxAmount">Max Amount</String>

<String Key="Yoga">Yoga</String>
<String Key="ObjectBasedMultiplier">Multiply min and max Sims based on the number of instances of an object</String>
<String Key="Situations">Situations</String>
<String Key="SpawnTimes">Spawn Times</String>
<String Key="AddSpawnTime">Add Spawn Time</String>
<String Key="RemoveSpawnTime">Remove Spawn Time</String>
<String Key="ObjectBasedMultiplierTag">Object Tag</String>

<String Key="ZoneDirector">Zone Director/Lot Spawn Logic (Experimental)</String>
<String Key="DefaultZoneDirectorTemplate">No Zone Director Type Selected</String>
<String Key="ShiftBasedZoneDirector">Shift-Based Zone Director</String>
<String Key="Enabled">Enabled</String>
<String Key="ObjectBasedMultiplierTags">Object-Based Multiplier Tags</String>
<String Key="StartObjectBasedMultiplierFrom">Start Object-Based Multiplier From</String>
<String Key="ObjectBasedMultiplierIterations">Object Based Multiplier Iterations</String>

<String Key="LotTypeBlacklist">Lot Type Blacklist</String>
<String Key="LotTypeWhitelist">Lot Type Whitelist</String>
<String Key="LotTraitBlacklist">Lot Trait Blacklist</String>
<String Key="LotTraitWhitelist">Lot Trait Whitelist</String>
<String Key="WorldBlacklist">World Blacklist</String>
<String Key="WorldWhitelist">World Whitelist</String>
<String Key="IsApartment">Is the lot an apartment?</String>
<String Key="IsPenthouse">Is the lot a penthouse?</String>
<String Key="UseParentLot">Use Parent Lot</String>
<String Key="UseParentLotHelp">If the lot is a sub-venue (example: a Community Garden from Eco Lifestyle is a sub-venue of Community Space), the condition will check the parent venue instead of the sub-venue.</String>

<String Key="Bowling">Bowling</String>
<String Key="Paparazzi">Paparazzi</String>
<String Key="ZoneDirectorMerges">Zone Director Merges</String>
<String Key="AllowShiftsToOverlap">Allow shifts to overlap (should generally be checked for visitor roles, but unchecked for staff roles)</String>
<String Key="IncreaseMultiplierForEveryInstances">Increase multiplier every # instances</String>
<String Key="StartingFromInstance">Starting from instance #</String>
<String Key="MaximumTimes">A maximum of # times</String>

<String Key="ZoneDirectorMergeNotice">You can merge this zone director with one or more zone directors that are already in the game. This allows you to insert your own custom spawn logic to existing venues.</String>

<String Key="CareerEventConditionsHelp">These conditions must pass for the event to be selected.</String>
<String Key="LocationConditionDescription">Information about a Sim's location, such as the lot type, whether or not they're standing on the lot, and whether they're indoors or outdoors.</String>
<String Key="LotInfoCondition">Lot Info Condition</String>
<String Key="LotInfoConditionDescription">Information about the current lot, including the type, lot traits and world. Unlike a Location Info condition, this doesn't know anything about the Sim and can't detect whether the Sim is standing on the lot or not, or any other Sim-specific info.</String>

<String Key="ActiveCareerEvents">Active Career Events</String>
<String Key="CareerEvent">Career Event</String>

<String Key="UseCustomScoreType">Use Custom Score Type</String>
<String Key="InteractionAutoScoreTypeError">Mod Constructor does not have score data for the selected pie menu category, so the interaction will not be effected by Conversation Topic preferences from Growing Together. You can specify the score type manually in the "Advanced" tab.</String>


</LocalizableTextStrings>
9 changes: 9 additions & 0 deletions Constructor5.Base/ProgramSettings.cs
@@ -1,4 +1,5 @@
using Constructor5.Base.Properties;
using System;

namespace Constructor5.Base
{
Expand All @@ -10,12 +11,20 @@ public static string CreatorName
set => Settings.Default.CreatorName = value;
}

public static string GetTS4Exe() => $"{Settings.Default.TS4Folder}/Game/Bin/TS4_x64.exe";

public static bool ShowAllSettingEnabled
{
get => Settings.Default.ShowAllSettingEnabled;
set => Settings.Default.ShowAllSettingEnabled = value;
}

public static string TS4Folder
{
get => Settings.Default.TS4Folder;
set => Settings.Default.TS4Folder = value;
}

public static void Save() => Settings.Default.Save();
}
}
12 changes: 12 additions & 0 deletions Constructor5.Base/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Constructor5.Base/Properties/Settings.settings
Expand Up @@ -11,5 +11,8 @@
<Setting Name="ShowAllSettingEnabled" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="TS4Folder" Type="System.String" Scope="User">
<Value Profile="(Default)">C:\Program Files\EA Games\The Sims 4</Value>
</Setting>
</Settings>
</SettingsFile>
46 changes: 46 additions & 0 deletions Constructor5.Base/Python/GlobalTraitPythonStep.cs
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Constructor5.Base.Python
{
public class GlobalTraitPythonStep : PythonBuildStep
{
public static GlobalTraitPythonStep Current { get; } = new GlobalTraitPythonStep();

public void AddTrait(ulong traitKey) => GlobalTraits.Add(traitKey);

public override string GetContent()
{
var result = new StringBuilder();

if (GlobalTraits.Count > 0)
{
result.AppendLine("@inject_to(Sim, 'on_add')");
result.AppendLine("def add_traits_after_sim_spawned(original, self, *args, **kwargs):");
result.AppendLine(" result = original(self, *args, **kwargs)");
result.AppendLine(" add_traits_to_sim(self.sim_info)");
result.AppendLine(" return result");

result.AppendLine("def add_traits_to_sim(sim_info):");
result.AppendLine(" trait_manager = services.trait_manager()");
result.AppendLine(" if sim_info is None:");
result.AppendLine(" return");
foreach(var trait in GlobalTraits)
{
result.AppendLine($" sim_info.add_trait(trait_manager.get({trait}))");
}
}

return result.ToString();
}

public override IEnumerable<string> GetHeaders() => new[] { "import services", "from sims.sim import Sim" };

protected internal override void Cleanup() => GlobalTraits.Clear();

protected List<ulong> GlobalTraits { get; } = new List<ulong>();
}
}
68 changes: 68 additions & 0 deletions Constructor5.Base/Python/MergeZoneDirectorPythonStep.cs
@@ -0,0 +1,68 @@
using Constructor5.Base.ProjectSystem;
using System.Collections.Generic;
using System.Text;

namespace Constructor5.Base.Python
{
public class MergeZoneDirectorPythonStep : PythonBuildStep
{
public static MergeZoneDirectorPythonStep Current { get; } = new MergeZoneDirectorPythonStep();

public void Add(ulong mergeTo, ulong toMerge)
{
if (!ToMerge.ContainsKey(mergeTo))
{
ToMerge.Add(mergeTo, new List<ulong>());
}

if (!ToMerge[mergeTo].Contains(toMerge))
{
ToMerge[mergeTo].Add(toMerge);
}
}

public override string GetContent()
{
var result = new StringBuilder();

if (ToMerge.Count > 0)
{
result.AppendLine("@inject_to(InstanceManager, 'load_data_into_class_instances')");
result.AppendLine($"def {Project.Id}_AddZoneDirector(original, self):");

result.AppendLine($" original(self)");
result.AppendLine($" if self.TYPE == Types.ZONE_DIRECTOR:");

foreach (var merger in ToMerge)
{
foreach (var value in merger.Value)
{
result.AppendLine($" {Project.Id}_AddZoneDirectorInjector(self, {value}, {merger.Key})");
}
}

result.AppendLine("");
result.AppendLine($"def {Project.Id}_AddZoneDirectorInjector(self, to_merge_key, value):");
result.AppendLine($" manager = services.get_instance_manager(sims4.resources.Types.ZONE_DIRECTOR)");
result.AppendLine($" merge_to = self._tuned_classes.get(sims4.resources.get_resource_key(value, Types.ZONE_DIRECTOR))");
result.AppendLine($" if merge_to is None:");
result.AppendLine($" return");
result.AppendLine($" to_merge = manager.get(sims4.resources.get_resource_key(to_merge_key, Types.ZONE_DIRECTOR))");
result.AppendLine($" if to_merge is None:");
result.AppendLine($" return");
result.AppendLine($" merge_to.situation_shifts = merge_to.situation_shifts + to_merge.situation_shifts");
}

return result.ToString();
}

public override IEnumerable<string> GetHeaders() => new[] {"import sims4.resources",
"from sims4.tuning.instance_manager import InstanceManager",
"from sims4.resources import Types",
"import services"};

protected internal override void Cleanup() => ToMerge.Clear();

protected Dictionary<ulong, List<ulong>> ToMerge { get; } = new Dictionary<ulong, List<ulong>>();
}
}
3 changes: 3 additions & 0 deletions Constructor5.Base/app.config
Expand Up @@ -16,6 +16,9 @@
<setting name="ShowAllSettingEnabled" serializeAs="String">
<value>False</value>
</setting>
<setting name="TS4Folder" serializeAs="String">
<value>C:\Program Files\EA Games\The Sims 4</value>
</setting>
</Constructor5.Base.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
1 change: 1 addition & 0 deletions Constructor5.Core/Reflection.cs
Expand Up @@ -107,6 +107,7 @@ private static IEnumerable<Assembly> GetAssemblies()
Assembly.Load("Constructor5.SimFilterTypes"),
Assembly.Load("Constructor5.SituationGoalTemplates"),
Assembly.Load("Constructor5.BasicExtraTypes"),
Assembly.Load("Constructor5.ZoneDirectorTemplates"),
};

var pluginsDir = DirectoryUtility.GetUserDirectory("Plugins");
Expand Down
Expand Up @@ -159,6 +159,10 @@
<Project>{92267ec9-b06a-44ac-b383-f40c4d6a5755}</Project>
<Name>Constructor5.UI</Name>
</ProjectReference>
<ProjectReference Include="..\Constructor5.ZoneDirectorTemplates\Constructor5.ZoneDirectorTemplates.csproj">
<Project>{3dce553c-be93-4464-be28-29c1a3bfd0c2}</Project>
<Name>Constructor5.ZoneDirectorTemplates</Name>
</ProjectReference>
<ProjectReference Include="..\Constructor5\Constructor5.csproj">
<Project>{8afd4531-4b69-42a6-aa95-37e8e527b058}</Project>
<Name>Constructor5</Name>
Expand Down
Expand Up @@ -129,6 +129,10 @@
<Project>{92267ec9-b06a-44ac-b383-f40c4d6a5755}</Project>
<Name>Constructor5.UI</Name>
</ProjectReference>
<ProjectReference Include="..\Constructor5.ZoneDirectorTemplates\Constructor5.ZoneDirectorTemplates.csproj">
<Project>{3dce553c-be93-4464-be28-29c1a3bfd0c2}</Project>
<Name>Constructor5.ZoneDirectorTemplates</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
18 changes: 17 additions & 1 deletion Constructor5.DebugTools.PresetExtractor/InstructionBatches.cs
Expand Up @@ -77,6 +77,11 @@ public static class InstructionBatches

public static PresetInstruction[] PieMenuCategories { get; } = PresetInstruction.CreateBatch("Pie_Menu_Category", "PieMenuCategory", "All Pie Menu Categories", "_display_name", new Dictionary<string, string>
{
{ "Conversation Topics - Friendly", "SubCat_Friendly" },
{ "Conversation Topics - Funny", "SubCat_Funny" },
{ "Conversation Topics - Mean", "SubCat_Mean" },
{ "Conversation Topics - Mischief", "SubCat_Mischief" },
{ "Conversation Topics - Romantic", "SubCat_Romantic" },
});

public static PresetInstruction[] Recipes { get; } = PresetInstruction.CreateBatch("Recipe", "Recipe", "All Recipes", "name", new Dictionary<string, string>
Expand Down Expand Up @@ -121,7 +126,6 @@ public static class InstructionBatches

public static PresetInstruction[] SocialInteractions { get; } = PresetInstruction.CreateBatch("Interaction", "SocialInteraction", "All Social Interactions", "display_name", new Dictionary<string, string>
{

}, "SocialMixerInteraction");

public static PresetInstruction[] Traits { get; } = PresetInstruction.CreateBatch("Trait", "Trait", "All Traits", "display_name", new Dictionary<string, string>
Expand Down Expand Up @@ -166,5 +170,17 @@ public static class InstructionBatches
public static PresetInstruction[] TemplateChoosers { get; } = PresetInstruction.CreateBatch("Template_Chooser", "TemplateChooser", "All Template Choosers", "reason", new Dictionary<string, string>
{
});

public static PresetInstruction[] Regions { get; } = PresetInstruction.CreateBatch("Region", "Region", "All Worlds", "reason", new Dictionary<string, string>
{
});

public static PresetInstruction[] ZoneModifiers { get; } = PresetInstruction.CreateBatch("Zone_Modifier", "ZoneModifier", "All Lot Traits", "reason", new Dictionary<string, string>
{
});

public static PresetInstruction[] ZoneDirectors { get; } = PresetInstruction.CreateBatch("Zone_Director", "ZoneDirector", "All Zone Directors", "reason", new Dictionary<string, string>
{
});
}
}

0 comments on commit e5463fb

Please sign in to comment.