fishingconsumables.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. class FishingHookBase: ItemBase
  2. {
  3. override void OnDebugSpawn()
  4. {
  5. GetInventory().CreateInInventory("Worm");
  6. }
  7. };
  8. class Hook: FishingHookBase {};
  9. class BoneHook: FishingHookBase {};
  10. class WoodenHook: FishingHookBase {};
  11. class Jig: FishingHookBase {};
  12. ///////////////////////////
  13. // Obsolete item prison //
  14. /////////////////////////
  15. class BaitBase : ItemBase
  16. {
  17. // replaces stray baits with hook + attachment combo
  18. override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
  19. {
  20. super.EEItemLocationChanged(oldLoc,newLoc);
  21. string hookType = ConfigGetString("hookType");
  22. if (GetGame().IsDedicatedServer() && hookType != string.Empty)
  23. {
  24. DeleteSafe();
  25. vector spawnPos;
  26. if (newLoc.GetType() == InventoryLocationType.GROUND)
  27. spawnPos = newLoc.GetPos();
  28. else
  29. spawnPos = newLoc.GetParent().GetHierarchyRoot().GetPosition();
  30. EntityAI newItem = EntityAI.Cast(GetGame().CreateObjectEx(hookType,spawnPos,ECE_PLACE_ON_SURFACE,RF_DEFAULT));
  31. EntityAI worm = newItem.GetInventory().CreateAttachment("Worm");
  32. MiscGameplayFunctions.TransferItemProperties(this,newItem);
  33. MiscGameplayFunctions.TransferItemProperties(this,worm);
  34. }
  35. }
  36. };
  37. class Bait: BaitBase {};
  38. class BoneBait: BaitBase {};
  39. ////////////////////////