Implemented GameData::Nature, improved registration of GameData entries

This commit is contained in:
Maruno17
2021-01-31 22:43:51 +00:00
parent 168a1e5df7
commit 9fe14395c0
18 changed files with 384 additions and 224 deletions

View File

@@ -4,6 +4,10 @@ module GameData
# Assumes the data class's data is stored in a class constant hash called DATA.
# For data that is known by a symbol or an ID number.
module ClassMethods
def register(hash)
self::DATA[hash[:id]] = self::DATA[hash[:id_number]] = self.new(hash)
end
# @param other [Symbol, self, String, Integer]
# @return [Boolean] whether the given other is defined as a self
def exists?(other)
@@ -60,6 +64,10 @@ module GameData
# Assumes the data class's data is stored in a class constant hash called DATA.
# For data that is only known by an ID number.
module ClassMethodsIDNumbers
def register(hash)
self::DATA[hash[:id]] = self.new(hash)
end
# @param other [self, Integer]
# @return [Boolean] whether the given other is defined as a self
def exists?(other)