Update distance_beta.sc

This commit is contained in:
Ghoulboy78 committed 2021-02-24 09:39:04 +01:00
1 parent 14018c8e1b
commit 5287fed712
1 file changed
+11 -9
@@ -60,11 +60,11 @@ global_generators = {
_create_shapes(mode, from, to) -> _create_shapes(mode, from, to) ->
( (
shapes = call(global_generators:mode, from+[0, 0.07, 0], to+[0, 0.07, 0]); shapes = call(global_generators:mode, from+[0, 0.07, 0], to+[0, 0.07, 0]);
shapes += ['label', 'pos',to+[0,0.2,0], 'align', 'right', 'indent', -1.5, 'text',format('rb Cylindrical:')]; shapes += ['label', 'pos',to+[0,0.2,0], 'align', 'right', 'indent', -1.5, 'text',format('rb Cylindrical:')];
shapes += ['label', 'pos',to+[0,0.2,0], 'align', 'left', 'text',_round(_euclidean(from, [to:0, from:1, to:2]), 0.001)]; shapes += ['label', 'pos',to+[0,0.2,0], 'align', 'left', 'text',_round(_euclidean(from, [to:0, from:1, to:2]), 0.001)];
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'right', 'indent', -1.5, 'text',format('rb Manhattan:')]; shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'right', 'indent', -1.5, 'text',format('rb Manhattan:')];
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'left', 'text',_round(_manhattan(from,to),0.001)]; shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'left', 'text',_round(_manhattan(from,to),0.001)];
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'right', 'indent', -1.5, 'text',format('rb Euclidian:')]; shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'right', 'indent', -1.5, 'text',format('rb Euclidean:')];
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'left', 'text',_round(_euclidean(from,to),0.001)]; shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'left', 'text',_round(_euclidean(from,to),0.001)];
map(shapes, put(_, 1, [20, 'player', player()], 'extend'); _); map(shapes, put(_, 1, [20, 'player', player()], 'extend'); _);
); );
@@ -77,9 +77,8 @@ set_start(pos)->(
); );
set_mode(mode)->( set_mode(mode)->(
if (global_display_modes ~ mode, global_current_mode = mode;
global_current_mode = mode print(player(),format('gi Set display mode to '+mode))
)
); );
calculate(end)->( calculate(end)->(
@@ -90,9 +89,12 @@ calculate(end)->(
) )
); );
_carpets() -> system_info('world_carpet_rules'):'carpets'=='true';
on_player_places_block(player, item_tuple, hand, block) -> on_player_places_block(player, item_tuple, hand, block) ->
( (
if(block==global_assist_block, if(block==global_assist_block && _carpets(),
effective_pos = pos(block)+[0.5, 0, 0.5]; effective_pos = pos(block)+[0.5, 0, 0.5];
if(global_current_start==null||player~'sneaking',//wont complain for first carpet if(global_current_start==null||player~'sneaking',//wont complain for first carpet
set_start(effective_pos) set_start(effective_pos)
@@ -104,7 +106,7 @@ on_player_places_block(player, item_tuple, hand, block) ->
on_player_uses_item(player, item_tuple, hand) -> on_player_uses_item(player, item_tuple, hand) ->
( (
if (item_tuple:0 == global_assist_block && hand == 'mainhand', if (item_tuple:0 == global_assist_block && hand == 'mainhand' && _carpets(),
if (player ~'sneaking', if (player ~'sneaking',
global_current_mode = global_display_modes:(global_display_modes ~ global_current_mode + 1); global_current_mode = global_display_modes:(global_display_modes ~ global_current_mode + 1);
display_title(player, 'actionbar', format('w Distance mode: ','e '+global_current_mode)); display_title(player, 'actionbar', format('w Distance mode: ','e '+global_current_mode));
@@ -152,4 +154,4 @@ render()->(
draw_shape(_); draw_shape(_);
); );
schedule(20,'render') schedule(20,'render')
); );