Rename ModApiEnvMod and ModApiItemMod

The 'mod' could have meant module in the past but no other classes do this.
This commit is contained in:
sfan5 2023-06-17 16:07:45 +02:00
parent 610578e3e2
commit 659828b142
8 changed files with 70 additions and 70 deletions

@ -126,7 +126,7 @@ protected:
friend class ObjectRef;
friend class NodeMetaRef;
friend class ModApiBase;
friend class ModApiEnvMod;
friend class ModApiEnv;
friend class LuaVoxelManip;
/*

@ -28,7 +28,7 @@ struct ItemStack;
class ServerActiveObject;
struct ItemDefinition;
class LuaItemStack;
class ModApiItemMod;
class ModApiItem;
class InventoryList;
struct InventoryLocation;
@ -58,7 +58,7 @@ public:
protected:
friend class LuaItemStack;
friend class ModApiItemMod;
friend class ModApiItem;
bool getItemCallback(const char *name, const char *callbackname, const v3s16 *p = nullptr);
/*!

@ -245,7 +245,7 @@ void LuaEmergeAreaCallback(v3s16 blockpos, EmergeAction action, void *param)
// set_node(pos, node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_set_node(lua_State *L)
int ModApiEnv::l_set_node(lua_State *L)
{
GET_ENV_PTR;
@ -260,7 +260,7 @@ int ModApiEnvMod::l_set_node(lua_State *L)
// bulk_set_node([pos1, pos2, ...], node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_bulk_set_node(lua_State *L)
int ModApiEnv::l_bulk_set_node(lua_State *L)
{
GET_ENV_PTR;
@ -290,14 +290,14 @@ int ModApiEnvMod::l_bulk_set_node(lua_State *L)
return 1;
}
int ModApiEnvMod::l_add_node(lua_State *L)
int ModApiEnv::l_add_node(lua_State *L)
{
return l_set_node(L);
}
// remove_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_remove_node(lua_State *L)
int ModApiEnv::l_remove_node(lua_State *L)
{
GET_ENV_PTR;
@ -311,7 +311,7 @@ int ModApiEnvMod::l_remove_node(lua_State *L)
// swap_node(pos, node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_swap_node(lua_State *L)
int ModApiEnv::l_swap_node(lua_State *L)
{
GET_ENV_PTR;
@ -326,7 +326,7 @@ int ModApiEnvMod::l_swap_node(lua_State *L)
// get_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node(lua_State *L)
int ModApiEnv::l_get_node(lua_State *L)
{
GET_ENV_PTR;
@ -341,7 +341,7 @@ int ModApiEnvMod::l_get_node(lua_State *L)
// get_node_or_nil(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node_or_nil(lua_State *L)
int ModApiEnv::l_get_node_or_nil(lua_State *L)
{
GET_ENV_PTR;
@ -362,7 +362,7 @@ int ModApiEnvMod::l_get_node_or_nil(lua_State *L)
// get_node_light(pos, timeofday)
// pos = {x=num, y=num, z=num}
// timeofday: nil = current time, 0 = night, 0.5 = day
int ModApiEnvMod::l_get_node_light(lua_State *L)
int ModApiEnv::l_get_node_light(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -389,7 +389,7 @@ int ModApiEnvMod::l_get_node_light(lua_State *L)
// get_natural_light(pos, timeofday)
// pos = {x=num, y=num, z=num}
// timeofday: nil = current time, 0 = night, 0.5 = day
int ModApiEnvMod::l_get_natural_light(lua_State *L)
int ModApiEnv::l_get_natural_light(lua_State *L)
{
GET_ENV_PTR;
@ -427,7 +427,7 @@ int ModApiEnvMod::l_get_natural_light(lua_State *L)
// place_node(pos, node)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_place_node(lua_State *L)
int ModApiEnv::l_place_node(lua_State *L)
{
GET_ENV_PTR;
@ -460,7 +460,7 @@ int ModApiEnvMod::l_place_node(lua_State *L)
// dig_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_dig_node(lua_State *L)
int ModApiEnv::l_dig_node(lua_State *L)
{
GET_ENV_PTR;
@ -483,7 +483,7 @@ int ModApiEnvMod::l_dig_node(lua_State *L)
// punch_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_punch_node(lua_State *L)
int ModApiEnv::l_punch_node(lua_State *L)
{
GET_ENV_PTR;
@ -506,7 +506,7 @@ int ModApiEnvMod::l_punch_node(lua_State *L)
// get_node_max_level(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node_max_level(lua_State *L)
int ModApiEnv::l_get_node_max_level(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -518,7 +518,7 @@ int ModApiEnvMod::l_get_node_max_level(lua_State *L)
// get_node_level(pos)
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_get_node_level(lua_State *L)
int ModApiEnv::l_get_node_level(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -531,7 +531,7 @@ int ModApiEnvMod::l_get_node_level(lua_State *L)
// set_node_level(pos, level)
// pos = {x=num, y=num, z=num}
// level: 0..63
int ModApiEnvMod::l_set_node_level(lua_State *L)
int ModApiEnv::l_set_node_level(lua_State *L)
{
GET_ENV_PTR;
@ -548,7 +548,7 @@ int ModApiEnvMod::l_set_node_level(lua_State *L)
// add_node_level(pos, level)
// pos = {x=num, y=num, z=num}
// level: -127..127
int ModApiEnvMod::l_add_node_level(lua_State *L)
int ModApiEnv::l_add_node_level(lua_State *L)
{
GET_ENV_PTR;
@ -563,7 +563,7 @@ int ModApiEnvMod::l_add_node_level(lua_State *L)
}
// find_nodes_with_meta(pos1, pos2)
int ModApiEnvMod::l_find_nodes_with_meta(lua_State *L)
int ModApiEnv::l_find_nodes_with_meta(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -580,7 +580,7 @@ int ModApiEnvMod::l_find_nodes_with_meta(lua_State *L)
}
// get_meta(pos)
int ModApiEnvMod::l_get_meta(lua_State *L)
int ModApiEnv::l_get_meta(lua_State *L)
{
GET_ENV_PTR;
@ -591,7 +591,7 @@ int ModApiEnvMod::l_get_meta(lua_State *L)
}
// get_node_timer(pos)
int ModApiEnvMod::l_get_node_timer(lua_State *L)
int ModApiEnv::l_get_node_timer(lua_State *L)
{
GET_ENV_PTR;
@ -603,7 +603,7 @@ int ModApiEnvMod::l_get_node_timer(lua_State *L)
// add_entity(pos, entityname, [staticdata]) -> ObjectRef or nil
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_add_entity(lua_State *L)
int ModApiEnv::l_add_entity(lua_State *L)
{
GET_ENV_PTR;
@ -626,7 +626,7 @@ int ModApiEnvMod::l_add_entity(lua_State *L)
// add_item(pos, itemstack or itemstring or table) -> ObjectRef or nil
// pos = {x=num, y=num, z=num}
int ModApiEnvMod::l_add_item(lua_State *L)
int ModApiEnv::l_add_item(lua_State *L)
{
GET_ENV_PTR;
@ -655,7 +655,7 @@ int ModApiEnvMod::l_add_item(lua_State *L)
}
// get_connected_players()
int ModApiEnvMod::l_get_connected_players(lua_State *L)
int ModApiEnv::l_get_connected_players(lua_State *L)
{
ServerEnvironment *env = (ServerEnvironment *) getEnv(L);
if (!env) {
@ -680,7 +680,7 @@ int ModApiEnvMod::l_get_connected_players(lua_State *L)
}
// get_player_by_name(name)
int ModApiEnvMod::l_get_player_by_name(lua_State *L)
int ModApiEnv::l_get_player_by_name(lua_State *L)
{
GET_ENV_PTR;
@ -698,7 +698,7 @@ int ModApiEnvMod::l_get_player_by_name(lua_State *L)
}
// get_objects_inside_radius(pos, radius)
int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L)
int ModApiEnv::l_get_objects_inside_radius(lua_State *L)
{
GET_ENV_PTR;
ScriptApiBase *script = getScriptApiBase(L);
@ -722,7 +722,7 @@ int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L)
}
// get_objects_in_area(pos, minp, maxp)
int ModApiEnvMod::l_get_objects_in_area(lua_State *L)
int ModApiEnv::l_get_objects_in_area(lua_State *L)
{
GET_ENV_PTR;
ScriptApiBase *script = getScriptApiBase(L);
@ -748,7 +748,7 @@ int ModApiEnvMod::l_get_objects_in_area(lua_State *L)
// set_timeofday(val)
// val = 0...1
int ModApiEnvMod::l_set_timeofday(lua_State *L)
int ModApiEnv::l_set_timeofday(lua_State *L)
{
GET_ENV_PTR;
@ -766,7 +766,7 @@ int ModApiEnvMod::l_set_timeofday(lua_State *L)
}
// get_timeofday() -> 0...1
int ModApiEnvMod::l_get_timeofday(lua_State *L)
int ModApiEnv::l_get_timeofday(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -778,7 +778,7 @@ int ModApiEnvMod::l_get_timeofday(lua_State *L)
}
// get_day_count() -> int
int ModApiEnvMod::l_get_day_count(lua_State *L)
int ModApiEnv::l_get_day_count(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -787,7 +787,7 @@ int ModApiEnvMod::l_get_day_count(lua_State *L)
}
// get_gametime()
int ModApiEnvMod::l_get_gametime(lua_State *L)
int ModApiEnv::l_get_gametime(lua_State *L)
{
GET_ENV_PTR;
@ -833,7 +833,7 @@ int ModApiEnvBase::findNodeNear(lua_State *L, v3s16 pos, int radius,
// find_node_near(pos, radius, nodenames, [search_center]) -> pos or nil
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
int ModApiEnvMod::l_find_node_near(lua_State *L)
int ModApiEnv::l_find_node_near(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -948,7 +948,7 @@ int ModApiEnvBase::findNodesInArea(lua_State *L, const NodeDefManager *ndef,
}
// find_nodes_in_area(minp, maxp, nodenames, [grouped])
int ModApiEnvMod::l_find_nodes_in_area(lua_State *L)
int ModApiEnv::l_find_nodes_in_area(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -1006,7 +1006,7 @@ int ModApiEnvBase::findNodesInAreaUnderAir(lua_State *L, v3s16 minp, v3s16 maxp,
// find_nodes_in_area_under_air(minp, maxp, nodenames) -> list of positions
// nodenames: e.g. {"ignore", "group:tree"} or "default:dirt"
int ModApiEnvMod::l_find_nodes_in_area_under_air(lua_State *L)
int ModApiEnv::l_find_nodes_in_area_under_air(lua_State *L)
{
/* TODO: A similar but generalized (and therefore slower) version of this
* function could be created -- e.g. find_nodes_in_area_under -- which
@ -1041,7 +1041,7 @@ int ModApiEnvMod::l_find_nodes_in_area_under_air(lua_State *L)
// get_perlin(seeddiff, octaves, persistence, scale)
// returns world-specific PerlinNoise
int ModApiEnvMod::l_get_perlin(lua_State *L)
int ModApiEnv::l_get_perlin(lua_State *L)
{
GET_ENV_PTR_NO_MAP_LOCK;
@ -1067,7 +1067,7 @@ int ModApiEnvMod::l_get_perlin(lua_State *L)
// get_perlin_map(noiseparams, size)
// returns world-specific PerlinNoiseMap
int ModApiEnvMod::l_get_perlin_map(lua_State *L)
int ModApiEnv::l_get_perlin_map(lua_State *L)
{
GET_ENV_PTR_NO_MAP_LOCK;
@ -1086,7 +1086,7 @@ int ModApiEnvMod::l_get_perlin_map(lua_State *L)
// get_voxel_manip()
// returns voxel manipulator
int ModApiEnvMod::l_get_voxel_manip(lua_State *L)
int ModApiEnv::l_get_voxel_manip(lua_State *L)
{
return LuaVoxelManip::create_object(L);
}
@ -1094,14 +1094,14 @@ int ModApiEnvMod::l_get_voxel_manip(lua_State *L)
// clear_objects([options])
// clear all objects in the environment
// where options = {mode = "full" or "quick"}
int ModApiEnvMod::l_clear_objects(lua_State *L)
int ModApiEnv::l_clear_objects(lua_State *L)
{
GET_ENV_PTR;
ClearObjectsMode mode = CLEAR_OBJECTS_MODE_QUICK;
if (lua_istable(L, 1)) {
mode = (ClearObjectsMode)getenumfield(L, 1, "mode",
ModApiEnvMod::es_ClearObjectsMode, mode);
ModApiEnv::es_ClearObjectsMode, mode);
}
env->clearObjects(mode);
@ -1109,7 +1109,7 @@ int ModApiEnvMod::l_clear_objects(lua_State *L)
}
// line_of_sight(pos1, pos2) -> true/false, pos
int ModApiEnvMod::l_line_of_sight(lua_State *L)
int ModApiEnv::l_line_of_sight(lua_State *L)
{
GET_PLAIN_ENV_PTR;
@ -1130,7 +1130,7 @@ int ModApiEnvMod::l_line_of_sight(lua_State *L)
}
// fix_light(p1, p2)
int ModApiEnvMod::l_fix_light(lua_State *L)
int ModApiEnv::l_fix_light(lua_State *L)
{
GET_ENV_PTR;
@ -1157,14 +1157,14 @@ int ModApiEnvMod::l_fix_light(lua_State *L)
return 1;
}
int ModApiEnvMod::l_raycast(lua_State *L)
int ModApiEnv::l_raycast(lua_State *L)
{
return LuaRaycast::create_object(L);
}
// load_area(p1, [p2])
// load mapblocks in area p1..p2, but do not generate map
int ModApiEnvMod::l_load_area(lua_State *L)
int ModApiEnv::l_load_area(lua_State *L)
{
GET_ENV_PTR;
MAP_LOCK_REQUIRED;
@ -1188,7 +1188,7 @@ int ModApiEnvMod::l_load_area(lua_State *L)
// emerge_area(p1, p2, [callback, context])
// emerge mapblocks in area p1..p2, calls callback with context upon completion
int ModApiEnvMod::l_emerge_area(lua_State *L)
int ModApiEnv::l_emerge_area(lua_State *L)
{
GET_ENV_PTR;
@ -1234,7 +1234,7 @@ int ModApiEnvMod::l_emerge_area(lua_State *L)
// delete_area(p1, p2)
// delete mapblocks in area p1..p2
int ModApiEnvMod::l_delete_area(lua_State *L)
int ModApiEnv::l_delete_area(lua_State *L)
{
GET_ENV_PTR;
@ -1267,7 +1267,7 @@ int ModApiEnvMod::l_delete_area(lua_State *L)
// find_path(pos1, pos2, searchdistance,
// max_jump, max_drop, algorithm) -> table containing path
int ModApiEnvMod::l_find_path(lua_State *L)
int ModApiEnv::l_find_path(lua_State *L)
{
GET_ENV_PTR;
@ -1346,7 +1346,7 @@ static bool read_tree_def(lua_State *L, int idx,
}
// spawn_tree(pos, treedef)
int ModApiEnvMod::l_spawn_tree(lua_State *L)
int ModApiEnv::l_spawn_tree(lua_State *L)
{
GET_ENV_PTR;
@ -1373,7 +1373,7 @@ int ModApiEnvMod::l_spawn_tree(lua_State *L)
}
// transforming_liquid_add(pos)
int ModApiEnvMod::l_transforming_liquid_add(lua_State *L)
int ModApiEnv::l_transforming_liquid_add(lua_State *L)
{
GET_ENV_PTR;
@ -1384,7 +1384,7 @@ int ModApiEnvMod::l_transforming_liquid_add(lua_State *L)
// forceload_block(blockpos)
// blockpos = {x=num, y=num, z=num}
int ModApiEnvMod::l_forceload_block(lua_State *L)
int ModApiEnv::l_forceload_block(lua_State *L)
{
GET_ENV_PTR;
@ -1394,7 +1394,7 @@ int ModApiEnvMod::l_forceload_block(lua_State *L)
}
// compare_block_status(nodepos)
int ModApiEnvMod::l_compare_block_status(lua_State *L)
int ModApiEnv::l_compare_block_status(lua_State *L)
{
GET_ENV_PTR;
@ -1413,7 +1413,7 @@ int ModApiEnvMod::l_compare_block_status(lua_State *L)
// forceload_free_block(blockpos)
// blockpos = {x=num, y=num, z=num}
int ModApiEnvMod::l_forceload_free_block(lua_State *L)
int ModApiEnv::l_forceload_free_block(lua_State *L)
{
GET_ENV_PTR;
@ -1423,7 +1423,7 @@ int ModApiEnvMod::l_forceload_free_block(lua_State *L)
}
// get_translated_string(lang_code, string)
int ModApiEnvMod::l_get_translated_string(lua_State * L)
int ModApiEnv::l_get_translated_string(lua_State * L)
{
GET_ENV_PTR;
std::string lang_code = luaL_checkstring(L, 1);
@ -1435,7 +1435,7 @@ int ModApiEnvMod::l_get_translated_string(lua_State * L)
return 1;
}
void ModApiEnvMod::Initialize(lua_State *L, int top)
void ModApiEnv::Initialize(lua_State *L, int top)
{
API_FCT(set_node);
API_FCT(bulk_set_node);
@ -1488,7 +1488,7 @@ void ModApiEnvMod::Initialize(lua_State *L, int top)
API_FCT(get_translated_string);
}
void ModApiEnvMod::InitializeClient(lua_State *L, int top)
void ModApiEnv::InitializeClient(lua_State *L, int top)
{
API_FCT(get_node_light);
API_FCT(get_timeofday);

@ -54,7 +54,7 @@ protected:
};
class ModApiEnvMod : public ModApiEnvBase {
class ModApiEnv : public ModApiEnvBase {
private:
// set_node(pos, node)
// pos = {x=num, y=num, z=num}

@ -564,7 +564,7 @@ const luaL_Reg LuaItemStack::methods[] = {
*/
// register_item_raw({lots of stuff})
int ModApiItemMod::l_register_item_raw(lua_State *L)
int ModApiItem::l_register_item_raw(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
luaL_checktype(L, 1, LUA_TTABLE);
@ -631,7 +631,7 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
}
// unregister_item(name)
int ModApiItemMod::l_unregister_item_raw(lua_State *L)
int ModApiItem::l_unregister_item_raw(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
std::string name = luaL_checkstring(L, 1);
@ -652,7 +652,7 @@ int ModApiItemMod::l_unregister_item_raw(lua_State *L)
}
// register_alias_raw(name, convert_to_name)
int ModApiItemMod::l_register_alias_raw(lua_State *L)
int ModApiItem::l_register_alias_raw(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
std::string name = luaL_checkstring(L, 1);
@ -668,7 +668,7 @@ int ModApiItemMod::l_register_alias_raw(lua_State *L)
}
// get_content_id(name)
int ModApiItemMod::l_get_content_id(lua_State *L)
int ModApiItem::l_get_content_id(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
std::string name = luaL_checkstring(L, 1);
@ -694,7 +694,7 @@ int ModApiItemMod::l_get_content_id(lua_State *L)
}
// get_name_from_content_id(name)
int ModApiItemMod::l_get_name_from_content_id(lua_State *L)
int ModApiItem::l_get_name_from_content_id(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
content_t c = luaL_checkint(L, 1);
@ -706,7 +706,7 @@ int ModApiItemMod::l_get_name_from_content_id(lua_State *L)
return 1; /* number of results */
}
void ModApiItemMod::Initialize(lua_State *L, int top)
void ModApiItem::Initialize(lua_State *L, int top)
{
API_FCT(register_item_raw);
API_FCT(unregister_item_raw);
@ -715,14 +715,14 @@ void ModApiItemMod::Initialize(lua_State *L, int top)
API_FCT(get_name_from_content_id);
}
void ModApiItemMod::InitializeAsync(lua_State *L, int top)
void ModApiItem::InitializeAsync(lua_State *L, int top)
{
// all read-only functions
API_FCT(get_content_id);
API_FCT(get_name_from_content_id);
}
void ModApiItemMod::InitializeClient(lua_State *L, int top)
void ModApiItem::InitializeClient(lua_State *L, int top)
{
// all read-only functions
API_FCT(get_content_id);

@ -163,7 +163,7 @@ public:
static const char className[];
};
class ModApiItemMod : public ModApiBase {
class ModApiItem : public ModApiBase {
private:
static int l_register_item_raw(lua_State *L);
static int l_unregister_item_raw(lua_State *L);

@ -79,9 +79,9 @@ void ClientScripting::InitializeModApi(lua_State *L, int top)
ModApiUtil::InitializeClient(L, top);
ModApiClient::Initialize(L, top);
ModApiItemMod::InitializeClient(L, top);
ModApiItem::InitializeClient(L, top);
ModApiStorage::Initialize(L, top);
ModApiEnvMod::InitializeClient(L, top);
ModApiEnv::InitializeClient(L, top);
ModApiChannels::Initialize(L, top);
ModApiParticlesLocal::Initialize(L, top);
ModApiClientSound::Initialize(L, top);

@ -112,7 +112,7 @@ void ServerScripting::initAsync()
asyncEngine.registerStateInitializer(InitializeAsync);
asyncEngine.registerStateInitializer(ModApiUtil::InitializeAsync);
asyncEngine.registerStateInitializer(ModApiCraft::InitializeAsync);
asyncEngine.registerStateInitializer(ModApiItemMod::InitializeAsync);
asyncEngine.registerStateInitializer(ModApiItem::InitializeAsync);
asyncEngine.registerStateInitializer(ModApiServer::InitializeAsync);
// not added: ModApiMapgen is a minefield for thread safety
// not added: ModApiHttp async api can't really work together with our jobs
@ -158,9 +158,9 @@ void ServerScripting::InitializeModApi(lua_State *L, int top)
// Initialize mod api modules
ModApiAuth::Initialize(L, top);
ModApiCraft::Initialize(L, top);
ModApiEnvMod::Initialize(L, top);
ModApiEnv::Initialize(L, top);
ModApiInventory::Initialize(L, top);
ModApiItemMod::Initialize(L, top);
ModApiItem::Initialize(L, top);
ModApiMapgen::Initialize(L, top);
ModApiParticles::Initialize(L, top);
ModApiRollback::Initialize(L, top);