Event Methods - elfuun1/FlowerDanceFix GitHub Wiki
This wiki page exists to explain the original method targeted by FDF, and the modded method provided by FDF. It is used to answer some questions about the process, and also provide an outlet for rubber duck debugging.
Original Method
The original flower dance method, setUpMainFestival()
is called after the Lewis's dialogue finishes. It can roughly broken up into five components:
- Dancer-selection pools set-up
- Insertion of farmers and their partners into dance line-up
- Pairing off of remaining NPCs
- Substitution of the names of the dancer pairs into event data notation
- Animation of the main event
Dancer Selection Pool Set-Up
The original method prevents selection of custom NPCs, and may incorrectly select modded vanilla NPCs, because the dancer selection pools are hard coded. Rather than selecting eligible NPCs from the current list of NPCs in-game, the method draws on two strongly-typed pools of NPCs:
leftoverMales = {"Sebastian", "Sam", "Elliot", "Harvey", "Alex", "Shane"}
leftoverFemales = {"Abigail", "Penny", "Leah", "Maru", "Haley", "Emily"}
There is no way to add NPCs to these lists, and any vanilla NPC with an altered gender value will still be placed in their original "leftoverGender" list, potentially using the wrong sprites during the event animation.
Farmer-Farmer and Farmer-NPC Pair Formation
After the leftoverGender lists are created, the game creates a list of all farmers in the session (farmers
), removes disconnecting farmers, and then checks to see which farmers have a dance partner (and therefore are participating in the dance). For each farmer that is participating, the method checks the gender of their dance partner. If the partner is female, they are added to a list of female dancers (females
) and then the farmer is added to the list of male dancers (males
). The reverse is true if the partner is male. Finally, the farmer is removed from farmers
, so that they may not be selected again. If the partner was a farmer, that farmer is also removed from farmers
. If the partner is a villager, that villager is removed from their corresponding leftoverGender
list, so that that village may not be selected again.
NPC-NPC Pair Formation
If farmers
is empty and there are fewer than 6 NPCs in females
, the method then moves on to pair up NPCs to fill up the dance lines. Starting with the last-indexed female NPC in leftoverFemales
, the method adds the female NPC to females
, and adds their corresponding "love interest" to males
. This does not refer to their "love interest" value in their NPC Disposition entry, but rather a method utility.getLoveInterest()
defining their cannon love interest as such:
- Abigail => Sebastian = > Abigail
- Penny => Sam => Penny
- Leah => Elliott => Leah
- Maru => Harvey => Maru
- Haley => Alex => Haley
- Emily => Shane => Emily
There is no way to change how an NPC's love interest is defined in this method.
Dancer Name Substitution
After females
is full, the method then searches the "mainEvent" event data from spring24.json for instances of Girl1
through Girl6
, and Guy1
through Guy6
, and replaces them with the names of the NPCs who's index matches each respective number, as provided by females
and males
. This produces the final event data, which can be read by the game to animate the event.
Event animation
The initial position for every NPC at the flower dance is provided by the map data, using the map layers Set-Up
and MainEvent
. When the "main event" event begins, all NPCs are displayed at their MainEvent
coordinates, including all NPCs and farmers selected to dance.
The event data begins by warping all selected dancers from their MainEvent
to the coordinates specified in mainEvent. After the animations finish, the dance ends, the festival finishes, and the farmer(s) are warped back to the farm (complete with a time-jump to the late evening).
Issues With the Original Method
The original method contains a number of impossible to change variables, or incompatibilities with custom NPCs:
- Hard-coded list of NPCs to draw from
- No handling for non-binary NPCs (ie, gender = 2, undefined)
- Forced pairing with "love interest" for NPC-NPC pairs
- Hard-coded "love interest" that cannot be altered to include custom NPCs for reference
- Forced heterosexual and gender-normative dance lines in NPC-NPC pairs
- Hardcoded number of dance pairs (6)
Most of these issues stem from the fact that the original flower dance was coded without modding in mind. ConcernedApe likely never though people would want to add their own NPCs to the festival's main event! Unfortunately, even though it's easy to just add NPCs to the leftoverGender
lists, as it leaves a lot to be desired as far as customization goes, and the implementation of Harmony to fix the method means that it would be difficult for multiple different mods to change the data at the same time.
FDF Method
TBA