# fix/growthbug enable [#d|w|m] |disable|status|now|help DAY = 1200 USAGE = < 0 and r > 0 then unit.relations.birth_time -= r count += 1 end end puts "FixGrowth: Fixed #{count} units so that their size will grow/thicken." unless count == 0 end def start( time=DAY*28 ) self.stop if @running @onupdate = df.onupdate_register('fixgrowth', time) { process } @running = true end def stop df.onupdate_unregister(@onupdate) @running = false end end $FixGrowth = FixGrowth.new unless $FixGrowth run = :help time = DAY * 28 $script_args.each do |arg| case arg.downcase when 'now' run = :now when 'enable', 'start' run = :enable when 'disable', 'end', 'stop' run = :disable when 'status' run = :status when 'help', '?' run = :help else if arg =~ /^([1-9]\d*)([dD|wW|mM])$/ time = $~[1].to_i case $~[2] when 'd', 'D' time *= DAY when 'w', 'W' time *= DAY * 7 when 'm', 'M' time *= DAY * 28 end end end end case run when :now $FixGrowth.process when :enable $FixGrowth.start(time) puts $FixGrowth.status when :disable $FixGrowth.stop puts $FixGrowth.status when :help puts $FixGrowth.status puts USAGE end