Difference between revisions of "MT-replace-deprecated.sh"
Jump to navigation
Jump to search
(Created page with "This is a shell script for finding and replacing most deprecated function calls of mod code from old Minetest versions (0.4.x) to update them to Minetest 5.0.0. See also: htt...") |
(Add setsprite → set_sprite) |
||
Line 37: | Line 37: | ||
ref_call "moveto" "move_to" | ref_call "moveto" "move_to" | ||
+ | |||
+ | ref_call "setsprite" "set_sprite" | ||
# l_noise.cpp | # l_noise.cpp |
Revision as of 11:05, 7 September 2019
This is a shell script for finding and replacing most deprecated function calls of mod code from old Minetest versions (0.4.x) to update them to Minetest 5.0.0.
See also: https://forum.minetest.net/viewtopic.php?f=18&t=20403
#!/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" ref_call "setsprite" "set_sprite" # 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