Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
341 changed files
with
19,015 additions
and
1,560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.