Add CSM restriction flag to block third party CSMs (#162)
This commit is contained in:
parent
bc3f43705c
commit
8eb09a5aa1
@ -1352,6 +1352,7 @@ server_side_occlusion_culling (Server side occlusion culling) bool true
|
|||||||
# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to
|
# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to
|
||||||
# csm_restriction_noderange)
|
# csm_restriction_noderange)
|
||||||
# READ_PLAYERINFO: 32 (disable get_player_names call client-side)
|
# READ_PLAYERINFO: 32 (disable get_player_names call client-side)
|
||||||
|
# THIRD_PARTY_MODS: 256 (disable loading third-party CSMs)
|
||||||
csm_restriction_flags (Client side modding restrictions) int 62
|
csm_restriction_flags (Client side modding restrictions) int 62
|
||||||
|
|
||||||
# If the CSM restriction for node range is enabled, get_node calls are limited
|
# If the CSM restriction for node range is enabled, get_node calls are limited
|
||||||
|
@ -1611,6 +1611,7 @@
|
|||||||
# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to
|
# LOOKUP_NODES_LIMIT: 16 (limits get_node call client-side to
|
||||||
# csm_restriction_noderange)
|
# csm_restriction_noderange)
|
||||||
# READ_PLAYERINFO: 32 (disable get_player_names call client-side)
|
# READ_PLAYERINFO: 32 (disable get_player_names call client-side)
|
||||||
|
# THIRD_PARTY_MODS: 256 (disable loading third-party client-provided mods)
|
||||||
# type: int
|
# type: int
|
||||||
# csm_restriction_flags = 60
|
# csm_restriction_flags = 60
|
||||||
|
|
||||||
|
@ -164,6 +164,7 @@ void Client::loadMods()
|
|||||||
scanModIntoMemory(BUILTIN_MOD_NAME, getBuiltinLuaPath());
|
scanModIntoMemory(BUILTIN_MOD_NAME, getBuiltinLuaPath());
|
||||||
m_script->loadModFromMemory(BUILTIN_MOD_NAME);
|
m_script->loadModFromMemory(BUILTIN_MOD_NAME);
|
||||||
|
|
||||||
|
if (!checkCSMRestrictionFlag(CSMRestrictionFlags::CSM_RF_THIRD_PARTY_MODS)) {
|
||||||
ClientModConfiguration modconf(getClientModsLuaPath());
|
ClientModConfiguration modconf(getClientModsLuaPath());
|
||||||
m_mods = modconf.getMods();
|
m_mods = modconf.getMods();
|
||||||
// complain about mods with unsatisfied dependencies
|
// complain about mods with unsatisfied dependencies
|
||||||
@ -191,6 +192,7 @@ void Client::loadMods()
|
|||||||
// Run them
|
// Run them
|
||||||
for (const ModSpec &mod : m_mods)
|
for (const ModSpec &mod : m_mods)
|
||||||
m_script->loadModFromMemory(mod.name);
|
m_script->loadModFromMemory(mod.name);
|
||||||
|
}
|
||||||
|
|
||||||
// Mods are done loading. Unlock callbacks
|
// Mods are done loading. Unlock callbacks
|
||||||
m_mods_loaded = true;
|
m_mods_loaded = true;
|
||||||
|
@ -1051,6 +1051,7 @@ enum CSMRestrictionFlags : u64 {
|
|||||||
CSM_RF_READ_NODEDEFS = 0x00000008, // Disable nodedef lookups
|
CSM_RF_READ_NODEDEFS = 0x00000008, // Disable nodedef lookups
|
||||||
CSM_RF_LOOKUP_NODES = 0x00000010, // Limit node lookups
|
CSM_RF_LOOKUP_NODES = 0x00000010, // Limit node lookups
|
||||||
CSM_RF_READ_PLAYERINFO = 0x00000020, // Disable player info lookups
|
CSM_RF_READ_PLAYERINFO = 0x00000020, // Disable player info lookups
|
||||||
|
CSM_RF_THIRD_PARTY_MODS = 0x00000100, // Don't load third-party CSMs
|
||||||
CSM_RF_ALL = 0xFFFFFFFF,
|
CSM_RF_ALL = 0xFFFFFFFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ const static CSMFlagDesc flagdesc_csm_restriction[] = {
|
|||||||
{"read_nodedefs", CSM_RF_READ_NODEDEFS},
|
{"read_nodedefs", CSM_RF_READ_NODEDEFS},
|
||||||
{"lookup_nodes", CSM_RF_LOOKUP_NODES},
|
{"lookup_nodes", CSM_RF_LOOKUP_NODES},
|
||||||
{"read_playerinfo", CSM_RF_READ_PLAYERINFO},
|
{"read_playerinfo", CSM_RF_READ_PLAYERINFO},
|
||||||
|
{"third_party_mods", CSM_RF_THIRD_PARTY_MODS},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user