battery.rb

znmud-0.0.1/lib/core/battery.rb · 852 B

From the archive znmud-minimal-0.0.1.tar.gz

Download the archive   « Back to the archive contents

#
# file::    battery.rb
# Author:   Craig Smith

# This source code copyright (C) 2009 Craig Smith
# All rights reserved.
#
# Released under the terms of the TeensyMUD Public License
# See LICENSE file for additional information.
#

$:.unshift "lib" if !$:.include? "lib"

require 'core/gameobject'
require 'storage/properties'

# This is the base container class
#
class Battery < GameObject
  # Create a new Liquid object
  # [+name+]    The displayed name of the Liquid.
  # [+return+]  A handle to the new Liquid.
  def initialize(name, owner, location=nil)
    super(name, owner, location)
  end

  def reset
	if has_val? :max_charge
		add_val(:current_charge, has_val?(:max_charge))
	else
		# Battery w/ no charge is technically a bug but we'll call
		# it a dead battery
		add_val(:max_charge, 0)
		add_val(:current_charge, 0)
	end
  end

end

Site Stats

Snippets: 1791
Codebases: 571