private void _warp_juni(Juni juni) { if (juni.dead) { return; } // If juni is dead, ignore warps // Calculate the warp var area = CurrentArea.Area; var jgp = juni.GlobalPosition; var new_coords = GDKnyttWorld.getAreaCoords(jgp); if (new_coords.Equals(area.Position)) { return; } // Area may change if warp is deferred var wc = area.Warp.getWarpCoords(new_coords, area.Position); // Apply the warp jgp += new Vector2(GDKnyttArea.Width * wc.x, GDKnyttArea.Height * wc.y); var after_warp_coords = GDKnyttWorld.getAreaCoords(jgp); // Apply flag warps var found_warp = getFlagWarp(after_warp_coords, juni); if (found_warp != null) { jgp += new Vector2(GDKnyttArea.Width * found_warp.Value.x, GDKnyttArea.Height * found_warp.Value.y); } var after_flag_warp_coords = GDKnyttWorld.getAreaCoords(jgp); juni.GlobalPosition = jgp; changeArea(after_flag_warp_coords, regenerate_same: false); }
public void warpJuni(Juni juni) { // Calculate the warp var area = CurrentArea.Area; var jgp = juni.GlobalPosition; var new_coords = GDKnyttWorld.getAreaCoords(jgp); var wc = area.Warp.getWarpCoords(new_coords, area.Position); // Apply the warp jgp += new Vector2(GDKnyttArea.Width * wc.x, GDKnyttArea.Height * wc.y); juni.GlobalPosition = jgp; var after_warp_coords = GDKnyttWorld.getAreaCoords(jgp); changeArea(after_warp_coords, regenerate_same: false); }