mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Add world as a global variable for plugins.
This commit is contained in:
@@ -7,9 +7,8 @@ java_import 'org.apollo.game.model.area.SectorCoordinates'
|
||||
java_import 'org.apollo.game.model.area.SectorRepository'
|
||||
java_import 'org.apollo.game.model.def.ItemDefinition'
|
||||
|
||||
# :transient :recurrent
|
||||
|
||||
def spawn_npc(hash)
|
||||
def spawn_item(hash)
|
||||
raise 'A name (or id), x coordinate, and y coordinate must be specified to spawn an item' unless (hash.has_key?(:name) || hash.has_key?(:id)) && hash.has_key?(:x) && hash.has_key?(:y)
|
||||
|
||||
z = hash.delete(:z)
|
||||
|
||||
@@ -32,7 +32,7 @@ end
|
||||
|
||||
# Spawns the specified npc and applies the properties in the hash.
|
||||
def spawn(npc, hash)
|
||||
World.world.register(npc)
|
||||
$world.register(npc)
|
||||
unless hash.empty?
|
||||
hash = decode_hash(npc.position, hash) # Use npc.position here because sector registry events (called by World.register) can be hooked
|
||||
apply_decoded_hash(npc, hash) # into and someone might do something daft like move the npc immediately after it gets spawned.
|
||||
|
||||
Reference in New Issue
Block a user