# # 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