Underground 2 Revived
Play Need for Speed: Underground 2 (2004) in Chrome and Firefox with WebGPU graphics, Web Audio, up to 120 fps widescreen, controller support, free roam and Online races with friends. Fan project, not
翻译准备中
Source2Mod: Source 2 server modding on Metamod:Source -- native and SourcePawn .smx plugins
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Source2Mod is a server modification for Counter-Strike 2 on top of Metamod:Source. Plugins are written in C++ or SourcePawn -- both are first-class, load side by side and use the same API: full access to Source 2 internals, together with the high-level pieces every server plugin needs.
Source2Mod is the successor of Source2Toolkit: its C++ core and SDK carried over, and SourcePawn was added on top of them.
| C++ | SourcePawn | |
|---|---|---|
| Plugin file | .smx -- a native library | .smx -- a compiled SourcePawn script |
| Built with | The SDK (CMake or AMBuild) | spcomp, shipped in addons/source2mod/scripting |
| API | ISource2Mod* interfaces, g_pSource2Mod* globals | Source2Mod* methodmaps, #include <source2mod/api> |
| Schema | Generated classes (CCSPlayerController, ...) | Methodmaps of the same names, fields as properties |
| Hot reload | Yes | Yes |
The core tells the two kinds apart by the file itself, so both go into
addons/source2mod/plugins/. The script API mirrors the C++ one name for
name -- ISource2ModCommands::RegisterConCommand is
Source2ModCommands.RegisterConCommand -- and C++ plugins can give scripts
natives of their own. cpp_sample and sp_sample in
source2mod-samples are the
same plugin in both languages, section for section.
// C++
g_pSource2ModCommands->RegisterConCommand("hello", [](const Source2ModCommandContext& ctx, const Source2ModCommandArgs&, bool)
{
if (auto* player = CCSPlayerController::FromSlot(ctx.GetPlayerSlot()))
player->PrintToChat("Hello!");
});
// SourcePawn
public void OnPluginStart()
{
Source2ModCommands.RegisterConCommand("hello", Cmd_Hello);
}
public void Cmd_Hello(Source2ModCommandContext context, Source2ModCommandArgs args, bool post)
{
CCSPlayerController player = CCSPlayerController.FromSlot(context.GetPlayerSlot());
if (player != NULL_ENTITY)
player.PrintToChat("Hello!");
}
Everything below is there for C++ and SourcePawn alike.
dontBroadcast, firing your own@all / @ct targets with immunityconfigs/databases.jsonPrerequisites: CMake 3.18+, a C++20 compiler, Metamod:Source on the server.
git clone --recurse-submodules https://github.com/Source2Mod/source2mod.git
cd source2mod
docker compose -f docker/docker-compose.yml up
The build puts the core, the gamedata and addons/source2mod/scripting
(spcomp and the include set) under addons/, ready to copy to the server.
The documentation is on source2mod.net: every example in C++ and SourcePawn, guides and the full API reference.
add_source2mod_plugin(...);
cpp_sample
shows every area of the API.#include <source2mod/api> and compile with
addons/source2mod/scripting/spcomp (the include set is also the SDK's
public/scripting);
sp_sample
is the same plugin as a script.A plugin asks the core for every interface by name and revision
(ISource2ModCommands004); PluginApi::Source2ModFactory() in
src/core/pluginapi.cpp answers:
src/compat/ -- a generated adapter
(src/compat/gen/) with the old vtable, forwarding each method by name and
signature to the current interface, so plugins built against it keep
loading; methods whose signature changed are written by hand in
src/compat/<ISource2ModX00N>.cpp;Changing an interface:
tools/ifacecompat/ifacecompat.py bump ISource2ModCommands # before editing: freeze the current revision, raise the SDK's
# edit the SDK header, implement it in the core
tools/ifacecompat/ifacecompat.py generate # write the adapters
CMake runs ifacecompat.py check and stops when src/compat/gen is stale.
SourcePawn natives bind by name and need none of this; the rules for them, and
the rest, are on Compatibility.
Fork the repository, branch off main, and open the pull request against
main -- dev is the maintainer's own working branch. The full walkthrough
(upstream remote, rebasing, what a pull request needs) is in
CONTRIBUTING.md. What is still open -- and the community
plugins Source2Mod is waiting for -- is in TODO.md.
This project is licensed under the GNU General Public License v3.0, with a linking exception for Valve's engines and games, a dual-licensing exception and an MIT exception for derivative works. See LICENSE_INFO.txt for the terms and LICENSE for the full GPLv3 text.
No. The GPLv3 license carries an explicit MIT exception for derivative works: your plugins, C++ or SourcePawn, can stay closed-source or commercial. The exception covers what you build on Source2Mod, not Source2Mod itself -- a modified Source2Mod or SDK stays under the GPLv3.
SourcePawn and the parts of the include set that come from SourceMod stay under AlliedModders LLC's own license terms; the exception above does not change them.
The full list is in ACKNOWLEDGEMENTS.md.