Got junimos to walk in circles. ._.
This commit is contained in:
parent
fe794e7861
commit
e4913d9720
|
@ -143,7 +143,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "It's your birthday today! Happy birthday!",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "It's @'s birthday! Happy birthday to them!",
|
||||
["Season"] = "Season",
|
||||
["Date"]="Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "It looks like the junimos wanted to throw you a party!",
|
||||
["Event:JunimoBirthdayParty_1"] = "It looks like there was some cake left over too!",
|
||||
["Event:JunimoBirthdayParty_2"] = "That was a fun party. Back to work!"
|
||||
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.ja] = new Dictionary<string, string>()
|
||||
|
@ -154,7 +157,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.ru] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -164,7 +170,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "Ёто твой день рождени¤! — днем рождени¤!",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "Ёто твой день рождени¤! ѕоздравл¤ю с этим!",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.zh] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -174,7 +183,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "今天是你的生日!生日快乐!",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.pt] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -184,7 +196,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.es] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -194,7 +209,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.de] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -204,7 +222,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.th] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -214,7 +235,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.fr] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -224,7 +248,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.ko] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -234,7 +261,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.it] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -244,7 +274,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.tr] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -254,7 +287,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
[StardewValley.LocalizedContentManager.LanguageCode.hu] = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -264,7 +300,10 @@ namespace Omegasis.HappyBirthday
|
|||
["Happy Birthday: Star Message"] = "",
|
||||
["Happy Birthday: Farmhand Birthday Message"] = "",
|
||||
["Season"] = "Season",
|
||||
["Date"] = "Date"
|
||||
["Date"] = "Date",
|
||||
["Event:JunimoBirthdayParty_0"] = "",
|
||||
["Event:JunimoBirthdayParty_1"] = "",
|
||||
["Event:JunimoBirthdayParty_2"] = ""
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -30,14 +30,36 @@ namespace Omegasis.HappyBirthday.Framework
|
|||
conditions.Add(new StardustCore.Events.Preconditions.PlayerSpecific.JojaMember(false));
|
||||
conditions.Add(new CommunityCenterCompleted(false));
|
||||
//conditions.Add(new HasUnlockedCommunityCenter()); //Infered by the fact that you must enter the community center to trigger this event anyways.
|
||||
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData("playful", 32, 16, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
|
||||
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData("playful", 32, 12, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
|
||||
|
||||
e.AddInJunimoActor("Juni", new Microsoft.Xna.Framework.Vector2(32, 14), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni2", new Microsoft.Xna.Framework.Vector2(30, 15), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni3", new Microsoft.Xna.Framework.Vector2(34, 15), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni", new Microsoft.Xna.Framework.Vector2(32, 10), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni2", new Microsoft.Xna.Framework.Vector2(30, 11), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni3", new Microsoft.Xna.Framework.Vector2(34, 11), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni4", new Microsoft.Xna.Framework.Vector2(26, 11), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni5", new Microsoft.Xna.Framework.Vector2(28, 11), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddInJunimoActor("Juni6Tank", new Vector2(38, 10), StardustCore.IlluminateFramework.Colors.getRandomJunimoColor());
|
||||
e.AddJunimoAdvanceMoveTiles(new StardustCore.Utilities.JunimoAdvanceMoveData("Juni6Tank", new List<Point>()
|
||||
{
|
||||
new Point(38,10),
|
||||
new Point(38,11),
|
||||
new Point(39,11),
|
||||
new Point(40,11),
|
||||
new Point(41,11),
|
||||
new Point(42,11),
|
||||
new Point(42,10),
|
||||
new Point(41,10),
|
||||
new Point(40,10),
|
||||
new Point(39,10),
|
||||
|
||||
}, 60, 1, true)); ;
|
||||
|
||||
e.FlipJunimoActor("Juni5", true);
|
||||
e.junimoFaceDirection("Juni4", EventHelper.FacingDirection.Right); //Make a junimo face right.
|
||||
e.junimoFaceDirection("Juni5", EventHelper.FacingDirection.Left);
|
||||
|
||||
e.globalFadeIn();
|
||||
e.moveFarmerUp(6, EventHelper.FacingDirection.Up, true);
|
||||
|
||||
e.moveFarmerUp(10, EventHelper.FacingDirection.Up, true);
|
||||
|
||||
//e.moveActorLeft("Juni", 1, EventHelper.FacingDirection.Down, false);
|
||||
e.animate("Juni", true, true, 250, new List<int>()
|
||||
|
@ -48,17 +70,17 @@ namespace Omegasis.HappyBirthday.Framework
|
|||
31
|
||||
});
|
||||
|
||||
//
|
||||
e.junimoFaceDirection("Juni4", EventHelper.FacingDirection.Down);
|
||||
e.junimoFaceDirection("Juni5", EventHelper.FacingDirection.Down);
|
||||
|
||||
e.playSound("junimoMeep1");
|
||||
//
|
||||
e.emoteFarmer_ExclamationMark();
|
||||
e.showMessage("It looks like the junimos wanted to throw you a party!"); //TODO get this from translated strings. NOT hard coded.
|
||||
e.showMessage(HappyBirthday.Config.translationInfo.getTranslatedString("Event:JunimoBirthdayParty_0"));
|
||||
e.emoteFarmer_Heart();
|
||||
e.globalFadeOut(0.010);
|
||||
e.setViewportPosition(-100, -100);
|
||||
e.showMessage("It looks like there was some cake left over too!");//TODO get this from translated strings. NOT hard coded.
|
||||
e.showMessage("That was a fun party. Back to work!");//TODO get this from translated strings. NOT hard coded.
|
||||
e.showMessage(HappyBirthday.Config.translationInfo.getTranslatedString("Event:JunimoBirthdayParty_1"));
|
||||
e.showMessage(HappyBirthday.Config.translationInfo.getTranslatedString("Event:JunimoBirthdayParty_2"));
|
||||
e.addObjectToPlayersInventory(220, 1, false);
|
||||
|
||||
e.end();
|
||||
|
|
|
@ -622,6 +622,30 @@ namespace StardustCore.Events
|
|||
this.add(b);
|
||||
}
|
||||
|
||||
public virtual void advanceMove(string Actor, bool Loop, List<Point> TilePoints)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("advancedMove ");
|
||||
b.Append(Actor);
|
||||
b.Append(" ");
|
||||
b.Append(Loop.ToString());
|
||||
b.Append(" ");
|
||||
for (int i = 0; i < TilePoints.Count; i++)
|
||||
{
|
||||
b.Append(TilePoints[i].X);
|
||||
b.Append(" ");
|
||||
b.Append(TilePoints[i].Y);
|
||||
if (i != TilePoints.Count - 1)
|
||||
{
|
||||
b.Append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
ModCore.ModMonitor.Log(b.ToString(), StardewModdingAPI.LogLevel.Info);
|
||||
|
||||
this.add(b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the ambient light level, with RGB values from 0 to 255. Note that it works by removing colors from the existing light ambience, so ambientLight 1 80 80 would reduce green and blue and leave the light with a reddish hue.
|
||||
/// </summary>
|
||||
|
@ -1192,25 +1216,56 @@ namespace StardustCore.Events
|
|||
}
|
||||
|
||||
public virtual void playerFaceDirection(FacingDirection Dir)
|
||||
{
|
||||
this.actorFaceDirection("farmer",Dir);
|
||||
}
|
||||
|
||||
public virtual void npcFaceDirection(NPC NPC, FacingDirection Dir)
|
||||
{
|
||||
this.actorFaceDirection(NPC.Name, Dir);
|
||||
}
|
||||
|
||||
public virtual void actorFaceDirection(string Actor, FacingDirection Dir)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("faceDirection farmer ");
|
||||
b.Append("faceDirection ");
|
||||
b.Append(Actor);
|
||||
b.Append(" ");
|
||||
b.Append(this.getFacingDirectionNumber(Dir).ToString());
|
||||
b.Append(" ");
|
||||
b.Append(true);
|
||||
this.add(b);
|
||||
}
|
||||
|
||||
public virtual void npcFaceDirection(NPC NPC, FacingDirection Dir)
|
||||
|
||||
/// <summary>
|
||||
/// Special code to make junimos face a direction because it doesn't work the same as npcs.
|
||||
/// </summary>
|
||||
/// <param name="Actor">The name of the junimo actor.</param>
|
||||
/// <param name="Dir">The direction for the junimo to face.</param>
|
||||
public virtual void junimoFaceDirection(string Actor,FacingDirection Dir)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("faceDirection ");
|
||||
b.Append(NPC.Name);
|
||||
b.Append(" ");
|
||||
b.Append(this.getFacingDirectionNumber(Dir).ToString());
|
||||
b.Append(" ");
|
||||
b.Append(true);
|
||||
this.add(b);
|
||||
this.actorFaceDirection(Actor, Dir);
|
||||
int frame = 0;
|
||||
bool flip = false;
|
||||
if(Dir.Equals(FacingDirection.Down))
|
||||
{
|
||||
frame = 0;
|
||||
}
|
||||
else if(Dir.Equals(FacingDirection.Left))
|
||||
{
|
||||
frame = 16;
|
||||
flip = true;
|
||||
}
|
||||
else if (Dir.Equals(FacingDirection.Right))
|
||||
{
|
||||
frame = 16;
|
||||
}
|
||||
else if(Dir.Equals(FacingDirection.Up))
|
||||
{
|
||||
frame = 32;
|
||||
}
|
||||
this.animate(Actor, flip, true, 250, new List<int>() { frame, frame });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.Characters;
|
||||
using StardustCore.Utilities;
|
||||
|
||||
namespace StardustCore.Events
|
||||
{
|
||||
|
@ -81,7 +82,7 @@ namespace StardustCore.Events
|
|||
/// <param name="ActorName"></param>
|
||||
/// <param name="Position"></param>
|
||||
/// <param name="Color"></param>
|
||||
public static void AddInJunimoActor(this EventHelper EventHelper,string ActorName,Vector2 Position,Color Color)
|
||||
public static void AddInJunimoActor(this EventHelper EventHelper,string ActorName,Vector2 Position,Color Color,bool Flipped=false)
|
||||
{
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
@ -97,9 +98,92 @@ namespace StardustCore.Events
|
|||
b.Append(Color.G);
|
||||
b.Append(" ");
|
||||
b.Append(Color.B);
|
||||
b.Append(" ");
|
||||
b.Append(Flipped);
|
||||
EventHelper.add(b);
|
||||
}
|
||||
|
||||
public static void FlipJunimoActor(this EventHelper EventHelper, string ActorName,bool Flipped = false)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("Omegasis.EventFramework.FlipJunimoActor ");
|
||||
b.Append(ActorName);
|
||||
b.Append(" ");
|
||||
b.Append(Flipped);
|
||||
EventHelper.add(b);
|
||||
}
|
||||
public static void SetUpJunimoAdvanceMove(this EventHelper EventHelper)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("Omegasis.EventFramework.SetUpAdvanceJunimoMovement");
|
||||
EventHelper.add(b);
|
||||
}
|
||||
|
||||
public static void FinishJunimoAdvanceMove(this EventHelper EventHelper)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("Omegasis.EventFramework.FinishAdvanceJunimoMovement");
|
||||
EventHelper.add(b);
|
||||
}
|
||||
|
||||
public static void AddJunimoAdvanceMove(this EventHelper EventHelper, JunimoAdvanceMoveData JunimoData)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("Omegasis.EventFramework.AddInJunimoAdvanceMove ");
|
||||
|
||||
b.Append(JunimoData.junimoActorID);
|
||||
b.Append(" ");
|
||||
b.Append(JunimoData.maxFrames);
|
||||
b.Append(" ");
|
||||
b.Append(JunimoData.tickSpeed);
|
||||
b.Append(" ");
|
||||
b.Append(JunimoData.loop);
|
||||
b.Append(" ");
|
||||
for (int i = 0; i < JunimoData.points.Count; i++)
|
||||
{
|
||||
b.Append(JunimoData.points[i].X);
|
||||
b.Append("_");
|
||||
b.Append(JunimoData.points[i].Y);
|
||||
if (i != JunimoData.points.Count - 1)
|
||||
{
|
||||
b.Append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
EventHelper.add(b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Same as above but allows for smaller tile position numbers instead.
|
||||
/// </summary>
|
||||
/// <param name="EventHelper"></param>
|
||||
/// <param name="JunimoData"></param>
|
||||
public static void AddJunimoAdvanceMoveTiles(this EventHelper EventHelper, JunimoAdvanceMoveData JunimoData)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.Append("Omegasis.EventFramework.AddInJunimoAdvanceMove ");
|
||||
|
||||
b.Append(JunimoData.junimoActorID);
|
||||
b.Append(" ");
|
||||
b.Append(JunimoData.maxFrames);
|
||||
b.Append(" ");
|
||||
b.Append(JunimoData.tickSpeed);
|
||||
b.Append(" ");
|
||||
b.Append(JunimoData.loop);
|
||||
b.Append(" ");
|
||||
for (int i = 0; i < JunimoData.points.Count; i++)
|
||||
{
|
||||
b.Append(JunimoData.points[i].X*Game1.tileSize);
|
||||
b.Append("_");
|
||||
b.Append(JunimoData.points[i].Y * Game1.tileSize);
|
||||
if (i != JunimoData.points.Count - 1)
|
||||
{
|
||||
b.Append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
EventHelper.add(b);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ namespace StardustCore.Events
|
|||
this.customEventLogic.Add("Omegasis.EventFramework.AddObjectToPlayersInventory", ExtraEventActions.addObjectToPlayerInventory);
|
||||
this.customEventLogic.Add("Omegasis.EventFramework.ViewportLerp", ExtraEventActions.ViewportLerp);
|
||||
this.customEventLogic.Add("Omegasis.EventFramework.AddInJunimoActor", ExtraEventActions.AddInJumimoActorForEvent);
|
||||
this.customEventLogic.Add("Omegasis.EventFramework.FlipJunimoActor", ExtraEventActions.FlipJunimoActor);
|
||||
this.customEventLogic.Add("Omegasis.EventFramework.SetUpAdvanceJunimoMovement", ExtraEventActions.SetUpAdvanceJunimoMovement);
|
||||
this.customEventLogic.Add("Omegasis.EventFramework.FinishAdvanceJunimoMovement", ExtraEventActions.FinishAdvanceJunimoMovement);
|
||||
this.customEventLogic.Add("Omegasis.EventFramework.AddInJunimoAdvanceMove", ExtraEventActions.AddInJunimoAdvanceMove);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -8,6 +8,7 @@ using Netcode;
|
|||
using StardewModdingAPI;
|
||||
using StardewValley;
|
||||
using StardewValley.Characters;
|
||||
using StardustCore.Utilities;
|
||||
|
||||
namespace StardustCore.Events
|
||||
{
|
||||
|
@ -21,6 +22,8 @@ namespace StardustCore.Events
|
|||
private static bool StartedLerp;
|
||||
private static int CurrentViewportLerpAmount;
|
||||
|
||||
public static Dictionary<string, JunimoAdvanceMoveData> junimoLerpData = new Dictionary<string, JunimoAdvanceMoveData>();
|
||||
|
||||
/// <summary>
|
||||
/// Adds the item from Game1.ObjectInformation to the player's inventory from the given event string.
|
||||
/// </summary>
|
||||
|
@ -102,11 +105,13 @@ namespace StardustCore.Events
|
|||
int xPos = Convert.ToInt32(splits[2]);
|
||||
int yPos = Convert.ToInt32(splits[3]);
|
||||
Color color = new Color(Convert.ToInt32(splits[4]), Convert.ToInt32(splits[5]), Convert.ToInt32(splits[6]));
|
||||
bool flipped = Convert.ToBoolean(splits[7]);
|
||||
|
||||
List<NPC> actors = Game1.CurrentEvent.actors;
|
||||
Junimo junimo = new Junimo(new Vector2(xPos * 64, yPos * 64), -1, false);
|
||||
junimo.Name = actorName;
|
||||
junimo.EventActor = true;
|
||||
junimo.flip = flipped;
|
||||
|
||||
IReflectedField<NetColor> colorF=StardustCore.ModCore.ModHelper.Reflection.GetField<NetColor>(junimo, "color", true);
|
||||
NetColor c = colorF.GetValue();
|
||||
|
@ -118,5 +123,90 @@ namespace StardustCore.Events
|
|||
actors.Add((NPC)junimo);
|
||||
++Game1.CurrentEvent.CurrentCommand; //I've been told ++<int> is more efficient than <int>++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flip a given junimo actor. Necessary to make junimos face left.
|
||||
/// </summary>
|
||||
/// <param name="EventManager"></param>
|
||||
/// <param name="EventData"></param>
|
||||
public static void FlipJunimoActor(EventManager EventManager, string EventData)
|
||||
{
|
||||
string[] splits = EventData.Split(' ');
|
||||
string name = splits[0];
|
||||
string actorName = splits[1];
|
||||
bool flipped = Convert.ToBoolean(splits[2]);
|
||||
NPC junimo=Game1.CurrentEvent.actors.Find(i => i.Name.Equals(actorName));
|
||||
junimo.flip = flipped;
|
||||
++Game1.CurrentEvent.CurrentCommand; //I've been told ++<int> is more efficient than <int>++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the concurrent event to handle junimo movement.
|
||||
/// </summary>
|
||||
/// <param name="EventManager"></param>
|
||||
/// <param name="EventData"></param>
|
||||
public static void SetUpAdvanceJunimoMovement(EventManager EventManager, string EventData)
|
||||
{
|
||||
string[] splits = EventData.Split(' ');
|
||||
string name = splits[0];
|
||||
++Game1.CurrentEvent.CurrentCommand; //I've been told ++<int> is more efficient than <int>++;
|
||||
EventManager.addConcurrentEvent(new ConcurrentEventInformation("AdvanceJunimoMove", "", EventManager, AdvanceJunimoMovement));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finishes handling advvance junimo movement.
|
||||
/// </summary>
|
||||
/// <param name="EventManager"></param>
|
||||
/// <param name="EventData"></param>
|
||||
public static void FinishAdvanceJunimoMovement(EventManager EventManager, string EventData)
|
||||
{
|
||||
string[] splits = EventData.Split(' ');
|
||||
string name = splits[0];
|
||||
++Game1.CurrentEvent.CurrentCommand; //I've been told ++<int> is more efficient than <int>++;
|
||||
EventManager.finishConcurrentEvent("AdvanceJunimoMove");
|
||||
}
|
||||
|
||||
public static void AddInJunimoAdvanceMove(EventManager EventManager, string EventData)
|
||||
{
|
||||
|
||||
if (EventManager.concurrentEventActions.ContainsKey("Omegasis.EventFramework.SetUpAdvanceJunimoMovement")==false)
|
||||
{
|
||||
EventManager.addConcurrentEvent(new ConcurrentEventInformation("AdvanceJunimoMove", "", EventManager, AdvanceJunimoMovement));
|
||||
}
|
||||
string[] splits = EventData.Split(' ');
|
||||
string name = splits[0];
|
||||
|
||||
string actorName = splits[1];
|
||||
int MaxFrames = Convert.ToInt32(splits[2]);
|
||||
int Speed = Convert.ToInt32(splits[3]);
|
||||
bool Loop = Convert.ToBoolean(splits[4]);
|
||||
|
||||
List<Point> points = new List<Point>();
|
||||
for(int i = 5; i < splits.Length; i++)
|
||||
{
|
||||
string pointData = splits[i];
|
||||
string[] point = pointData.Split('_');
|
||||
int x = Convert.ToInt32(point[0]);
|
||||
int y = Convert.ToInt32(point[1]);
|
||||
points.Add(new Point(x, y));
|
||||
}
|
||||
|
||||
junimoLerpData.Add(actorName, new JunimoAdvanceMoveData(actorName,points,MaxFrames,Speed,Loop));
|
||||
|
||||
++Game1.CurrentEvent.CurrentCommand; //I've been told ++<int> is more efficient than <int>++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates all of the junimo movement logic.
|
||||
/// </summary>
|
||||
/// <param name="EventManager"></param>
|
||||
/// <param name="EventData"></param>
|
||||
public static void AdvanceJunimoMovement(EventManager EventManager, string EventData)
|
||||
{
|
||||
foreach(KeyValuePair<string,JunimoAdvanceMoveData> pair in junimoLerpData)
|
||||
{
|
||||
pair.Value.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
<Compile Include="UIUtilities\Texture2DExtended.cs" />
|
||||
<Compile Include="UIUtilities\TextureManager.cs" />
|
||||
<Compile Include="Utilities\HexDumper.cs" />
|
||||
<Compile Include="Utilities\JunimoAdvanceMoveData.cs" />
|
||||
<Compile Include="Utilities\PlayerExtensions.cs" />
|
||||
<Compile Include="Utilities\Serializer.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.Characters;
|
||||
|
||||
namespace StardustCore.Utilities
|
||||
{
|
||||
public class JunimoAdvanceMoveData
|
||||
{
|
||||
public string junimoActorID;
|
||||
public int maxFrames;
|
||||
public int tickSpeed;
|
||||
public bool loop;
|
||||
public List<Point> points;
|
||||
|
||||
|
||||
private int currentIndex;
|
||||
private int currentFrameAmount;
|
||||
private bool finished;
|
||||
|
||||
public JunimoAdvanceMoveData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public JunimoAdvanceMoveData(string Actor, List<Point> Points, int FramesToPoint, int tickSpeed = 1,bool Loop=false)
|
||||
{
|
||||
this.junimoActorID = Actor;
|
||||
this.points = Points;
|
||||
this.maxFrames = FramesToPoint;
|
||||
|
||||
this.tickSpeed = tickSpeed;
|
||||
this.currentFrameAmount = 0;
|
||||
this.currentIndex = 0;
|
||||
this.loop = Loop;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (Game1.CurrentEvent == null) return;
|
||||
else
|
||||
{
|
||||
if (this.finished) return;
|
||||
Junimo junimo=(Junimo)Game1.CurrentEvent.actors.Find(i => i.Name.Equals(this.junimoActorID));
|
||||
if (junimo == null) return;
|
||||
Point nextPoint = this.getNextPoint();
|
||||
if (this.finished) return;
|
||||
|
||||
if (nextPoint.X > this.getCurrentPoint().X)
|
||||
{
|
||||
junimo.flip = false;
|
||||
|
||||
//junimo.Sprite.Animate(Game1.currentGameTime, 0, 8, 50f);
|
||||
if (junimo.Sprite.CurrentAnimation==null)
|
||||
{
|
||||
junimo.Sprite.Animate(Game1.currentGameTime, 16, 7, 50f);
|
||||
}
|
||||
}
|
||||
if (nextPoint.X < this.getCurrentPoint().X)
|
||||
{
|
||||
junimo.flip = true;
|
||||
|
||||
//junimo.Sprite.Animate(Game1.currentGameTime, 0, 8, 50f);
|
||||
if (junimo.Sprite.CurrentAnimation== null)
|
||||
{
|
||||
junimo.Sprite.Animate(Game1.currentGameTime, 16, 7 , 50f);
|
||||
}
|
||||
}
|
||||
if (nextPoint.Y < this.getCurrentPoint().Y)
|
||||
{
|
||||
junimo.flip = false;
|
||||
|
||||
//junimo.Sprite.Animate(Game1.currentGameTime, 0, 8, 50f);
|
||||
if (junimo.Sprite.CurrentAnimation == null)
|
||||
{
|
||||
junimo.Sprite.Animate(Game1.currentGameTime, 32, 8, 50f);
|
||||
}
|
||||
}
|
||||
if(nextPoint.Y > this.getCurrentPoint().Y)
|
||||
{
|
||||
junimo.flip = false;
|
||||
|
||||
if (junimo.Sprite.CurrentAnimation==null) {
|
||||
junimo.Sprite.Animate(Game1.currentGameTime, 0, 8, 50f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
junimo.Position= Vector2.Lerp(new Vector2(this.getCurrentPoint().X,this.getCurrentPoint().Y),new Vector2(nextPoint.X,nextPoint.Y),(float)((float)this.currentFrameAmount/(float)this.maxFrames));
|
||||
|
||||
++this.currentFrameAmount;
|
||||
|
||||
if (this.currentFrameAmount >= this.maxFrames)
|
||||
{
|
||||
this.currentFrameAmount = 0;
|
||||
this.currentIndex++;
|
||||
junimo.Sprite.StopAnimation();
|
||||
if (this.currentIndex >= this.points.Count)
|
||||
{
|
||||
if (this.loop == false)
|
||||
{
|
||||
this.finished = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.currentIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Point getNextPoint()
|
||||
{
|
||||
if (this.currentIndex+1 >= this.points.Count)
|
||||
{
|
||||
if (this.loop == false)
|
||||
{
|
||||
this.finished=true;
|
||||
return new Point(0, 0);
|
||||
}
|
||||
return this.points[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.points[this.currentIndex+1];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Point getCurrentPoint()
|
||||
{
|
||||
if (this.currentIndex >= this.points.Count)
|
||||
{
|
||||
return this.points[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.points[this.currentIndex];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue