Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Jul 2, 2018

Good job!!11!!!!!

@SmallJoker

This comment has been minimized.

Copy link
Owner Author

commented Jul 2, 2018

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

@Wuzzy2

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.