I have built a Barracks with a Reactor and want to train two Marines. However, Unit.command() and Unit.train() will not process the second train command, unless it is queued. As far as I can tell, the second command gets filtered out by the APM spam filter, because it is identical to the previous command, and the Barracks is not technically idle (it is_unused).
The code snippet for the spam filter I am talking about looks like this:
pub fn command(&self, ability: AbilityId, target: Target, queue: bool) {
if !(queue || self.is_idle() || self.data.allow_spam.get_locked()) {
let last_order = &self.orders()[0];
if ability == last_order.ability && target == last_order.target {
return;
}
} else if self.is_sleeping() {
return;
}
[...]
I can work around this using the queue flag, but I think a more proper solution in this case would be to change self.is_idle() to self.is_unused() in command(). self.is_unused() falls back to is_idle() when no reactor is present. However, I am not sure if that is indeed the correct way to solve this problem for good.
If you want me to, I can prepare a small pull request with the proposed change.
Hi.
I have built a Barracks with a Reactor and want to train two Marines. However,
Unit.command()
andUnit.train()
will not process the second train command, unless it is queued. As far as I can tell, the second command gets filtered out by the APM spam filter, because it is identical to the previous command, and the Barracks is not technically idle (itis_unused
).The code snippet for the spam filter I am talking about looks like this:
I can work around this using the queue flag, but I think a more proper solution in this case would be to change
self.is_idle()
toself.is_unused()
incommand()
.self.is_unused()
falls back tois_idle()
when no reactor is present. However, I am not sure if that is indeed the correct way to solve this problem for good.If you want me to, I can prepare a small pull request with the proposed change.