edit: Teleport planes and land units to carrier on load
Edit lets deities load units onto remote carriers, resulting in a carriers having cargo in another sector. Not good. Cargo gets teleported to its carrier belatedly when the carrier moves. Better let edit take care of the teleport. Also tell the deity that he just caused a teleport. Necessary to give the deity a chance to catch unexpected changes, e.g. a player moving a plane right before the deity edits it. Watching out for such changes is especially important with non-interactive edit. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
3dceefbbc9
commit
ef2e2d08a2
6 changed files with 43 additions and 13 deletions
|
@ -157,7 +157,16 @@ divine_load_unload(struct empobj *unit, int type, int uid, char *act)
|
|||
void
|
||||
divine_load(struct empobj *unit, int type, int uid)
|
||||
{
|
||||
union empobj_storage carrier;
|
||||
|
||||
divine_load_unload(unit, type, uid, "loaded onto");
|
||||
if (get_empobj(type, uid, &carrier)
|
||||
&& (unit->x != carrier.gen.x || unit->y != carrier.gen.y)) {
|
||||
pr("%s teleported from %s to %s!",
|
||||
unit_nameof(unit), xyas(unit->x, unit->y, player->cnum),
|
||||
xyas(carrier.gen.x, carrier.gen.y, player->cnum));
|
||||
unit_teleport(unit, carrier.gen.x, carrier.gen.y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue