diff --git a/lib/aethyr/core/commands/look.rb b/lib/aethyr/core/commands/look.rb
index 7f24f7dc655ac9ac26dab23a3bea3216a965b4b0..7b0615bac97eb60ed3ba35344895871d31aa23c9 100644
--- a/lib/aethyr/core/commands/look.rb
+++ b/lib/aethyr/core/commands/look.rb
@@ -96,7 +96,7 @@ EOF
else
if not room.nil?
look_text = room.look(@player)
- @player.output(look_text, message_type: :look)
+ @player.output(look_text)
else
@player.output "Nothing to look at."
end
diff --git a/lib/aethyr/core/commands/map.rb b/lib/aethyr/core/commands/map.rb
index 16b84b3417529809978126d2b6276942f6adb659..60b747fcd001d9c5d1dca6b104fe8bd701d081b0 100644
--- a/lib/aethyr/core/commands/map.rb
+++ b/lib/aethyr/core/commands/map.rb
@@ -9,7 +9,7 @@ module Aethyr
def initialize(player)
super(player, ["m", "map"])
end
-
+
def self.object_added(data)
return unless data[:game_object].is_a? Player
data[:game_object].subscribe(MapHandler.new(data[:game_object]))
@@ -24,7 +24,7 @@ module Aethyr
action_help({})
end
end
-
+
private
def action_help(event)
player.output <<'EOF'
@@ -34,10 +34,10 @@ Syntax: MAP
Displays a map of the area.
EOF
end
-
+
def action(event)
room = $manager.get_object(@player.container)
- player.output(room.area.render_map(player, room.area.position(room)), message_type: :map)
+ player.output(room.area.render_map(player, room.area.position(room)))
end
end
@@ -45,4 +45,4 @@ EOF
end
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/aethyr/core/connection/server.rb b/lib/aethyr/core/connection/server.rb
index 8dd9bbea250427e24efde29246478f5fa513f417..4d4d3c77160279517302110b3c1a9b8ae9e85e3a 100644
--- a/lib/aethyr/core/connection/server.rb
+++ b/lib/aethyr/core/connection/server.rb
@@ -44,7 +44,8 @@ module Aethyr
$manager.update_all
end
saveTask = Concurrent::TimerTask.new(execution_interval: ServerConfig.save_rate, timeout_interval: 30) do
- log "Automatic state save."; $manager.save_all
+ log "Automatic state save."
+ $manager.save_all
end
updateTask.execute
diff --git a/lib/aethyr/core/objects/game_object.rb b/lib/aethyr/core/objects/game_object.rb
index 96201b831d41984e7da517cc5b3504720755d5c9..dfc680e958576180c41727a2d4473df652b9bbc1 100644
--- a/lib/aethyr/core/objects/game_object.rb
+++ b/lib/aethyr/core/objects/game_object.rb
@@ -70,11 +70,11 @@ class GameObject < Publisher
@actions = Set.new
@admin = false
end
-
+
def flags
Hash.new @info.flags
end
-
+
def add_flag(new_flag)
new_flag.negate_flags(@info.flags)
@info.flags[new_flag.id] = new_flag
@@ -97,11 +97,14 @@ class GameObject < Publisher
def update
return if @busy
@busy = true
- if self.is_a? Reacts
- self.alert(Event.new(:Generic, :action => :tick))
+ begin
+ if self.is_a? Reacts
+ self.alert(Event.new(:Generic, :action => :tick))
+ end
+ run
+ ensure
+ @busy = false
end
- run
- @busy = false
end
#Checks if the GameObject is busy in the GameObject#update method.
@@ -263,4 +266,3 @@ class GameObject < Publisher
end
end
-
diff --git a/lib/aethyr/core/objects/player.rb b/lib/aethyr/core/objects/player.rb
index 8af01b1be1c145be061387b318343d513f50f700..bb4d27043a43e81e7c16e1f9f73b5baf187dd59b 100644
--- a/lib/aethyr/core/objects/player.rb
+++ b/lib/aethyr/core/objects/player.rb
@@ -249,6 +249,10 @@ class Player < LivingObject
super
end
+ def update_display
+ @player.display.refresh_watch_windows(self)
+ end
+
def run
super
if info.stats.health < info.stats.max_health - 10
@@ -256,5 +260,6 @@ class Player < LivingObject
elsif info.stats.health < info.stats.max_health
info.stats.health = info.stats.max_health
end
+ update_display
end
end
diff --git a/lib/aethyr/core/objects/room.rb b/lib/aethyr/core/objects/room.rb
index e49b6ebcb496c4153e4417658aa70fdfe745cbe8..ac01b2102c48327cd1053f5f891057740c2eb5c5 100644
--- a/lib/aethyr/core/objects/room.rb
+++ b/lib/aethyr/core/objects/room.rb
@@ -14,13 +14,13 @@ require 'aethyr/core/objects/traits/location'
# terrain.room_type (Symbol)
class Room < Container
include Location
-
+
attr_reader :terrain
#Create new room. Arguments same as GameObject.
def initialize(*args)
super(nil, *args)
-
+
@generic = "room"
end
@@ -36,8 +36,7 @@ class Room < Container
object.container = @game_object_id
if object.is_a? Player or object.is_a? Mobile
- object.output(self.look(object), message_type: :look) unless object.blind?
- object.output(self.area.render_map(object, self.area.position(self)), message_type: :map) if object.is_a? Player
+ object.update_display
end
end
@@ -51,7 +50,7 @@ class Room < Container
def exits
@inventory.find_all('class', Exit)
end
-
+
def players(only_visible = true, exclude = nil)
players = Array.new
@inventory.each do |item|
@@ -59,7 +58,7 @@ class Room < Container
end
players
end
-
+
def mobs(only_visible = true)
mobs = Array.new
@inventory.each do |item|
@@ -67,7 +66,7 @@ class Room < Container
end
mobs
end
-
+
def things(only_visible = true)
things = Array.new
@inventory.each do |item|
@@ -75,7 +74,7 @@ class Room < Container
end
things
end
-
+
def exits(only_visible = true)
exits = Array.new
@inventory.each do |item|
@@ -121,7 +120,7 @@ class Room < Container
else
quantity = item.article
end
-
+
idents = ["<identifier>#{item.generic}</identifier>"]
idents += item.alt_names.map() {|e| "<identifier>" + e + "</identifier>"}
idents = idents.join(', ')
@@ -147,7 +146,7 @@ class Room < Container
else
players = "The following #{players.length <= 1 ? 'player is' : 'players are'} here:\n#{players.list(@inventory, :expanded)}\n"
end
-
+
if mobs.empty?
mobs = ""
else
@@ -159,7 +158,7 @@ class Room < Container
else
things = "There are the following items in the room:\n#{things.list(@inventory, :expanded)}\n"
end
-
+
info = "You find some things unusual about this place:\n"
info += " Type: " + self.terrain_type.name + "\n"
self.flags.values.each do |f|
@@ -172,4 +171,3 @@ class Room < Container
"\n<roomtitle>#{@name}</roomtitle>\n\n#{(@short_desc || '') + add_to_desc}\n\n[Exits: #{exits.list}]\n\n#{info}#{players}#{mobs}#{things}\n"
end
end
-
diff --git a/lib/aethyr/core/render/display.rb b/lib/aethyr/core/render/display.rb
index b5982caac1cb1fa79a000ace014a89097f3644f0..28e18450e11ea10997c540420f170282c5d8138d 100644
--- a/lib/aethyr/core/render/display.rb
+++ b/lib/aethyr/core/render/display.rb
@@ -2,6 +2,7 @@ require "ncursesw"
require 'stringio'
require 'aethyr/core/connection/telnet_codes'
require 'aethyr/core/connection/telnet'
+require 'aethyr/core/components/manager'
class Display
attr_accessor :color_settings, :use_color
@@ -131,6 +132,7 @@ class Display
@width = resolution[0]
@height = resolution[1]
Ncurses.resizeterm(@height, @width)
+ @layout_type = :full if @height > 100 && @width > 165
layout
end
@@ -429,6 +431,31 @@ Regular regular #{@color_settings['regular']}
CONF
end
+ def refresh_watch_windows(player)
+ unless @window_look.nil?
+ if player.blind?
+ send( "You cannot see while you are blind.", message_type: :look, internal_clear: true)
+ else
+ room = $manager.get_object(player.container)
+ if not room.nil?
+ look_text = room.look(player)
+ send(look_text, message_type: :look, internal_clear: true)
+ else
+ send("Nothing to look at.", message_type: :look, internal_clear: true)
+ end
+ end
+ end
+
+ unless @window_map.nil?
+ room = $manager.get_object(player.container)
+ if not room.nil?
+ send(room.area.render_map(player, room.area.position(room)), message_type: :map, internal_clear: true)
+ else
+ send("No map of current area.", message_type: :map, internal_clear: true)
+ end
+ end
+ end
+
private
def update