Make Chronoshiftable conditional.

This commit is contained in:
Paul Chote
2018-08-12 21:19:06 +01:00
parent 828106cf82
commit e6d552eee7
3 changed files with 22 additions and 12 deletions

View File

@@ -37,7 +37,9 @@ namespace OpenRA.Mods.Cnc.Scripting
kv.Key.WrappedClrType().Name, kv.Value.WrappedClrType().Name));
}
var cs = actor.TraitOrDefault<Chronoshiftable>();
var cs = actor.TraitsImplementing<Chronoshiftable>()
.FirstEnabledTraitOrDefault();
if (cs != null && cs.CanChronoshiftTo(actor, cell))
cs.Teleport(actor, cell, duration, killCargo, Self);
}