Advertisement
Guest User

Untitled

a guest
Oct 19th, 2024
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDScript 1.50 KB | Source Code | 0 0
  1. # data container for an item
  2. # read only
  3. extends SerializableData
  4. class_name ItemData
  5.  
  6. var item_id: String = "item_unrefined_ore"
  7. var item_texture_path: String = "sprites/items/unloaded_item.png"
  8. var item_name: String = "Unrefined Ore"
  9. var item_description: String = "Unrefined material mined from asteroids and planetary bodies"
  10. var item_flavor_text: String = "It’s just a space rock now, but with a bit of work you can get some smaller, more valuable space rocks from it"
  11.  
  12. var item_cargo_size: int = 1 # how much space this takes up in the inventory
  13.  
  14. # item roles
  15. enum ITEM_ROLES {ITEM, WEAPON, HULLMOD, EQUIPMENT}
  16. var item_role: int = ITEM_ROLES.ITEM    # determines how to handle the item
  17. var item_role_id = ""   # the weapon, equipment, or hullmod id the item corresponds to if not a simple item
  18.  
  19. # item costs
  20. var item_base_cost: int = 200  
  21. var item_min_cost: int = 150 # the cheapest the item can get
  22. var item_max_cost: int = 250 # the most expensive the item can get
  23.  
  24. # audio
  25. var item_audio_path: String = ""    # sound when item is picked up in inventory
  26.  
  27.  
  28. ############ Serialization ############
  29. func get_serialized_property_names() -> Array:
  30.     # Overrides base class
  31.     return [
  32.             "item_id",
  33.             "item_texture_path",
  34.             "item_name",
  35.             "item_description",
  36.             "item_flavor_text",
  37.            
  38.             "item_cargo_size",
  39.            
  40.             "item_role",
  41.             "item_role_id",
  42.            
  43.             "item_base_cost",
  44.             "item_min_cost",
  45.             "item_max_cost",
  46.            
  47.             "item_audio_path",
  48.         ]
  49.  
  50. func get_id() -> String:
  51.     return self.item_id
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement