2012-07-12 06:35:49 -06:00
|
|
|
# create an infinite magma source at the cursor
|
|
|
|
|
|
|
|
$magma_sources ||= []
|
|
|
|
|
|
|
|
case $script_args[0]
|
|
|
|
when 'here'
|
2012-11-24 08:05:03 -07:00
|
|
|
$magma_onupdate ||= df.onupdate_register('magmasource', 12) {
|
2012-07-12 06:50:59 -06:00
|
|
|
# called every 12 game ticks (100x a dwarf day)
|
2012-07-12 06:35:49 -06:00
|
|
|
if $magma_sources.empty?
|
|
|
|
df.onupdate_unregister($magma_onupdate)
|
|
|
|
$magma_onupdate = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
$magma_sources.each { |x, y, z|
|
2012-08-03 08:54:40 -06:00
|
|
|
if tile = df.map_tile_at(x, y, z) and tile.shape_passableflow
|
2012-07-12 06:35:49 -06:00
|
|
|
des = tile.designation
|
2012-08-03 08:54:40 -06:00
|
|
|
tile.spawn_magma(des.flow_size + 1) if des.flow_size < 7
|
2012-07-12 06:35:49 -06:00
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if df.cursor.x != -30000
|
|
|
|
if tile = df.map_tile_at(df.cursor)
|
2012-08-03 08:54:40 -06:00
|
|
|
if tile.shape_passableflow
|
2012-07-12 06:35:49 -06:00
|
|
|
$magma_sources << [df.cursor.x, df.cursor.y, df.cursor.z]
|
|
|
|
else
|
|
|
|
puts "Impassable tile: I'm afraid I can't do that, Dave"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
puts "Unallocated map block - build something here first"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
puts "Please put the game cursor where you want a magma source"
|
|
|
|
end
|
|
|
|
|
|
|
|
when 'delete-here'
|
|
|
|
$magma_sources.delete [df.cursor.x, df.cursor.y, df.cursor.z]
|
|
|
|
|
|
|
|
when 'stop'
|
|
|
|
$magma_sources.clear
|
|
|
|
|
|
|
|
else
|
|
|
|
puts <<EOS
|
|
|
|
Creates a new infinite magma source at the cursor.
|
2012-07-12 06:50:59 -06:00
|
|
|
|
2012-07-12 06:35:49 -06:00
|
|
|
Arguments:
|
|
|
|
here - create a new source at the current cursor position
|
2012-07-12 06:50:59 -06:00
|
|
|
(call multiple times for higher flow)
|
2012-07-12 06:35:49 -06:00
|
|
|
delete-here - delete the source under the cursor
|
|
|
|
stop - delete all created magma sources
|
|
|
|
EOS
|
|
|
|
|
|
|
|
if $magma_sources.first
|
2012-07-12 06:50:59 -06:00
|
|
|
puts '', 'Current magma sources:', $magma_sources.map { |s| " #{s.inspect}" }
|
2012-07-12 06:35:49 -06:00
|
|
|
end
|
|
|
|
end
|