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
525 526 527 |
# File 'documented/gemstone/creature.rb', line 525 def self.[](id) CreatureInstance[id] end |
.all ⇒ Object
Get all creature instances
602 603 604 |
# File 'documented/gemstone/creature.rb', line 602 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.
587 588 589 |
# File 'documented/gemstone/creature.rb', line 587 def self.cleanup_old(max_age_seconds = 600) CreatureInstance.cleanup_old(max_age_seconds) end |
.clear ⇒ Object
Clear all instances
573 574 575 |
# File 'documented/gemstone/creature.rb', line 573 def self.clear CreatureInstance.clear end |
.clear_room ⇒ void
This method returns an undefined value.
Empties the current room roster.
548 549 550 |
# File 'documented/gemstone/creature.rb', line 548 def self.clear_room CreatureInstance.clear_room end |
.configure(**options) ⇒ Object
Configure the system
558 559 560 |
# File 'documented/gemstone/creature.rb', line 558 def self.configure(**) CreatureInstance.configure(**) end |
.damage_report(**options) ⇒ Object
Generate damage report for HP analysis
592 593 594 |
# File 'documented/gemstone/creature.rb', line 592 def self.damage_report(**) CreatureInstance.damage_report(**) end |
.debug_on(level = :changes) ⇒ Boolean, Symbol
Toggles live echo of status, flag, and registration changes.
520 521 522 |
# File 'documented/gemstone/creature.rb', line 520 def self.debug_on(level = :changes) $creature_debug = level end |
.in_room(*filters) ⇒ Array<CreatureInstance>
Returns all tracked creatures currently in the room.
541 542 543 |
# File 'documented/gemstone/creature.rb', line 541 def self.in_room(*filters) CreatureInstance.in_room(*filters) end |
.print_damage_report(**options) ⇒ Object
Print formatted damage report
597 598 599 |
# File 'documented/gemstone/creature.rb', line 597 def self.print_damage_report(**) CreatureInstance.print_damage_report(**) end |
.register(name, id, noun = nil) ⇒ Object
Register a new creature
553 554 555 |
# File 'documented/gemstone/creature.rb', line 553 def self.register(name, id, noun = nil) CreatureInstance.register(name, id, noun) end |
.stats ⇒ Object
Get registry stats
563 564 565 566 567 568 569 570 |
# File 'documented/gemstone/creature.rb', line 563 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.
533 534 535 |
# File 'documented/gemstone/creature.rb', line 533 def self.targets(*filters) CreatureInstance.targets(*filters) end |