Giter Site home page Giter Site logo

Comments (4)

AlexNijjar avatar AlexNijjar commented on July 20, 2024 1

you probably have https://www.curseforge.com/minecraft/mc-mods/minecraft-transit-railway which breaks the lander for some reason

from ad-astra.

peanutinky avatar peanutinky commented on July 20, 2024

samething happens with the fabric version 1.19.2 fabric loader 1.14.10 v1.11.9

from ad-astra.

iczero avatar iczero commented on July 20, 2024

Quick scarpet script to fix this temporarily:

distance_horizontal(p1, p2) -> sqrt((p2:0 - p1:0)^2 + (p2:2 - p1:2)^2);

try_find_lander(player, try_count) -> (
  // if player is already on a lander, ensure they remain on it
  current_mount = player ~ 'mount';
  if(current_mount != null, (
    print(player, str('rocket-fix: player already on lander %s', current_mount ~ 'uuid'));
    schedule(5, 'ensure_player_on_lander', player, lander, 1);
    return();
  ));
  
  // attempt to find lander
  landers = entity_area('ad_astra:lander', player, [10, 200, 10]);
  // exclude landers already with passengers
  landers_filtered = filter(landers, length(_ ~ 'passengers') == 0);
  
  if(length(landers_filtered) < 1, (
    if(try_count > 10, (
      print(player, str('rocket-fix: no lander found after %d tries', try_count));
      return();
    ));
    schedule(5, 'try_find_lander', player, try_count + 1);
    return();
  ));

  // sort all found landers by horizontal distance to player
  player_pos = player ~ 'pos';
  landers_sorted = sort_key(landers, distance_horizontal(_ ~ 'pos', player_pos));

  lander = landers_sorted:0;
  print(player, str('rocket-fix: found lander %s (try %d), mounting player', lander ~ 'uuid', try_count));
  modify(lander, 'mount_passengers', player);
  schedule(5, 'ensure_player_on_lander', player, lander, 1);
);

ensure_player_on_lander(player, lander, try_count) -> (
  if(player ~ 'mount' != null, (
    // still on lander, probably
    // print(player, str('rocket-fix: mount still exists (try %d)', try_count));
    null
  ), (
    print(player, str('rocket-fix: re-mounting player (try %d)', try_count));
    modify(lander, 'mount_passengers', player);
  ));
  if(try_count > 10, (
    print(player, 'rocket-fix: done, have fun not being dead');
    return();
  ));
  schedule(5, 'ensure_player_on_lander', player, lander, try_count + 1);
);

__on_player_changes_dimension(player, from_pos, from_dimension, to_pos, to_dimension) -> (
  // players coming from rockets spawn well above height limit
  if(to_pos:1 <= 320, return());
  print(player, 'rocket-fix: attempting to put you back on your lander');
  try_find_lander(player, 1);
);

from ad-astra.

peanutinky avatar peanutinky commented on July 20, 2024

Quick scarpet script to fix this temporarily:

distance_horizontal(p1, p2) -> sqrt((p2:0 - p1:0)^2 + (p2:2 - p1:2)^2);

try_find_lander(player, try_count) -> (
  // if player is already on a lander, ensure they remain on it
  current_mount = player ~ 'mount';
  if(current_mount != null, (
    print(player, str('rocket-fix: player already on lander %s', current_mount ~ 'uuid'));
    schedule(5, 'ensure_player_on_lander', player, lander, 1);
    return();
  ));
  
  // attempt to find lander
  landers = entity_area('ad_astra:lander', player, [10, 200, 10]);
  // exclude landers already with passengers
  landers_filtered = filter(landers, length(_ ~ 'passengers') == 0);
  
  if(length(landers_filtered) < 1, (
    if(try_count > 10, (
      print(player, str('rocket-fix: no lander found after %d tries', try_count));
      return();
    ));
    schedule(5, 'try_find_lander', player, try_count + 1);
    return();
  ));

  // sort all found landers by horizontal distance to player
  player_pos = player ~ 'pos';
  landers_sorted = sort_key(landers, distance_horizontal(_ ~ 'pos', player_pos));

  lander = landers_sorted:0;
  print(player, str('rocket-fix: found lander %s (try %d), mounting player', lander ~ 'uuid', try_count));
  modify(lander, 'mount_passengers', player);
  schedule(5, 'ensure_player_on_lander', player, lander, 1);
);

ensure_player_on_lander(player, lander, try_count) -> (
  if(player ~ 'mount' != null, (
    // still on lander, probably
    // print(player, str('rocket-fix: mount still exists (try %d)', try_count));
    null
  ), (
    print(player, str('rocket-fix: re-mounting player (try %d)', try_count));
    modify(lander, 'mount_passengers', player);
  ));
  if(try_count > 10, (
    print(player, 'rocket-fix: done, have fun not being dead');
    return();
  ));
  schedule(5, 'ensure_player_on_lander', player, lander, try_count + 1);
);

__on_player_changes_dimension(player, from_pos, from_dimension, to_pos, to_dimension) -> (
  // players coming from rockets spawn well above height limit
  if(to_pos:1 <= 320, return());
  print(player, 'rocket-fix: attempting to put you back on your lander');
  try_find_lander(player, 1);
);

how do i use this code i have searched google and haven't got any results that would help... i have carpet installed but can't make any sence of this code on how to get it to work

from ad-astra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.