Sha256: ada9211b63a760db640b8d14f7c895c476557d8d641b4023d8ea4fe04534ec2a
Contents?: true
Size: 895 Bytes
Versions: 6
Compression:
Stored size: 895 Bytes
Contents
module Gamefic::Suggestible def suggestions @suggestions ||= [] end def suggestions= arr @suggestions = arr end def suggest command if !suggestions.include?(command) suggestions.push command end end def self.automatic? if @automatic.nil? @automatic = false end @automatic end def self.automatic= bool @automatic = bool end end class Gamefic::Character include Suggestible serialize :suggestions end on_update do players.each { |player| if Suggestible.automatic? and player.suggestions.length > 0 player.suggestions.each { |s| player.stream "<a class=\"suggestion\" href=\"#\" rel=\"gamefic\" data-command=\"#{s.cap_first}\">#{s.cap_first}</a>" } end #player.suggestions.clear } end before_player_update do |player| player.suggestions.clear end
Version data entries
6 entries across 6 versions & 1 rubygems