minervamaga

Untitled

Jun 26th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1.  
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Netcode;
  8. using StardewValley;
  9. using StardewValley.Objects;
  10.  
  11.  
  12. namespace CustomMayoMachine
  13.  
  14. {
  15. internal class ObjectOverrides
  16. {
  17.  
  18. public virtual bool PerformObjectDropInAction(ref Object __instance, ref Item dropInItem, ref bool probe, ref Farmer who, ref bool __result)
  19. {
  20. if (dropInItem is Object object1)
  21. {
  22. if (__instance.Name.Equals("Mayonnaise Machine"))
  23. {
  24. if (object1.Value == null && (object1.Category == -5 || (int)(NetFieldBase<int, NetInt>)object1.parentSheetIndex == 107))
  25. {}
  26. if ((__instance.heldObject.Value == null || __instance.heldObject.Value.ParentSheetIndex != object1.ParentSheetIndex)
  27. && (__instance.heldObject.Value == null || __instance.MinutesUntilReady > 0))
  28. {
  29. int minutesUntilReady = 0;
  30.  
  31. Item currentObject = __instance.heldObject.Value;
  32.  
  33. if (DataLoader.MayoData.ContainsKey(object1.ParentSheetIndex))
  34. {
  35. minutesUntilReady = DataLoader.MayoData[object1.ParentSheetIndex];
  36. }
  37. else
  38. {
  39. return true;
  40. }
  41.  
  42. if (__instance.bigCraftable.Value && !probe &&
  43. (object1 != null && __instance.heldObject.Value == null))
  44. {
  45. __instance.scale.X = 5f;
  46. }
  47.  
  48. __result = true;
  49. return false;
  50. }
  51. }
  52. }
  53.  
  54. return true;
  55. }
  56.  
  57. public static bool PerformRemoveAction(ref Object __instance, ref Vector2 tileLocation)
  58. {
  59. if (__instance.Name == "Mayonnaise Machine")
  60. {
  61. if (__instance.heldObject.Value != null)
  62. {
  63. Game1.createItemDebris(__instance.heldObject.Value.getOne(), tileLocation * 64f, (Game1.player.FacingDirection + 2) % 4, (GameLocation)null, -1);
  64. }
  65.  
  66. }
  67.  
  68. return true;
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment