Merge branch 'master' into 1.15

# Conflicts:
#	src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java
#	src/main/java/carpet/script/CarpetExpression.java
#	src/main/java/carpet/script/bundled/BundledModule.java
#	src/main/resources/assets/carpet/scripts/camera.sc
#	src/main/resources/assets/carpet/scripts/event_test.sc
This commit is contained in:
gnembon committed 2019-10-11 02:28:15 -03:00
commit f32a353655
2 files changed
+7 -17

No files matched your search

@@ -1141,6 +1141,13 @@ public class CarpetExpression
return (_c, _t) -> res;
});
this.expr.addLazyFunction("item_category", 1, (c, t, lv) ->
{
ItemStackArgument item = NBTSerializableValue.parseItem(lv.get(0).evalValue(c).getString());
Value res = new StringValue(item.getItem().getGroup().getName());
return (_c, _t) -> res;
});
this.expr.addLazyFunction("inventory_size", -1, (c, t, lv) ->
@@ -42,7 +42,6 @@ start() ->
undef('global_path_precalculated');
str('Started path at %.1f %.1f %.1f', p~'x', p~'y', p~'z')
);
add(delay) ->
(
p = player();
@@ -52,7 +51,6 @@ add(delay) ->
__add_path_segment(p ~ 'location', delay, mode);
str('Added point %d: %.1f %.1f %.1f', length(global_points), p~'x', p~'y', p~'z')
);
__add_path_segment(vector, duration, mode) ->
(
undef('global_path_precalculated');
@@ -62,7 +60,6 @@ __add_path_segment(vector, duration, mode) ->
put(vector,-2, __adjusted_rot(get(v, -2), get(vector, -2)));
global_points += l(vector, end_time+duration, mode)
);
// adjusts current rotation so we don\'t spin around like crazy
__adjusted_rot(previous_rot, current_rot) ->
(
@@ -87,7 +84,6 @@ repeat(times, last_section_duration) ->
);
str('Add %d points %d times', length(positions), times)
);
speed(percentage) ->
(
undef('global_path_precalculated');
@@ -104,7 +100,6 @@ speed(percentage) ->
get(get(global_points, -1),1)
)
);
select_interpolation(method) ->
(
undef('global_path_precalculated');
@@ -128,16 +123,13 @@ select_interpolation(method) ->
);
'Ok'
);
select_interpolation('gauss_auto');
__assert_valid_for_motion() ->
(
if(!global_points, exit('Path not defined yet'));
if(length(global_points)<2, exit('Path not complete - add more points'));
null
);
__get_path_at(segment, start, index) ->
(
v = get(global_path_precalculated, start+index);
@@ -147,9 +139,7 @@ __get_path_at(segment, start, index) ->
);
v
);
__invalidate_points_cache() -> global_path_precalculated = map(range(get(get(global_points, -1),1)), null);
show() ->
(
loop(100,
@@ -158,7 +148,6 @@ show() ->
);
'Done!'
);
play(fps) ->
(
p = player();
@@ -187,7 +176,6 @@ play(fps) ->
game_tick(1000);
'Done!'
);
_show_path_tick(particle_type, total) ->
(
__assert_valid_for_motion();
@@ -202,12 +190,10 @@ _show_path_tick(particle_type, total) ->
);
null
);
__prepare_path_if_needed_generic() ->
(
if(!global_path_precalculated, __invalidate_points_cache())
);
__find_position_for_linear(segment, point) ->
(
l(va, start, mode_a) = get(global_points,segment);
@@ -216,12 +202,9 @@ __find_position_for_linear(segment, point) ->
dt = point/section;
dt*vb+(1-dt)*va
);
//(1/sqrt(2*pi*d*d))*euler^(-((x-miu)^2)/(2*d*d))
// but we will be normalizing anyways, so who cares
__norm_prob(x, miu, d) -> euler^(-((x-miu)^2)/(2*d*d));
__find_position_for_gauss(from_index, point) ->
(
dev = global_interpol_option;