Skip to content

Commit

Permalink
Spooky Pumpkin finish up
Browse files Browse the repository at this point in the history
  • Loading branch information
akitary committed Oct 21, 2021
1 parent eb7726c commit 93ec470
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 81 deletions.
1 change: 0 additions & 1 deletion Futility/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ private static void Yeet(GameObject go, float distance, bool rotate, Vector2 vec
}
}

public
public static Vector2 RadianToVector2(float radian) => new Vector2(Mathf.Cos(radian), Mathf.Sin(radian));
public static Vector2 DegreeToVector2(float degree) => RadianToVector2(degree * Mathf.Deg2Rad);
}
Expand Down
2 changes: 1 addition & 1 deletion SpookyPumpkinSO/Foods/PumpkinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GameObject CreatePrefab()

var foodInfo = new EdiblesManager.FoodInfo(
id: ID,
dlcId: DlcManager.EXPANSION1_ID,
dlcId: DlcManager.VANILLA_ID,
caloriesPerUnit: 600f * 1000f,
quality: TUNING.FOOD.FOOD_QUALITY_AWFUL,
preserveTemperatue: TUNING.FOOD.DEFAULT_PRESERVE_TEMPERATURE,
Expand Down
11 changes: 8 additions & 3 deletions SpookyPumpkinSO/Foods/PumpkinPieConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using System.Collections.Generic;
using UnityEngine;
using static EdiblesManager;

namespace SpookyPumpkinSO.Foods
Expand Down Expand Up @@ -28,15 +29,19 @@ public GameObject CreatePrefab()
element: SimHashes.Creature,
additionalTags: null);


FoodInfo foodInfo = new FoodInfo(
id: ID,
dlcId: DlcManager.EXPANSION1_ID,
dlcId: DlcManager.VANILLA_ID,
caloriesPerUnit: 6000f * 1000f,
quality: TUNING.FOOD.FOOD_QUALITY_WONDERFUL,
preserveTemperatue: TUNING.FOOD.DEFAULT_PRESERVE_TEMPERATURE,
rotTemperature: TUNING.FOOD.DEFAULT_ROT_TEMPERATURE,
spoilTime: TUNING.FOOD.SPOIL_TIME.DEFAULT,
can_rot: true);
can_rot: true).AddEffects(new List<string>
{
ModAssets.holidaySpiritEffectID
}, DlcManager.AVAILABLE_ALL_VERSIONS);

return EntityTemplates.ExtendEntityToFood(prefab, foodInfo);
}
Expand Down
2 changes: 1 addition & 1 deletion SpookyPumpkinSO/Foods/ToastedPumpkinSeedsConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public GameObject CreatePrefab()

FoodInfo foodInfo = new FoodInfo(
id: ID,
dlcId: DlcManager.EXPANSION1_ID,
dlcId: DlcManager.VANILLA_ID,
caloriesPerUnit: 800f * 1000f,
quality: TUNING.FOOD.FOOD_QUALITY_GOOD,
preserveTemperatue: TUNING.FOOD.HIGH_PRESERVE_TEMPERATURE,
Expand Down
34 changes: 0 additions & 34 deletions SpookyPumpkinSO/GhostPip/GhostSquirrel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,40 +143,6 @@ protected override void OnCleanUp()
StopAllCoroutines();
base.OnCleanUp();
}
/*
#if DEBUG
string inputString = "";
private void OnGUI()
{
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
pos = CameraController.Instance.GetVerticallyScaledPosition(pos);
GUILayout.BeginArea(new Rect(pos.x, pos.y, 200, 200));
inputString = GUILayout.TextField(inputString, 25);
if (GUILayout.Button("Spawn"))
{
var prefab = Assets.TryGetPrefab(inputString);
if (prefab != null)
{
var obj = GameUtil.KInstantiate(prefab, transform.position, Grid.SceneLayer.Creatures);
obj.SetActive(true);
}
else {
GUILayout.Label("Not a valid ID");
}
}
Tag treatTag = GetComponent<SeedTrader>().treatTag;
GUILayout.Label("WANTS: " + treatTag);
WorldInventory worldInventory = ClusterManager.Instance.GetWorld(gameObject.GetMyWorldId()).worldInventory;
GUILayout.Label("AVAILABLE: " + worldInventory.GetAmount(treatTag, false));
GUILayout.EndArea();
}
#endif
*/
}
}

Expand Down
1 change: 0 additions & 1 deletion SpookyPumpkinSO/GhostPip/SeedTrader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void RollNewTreat()
// tries several times to find something the user actually has
Tag RollForAvailable(int tries)
{

WorldInventory worldInventory = ClusterManager.Instance.GetWorld(gameObject.GetMyWorldId()).worldInventory;
for (int i = 0; i < tries - 1; i++)
{
Expand Down
3 changes: 0 additions & 3 deletions SpookyPumpkinSO/GhostPip/SideScreenPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ public static class DetailsScreen_OnPrefabInit_Patch
public static void Postfix()
{
FUtility.FUI.SideScreen.AddCustomSideScreen<GhostSquirrelSideScreen>("GhostSquirrelSideScreen", ModAssets.Prefabs.sideScreenPrefab);
//FUtility.FUI.SideScreen.AddCustomSideScreen<GhostSquirrelSideScreen>("GhostSquirrelSideScreen", ModAssets.Prefabs.sideScreenPrefab);
//PUIUtils.AddSideScreenContent<GhostPipSidescreen>();
//Futility.SideScreen.AddClonedSideScreen<MysteryCallSidescreen>("Mysterious Call Screen", "ButtonMenuSideScreen", typeof(ButtonMenuSideScreen));
}
}
}
Expand Down
34 changes: 4 additions & 30 deletions SpookyPumpkinSO/GhostPip/Spawning/GhostPipSpawner.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using FUtility;
using KSerialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using static SpookyPumpkinSO.STRINGS.UI.UISIDESCREENS.GHOSTPIP_SPAWNER;

// Adds a button to telepads to call a pip
namespace SpookyPumpkinSO.GhostPip.Spawning
Expand All @@ -24,9 +20,9 @@ public void SetSpawnComplete(bool value)

public const float SPAWN_DELAY = 1f;

public string SidescreenButtonText => spawnComplete ? "(Completed)" : "Answer mysterious call";
public string SidescreenButtonText => spawnComplete ? TEXT_INACTIVE : TEXT_ACTIVE;

public string SidescreenButtonTooltip => "Spooky Squeaks are whispered through the receiver... Wait, since when does this thing have a speaker??!";
public string SidescreenButtonTooltip => spawnComplete ? TOOLTIP_INACTIVE : TOOLTIP;

public int ButtonSideScreenSortOrder() => 4;

Expand All @@ -53,30 +49,8 @@ public void OnSidescreenButtonPressed()
private void SpawnPip(GhostPipSpawner spawner)
{
GameObject pip = Spawn(GhostSquirrelConfig.ID, spawner.gameObject.transform.position);
Utils.YeetRandomly(pip, true, 3, 7, false);
Utils.YeetRandomly(pip, true, 3, 5, false);
}

protected override void OnSpawn()
{
base.OnSpawn();
if(!spawnComplete)
{
var notification = new Notification(
title: "You got a call!",
type: NotificationType.Good,
tooltip: null,
tooltip_data: null,
expires: true,
delay: 0f,
custom_click_callback: null,
custom_click_data: null,
click_focus: gameObject.transform);

notifier = gameObject.AddComponent<Notifier>();
notifier.Add(notification);
}
}

public static GameObject Spawn(Tag tag, Vector3 position, Grid.SceneLayer sceneLayer = Grid.SceneLayer.Creatures, bool setActive = true)
{
GameObject prefab = Assets.GetPrefab(tag);
Expand Down
3 changes: 2 additions & 1 deletion SpookyPumpkinSO/ModAssets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace SpookyPumpkinSO
{
class ModAssets
{
public const string spookedEffectID = "SP_Spooked";
public const string spookedEffectID = "SP_Spooked";
public const string holidaySpiritEffectID = "AHM_HolidaySpirit";
public static readonly Tag buildingPumpkinTag = TagManager.Create("SP_BuildPumpkin", STRINGS.ITEMS.FOOD.SP_PUMPKIN.NAME);
public static readonly Tag luxuryFood = TagManager.Create("SP_LuxuryFood", "Luxurious Food");
public static HashSet<Tag> pipTreats;
Expand Down
29 changes: 27 additions & 2 deletions SpookyPumpkinSO/PumpkinPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static class ModifierSet_Initialize_Patch
{
public static void Postfix(ModifierSet __instance)
{
var effect = new Effect(
var spookedEffect = new Effect(
id: ModAssets.spookedEffectID,
name: STRINGS.DUPLICANTS.STATUSITEMS.SPOOKED.NAME,
description: STRINGS.DUPLICANTS.STATUSITEMS.SPOOKED.TOOLTIP,
Expand All @@ -78,7 +78,32 @@ public static void Postfix(ModifierSet __instance)
}
};

__instance.effects.Add(effect);
var holidaySpiritEffect = new Effect(
id: ModAssets.holidaySpiritEffectID,
name: STRINGS.DUPLICANTS.STATUSITEMS.HOLIDAY_SPIRIT.NAME,
description: STRINGS.DUPLICANTS.STATUSITEMS.HOLIDAY_SPIRIT.TOOLTIP,
duration: 360f,
show_in_ui: true,
trigger_floating_text: true,
is_bad: false)
{
SelfModifiers = new List<AttributeModifier>() {
new AttributeModifier(Db.Get().Attributes.Athletics.Id, 1),
new AttributeModifier(Db.Get().Attributes.Art.Id, 1),
new AttributeModifier(Db.Get().Attributes.Botanist.Id, 1),
new AttributeModifier(Db.Get().Attributes.Construction.Id, 1),
new AttributeModifier(Db.Get().Attributes.Caring.Id, 1),
new AttributeModifier(Db.Get().Attributes.Learning.Id, 1),
new AttributeModifier(Db.Get().Attributes.Machinery.Id, 1),
new AttributeModifier(Db.Get().Attributes.Strength.Id, 1),
new AttributeModifier(Db.Get().Attributes.Ranching.Id, 1),
new AttributeModifier(Db.Get().Attributes.Cooking.Id, 1),
new AttributeModifier(Db.Get().Attributes.Digging.Id, 1)
}
};

__instance.effects.Add(spookedEffect);
__instance.effects.Add(holidaySpiritEffect);
}
}

Expand Down
37 changes: 37 additions & 0 deletions SpookyPumpkinSO/STRINGS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ public class SPOOKED
public static LocString NAME = "Spooked!";
public static LocString TOOLTIP = "This Duplicant saw something super scary!";
}

public class HOLIDAY_SPIRIT
{
public static LocString NAME = "Holiday Spirit";
public static LocString TOOLTIP = "This Duplicant is excited for this time of year. (All stats up!)";
}
}

public class MODIFIERS
{
public class AHM_HOLIDAYSPIRIT
{
public static LocString NAME = "Holiday Spirit";
public static LocString DESCRIPTION = "This Duplicant is excited for this time of year. (All stats up!)";
}
}
}

Expand Down Expand Up @@ -97,6 +112,28 @@ public class GHOSTSIDESCREEN
public static LocString LABEL = "Wants one ";
public static LocString LABEL2 = "Delivering ";
}

public class GHOSTPIP_SPAWNER
{
public static LocString TEXT_ACTIVE = "Answer mysterious call";
public static LocString TEXT_INACTIVE = "Pip called";
public static LocString TOOLTIP = "Spooky squeaks are whispered through the receiver... ";
public static LocString TOOLTIP_INACTIVE = "Pip spawned.";
}
}

public class MODSETTINGS
{
public class ROT
{
public static LocString TITLE = "Use rot for fertilizer";
public static LocString TOOLTIP = "If true, pumpkin plants will use Rot along Dirt for fertilization.";
}
public class GHOSTPIP_LIGHT
{
public static LocString TITLE = "Suspicious Pip emits Light";
public static LocString TOOLTIP = "If true, the Suspicious Pip will emit some light.";
}
}
}
}
Expand Down
1 change: 0 additions & 1 deletion SpookyPumpkinSO/Sandbox/SandboxPatches.cs

This file was deleted.

9 changes: 7 additions & 2 deletions SpookyPumpkinSO/Settings/SPSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ namespace SpookyPumpkinSO.Settings
{
[ModInfo("Spooky Pumpkin", "assets/magicalpuftgirl3.png")]
[JsonObject(MemberSerialization.OptIn)]
[RestartRequired]
public class SPSettings
{
[Option("Use rot for fertilizer", "If true, pumpkin plants will use Rot along Dirt for fertilization.")]
[Option(
"SpookyPumpkinSO.STRINGS.UI.MODSETTINGS.ROT.TITLE",
"SpookyPumpkinSO.STRINGS.UI.MODSETTINGS.ROT.TOOLTIP" )]
[JsonProperty]
public bool UseRot { get; set; }

[Option("Suspicious Pip emits Light", "If true, the Suspicious Pip will emit some light.")]
[Option(
"SpookyPumpkinSO.STRINGS.UI.MODSETTINGS.GHOSTPIP_LIGHT.TITLE",
"SpookyPumpkinSO.STRINGS.UI.MODSETTINGS.GHOSTPIP_LIGHT.TOOLTIP" )]
[JsonProperty]
public bool GhostPipLight { get; set; }

Expand Down
5 changes: 5 additions & 0 deletions SpookyPumpkinSO/SpookyPumpkinConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,10 @@ public override void DoPostConfigureComplete(GameObject go)

go.AddOrGetDef<LightController.Def>();
}

public override string[] GetDlcIds()
{
return DlcManager.AVAILABLE_ALL_VERSIONS;
}
}
}
1 change: 0 additions & 1 deletion SpookyPumpkinSO/SpookyPumpkinSO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
<Compile Include="GhostPip\Spawning\GhostPipSpawner.cs" />
<Compile Include="GhostPip\Spawning\TelepadPatch.cs" />
<Compile Include="PumpkinPlantConfig.cs" />
<Compile Include="Sandbox\SandboxPatches.cs" />
<Compile Include="Settings\SPSettings.cs" />
<Compile Include="Spooks.cs" />
<Compile Include="Foods\PumpkinConfig.cs" />
Expand Down

0 comments on commit 93ec470

Please sign in to comment.