Skip to content

Instantly share code, notes, and snippets.

@SmallJoker
Last active March 9, 2022 00:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmallJoker/cb89c3f9e4be27a0e8bc10ced1c5fc31 to your computer and use it in GitHub Desktop.
Save SmallJoker/cb89c3f9e4be27a0e8bc10ced1c5fc31 to your computer and use it in GitHub Desktop.
Minetest - Replace deprecated function calls
#!/bin/bash
# License: CC0
# How to use:
# 1) Open the terminal in the target mod directory
# 2) Call the script
files=$(find . -name "*.lua")
ref_call()
{
sed -i "s/:$1(/:$2(/g" "$f"
}
for f in $files; do
sed -i 's/\.env:/\./g' "$f";
sed -i "s/nodeupdate(/minetest\.check_for_falling(/g" "$f"
# l_object.cpp
ref_call "getacceleration" "get_acceleration"
ref_call "setacceleration" "set_acceleration"
ref_call "getpos" "get_pos"
ref_call "setpos" "set_pos"
ref_call "getvelocity" "get_velocity"
ref_call "setvelocity" "set_velocity"
ref_call "getyaw" "get_yaw"
ref_call "setyaw" "set_yaw"
ref_call "moveto" "move_to"
# l_noise.cpp
ref_call "get2dMap" "get_2d_map"
ref_call "get3dMap" "get_3d_map"
ref_call "get2dMap_flat" "get_2d_map_flat"
ref_call "get3dMap_flat" "get_3d_map_flat"
ref_call "calc2dMap" "calc_2d_map"
ref_call "calc3dMap" "calc_3d_map"
ref_call "get2d" "get_2d"
ref_call "get3d" "get_3d"
ref_call "getMapSlice" "get_map_slice"
# l_settings.cpp
sed -i 's/\.setting_get(/\.settings:get(/g' "$f";
sed -i 's/\.setting_set(/\.settings:set(/g' "$f";
sed -i 's/\.setting_getbool/\.settings:get_bool/g' "$f";
sed -i 's/\.setting_setbool/\.settings:set_bool/g' "$f";
sed -i 's/\.setting_save/\.settings:write/g' "$f";
done
@rubenwardy
Copy link

Good job!!11!!!!!

@SmallJoker
Copy link
Author

Thank you!!!!!11¨!4¨!!2424!!!

@Wuzzy2
Copy link

Wuzzy2 commented Mar 7, 2019

Please add setspriteset_sprite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment