ModernUO/Projects/UOContent/Engines/Plants
Copilot fbf8497c59
fix: Fix PlantSystem serialization of LeftSeeds and LeftResources at zero (#2255)
* Initial plan

* Add SerializableFieldDefault attributes for LeftSeeds and LeftResources

This fixes the serialization bug where _leftSeeds and _leftResources were initialized to 8 in the constructor but didn't serialize when their value was 0. Upon deserialization, the constructor would run again and reset these values back to 8.

The SerializableFieldDefault attributes tell the serialization system that the default value is 8, so it will properly serialize 0 values and maintain the correct state across server restarts.

Co-authored-by: kamronbatman <3953314+kamronbatman@users.noreply.github.com>

* Update ShouldSerialize methods to check against default value

Changed ShouldSerializeLeftSeeds() and ShouldSerializeLeftResources() to check if the value is != 8 (the default) instead of != 0. This ensures that only non-default values are serialized, following the same pattern used in BaseWeapon.cs and other classes with SerializableFieldDefault attributes.

Co-authored-by: kamronbatman <3953314+kamronbatman@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kamronbatman <3953314+kamronbatman@users.noreply.github.com>
2025-10-31 00:53:47 -07:00
..
MiscItems fix: Optimizes items to use default weights. (Part 1) (#2240) 2025-07-24 14:44:39 -07:00
MiscMobiles fix: Codegens and fixes bugs with plant system (#1490) 2023-09-05 19:20:03 -07:00
EmptyTheBowlGump.cs fix: Optimizes gump relay info (Prep for Static Gumps) (#1698) 2024-03-07 20:54:53 -08:00
MainPlantGump.cs fix: Fixes dupe property copying. Adds IgnoreDupe (#1811) 2024-06-02 15:04:54 -07:00
PlantBowl.cs fix: Optimizes items to use default weights. (Part 1) (#2240) 2025-07-24 14:44:39 -07:00
PlantHue.cs chore: Cleans up pattern checks. (#892) 2021-12-24 15:53:59 -08:00
PlantItem.cs fix: Optimizes items to use default weights. (Part 1) (#2240) 2025-07-24 14:44:39 -07:00
PlantPourTarget.cs feat: Moves gumps out of the core (#1916) 2024-08-09 19:07:32 -07:00
PlantResources.cs fix: Consolidates Color/Center html (#1762) 2024-05-07 23:56:32 -07:00
PlantSystem.cs fix: Fix PlantSystem serialization of LeftSeeds and LeftResources at zero (#2255) 2025-10-31 00:53:47 -07:00
PlantType.cs C# 9 Cleanup (#325) 2020-11-27 00:29:21 -08:00
PollinateTarget.cs feat: Moves gumps out of the core (#1916) 2024-08-09 19:07:32 -07:00
ReproductionGump.cs fix: Optimizes gump relay info (Prep for Static Gumps) (#1698) 2024-03-07 20:54:53 -08:00
Seed.cs fix: Optimizes items to use default weights. (Part 1) (#2240) 2025-07-24 14:44:39 -07:00
SetToDecorativeGump.cs fix: Optimizes gump relay info (Prep for Static Gumps) (#1698) 2024-03-07 20:54:53 -08:00