Sha256: b01d795c366f9444b4e3f8efcc09b34be9f26b50a87a299b98be3765e734ab1b

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

module Gamefic

	Action.new nil, :look do |actor|
		actor.perform "itemize room full"
	end

	Action.new nil, :look_around do |actor|
		actor.perform "look"
	end

	Action.new nil, :itemize_room, Query.new(:string) do |actor, option|
		actor.tell "#{actor.parent.longname.cap_first}"
		if option == "full"
			actor.tell actor.parent.description
		end
		chars = actor.parent.children.that_are(Character) - [actor]
		if chars.length > 0
			actor.tell "Others here: #{chars.join(", ")}"
		end
		#items = actor.parent.children.that_are(Itemized) - [chars] - [actor] - actor.parent.children.that_are(Portal)
		items = actor.parent.children.that_are(Itemized)
		if items.length > 0
			actor.tell "Visible items: #{items.join(", ")}"
		end
		portals = actor.parent.children.that_are(Portal)
		if portals.length > 0
			actor.tell "Obvious exits: #{portals.join(', ')}"
		else
			actor.tell "Obvious exits: none"	
		end
	end
	Syntax.new nil, "itemize room", :itemize_room, "short"
	Syntax.new nil, "itemize room :option", :itemize_room, :option

	Action.new nil, :look, Query.new(:family) do |actor, thing|
		actor.tell thing.description
	end

	Action.new nil, :look, Query.new(:parent) do |actor, thing|
		actor.perform "look"
	end

	Action.new nil, :look, String do |actor, string|
		actor.tell "You don't see any \"#{string}\" here."
	end

	Syntax.new nil, "look at :thing", :look, :thing
	Syntax.new nil, "examine :thing", :look, :thing
	Syntax.new nil, "exam :thing", :look, :thing
	Syntax.new nil, "x :thing", :look, :thing

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gamefic-0.0.4 lib/gamefic/action_ext/look.rb
gamefic-0.0.3 lib/gamefic/action_ext/look.rb
gamefic-0.0.2 lib/gamefic/action_ext/look.rb
gamefic-0.0.1 lib/gamefic/action_ext/look.rb