Module: Lich::Gemstone::Creature
- Defined in:
- documented/gemstone/creature.rb
Overview
Public Creature API for GemStone runtime creature tracking.
A thin facade: every call delegates to CreatureInstance, which mixes in
the shared id-keyed registry, room roster and targets/in_room query
methods from Common::CreatureBase.
Class Method Summary collapse
-
.[](id) ⇒ Object
Lookup creature instance by ID.
-
.all ⇒ Object
Get all creature instances.
-
.cleanup_old(max_age_seconds = 600) ⇒ Integer
Removes creatures older than the given age (in seconds).
-
.clear ⇒ Object
Clear all instances.
-
.clear_room ⇒ void
Empties the current room roster.
-
.configure(**options) ⇒ Object
Configure the system.
-
.damage_report(**options) ⇒ Object
Generate damage report for HP analysis.
-
.debug_on(level = :changes) ⇒ Boolean, Symbol
Toggles live echo of status, flag, and registration changes.
-
.in_room(*filters) ⇒ Array<CreatureInstance>
Returns all tracked creatures currently in the room.
-
.print_damage_report(**options) ⇒ Object
Print formatted damage report.
-
.register(name, id, noun = nil) ⇒ Object
Register a new creature.
-
.stats ⇒ Object
Get registry stats.
-
.targets(*filters) ⇒ Array<CreatureInstance>
Returns attackable hostile creatures currently in the room.
Class Method Details
.[](id) ⇒ Object
Lookup creature instance by ID
756 757 758 |
# File 'documented/gemstone/creature.rb', line 756 def self.[](id) CreatureInstance[id] end |
.all ⇒ Object
Get all creature instances
833 834 835 |
# File 'documented/gemstone/creature.rb', line 833 def self.all CreatureInstance.all end |
.cleanup_old(max_age_seconds = 600) ⇒ Integer
Removes creatures older than the given age (in seconds).
Positional to match CreatureInstance#cleanup_old (supplied by Common::CreatureBase) and the positional call in Combat::Tracker#cleanup_creatures. A keyword-only signature here raised ArgumentError on every scheduled tracker cleanup, which the tracker's rescue then swallowed - so registry cleanup silently never ran.
818 819 820 |
# File 'documented/gemstone/creature.rb', line 818 def self.cleanup_old(max_age_seconds = 600) CreatureInstance.cleanup_old(max_age_seconds) end |
.clear ⇒ Object
Clear all instances
804 805 806 |
# File 'documented/gemstone/creature.rb', line 804 def self.clear CreatureInstance.clear end |
.clear_room ⇒ void
This method returns an undefined value.
Empties the current room roster.
779 780 781 |
# File 'documented/gemstone/creature.rb', line 779 def self.clear_room CreatureInstance.clear_room end |
.configure(**options) ⇒ Object
Configure the system
789 790 791 |
# File 'documented/gemstone/creature.rb', line 789 def self.configure(**) CreatureInstance.configure(**) end |
.damage_report(**options) ⇒ Object
Generate damage report for HP analysis
823 824 825 |
# File 'documented/gemstone/creature.rb', line 823 def self.damage_report(**) CreatureInstance.damage_report(**) end |
.debug_on(level = :changes) ⇒ Boolean, Symbol
Toggles live echo of status, flag, and registration changes.
751 752 753 |
# File 'documented/gemstone/creature.rb', line 751 def self.debug_on(level = :changes) $creature_debug = level end |
.in_room(*filters) ⇒ Array<CreatureInstance>
Returns all tracked creatures currently in the room.
772 773 774 |
# File 'documented/gemstone/creature.rb', line 772 def self.in_room(*filters) CreatureInstance.in_room(*filters) end |
.print_damage_report(**options) ⇒ Object
Print formatted damage report
828 829 830 |
# File 'documented/gemstone/creature.rb', line 828 def self.print_damage_report(**) CreatureInstance.print_damage_report(**) end |
.register(name, id, noun = nil) ⇒ Object
Register a new creature
784 785 786 |
# File 'documented/gemstone/creature.rb', line 784 def self.register(name, id, noun = nil) CreatureInstance.register(name, id, noun) end |
.stats ⇒ Object
Get registry stats
794 795 796 797 798 799 800 801 |
# File 'documented/gemstone/creature.rb', line 794 def self.stats { instances: CreatureInstance.size, templates: CreatureTemplate.all.size, max_size: CreatureInstance.max_size, auto_register: CreatureInstance.auto_register? } end |
.targets(*filters) ⇒ Array<CreatureInstance>
Returns attackable hostile creatures currently in the room.
764 765 766 |
# File 'documented/gemstone/creature.rb', line 764 def self.targets(*filters) CreatureInstance.targets(*filters) end |