From eb501f14ff8d8961a4cf38b87e6ad53f326b19c9 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 13 Dec 2021 14:22:22 +0100 Subject: [PATCH 01/13] Base modifier testing --- Content/Data/ModificationsHoldable.cs | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Content/Data/ModificationsHoldable.cs diff --git a/Content/Data/ModificationsHoldable.cs b/Content/Data/ModificationsHoldable.cs new file mode 100644 index 000000000..561b0a3b4 --- /dev/null +++ b/Content/Data/ModificationsHoldable.cs @@ -0,0 +1,31 @@ +using TC2.Base.Components; + +namespace TC2.Base +{ + public sealed partial class ModInstance + { + private static void RegisterSpriteModifications(ref List definitions) + { + definitions.Add(Modification.Definition.New + ( + identifier: "holdable.sneaky", + category: "Holdable", + name: "Sneaky", + description: "Hold this item BEHIND your body to make it less obvious", + + can_add: static (ref Modification.Context context, in Holdable.Data data, ref Modification.Handle handle, Span modifications) => + { + ref var renderer = ref context.GetComponent(); + return !modifications.HasModification(handle) && !renderer.IsNull(); + }, + + apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => + { + data.pain -= 200.00f; + context.requirements_new.Add(Crafting.Requirement.Resource("red_sugar", 10)); + } + )); + } + } +} + From 08f510e3c000a853744a82453b5407f9fd0356f3 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 13 Dec 2021 14:34:07 +0100 Subject: [PATCH 02/13] Sneaky Modifier --- Content/Data/ModificationsHoldable.cs | 21 ++++++++++++++++++--- content/Mod.cs | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Content/Data/ModificationsHoldable.cs b/Content/Data/ModificationsHoldable.cs index 561b0a3b4..0128ad2c4 100644 --- a/Content/Data/ModificationsHoldable.cs +++ b/Content/Data/ModificationsHoldable.cs @@ -4,7 +4,7 @@ namespace TC2.Base { public sealed partial class ModInstance { - private static void RegisterSpriteModifications(ref List definitions) + private static void RegisterHoldableModifications(ref List definitions) { definitions.Add(Modification.Definition.New ( @@ -21,8 +21,23 @@ private static void RegisterSpriteModifications(ref List modifications) => { - data.pain -= 200.00f; - context.requirements_new.Add(Crafting.Requirement.Resource("red_sugar", 10)); + ref var renderer = ref context.GetComponent(); + if (!renderer.IsNull()) + { + renderer.z = -140.00f; + } + + ref var gun = ref context.GetComponent(); + if (!gun.IsNull()) + { + gun.damage_multiplier *= 0.80f; + } + + ref var melee = ref context.GetComponent(); + if (!melee.IsNull()) + { + melee.damage_base *= 0.80f; + } } )); } diff --git a/content/Mod.cs b/content/Mod.cs index ab89618cb..f132d9893 100644 --- a/content/Mod.cs +++ b/content/Mod.cs @@ -10,6 +10,7 @@ protected override void OnRegister(ModContext context) Modification.OnInitialize += RegisterMeleeModifications; Modification.OnInitialize += RegisterDrillModifications; Modification.OnInitialize += RegisterMedkitModifications; + Modification.OnInitialize += RegisterHoldableModifications; } protected override void OnInitialize(ModContext context) From 0defba392799acde8398396905da38b2b3650102 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 13 Dec 2021 14:37:20 +0100 Subject: [PATCH 03/13] Now increases work costs slightly --- Content/Data/ModificationsHoldable.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Content/Data/ModificationsHoldable.cs b/Content/Data/ModificationsHoldable.cs index 0128ad2c4..298deea02 100644 --- a/Content/Data/ModificationsHoldable.cs +++ b/Content/Data/ModificationsHoldable.cs @@ -38,6 +38,15 @@ private static void RegisterHoldableModifications(ref List Date: Mon, 13 Dec 2021 14:39:11 +0100 Subject: [PATCH 04/13] Changed work cost a tiny bit --- Content/Data/ModificationsHoldable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content/Data/ModificationsHoldable.cs b/Content/Data/ModificationsHoldable.cs index 298deea02..9f057e6e4 100644 --- a/Content/Data/ModificationsHoldable.cs +++ b/Content/Data/ModificationsHoldable.cs @@ -44,7 +44,7 @@ private static void RegisterHoldableModifications(ref List Date: Mon, 13 Dec 2021 14:42:41 +0100 Subject: [PATCH 05/13] Renamed file --- .../Data/{ModificationsHoldable.cs => Modifications.Holdable.cs} | 1 - 1 file changed, 1 deletion(-) rename Content/Data/{ModificationsHoldable.cs => Modifications.Holdable.cs} (95%) diff --git a/Content/Data/ModificationsHoldable.cs b/Content/Data/Modifications.Holdable.cs similarity index 95% rename from Content/Data/ModificationsHoldable.cs rename to Content/Data/Modifications.Holdable.cs index 9f057e6e4..e1abd68fc 100644 --- a/Content/Data/ModificationsHoldable.cs +++ b/Content/Data/Modifications.Holdable.cs @@ -16,7 +16,6 @@ private static void RegisterHoldableModifications(ref List modifications) => { ref var renderer = ref context.GetComponent(); - return !modifications.HasModification(handle) && !renderer.IsNull(); }, apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => From 7e6a5ed1256630f908e9a8363f08e279c8ccd83d Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 13 Dec 2021 14:43:41 +0100 Subject: [PATCH 06/13] weird fix --- Content/Data/Modifications.Holdable.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Content/Data/Modifications.Holdable.cs b/Content/Data/Modifications.Holdable.cs index e1abd68fc..9f057e6e4 100644 --- a/Content/Data/Modifications.Holdable.cs +++ b/Content/Data/Modifications.Holdable.cs @@ -16,6 +16,7 @@ private static void RegisterHoldableModifications(ref List modifications) => { ref var renderer = ref context.GetComponent(); + return !modifications.HasModification(handle) && !renderer.IsNull(); }, apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => From 1c8267e26ae00477b2d6f23b3e2e0138f129dc76 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Wed, 19 Jan 2022 11:24:06 +0100 Subject: [PATCH 07/13] Fixed with new sprite --- content/Modifications/Modifications.Holdable.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/Modifications/Modifications.Holdable.cs b/content/Modifications/Modifications.Holdable.cs index 9f057e6e4..8eccd414f 100644 --- a/content/Modifications/Modifications.Holdable.cs +++ b/content/Modifications/Modifications.Holdable.cs @@ -15,13 +15,13 @@ private static void RegisterHoldableModifications(ref List modifications) => { - ref var renderer = ref context.GetComponent(); + ref var renderer = ref context.GetComponent(); return !modifications.HasModification(handle) && !renderer.IsNull(); }, apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => { - ref var renderer = ref context.GetComponent(); + ref var renderer = ref context.GetComponent(); if (!renderer.IsNull()) { renderer.z = -140.00f; From e92a958b4e41c1445ff2ec84272fc2fb7e2601f5 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 28 Feb 2022 16:47:29 +0100 Subject: [PATCH 08/13] Added Rubber Grip --- .../Modifications/Modifications.Holdable.cs | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/content/Modifications/Modifications.Holdable.cs b/content/Modifications/Modifications.Holdable.cs index 8eccd414f..f8a3cd310 100644 --- a/content/Modifications/Modifications.Holdable.cs +++ b/content/Modifications/Modifications.Holdable.cs @@ -9,7 +9,7 @@ private static void RegisterHoldableModifications(ref List ( identifier: "holdable.sneaky", - category: "Holdable", + category: "Utility", name: "Sneaky", description: "Hold this item BEHIND your body to make it less obvious", @@ -49,6 +49,36 @@ private static void RegisterHoldableModifications(ref List + ( + identifier: "holdable.easy_grip", + category: "Body", + name: "Rubber Grip", + description: "Get a better grip on the item by adding a rubber grip", + + can_add: static (ref Modification.Context context, in Holdable.Data data, ref Modification.Handle handle, Span modifications) => + { + return !modifications.HasModification(handle); + }, + + apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => + { + data.force_multiplier *= 1.5f; + data.torque_multiplier *= 1.5f; + + foreach (ref var requirement in context.requirements_new) + { + if (requirement.type == Crafting.Requirement.Type.Work) + { + requirement.difficulty += 1.00f; + requirement.amount *= 1.20f; + } + } + + context.requirements_new.Add(Crafting.Requirement.Resource("rubber", 10.00f)); + } + )); } } } From be817ffc227060f84b699cec69edeac2a736e35b Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 28 Feb 2022 16:47:57 +0100 Subject: [PATCH 09/13] Updated Costs --- content/Modifications/Modifications.Holdable.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/Modifications/Modifications.Holdable.cs b/content/Modifications/Modifications.Holdable.cs index f8a3cd310..ed6ba14cf 100644 --- a/content/Modifications/Modifications.Holdable.cs +++ b/content/Modifications/Modifications.Holdable.cs @@ -71,12 +71,11 @@ private static void RegisterHoldableModifications(ref List Date: Mon, 28 Feb 2022 16:48:37 +0100 Subject: [PATCH 10/13] Changed Name --- content/Modifications/Modifications.Holdable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/Modifications/Modifications.Holdable.cs b/content/Modifications/Modifications.Holdable.cs index ed6ba14cf..0d466add7 100644 --- a/content/Modifications/Modifications.Holdable.cs +++ b/content/Modifications/Modifications.Holdable.cs @@ -52,7 +52,7 @@ private static void RegisterHoldableModifications(ref List ( - identifier: "holdable.easy_grip", + identifier: "holdable.rubber_grip", category: "Body", name: "Rubber Grip", description: "Get a better grip on the item by adding a rubber grip", From 2dd4d5255483c5cbb3a446e70b9ba70c9ff85b9e Mon Sep 17 00:00:00 2001 From: Wunarg Date: Mon, 28 Feb 2022 16:51:58 +0100 Subject: [PATCH 11/13] Slippery Grip Modifier --- .../Modifications/Modifications.Holdable.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/content/Modifications/Modifications.Holdable.cs b/content/Modifications/Modifications.Holdable.cs index 0d466add7..d3e906a7f 100644 --- a/content/Modifications/Modifications.Holdable.cs +++ b/content/Modifications/Modifications.Holdable.cs @@ -78,6 +78,35 @@ private static void RegisterHoldableModifications(ref List + ( + identifier: "holdable.lubricated_grip", + category: "Body", + name: "Slippery Grip", + description: "Lubricate any grippable places of the object making it nearly unholdable", + + can_add: static (ref Modification.Context context, in Holdable.Data data, ref Modification.Handle handle, Span modifications) => + { + return !modifications.HasModification(handle); + }, + + apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => + { + data.force_multiplier *= 0.01f; + data.torque_multiplier *= 0.01f; + + foreach (ref var requirement in context.requirements_new) + { + if (requirement.type == Crafting.Requirement.Type.Work) + { + requirement.amount *= 1.10f; + } + } + + context.requirements_new.Add(Crafting.Requirement.Resource("lubricant", 5.00f)); + } + )); } } } From 25f8704c5851ce6651c428b30bcfffe8a1cf4ef3 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Fri, 17 Jun 2022 21:15:41 +0200 Subject: [PATCH 12/13] Fixed --- .../Augments/Augments.Holdable.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) rename content/Augments/Modifications.Holdable.cs => Content/Augments/Augments.Holdable.cs (59%) diff --git a/content/Augments/Modifications.Holdable.cs b/Content/Augments/Augments.Holdable.cs similarity index 59% rename from content/Augments/Modifications.Holdable.cs rename to Content/Augments/Augments.Holdable.cs index d3e906a7f..fbf6dbc5e 100644 --- a/content/Augments/Modifications.Holdable.cs +++ b/Content/Augments/Augments.Holdable.cs @@ -4,22 +4,22 @@ namespace TC2.Base { public sealed partial class ModInstance { - private static void RegisterHoldableModifications(ref List definitions) + private static void RegisterHoldableAugments(ref List definitions) { - definitions.Add(Modification.Definition.New + definitions.Add(Augment.Definition.New ( identifier: "holdable.sneaky", category: "Utility", name: "Sneaky", description: "Hold this item BEHIND your body to make it less obvious", - can_add: static (ref Modification.Context context, in Holdable.Data data, ref Modification.Handle handle, Span modifications) => + can_add: static (ref Augment.Context context, in Holdable.Data data, ref Augment.Handle handle, Span Augments) => { ref var renderer = ref context.GetComponent(); - return !modifications.HasModification(handle) && !renderer.IsNull(); + return !Augments.HasAugment(handle) && !renderer.IsNull(); }, - apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => + apply_1: static (ref Augment.Context context, ref Holdable.Data data, ref Augment.Handle handle, Span Augments) => { ref var renderer = ref context.GetComponent(); if (!renderer.IsNull()) @@ -50,19 +50,19 @@ private static void RegisterHoldableModifications(ref List + definitions.Add(Augment.Definition.New ( identifier: "holdable.rubber_grip", - category: "Body", + category: "Utility", name: "Rubber Grip", description: "Get a better grip on the item by adding a rubber grip", - can_add: static (ref Modification.Context context, in Holdable.Data data, ref Modification.Handle handle, Span modifications) => + can_add: static (ref Augment.Context context, in Holdable.Data data, ref Augment.Handle handle, Span Augments) => { - return !modifications.HasModification(handle); + return !Augments.HasAugment(handle); }, - apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => + apply_1: static (ref Augment.Context context, ref Holdable.Data data, ref Augment.Handle handle, Span Augments) => { data.force_multiplier *= 1.5f; data.torque_multiplier *= 1.5f; @@ -79,19 +79,19 @@ private static void RegisterHoldableModifications(ref List + definitions.Add(Augment.Definition.New ( identifier: "holdable.lubricated_grip", - category: "Body", + category: "Utility", name: "Slippery Grip", description: "Lubricate any grippable places of the object making it nearly unholdable", - can_add: static (ref Modification.Context context, in Holdable.Data data, ref Modification.Handle handle, Span modifications) => + can_add: static (ref Augment.Context context, in Holdable.Data data, ref Augment.Handle handle, Span Augments) => { - return !modifications.HasModification(handle); + return !Augments.HasAugment(handle); }, - apply_1: static (ref Modification.Context context, ref Holdable.Data data, ref Modification.Handle handle, Span modifications) => + apply_1: static (ref Augment.Context context, ref Holdable.Data data, ref Augment.Handle handle, Span Augments) => { data.force_multiplier *= 0.01f; data.torque_multiplier *= 0.01f; From b40dfefb1760159e3a2bcca8b243fe6aab9e9fd6 Mon Sep 17 00:00:00 2001 From: Wunarg Date: Sun, 16 Oct 2022 12:09:34 +0200 Subject: [PATCH 13/13] Merge fix --- Content/Augments/Augments.Holdable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content/Augments/Augments.Holdable.cs b/Content/Augments/Augments.Holdable.cs index fbf6dbc5e..690999254 100644 --- a/Content/Augments/Augments.Holdable.cs +++ b/Content/Augments/Augments.Holdable.cs @@ -2,7 +2,7 @@ namespace TC2.Base { - public sealed partial class ModInstance + public sealed partial class BaseMod { private static void RegisterHoldableAugments(ref List definitions) {