|
|
@ -3,13 +3,6 @@
|
|
|
|
$superdwarf_onupdate ||= nil
|
|
|
|
$superdwarf_onupdate ||= nil
|
|
|
|
$superdwarf_ids ||= []
|
|
|
|
$superdwarf_ids ||= []
|
|
|
|
|
|
|
|
|
|
|
|
def unregister
|
|
|
|
|
|
|
|
unless $superdwarf_onupdate.nil?
|
|
|
|
|
|
|
|
df.onupdate_unregister($superdwarf_onupdate)
|
|
|
|
|
|
|
|
$superdwarf_onupdate = nil
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case $script_args[0]
|
|
|
|
case $script_args[0]
|
|
|
|
when 'add'
|
|
|
|
when 'add'
|
|
|
|
if u = df.unit_find
|
|
|
|
if u = df.unit_find
|
|
|
@ -17,7 +10,8 @@ when 'add'
|
|
|
|
|
|
|
|
|
|
|
|
$superdwarf_onupdate ||= df.onupdate_register('superdwarf', 1) {
|
|
|
|
$superdwarf_onupdate ||= df.onupdate_register('superdwarf', 1) {
|
|
|
|
if $superdwarf_ids.empty?
|
|
|
|
if $superdwarf_ids.empty?
|
|
|
|
unregister()
|
|
|
|
df.onupdate_unregister($superdwarf_onupdate)
|
|
|
|
|
|
|
|
$superdwarf_onupdate = nil
|
|
|
|
else
|
|
|
|
else
|
|
|
|
$superdwarf_ids.each { |id|
|
|
|
|
$superdwarf_ids.each { |id|
|
|
|
|
if u = df.unit_find(id) and not u.flags1.dead
|
|
|
|
if u = df.unit_find(id) and not u.flags1.dead
|
|
|
@ -32,11 +26,11 @@ when 'add'
|
|
|
|
when :Job2
|
|
|
|
when :Job2
|
|
|
|
a.data.job2.timer = 1
|
|
|
|
a.data.job2.timer = 1
|
|
|
|
when :Attack
|
|
|
|
when :Attack
|
|
|
|
# Attack execution timer; fires when reaches zero.
|
|
|
|
# Attack execution timer; fires when reaches zero.
|
|
|
|
a.data.attack.timer1 = 1
|
|
|
|
a.data.attack.timer1 = 1
|
|
|
|
# Attack completion timer: finishes action at zero.
|
|
|
|
# Attack completion timer: finishes action at zero.
|
|
|
|
# An action must complete before target re-seleciton
|
|
|
|
# An action must complete before target re-seleciton
|
|
|
|
# occurs.
|
|
|
|
# occurs.
|
|
|
|
a.data.attack.timer2 = 0
|
|
|
|
a.data.attack.timer2 = 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -67,13 +61,8 @@ when 'del'
|
|
|
|
puts "Select a creature using 'v'"
|
|
|
|
puts "Select a creature using 'v'"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if $superdwarf_ids.empty?
|
|
|
|
|
|
|
|
unregister()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
when 'clear'
|
|
|
|
when 'clear'
|
|
|
|
$superdwarf_ids.clear
|
|
|
|
$superdwarf_ids.clear
|
|
|
|
unregister()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
when 'list'
|
|
|
|
when 'list'
|
|
|
|
puts "current superdwarves:", $superdwarf_ids.map { |id| df.unit_find(id).name }
|
|
|
|
puts "current superdwarves:", $superdwarf_ids.map { |id| df.unit_find(id).name }
|
|
|
|