Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Looking while blind.  (Read 365 times)
Saffire
Citizen
***
Posts: 136


View Profile
« on: February 05, 2009, 07:47:30 pm »

I've changed the look code from events/generic to the following:

Code:
#Look
def look(event, player, room)
if player.blind?
player.output "You cannot see anything. You are blind."
else
if event[:at]
object = room if event[:at] == "here"
object = object || player.search_inv(event[:at]) || room.find(event[:at])

if object.nil?
player.output("Look at what, again?")
return
end

if object.is_a? Exit
player.output object.peer
elsif object.is_a? Room
player.output("You are indoors.", true) if object.info.terrain.indoors
player.output("You are underwater.", true) if object.info.terrain.underwater
player.output("You are swimming.", true) if object.info.terrain.water

player.output "You are in a place called #{room.name} in #{room.area ? room.area.name : "an unknown area"}.", true
if room.area
player.output "The area is generally #{describe_area(room.area)} and this spot is #{describe_area(room)}."
elsif room.info.terrain.room_type
player.output "Where you are standing is considered to be #{describe_area(room)}."
else
player.output "You are unsure about anything else concerning the area."
end
elsif player == object
player.output "You look over yourself and see:\n#{player.instance_variable_get("@long_desc")}", true
player.output object.show_inventory
else
player.output object.long_desc
end
elsif event[:in]
object = room.find(event[:in])
object = player.inventory.find(event[:in]) if object.nil?

if object.nil?
player.output("Look inside what?")
elsif not object.can? :look_inside
player.output("You cannot look inside that.")
else
object.look_inside(event)
end
else
if not room.nil?
player.output(room.look(player))
else
player.output "Nothing to look at."
end
end
end
end

The way it was originally, you could still look at other players and yourself while blind, plus I think you could also look inside containers, if I recall correctly. You could also use the look here command. This way, all forms of looking are disallowed when blind.
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #1 on: February 06, 2009, 08:44:16 pm »

Good call.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc