mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2024-12-27 15:10:20 +01:00
Add sleds.
This commit is contained in:
parent
ad063c0b66
commit
191e94af02
3
init.lua
3
init.lua
@ -20,6 +20,9 @@
|
|||||||
dofile(minetest.get_modpath("snow").."/util.lua")
|
dofile(minetest.get_modpath("snow").."/util.lua")
|
||||||
dofile(minetest.get_modpath("snow").."/mapgen.lua")
|
dofile(minetest.get_modpath("snow").."/mapgen.lua")
|
||||||
dofile(minetest.get_modpath("snow").."/falling_snow.lua")
|
dofile(minetest.get_modpath("snow").."/falling_snow.lua")
|
||||||
|
dofile(minetest.get_modpath("snow").."/sled.lua")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local needles = {
|
local needles = {
|
||||||
description = "Pine Needles",
|
description = "Pine Needles",
|
||||||
|
BIN
models/sled.blend
Normal file
BIN
models/sled.blend
Normal file
Binary file not shown.
BIN
models/sled.png
Normal file
BIN
models/sled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
369
models/sled.x
Normal file
369
models/sled.x
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
xof 0303txt 0032
|
||||||
|
|
||||||
|
Frame Root {
|
||||||
|
FrameTransformMatrix {
|
||||||
|
1.000000, 0.000000, 0.000000, 0.000000,
|
||||||
|
0.000000, 0.000000, 1.000000, 0.000000,
|
||||||
|
0.000000, 1.000000,-0.000000, 0.000000,
|
||||||
|
0.000000, 0.000000, 0.000000, 1.000000;;
|
||||||
|
}
|
||||||
|
Frame Cube_001 {
|
||||||
|
FrameTransformMatrix {
|
||||||
|
0.000000, 0.149813, 0.000000, 0.000000,
|
||||||
|
-0.149813, 0.000000, 0.000000, 0.000000,
|
||||||
|
0.000000, 0.000000, 0.149813, 0.000000,
|
||||||
|
0.025244, 3.853863,-2.133818, 1.000000;;
|
||||||
|
}
|
||||||
|
Mesh { //Cube_003 Mesh
|
||||||
|
88;
|
||||||
|
-1.000000;53.554752;-1.000000;,
|
||||||
|
-1.000000;-53.189678;-1.000000;,
|
||||||
|
1.000000;-53.189678;-1.000000;,
|
||||||
|
1.000000;53.554752;-1.000000;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
0.999999;-53.189678;16.253036;,
|
||||||
|
1.000000;-53.189678;-1.000000;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
1.000000;53.554752;-1.000000;,
|
||||||
|
-1.000000;-53.189678;-1.000000;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
1.000000;-53.189678;-1.000000;,
|
||||||
|
-1.000000;53.554752;-1.000000;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-1.000000;-53.189678;-1.000000;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-1.000000;53.554752;-1.000000;,
|
||||||
|
1.000000;53.554752;-1.000000;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
0.999999;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
1.000000;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
0.999999;-53.189678;14.242604;,
|
||||||
|
0.999999;-53.189678;16.253036;,
|
||||||
|
1.000000;53.554752;16.253036;,
|
||||||
|
1.000000;53.554752;16.253036;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
1.000000;53.554752;14.242604;,
|
||||||
|
-52.403629;-53.189678;16.253036;,
|
||||||
|
-52.403629;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-1.000000;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-1.000000;53.554752;16.253036;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;16.253036;,
|
||||||
|
-1.000000;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-52.403629;53.554752;16.253036;,
|
||||||
|
-52.403629;-53.189678;16.253036;,
|
||||||
|
-50.412270;-53.189678;16.253036;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-52.403629;-53.189678;16.253036;,
|
||||||
|
-52.403629;53.554752;16.253036;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;16.253036;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-52.403629;53.554752;-0.989515;,
|
||||||
|
-50.412270;53.554752;-0.989515;,
|
||||||
|
-50.412270;-53.189678;-0.989515;,
|
||||||
|
-50.412270;53.554752;-0.989515;,
|
||||||
|
-52.403629;53.554752;-0.989515;,
|
||||||
|
-52.403629;-53.189678;-0.989515;,
|
||||||
|
-52.403629;-53.189678;-0.989515;,
|
||||||
|
-52.403629;53.554752;-0.989515;,
|
||||||
|
-52.403629;53.554752;14.242604;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-52.403629;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;-53.189678;-0.989515;,
|
||||||
|
-52.403629;-53.189678;-0.989515;,
|
||||||
|
-50.412270;-53.189678;14.242604;,
|
||||||
|
-50.412270;53.554752;14.242604;,
|
||||||
|
-50.412270;53.554752;-0.989515;,
|
||||||
|
-50.412270;-53.189678;-0.989515;;
|
||||||
|
22;
|
||||||
|
4;0;1;2;3;,
|
||||||
|
4;4;5;6;7;,
|
||||||
|
4;8;9;10;11;,
|
||||||
|
4;12;13;14;15;,
|
||||||
|
4;16;17;18;19;,
|
||||||
|
4;20;21;22;23;,
|
||||||
|
4;24;25;26;27;,
|
||||||
|
4;28;29;30;31;,
|
||||||
|
4;32;33;34;35;,
|
||||||
|
4;36;37;38;39;,
|
||||||
|
4;40;41;42;43;,
|
||||||
|
4;44;45;46;47;,
|
||||||
|
4;48;49;50;51;,
|
||||||
|
4;52;53;54;55;,
|
||||||
|
4;56;57;58;59;,
|
||||||
|
4;60;61;62;63;,
|
||||||
|
4;64;65;66;67;,
|
||||||
|
4;68;69;70;71;,
|
||||||
|
4;72;73;74;75;,
|
||||||
|
4;76;77;78;79;,
|
||||||
|
4;80;81;82;83;,
|
||||||
|
4;84;85;86;87;;
|
||||||
|
MeshNormals { //Cube_003 Normals
|
||||||
|
88;
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000; 0.000000;-1.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-1.000000; 0.000000;-0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
0.000000;-0.000000; 1.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
1.000000;-0.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000; 0.000000; 1.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000;-1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
0.000000; 1.000000; 0.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-0.000000; 0.000000;-1.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
-1.000000; 0.000000; 0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
0.000000;-1.000000;-0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;,
|
||||||
|
1.000000; 0.000000; 0.000000;;
|
||||||
|
22;
|
||||||
|
4;0;1;2;3;,
|
||||||
|
4;4;5;6;7;,
|
||||||
|
4;8;9;10;11;,
|
||||||
|
4;12;13;14;15;,
|
||||||
|
4;16;17;18;19;,
|
||||||
|
4;20;21;22;23;,
|
||||||
|
4;24;25;26;27;,
|
||||||
|
4;28;29;30;31;,
|
||||||
|
4;32;33;34;35;,
|
||||||
|
4;36;37;38;39;,
|
||||||
|
4;40;41;42;43;,
|
||||||
|
4;44;45;46;47;,
|
||||||
|
4;48;49;50;51;,
|
||||||
|
4;52;53;54;55;,
|
||||||
|
4;56;57;58;59;,
|
||||||
|
4;60;61;62;63;,
|
||||||
|
4;64;65;66;67;,
|
||||||
|
4;68;69;70;71;,
|
||||||
|
4;72;73;74;75;,
|
||||||
|
4;76;77;78;79;,
|
||||||
|
4;80;81;82;83;,
|
||||||
|
4;84;85;86;87;;
|
||||||
|
} //End of Cube_003 Normals
|
||||||
|
MeshMaterialList { //Cube_003 Material List
|
||||||
|
1;
|
||||||
|
22;
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0;;
|
||||||
|
Material Material {
|
||||||
|
0.640000; 0.640000; 0.640000; 1.000000;;
|
||||||
|
96.078431;
|
||||||
|
0.500000; 0.500000; 0.500000;;
|
||||||
|
0.000000; 0.000000; 0.000000;;
|
||||||
|
}
|
||||||
|
} //End of Cube_003 Material List
|
||||||
|
MeshTextureCoords { //Cube_003 UV Coordinates
|
||||||
|
88;
|
||||||
|
0.973358; 0.999965;,
|
||||||
|
0.975236; 0.387889;,
|
||||||
|
0.986704; 0.387924;,
|
||||||
|
0.984826; 1.000000;,
|
||||||
|
0.706578; 0.081368;,
|
||||||
|
0.706614; 0.092836;,
|
||||||
|
0.695086; 0.092871;,
|
||||||
|
0.695051; 0.081403;,
|
||||||
|
0.593305; 0.387924;,
|
||||||
|
0.680706; 0.387656;,
|
||||||
|
0.682584; 0.999732;,
|
||||||
|
0.595183; 1.000000;,
|
||||||
|
0.794015; 0.092568;,
|
||||||
|
0.706614; 0.092836;,
|
||||||
|
0.706578; 0.081368;,
|
||||||
|
0.793980; 0.081100;,
|
||||||
|
0.882261; 1.000000;,
|
||||||
|
0.794859; 0.999732;,
|
||||||
|
0.796737; 0.387656;,
|
||||||
|
0.884139; 0.387924;,
|
||||||
|
0.806422; 0.375920;,
|
||||||
|
0.893824; 0.376188;,
|
||||||
|
0.893789; 0.387656;,
|
||||||
|
0.806387; 0.387388;,
|
||||||
|
0.000000; 0.387924;,
|
||||||
|
0.011468; 0.387889;,
|
||||||
|
0.013346; 0.999965;,
|
||||||
|
0.001878; 1.000000;,
|
||||||
|
0.795764; 0.092553;,
|
||||||
|
0.807291; 0.092589;,
|
||||||
|
0.806422; 0.375920;,
|
||||||
|
0.794894; 0.375885;,
|
||||||
|
0.682584; 0.999732;,
|
||||||
|
0.680706; 0.387656;,
|
||||||
|
0.692234; 0.387621;,
|
||||||
|
0.694112; 0.999696;,
|
||||||
|
0.794859; 0.387353;,
|
||||||
|
0.794894; 0.375885;,
|
||||||
|
0.806422; 0.375920;,
|
||||||
|
0.806387; 0.387388;,
|
||||||
|
0.306218; 0.386985;,
|
||||||
|
0.308096; 0.999061;,
|
||||||
|
0.296677; 0.999096;,
|
||||||
|
0.294799; 0.387020;,
|
||||||
|
0.593305; 0.387924;,
|
||||||
|
0.591427; 1.000000;,
|
||||||
|
0.308096; 0.999131;,
|
||||||
|
0.309974; 0.387055;,
|
||||||
|
0.294799; 0.387020;,
|
||||||
|
0.296677; 0.999096;,
|
||||||
|
0.013346; 0.999965;,
|
||||||
|
0.011468; 0.387889;,
|
||||||
|
0.695086; 0.092871;,
|
||||||
|
0.706614; 0.092836;,
|
||||||
|
0.707483; 0.376167;,
|
||||||
|
0.695955; 0.376202;,
|
||||||
|
0.707518; 0.387656;,
|
||||||
|
0.705640; 0.999732;,
|
||||||
|
0.694112; 0.999697;,
|
||||||
|
0.695990; 0.387621;,
|
||||||
|
0.695955; 0.376202;,
|
||||||
|
0.707483; 0.376167;,
|
||||||
|
0.707518; 0.387586;,
|
||||||
|
0.695990; 0.387621;,
|
||||||
|
0.795799; 0.081135;,
|
||||||
|
0.807326; 0.081170;,
|
||||||
|
0.807291; 0.092589;,
|
||||||
|
0.795764; 0.092553;,
|
||||||
|
0.807291; 0.092589;,
|
||||||
|
0.807326; 0.081170;,
|
||||||
|
0.894668; 0.081438;,
|
||||||
|
0.894633; 0.092856;,
|
||||||
|
0.988581; 1.000000;,
|
||||||
|
0.986704; 0.387924;,
|
||||||
|
0.998122; 0.387889;,
|
||||||
|
1.000000; 0.999965;,
|
||||||
|
0.794859; 0.387924;,
|
||||||
|
0.792981; 1.000000;,
|
||||||
|
0.705640; 0.999732;,
|
||||||
|
0.707518; 0.387656;,
|
||||||
|
0.707518; 0.387586;,
|
||||||
|
0.707483; 0.376167;,
|
||||||
|
0.794824; 0.375899;,
|
||||||
|
0.794859; 0.387318;,
|
||||||
|
0.884138; 0.999732;,
|
||||||
|
0.886016; 0.387656;,
|
||||||
|
0.973358; 0.387924;,
|
||||||
|
0.971480; 1.000000;;
|
||||||
|
} //End of Cube_003 UV Coordinates
|
||||||
|
} //End of Cube_003 Mesh
|
||||||
|
} //End of Cube_001
|
||||||
|
} //End of Root Frame
|
138
sled.lua
Normal file
138
sled.lua
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
--
|
||||||
|
-- Helper functions
|
||||||
|
--
|
||||||
|
|
||||||
|
local function is_water(pos)
|
||||||
|
local nn = minetest.env:get_node(pos).name
|
||||||
|
return minetest.get_item_group(nn, "water") ~= 0
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Sled entity
|
||||||
|
--
|
||||||
|
|
||||||
|
local sled = {
|
||||||
|
physical = false,
|
||||||
|
collisionbox = {-0.6,-0.25,-0.6, 0.6,0.3,0.6},
|
||||||
|
visual = "mesh",
|
||||||
|
mesh = "sled.x",
|
||||||
|
textures = {"sled.png"},
|
||||||
|
|
||||||
|
driver = nil,
|
||||||
|
sliding = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
local players_sled = {}
|
||||||
|
|
||||||
|
function sled:on_rightclick(clicker)
|
||||||
|
if (not self.driver) and snow.sleds then
|
||||||
|
players_sled[clicker:get_player_name()] = true
|
||||||
|
self.driver = clicker
|
||||||
|
self.object:set_attach(clicker, "", {x=0,y=-9,z=0}, {x=0,y=90,z=0})
|
||||||
|
clicker:set_physics_override({
|
||||||
|
speed = 2, -- multiplier to default value
|
||||||
|
jump = 0, -- multiplier to default value
|
||||||
|
gravity = 1
|
||||||
|
})
|
||||||
|
local HUD =
|
||||||
|
{
|
||||||
|
hud_elem_type = "text", -- see HUD element types
|
||||||
|
position = {x=0.5, y=0.89},
|
||||||
|
name = "sled",
|
||||||
|
scale = {x=2, y=2},
|
||||||
|
text = "You are sledding, hold sneak to stop.",
|
||||||
|
direction = 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
clicker:hud_add(HUD)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:on_activate(staticdata, dtime_s)
|
||||||
|
self.object:set_armor_groups({immortal=1})
|
||||||
|
if staticdata then
|
||||||
|
self.v = tonumber(staticdata)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:get_staticdata()
|
||||||
|
return tostring(v)
|
||||||
|
end
|
||||||
|
|
||||||
|
function sled:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
|
||||||
|
self.object:remove()
|
||||||
|
if puncher and puncher:is_player() then
|
||||||
|
puncher:get_inventory():add_item("main", "snow:sled")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
for _, player in pairs(minetest.get_connected_players()) do
|
||||||
|
if players_sled[player:get_player_name()] then
|
||||||
|
default.player_set_animation(player, "sit", 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
function sled:on_step(dtime)
|
||||||
|
if self.driver then
|
||||||
|
local p = self.object:getpos()
|
||||||
|
p.y = p.y+0.4
|
||||||
|
local s = self.object:getpos()
|
||||||
|
s.y = s.y -0.5
|
||||||
|
local keys = self.driver:get_player_control()
|
||||||
|
if keys["sneak"] or is_water(p) or (not minetest.find_node_near(s, 1, {"default:snow","default:snowblock","default:ice","default:dirt_with_snow"})) then
|
||||||
|
self.driver:set_physics_override({
|
||||||
|
speed = 1, -- multiplier to default value
|
||||||
|
jump = 1, -- multiplier to default value
|
||||||
|
gravity = 1
|
||||||
|
})
|
||||||
|
players_sled[self.driver:get_player_name()] = false
|
||||||
|
self.object:set_detach()
|
||||||
|
self.driver:hud_remove("sled")
|
||||||
|
self.driver = nil
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_entity("snow:sled", sled)
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craftitem("snow:sled", {
|
||||||
|
description = "Sled",
|
||||||
|
inventory_image = "snow_sled.png",
|
||||||
|
wield_image = "snow_sled.png",
|
||||||
|
wield_scale = {x=2, y=2, z=1},
|
||||||
|
liquids_pointable = true,
|
||||||
|
stack_max = 1,
|
||||||
|
|
||||||
|
on_use = function(itemstack, placer)
|
||||||
|
local pos = {x=0,y=-1000, z=0}
|
||||||
|
local name = placer:get_player_name()
|
||||||
|
if not players_sled[name] then
|
||||||
|
local sled = minetest.env:add_entity(pos, "snow:sled")
|
||||||
|
sled:get_luaentity():on_rightclick(placer)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "snow:sled",
|
||||||
|
recipe = {
|
||||||
|
{"", "", ""},
|
||||||
|
{"group:stick", "", ""},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "snow:sled",
|
||||||
|
recipe = {
|
||||||
|
{"", "", ""},
|
||||||
|
{"", "", "group:stick"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
BIN
textures/snow_sled.png
Normal file
BIN
textures/snow_sled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 501 B |
2
util.lua
2
util.lua
@ -1,6 +1,7 @@
|
|||||||
--Global config and function table.
|
--Global config and function table.
|
||||||
snow = {
|
snow = {
|
||||||
legacy = true,
|
legacy = true,
|
||||||
|
sleds = true,
|
||||||
enable_snowfall = true,
|
enable_snowfall = true,
|
||||||
lighter_snowfall = false,
|
lighter_snowfall = false,
|
||||||
debug = false,
|
debug = false,
|
||||||
@ -13,6 +14,7 @@ snow = {
|
|||||||
--Config documentation.
|
--Config documentation.
|
||||||
local doc = {
|
local doc = {
|
||||||
legacy = "Whether you are running a legacy minetest version (auto-detected).",
|
legacy = "Whether you are running a legacy minetest version (auto-detected).",
|
||||||
|
sleds = "Disable this to prevent sleds from being riden.",
|
||||||
enable_snowfall = "Enables falling snow.",
|
enable_snowfall = "Enables falling snow.",
|
||||||
lighter_snowfall = "Reduces the amount of resources and fps used by snowfall.",
|
lighter_snowfall = "Reduces the amount of resources and fps used by snowfall.",
|
||||||
debug = "Enables debug output.",
|
debug = "Enables debug output.",
|
||||||
|
Loading…
Reference in New Issue
Block a user