Merge branch master into CmakeMultiConfig.
This commit is contained in:
commit
180b9b9099
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,6 +19,7 @@ cloc.xsl
|
||||
## emacs
|
||||
*.*~
|
||||
*~
|
||||
*.orig
|
||||
|
||||
# world inside source
|
||||
ChunkWorx.ini
|
||||
|
@ -36,6 +36,11 @@ endif()
|
||||
if(MSVC)
|
||||
# Make build use multiple threads under MSVC:
|
||||
add_flags_cxx("/MP")
|
||||
elseif(APPLE)
|
||||
#on os x clang adds pthread for us but we need to add it for gcc
|
||||
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
add_flags_cxx("-pthread")
|
||||
endif()
|
||||
else()
|
||||
# Let gcc / clang know that we're compiling a multi-threaded app:
|
||||
add_flags_cxx("-pthread")
|
||||
@ -71,6 +76,17 @@ if (WIN32)
|
||||
add_definitions(-DLUA_BUILD_AS_DLL)
|
||||
endif()
|
||||
|
||||
# On Unix we use two dynamic loading libraries dl and ltdl.
|
||||
# Preference is for dl on unknown systems as it is specified in POSIX
|
||||
# the dynamic loader is used by lua and sqllite.
|
||||
if (UNIX)
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
set(DYNAMIC_LOADER ltdl)
|
||||
else()
|
||||
set(DYNAMIC_LOADER dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# The Expat library is linked in statically, make the source files aware of that:
|
||||
add_definitions(-DXML_STATIC)
|
||||
|
||||
@ -147,21 +163,16 @@ add_subdirectory(lib/expat/)
|
||||
add_subdirectory(lib/luaexpat/)
|
||||
add_subdirectory(lib/md5/)
|
||||
|
||||
# Re-add the maximum warning level:
|
||||
# Remove disabling the maximum warning level:
|
||||
# clang does not like a command line that reads -Wall -Wextra -w -Wall -Wextra and does not output any warnings
|
||||
# We do not do that for MSVC since MSVC produces an awful lot of warnings for its own STL headers;
|
||||
# the important warnings will be turned on using #pragma in Globals.h
|
||||
# the important warnings are turned on using #pragma in Globals.h
|
||||
if (NOT MSVC)
|
||||
#TODO: set -Wall -Werror -Wextra
|
||||
add_flags_cxx("-Wall -Wextra")
|
||||
string(REPLACE "-w" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
string(REPLACE "-w" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
string(REPLACE "-w" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
string(REPLACE "-w" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -rdynamic")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_PROFILE} -rdynamic")
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory (src)
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
Code Stuff
|
||||
----------
|
||||
|
||||
@ -23,7 +22,9 @@ Code Stuff
|
||||
- This helps prevent mistakes such as "if (a & 1 == 0)"
|
||||
* White space is free, so use it freely
|
||||
- "freely" as in "plentifully", not "arbitrarily"
|
||||
* Please leave the first line of all files blank, to get around an IDE bug.
|
||||
* Each and every control statement deserves its braces. This helps maintainability later on when the file is edited, lines added or removed - the control logic doesn't break so easily.
|
||||
* Please leave the first line of all source files blank, to get around an IDE bug.
|
||||
* Also leave the last line of all source files blank (GCC and GIT can complain otherwise)
|
||||
|
||||
|
||||
Copyright
|
||||
|
@ -19,5 +19,6 @@ SamJBarney
|
||||
worktycho
|
||||
Sxw1212
|
||||
tonibm19
|
||||
Diusrex
|
||||
|
||||
Please add yourself to this list if you contribute to MCServer.
|
||||
|
121
GETTING-STARTED.md
Normal file
121
GETTING-STARTED.md
Normal file
@ -0,0 +1,121 @@
|
||||
Hello! Thanks for wanting to work on this project :smile:, and I hope that this file will help you somewhat in getting all set up and running. I'll go through the basics of getting the projet environment set up, the code organization and style, and general development practices. I'll also show you some good issues to start off working on to get yourself familiarised with the code.
|
||||
|
||||
Minecraft Basics
|
||||
----------------
|
||||
|
||||
If you don't play Minecraft or don't have a great knowledge of the basic systems, you should get to know them. The [Minecraft Wiki](http://minecraft.gamepedia.com/Minecraft_Wiki) is quite useful for this task, although some youtubers are also fairly good at teaching the basics and just playing is quite good too.
|
||||
|
||||
I'd say that the important topics are:
|
||||
|
||||
* Differnt types of blocks and how they act.
|
||||
* Mobs, what they do and how.
|
||||
* Redstone, pistons, and automation.
|
||||
* Farming
|
||||
* Fighting, health and the hunger system.
|
||||
|
||||
Useful Resources
|
||||
----------------
|
||||
|
||||
* [Minecraft Wiki](http://minecraft.gamepedia.com/Minecraft_Wiki)
|
||||
* [Minecraft Protocol Wiki](http://wiki.vg)
|
||||
* [Lua API Documentation](http://mc-server.xoft.cz/LuaAPI)
|
||||
* [VS2008 Download](http://stackoverflow.com/questions/15318560/visual-c-2008-express-download-link-dead)
|
||||
|
||||
Setting up a Dev Environment
|
||||
============================
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
**Linux/BSD/Solaris/OSX:**
|
||||
|
||||
You'll need the basic C++ build tools:
|
||||
|
||||
* gcc (or clang or another C compiler)
|
||||
* g++ (or clang++ or another C++ compiler)
|
||||
* make
|
||||
|
||||
You'll also need CMake to generate the makefile to build from.
|
||||
|
||||
**Windows:**
|
||||
|
||||
If you use Windows, your best bet is the MSVC2008 (available as a free download in the Express edition from MS) or MSVS2013 (ditto), solution files for both are currently in the repo.
|
||||
|
||||
Setting up the Repo
|
||||
-------------------
|
||||
|
||||
Next, you'll need to set up the repo. You can make a fork and work on that then PR in, or I can set you up with membership for the repo so you can work on branches here (still use PRs though, they're great tools and for the first few you'll definitely need some changes). If you want membership to the repo, just create an issue and I can set you up.
|
||||
|
||||
Once you've cloned, you need to pull down the submodules:
|
||||
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
After that they should come down automatically when you pull but it's not bad to refresh every once in a while.
|
||||
|
||||
Repo Arrangement
|
||||
---------------------------
|
||||
|
||||
The MCServer repo has recently been rearranged for better code separation and other things, but basically it's split into a few areas:
|
||||
|
||||
* `src`
|
||||
This holds all of the MCServer source code, and is where most development takes place.
|
||||
It's split into logical areas for blocks, the protocol handling and other things.
|
||||
* `lib`
|
||||
This holds all the 3rd party libraries for MCServer. You basically don't need to touch these, and we're thinking of switching them into submodules soon.
|
||||
* `MCServer`
|
||||
This folder isn't greatly named, but it contains the default plugins and environment to actually run the server. You'll find the executable (named `MCServer`) here and in the `plugins` subdir the default plugins. The config files are also stored here. Config files with `.example.ini` on the end are generated by the server or source control and should be left alone, instead you should copy them to a file without the `example` in the name which will be prioritised over the generated ones.
|
||||
|
||||
Code Styles
|
||||
------------------
|
||||
|
||||
Mainly follow the code styles in [CONTRIBUTING.md](https://github.com/mc-server/MCServer/blob/master/CONTRIBUTING.md), which is definitely an important read.
|
||||
|
||||
|
||||
How to Build
|
||||
------------------
|
||||
|
||||
**Linux/BSD/Solaris/OSX:**
|
||||
|
||||
Follow the instructions in [COMPILING.md](https://github.com/mc-server/MCServer/blob/master/COMPILING.md). You probably want to build in debug mode (when you're developing) for console alerts and debugging capability, even though it's much slower for everyday use.
|
||||
|
||||
Basically, the process is:
|
||||
|
||||
cmake . -DCMAKE_BUILD_TYPE=DEBUG && make
|
||||
|
||||
**Windows:**
|
||||
|
||||
You need to first execute the `src/Bindings/AllToLua.bat` script file, then just open the solution file in your MSVC of choice and build.
|
||||
|
||||
How to Run
|
||||
----------
|
||||
|
||||
The server can be run (on *nix) by a simple `./MCServer` in the `MCServer` directory. On first run it will generate the world and start a server on the default port (configurable in `settings.ini`) so you can connect in minecraft via `localhost`.
|
||||
|
||||
Where to Get Started
|
||||
-------------------------------
|
||||
|
||||
There are a few fairly easy issues for you to get started with, as well as some more difficult but interesting ones.
|
||||
|
||||
**Easy**:
|
||||
|
||||
* #288
|
||||
* #385
|
||||
* #402
|
||||
* #388
|
||||
* #380
|
||||
* Clean up some of the compiler warnings. (Check [Travis CI](http://travis-ci.org/mc-server/MCServer) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
|
||||
|
||||
**More Difficult**:
|
||||
|
||||
* #17
|
||||
* #418
|
||||
* #398
|
||||
|
||||
You may also want to write some plugins. They are written in lua, with excellent API documentation available via [APIDump](http://mc-server.xoft.cz/LuaAPI). The [Core](https://github.com/mc-server/Core) plugin should also help quite a bit here.
|
||||
|
||||
Special Things
|
||||
---------------------
|
||||
|
||||
* MCServer uses ToLUA for the Lua API, and you'll really have to ask @madmaxoft for how to export stuff and @worktycho for how to add stuff to the auto generated bindings (he just re-worked it with CMake).
|
||||
* Ask questions as much as you like, we're here to help :smiley:
|
@ -867,6 +867,10 @@ ValueName0=SomeOtherValue
|
||||
{ Params = "KeyName, Comment", Return = "", Notes = "Adds a comment to be stored in the file under the specified key" },
|
||||
},
|
||||
AddKeyName = { Params = "KeyName", Returns = "number", Notes = "Adds a new key of the specified name. Returns the KeyID of the new key." },
|
||||
AddValue = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
|
||||
AddValueB = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new bool value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
|
||||
AddValueF = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new float value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
|
||||
AddValueI = { Params = "KeyName, ValueName, Value", Return = "", Notes = "Adds a new integer value of the specified name to the specified key. If another value of the same name exists in the key, both are kept (nonstandard INI file)" },
|
||||
CaseInsensitive = { Params = "", Return = "", Notes = "Sets key names' and value names' comparisons to case insensitive (default)." },
|
||||
CaseSensitive = { Params = "", Return = "", Notes = "Sets key names and value names comparisons to case sensitive." },
|
||||
Clear = { Params = "", Return = "", Notes = "Removes all the in-memory data. Note that , like all the other operations, this doesn't affect any file data." },
|
||||
@ -1713,7 +1717,7 @@ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChatMessage);
|
||||
ForceExecuteCommand = { Params = "{{cPlayer|Player}}, CommandStr", Return = "bool", Notes = "Same as ExecuteCommand, but doesn't check permissions" },
|
||||
ForEachCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function(Command, Permission, HelpString)</pre>. If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." },
|
||||
ForEachConsoleCommand = { Params = "CallbackFn", Return = "bool", Notes = "Calls the CallbackFn function for each command that has been bound using BindConsoleCommand(). The CallbackFn has the following signature: <pre class=\"prettyprint lang-lua\">function (Command, HelpString)</pre>. If the callback returns true, the enumeration is aborted and this API function returns false; if it returns false or no value, the enumeration continues with the next command, and the API function returns true." },
|
||||
Get = { Params = "", Return = "cPluginManager", Notes = "Returns the single instance of the plugin manager" },
|
||||
Get = { Params = "", Return = "cPluginManager", Notes = "(STATIC) Returns the single instance of the plugin manager" },
|
||||
GetAllPlugins = { Params = "", Return = "table", Notes = "Returns a table (dictionary) of all plugins, [name => {{cPlugin}}] pairing." },
|
||||
GetCommandPermission = { Params = "Command", Return = "Permission", Notes = "Returns the permission needed for executing the specified command" },
|
||||
GetCurrentPlugin = { Params = "", Return = "{{cPlugin}}", Notes = "Returns the {{cPlugin}} object for the calling plugin. This is the same object that the Initialize function receives as the argument." },
|
||||
|
20
MCServer/Plugins/APIDump/Hooks/OnPlayerFished.lua
Normal file
20
MCServer/Plugins/APIDump/Hooks/OnPlayerFished.lua
Normal file
@ -0,0 +1,20 @@
|
||||
return
|
||||
{
|
||||
HOOK_PLAYER_FISHED =
|
||||
{
|
||||
CalledWhen = "A player gets a reward from fishing.",
|
||||
DefaultFnName = "OnPlayerFished", -- also used as pagename
|
||||
Desc = [[
|
||||
This hook gets called after a player reels in the fishing rod. This is a notification-only hook, the reward has already been decided. If a plugin needs to modify the reward, use the {{OnPlayerFishing|HOOK_PLAYER_FISHING}} hook.
|
||||
]],
|
||||
Params =
|
||||
{
|
||||
{ Name = "Player", Type = "{{cPlayer}}", Notes = "The player who pulled the fish in." },
|
||||
{ Name = "Reward", Type = "{{cItems}}", Notes = "The reward the player gets. It can be a fish, treasure and junk." },
|
||||
},
|
||||
Returns = [[
|
||||
If the function returns false or no value, the next plugin's callback is called. If the function returns true, no other
|
||||
callback is called for this event.
|
||||
]],
|
||||
}, -- HOOK_PLAYER_FISHED
|
||||
};
|
21
MCServer/Plugins/APIDump/Hooks/OnPlayerFishing.lua
Normal file
21
MCServer/Plugins/APIDump/Hooks/OnPlayerFishing.lua
Normal file
@ -0,0 +1,21 @@
|
||||
return
|
||||
{
|
||||
HOOK_PLAYER_FISHING =
|
||||
{
|
||||
CalledWhen = "A player is about to get a reward from fishing.",
|
||||
DefaultFnName = "OnPlayerFishing", -- also used as pagename
|
||||
Desc = [[
|
||||
This hook gets called when a player right clicks with a fishing rod while the floater is under water. The reward is already descided, but the plugin may change it.
|
||||
]],
|
||||
Params =
|
||||
{
|
||||
{ Name = "Player", Type = "{{cPlayer}}", Notes = "The player who pulled the fish in." },
|
||||
{ Name = "Reward", Type = "{{cItems}}", Notes = "The reward the player gets. It can be a fish, treasure and junk." },
|
||||
},
|
||||
Returns = [[
|
||||
If the function returns false or no value, the next plugin's callback is called. Afterwards, the
|
||||
server gives the player his reward. If the function returns true, no other
|
||||
callback is called for this event and the player doesn't get his reward.
|
||||
]],
|
||||
}, -- HOOK_PLAYER_FISHING
|
||||
};
|
79
MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
Normal file
79
MCServer/Plugins/APIDump/Hooks/OnPluginsLoaded.lua
Normal file
@ -0,0 +1,79 @@
|
||||
return
|
||||
{
|
||||
HOOK_PLUGINS_LOADED =
|
||||
{
|
||||
CalledWhen = "All the enabled plugins have been loaded",
|
||||
DefaultFnName = "OnPluginsLoaded", -- also used as pagename
|
||||
Desc = [[
|
||||
This callback gets called when the server finishes loading and initializing plugins. This is the
|
||||
perfect occasion for a plugin to query other plugins through {{cPluginManager}}:GetPlugin() and
|
||||
possibly start communicating with them using the {{cPlugin}}:Call() function.
|
||||
]],
|
||||
Params = {},
|
||||
Returns = [[
|
||||
The return value is ignored, all registered callbacks are called.
|
||||
]],
|
||||
CodeExamples =
|
||||
{
|
||||
{
|
||||
Title = "CoreMessaging",
|
||||
Desc = [[
|
||||
This example shows how to implement the CoreMessaging functionality - messages to players will be
|
||||
sent through the Core plugin, formatted by that plugin. As a fallback for when the Core plugin is
|
||||
not present, the messages are sent directly by this code, unformatted.
|
||||
]],
|
||||
Code = [[
|
||||
-- These are the fallback functions used when the Core is not present:
|
||||
local function SendMessageFallback(a_Player, a_Message)
|
||||
a_Player:SendMessage(a_Message);
|
||||
end
|
||||
|
||||
local function SendMessageSuccessFallback(a_Player, a_Message)
|
||||
a_Player:SendMessage(a_Message);
|
||||
end
|
||||
|
||||
local function SendMessageFailureFallback(a_Player, a_Message)
|
||||
a_Player:SendMessage(a_Message);
|
||||
end
|
||||
|
||||
-- These three "variables" will hold the actual functions to call.
|
||||
-- By default they are initialized to the Fallback variants, but will be redirected to Core when all plugins load
|
||||
SendMessage = SendMessageFallback;
|
||||
SendMessageSuccess = SendMessageSuccessFallback;
|
||||
SendMessageFailure = SendMessageFailureFallback;
|
||||
|
||||
-- The callback tries to connect to the Core, if successful, overwrites the three functions with Core ones
|
||||
local function OnPluginsLoaded()
|
||||
local CorePlugin = cPluginManager:Get():GetPlugin("Core");
|
||||
if (CorePlugin == nil) then
|
||||
-- The Core is not loaded, keep the Fallback functions
|
||||
return;
|
||||
end
|
||||
|
||||
-- Overwrite the three functions with Core functionality:
|
||||
SendMessage = function(a_Player, a_Message)
|
||||
CorePlugin:Call("SendMessage", a_Player, a_Message);
|
||||
end
|
||||
SendMessageSuccess = function(a_Player, a_Message)
|
||||
CorePlugin:Call("SendMessageSuccess", a_Player, a_Message);
|
||||
end
|
||||
SendMessageFailure = function(a_Player, a_Message)
|
||||
CorePlugin:Call("SendMessageFailure", a_Player, a_Message);
|
||||
end
|
||||
end
|
||||
|
||||
-- Global scope, register the callback:
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_PLUGINS_LOADED, CoreMessagingPluginsLoaded);
|
||||
|
||||
|
||||
-- Usage, anywhere else in the plugin:
|
||||
SendMessageFailure(a_Player, "Cannot teleport to player, the destination player " .. PlayerName .. " was not found");
|
||||
]],
|
||||
},
|
||||
} , -- CodeExamples
|
||||
}, -- HOOK_PLUGINS_LOADED
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -84,7 +84,7 @@ end
|
||||
To register a hook, insert the following code template into the "-- Hooks" area in the previous code example.
|
||||
</p>
|
||||
<pre class="prettyprint lang-lua">
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_NAME_HERE, FunctionNameToBeCalled)
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_NAME_HERE, FunctionNameToBeCalled)
|
||||
</pre>
|
||||
<p>
|
||||
What does this code do?
|
||||
@ -102,7 +102,7 @@ function Initialize(Plugin)
|
||||
Plugin:SetName("DerpyPlugin")
|
||||
Plugin:SetVersion(1)
|
||||
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
|
||||
|
||||
local PluginManager = cPluginManager:Get()
|
||||
-- Command bindings
|
||||
@ -200,7 +200,7 @@ function Initialize(Plugin)
|
||||
local PluginManager = cPluginManager:Get()
|
||||
PluginManager:BindCommand("/explode", "derpyplugin.explode", Explode, " ~ Explode a player");
|
||||
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_COLLECTING_PICKUP, OnCollectingPickup)
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_COLLECTING_PICKUP, OnCollectingPickup)
|
||||
|
||||
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
|
||||
return true
|
||||
|
@ -30,6 +30,11 @@ pre
|
||||
{
|
||||
border: 1px solid #ccc;
|
||||
background-color: #eee;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
-webkit-tab-size: 2;
|
||||
-ms-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
|
||||
body
|
||||
|
@ -321,6 +321,7 @@ function DumpAPIHtml()
|
||||
cFile:CreateFolder("API/Static");
|
||||
local localFolder = g_Plugin:GetLocalFolder();
|
||||
for idx, fnam in ipairs(cFile:GetFolderContents(localFolder .. "/Static")) do
|
||||
cFile:Delete("API/Static/" .. fnam);
|
||||
cFile:Copy(localFolder .. "/Static/" .. fnam, "API/Static/" .. fnam);
|
||||
end
|
||||
|
||||
@ -428,11 +429,18 @@ function DumpAPIHtml()
|
||||
WriteClasses(f, API, ClassMenu);
|
||||
WriteHooks(f, Hooks, UndocumentedHooks, HookNav);
|
||||
|
||||
-- Copy the static files to the output folder (overwrite any existing):
|
||||
cFile:Copy(g_Plugin:GetLocalFolder() .. "/main.css", "API/main.css");
|
||||
cFile:Copy(g_Plugin:GetLocalFolder() .. "/prettify.js", "API/prettify.js");
|
||||
cFile:Copy(g_Plugin:GetLocalFolder() .. "/prettify.css", "API/prettify.css");
|
||||
cFile:Copy(g_Plugin:GetLocalFolder() .. "/lang-lua.js", "API/lang-lua.js");
|
||||
-- Copy the static files to the output folder:
|
||||
local StaticFiles =
|
||||
{
|
||||
"main.css",
|
||||
"prettify.js",
|
||||
"prettify.css",
|
||||
"lang-lua.js",
|
||||
};
|
||||
for idx, fnam in ipairs(StaticFiles) do
|
||||
cFile:Delete("API/" .. fnam);
|
||||
cFile:Copy(g_Plugin:GetLocalFolder() .. "/" .. fnam, "API/" .. fnam);
|
||||
end
|
||||
|
||||
-- List the documentation problems:
|
||||
LOG("Listing leftovers...");
|
||||
@ -1169,7 +1177,7 @@ function WriteHtmlHook(a_Hook, a_HookNav)
|
||||
f:write("</table>\n<p>" .. (a_Hook.Returns or "") .. "</p>\n\n");
|
||||
f:write([[<hr /><h1>Code examples</h1><h2>Registering the callback</h2>]]);
|
||||
f:write("<pre class=\"prettyprint lang-lua\">\n");
|
||||
f:write([[cPluginManager.AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]);
|
||||
f:write([[cPluginManager:AddHook(cPluginManager.]] .. a_Hook.Name .. ", My" .. a_Hook.DefaultFnName .. [[);]]);
|
||||
f:write("</pre>\n\n");
|
||||
local Examples = a_Hook.CodeExamples or {};
|
||||
for i, example in ipairs(Examples) do
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 351aff7efa94ce3c7ba733d5f83013e8a3fdfbfd
|
||||
Subproject commit c65b56767a5e59ca387a05be72ef18791baa9aed
|
@ -19,14 +19,16 @@ function Initialize(Plugin)
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick2);
|
||||
--]]
|
||||
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
|
||||
cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_TICK, OnTick);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_CHAT, OnChat);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_PLUGINS_LOADED, OnPluginsLoaded);
|
||||
cPluginManager:AddHook(cPluginManager.HOOK_PLUGIN_MESSAGE, OnPluginMessage);
|
||||
|
||||
PM = cRoot:Get():GetPluginManager();
|
||||
PM:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities");
|
||||
@ -524,6 +526,14 @@ end
|
||||
|
||||
|
||||
|
||||
function OnPluginsLoaded()
|
||||
LOG("All plugins loaded");
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
|
||||
-- Get the topmost block coord:
|
||||
local Height = a_ChunkDesc:GetHeight(0, 0);
|
||||
@ -532,7 +542,6 @@ function OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)
|
||||
a_ChunkDesc:SetBlockTypeMeta(0, Height + 1, 0, E_BLOCK_SIGN_POST, 0);
|
||||
local BlockEntity = a_ChunkDesc:GetBlockEntity(0, Height + 1, 0);
|
||||
if (BlockEntity ~= nil) then
|
||||
LOG("Setting sign lines...");
|
||||
local SignEntity = tolua.cast(BlockEntity, "cSignEntity");
|
||||
SignEntity:SetLines("Chunk:", tonumber(a_ChunkX) .. ", " .. tonumber(a_ChunkZ), "", "(Debuggers)");
|
||||
end
|
||||
@ -954,3 +963,28 @@ end
|
||||
|
||||
|
||||
|
||||
|
||||
function OnPluginMessage(a_Client, a_Channel, a_Message)
|
||||
LOGINFO("Received a plugin message from client " .. a_Client:GetUsername() .. ": channel '" .. a_Channel .. "', message '" .. a_Message .. "'");
|
||||
|
||||
if (a_Channel == "REGISTER") then
|
||||
if (a_Message:find("WECUI")) then
|
||||
-- The client has WorldEditCUI mod installed, test the comm by sending a few WECUI messages:
|
||||
--[[
|
||||
WECUI messages have the following generic format:
|
||||
<shape>|<params>
|
||||
If shape is p (cuboid selection), the params are sent individually for each corner click and have the following format:
|
||||
<point-index>|<x>|<y>|<z>|<volume>
|
||||
point-index is 0 or 1 (lclk / rclk)
|
||||
volume is the 3D volume of the current cuboid selected (all three coords' deltas multiplied), including the edge blocks; -1 if N/A
|
||||
--]]
|
||||
-- Select a 51 * 51 * 51 block cuboid:
|
||||
a_Client:SendPluginMessage("WECUI", "p|0|50|50|50|-1");
|
||||
a_Client:SendPluginMessage("WECUI", "p|1|100|100|100|132651"); -- 132651 = 51 * 51 * 51
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
-- Global variables
|
||||
PLUGIN = {} -- Reference to own plugin object
|
||||
CHEST_WIDTH = 9
|
||||
HANDY_VERSION = 1
|
||||
HANDY_VERSION = 2
|
||||
--[[
|
||||
|
||||
Handy is a plugin for other plugins. It contain no commands, no hooks, but functions to ease plugins developers' life.
|
||||
|
@ -6,350 +6,211 @@ function GetHandyVersion()
|
||||
return HANDY_VERSION
|
||||
end
|
||||
-- Checks if handy is in proper version
|
||||
function CheckForRequiedVersion(IN_version)
|
||||
if (IN_version > HANDY_VERSION) then return false end
|
||||
function CheckForRequiedVersion( inVersion )
|
||||
if( inVersion > HANDY_VERSION ) then return false end
|
||||
return true
|
||||
end
|
||||
--[[
|
||||
MCS-specific _functions and nasty hacks :D
|
||||
]]
|
||||
-- There's a "GetChestHeight" function inside source code, but it's not lua-exported
|
||||
function GetChestHeightCheat(IN_chest)
|
||||
if (IN_chest:GetSlot(28) == nil) then -- this means we're trying to get double chest slot and FAIL
|
||||
LOGWARN("HANDY: single chest checked")
|
||||
return 3
|
||||
end
|
||||
LOGWARN("HANDY: double chest checked")
|
||||
return 6
|
||||
function GetChestHeightCheat( inChest )
|
||||
local chestGrid = inChest:GetContents()
|
||||
LOGINFO( "This function serves no purpose now! You should consider chest:GetContents():GetHeight() now!" )
|
||||
LOGINFO( "Also, you might find Handy's new 'IsChestDouble()' useful for your case" )
|
||||
return chestGrid:GetHeight()
|
||||
end
|
||||
-- Those two checks how many items of given IN_itemID chest and player have, and how much they could fit inside them
|
||||
function ReadChestForItem(IN_chest, IN_itemID)
|
||||
local _items_found = 0
|
||||
local _free_space = 0
|
||||
-- stalk through chest slots...
|
||||
local _slot_counter = 0
|
||||
local _slot_item
|
||||
local _item_max_stack = GetItemMaxStack(IN_itemID)
|
||||
while true do
|
||||
_slot_item = IN_chest:GetSlot(_slot_counter)
|
||||
if (_slot_item ~= nil) then
|
||||
if (_slot_item.m_ItemID == IN_itemID) then
|
||||
_items_found = _items_found + _slot_item.m_ItemCount
|
||||
_free_space = _free_space + (_item_max_stack - _slot_item.m_ItemCount)
|
||||
function IsChestDouble( inChest )
|
||||
local chestHeight = inChest:GetContents():GetHeight()
|
||||
if( chestHeight == 3 ) then
|
||||
return false
|
||||
end
|
||||
if (_slot_item:IsEmpty() == true) then
|
||||
_free_space = _free_space + _item_max_stack
|
||||
end
|
||||
end
|
||||
_slot_counter = _slot_counter + 1
|
||||
if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return _items_found, _free_space
|
||||
return true
|
||||
end
|
||||
function ReadPlayerForItem(IN_player, IN_itemID)
|
||||
local _items_found = 0
|
||||
local _free_space = 0
|
||||
-- stalk through IN_player inventory slots...
|
||||
local _slot_counter = 9
|
||||
if (ItemIsArmor(IN_itemID) == true) then _slot_counter = 5 end
|
||||
local _slot_item
|
||||
local _item_max_stack = GetItemMaxStack(IN_itemID)
|
||||
while true do
|
||||
_slot_item = IN_player:GetInventory():GetSlot(_slot_counter)
|
||||
if (_slot_item ~= nil) then
|
||||
if (_slot_item.m_ItemID == IN_itemID) then
|
||||
_items_found = _items_found + _slot_item.m_ItemCount
|
||||
_free_space = _free_space + (_item_max_stack - _slot_item.m_ItemCount)
|
||||
end
|
||||
if (_slot_item:IsEmpty() == true) then
|
||||
_free_space = _free_space + _item_max_stack
|
||||
end
|
||||
end
|
||||
_slot_counter = _slot_counter + 1
|
||||
if (_slot_counter == 45) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return _items_found, _free_space
|
||||
-- Those two checks how many items of given inItemID chest and player have, and how much they could fit inside them
|
||||
function ReadChestForItem( inChest, inItemID )
|
||||
return ReadGridForItems( inChest:GetContents(), inItemID )
|
||||
end
|
||||
-- Following functions are for chest-related operations (since noone was bothered writing them in MCS code)
|
||||
function ReadPlayerForItem( inPlayer, inItemID )
|
||||
local inventoryFound, inventoryFree = ReadGridForItems( inPlayer:GetInventory():GetInventoryGrid(), inItemID )
|
||||
local hotbarFound, hotbarFree = ReadGridForItems( inPlayer:GetInventory():GetHotbarGrid(), inItemID )
|
||||
local itemsFound = inventoryFound + hotbarFound
|
||||
local freeSpace = inventoryFree + hotbarFree
|
||||
return itemsFound, freeSpace
|
||||
end
|
||||
-- Following functions are for chest-related operations
|
||||
-- BEWARE! Those assume you did checked if chest has items/space in it!
|
||||
function TakeItemsFromChest(IN_chest, IN_itemID, IN_ammount) -- UNSAFE! CHECK FOR ITEMS FIRST!!
|
||||
-- stalk through chest slots...
|
||||
local _slot_counter = 0
|
||||
local _slot_item
|
||||
local _take_count = IN_ammount
|
||||
while true do
|
||||
_slot_item = IN_chest:GetSlot(_slot_counter)
|
||||
if (_slot_item ~= nil) then
|
||||
if (_slot_item.m_ItemID == IN_itemID) then
|
||||
-- assuming player have enought money
|
||||
if (_take_count > 0) then
|
||||
if (_take_count > _slot_item.m_ItemCount) then
|
||||
_take_count = _take_count - _slot_item.m_ItemCount
|
||||
IN_chest:SetSlot(_slot_counter, cItem()) -- a bit hacky, can't make cItem:Clear() work(
|
||||
function ReadGridForItems( inGrid, inItemID )
|
||||
local itemsFound = 0
|
||||
local freeSpace = 0
|
||||
local slotsCount = inGrid:GetNumSlots()
|
||||
local testerItem = cItem( inItemID )
|
||||
local maxStackSize = testerItem:GetMaxStackSize()
|
||||
for index = 0, (slotsCount - 1) do
|
||||
slotItem = inGrid:GetSlot( index )
|
||||
if( slotItem:IsEmpty() ) then
|
||||
freeSpace = freeSpace + maxStackSize
|
||||
else
|
||||
local _left_count = _slot_item.m_ItemCount - _take_count
|
||||
IN_chest:SetSlot(_slot_counter, cItem(_slot_item.m_ItemID, _left_count)) -- a bit hacky
|
||||
_take_count = 0
|
||||
end
|
||||
end
|
||||
if (_take_count == 0) then
|
||||
break
|
||||
if( slotItem:IsStackableWith( testerItem ) ) then
|
||||
itemsFound = itemsFound + slotItem.m_ItemCount
|
||||
freeSpace = maxStackSize - slotItem.m_ItemCount
|
||||
end
|
||||
end
|
||||
end
|
||||
_slot_counter = _slot_counter + 1
|
||||
if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
|
||||
break
|
||||
end
|
||||
end
|
||||
return itemsFound, freeSpace
|
||||
end
|
||||
function PutItemsToChest(IN_chest, IN_itemID, IN_ammount) -- UNSAFE! CHECK FOR SPACE FIRST!!
|
||||
-- stalk through chest slots...
|
||||
local _slot_counter = 0
|
||||
local _slot_item
|
||||
local _put_count = IN_ammount
|
||||
local _max_stack = GetItemMaxStack(IN_itemID)
|
||||
while true do
|
||||
_slot_item = IN_chest:GetSlot(_slot_counter)
|
||||
local _portion = 0
|
||||
local _ammount_to_set = 0
|
||||
if (_slot_item ~= nil) then
|
||||
if (_slot_item:IsEmpty() == true) then
|
||||
_portion = math.min(_max_stack, _put_count)
|
||||
_ammount_to_set = _portion
|
||||
|
||||
function TakeItemsFromGrid( inGrid, inItem )
|
||||
local slotsCount = inGrid:GetNumSlots()
|
||||
local removedItem = cItem( inItem )
|
||||
for index = 0, (slotsCount - 1) do
|
||||
slotItem = inGrid:GetSlot( index )
|
||||
if( slotItem:IsSameType( removedItem ) ) then
|
||||
if( slotItem.m_ItemCount <= removedItem.m_ItemCount ) then
|
||||
removedItem.m_ItemCount = removedItem.m_ItemCount - slotItem.m_ItemCount
|
||||
inGrid:EmptySlot( index )
|
||||
else
|
||||
if (_slot_item.m_ItemID == IN_itemID) then
|
||||
-- choose between how much we need to put and how much free space left
|
||||
_portion = math.min(_put_count, _max_stack - _slot_item.m_ItemCount)
|
||||
_ammount_to_set = _slot_item.m_ItemCount + _portion
|
||||
end
|
||||
end
|
||||
end
|
||||
IN_chest:SetSlot(_slot_counter, cItem(IN_itemID, _ammount_to_set)) -- we add max stack to chest
|
||||
_put_count = _put_count - _portion
|
||||
if (_put_count == 0) then break end
|
||||
_slot_counter = _slot_counter + 1
|
||||
if (_slot_counter == CHEST_WIDTH*GetChestHeightCheat(IN_chest)) then
|
||||
break
|
||||
removedItem.m_ItemCount = slotItem.m_ItemCount - removedItem.m_ItemCount
|
||||
inGrid:SetSlot( index, removedItem )
|
||||
removedItem.m_ItemCount = 0
|
||||
end
|
||||
if( removedItem.m_ItemCount <= 0 ) then break end
|
||||
end
|
||||
end
|
||||
return removedItem.m_ItemCount
|
||||
end
|
||||
--------------
|
||||
function TakeItemsFromChest( inChest, inItemID, inAmount ) -- MIGHT BE UNSAFE! CHECK FOR ITEMS FIRST!!
|
||||
local chestGrid = inChest:GetContents()
|
||||
local removedItem = cItem( inItemID, inAmount )
|
||||
TakeItemsFromGrid( chestGrid, removedItem )
|
||||
end
|
||||
function PutItemsToChest( inChest, inItemID, inAmount )
|
||||
local chestGrid = inChest:GetContents()
|
||||
local addedItem = cItem( inItemID, inAmount )
|
||||
chestGrid:AddItem( addedItem )
|
||||
end
|
||||
-- Similar to chest-related.
|
||||
function TakeItemsFromPlayer(IN_player, IN_itemID, IN_ammount) -- UNSAFE! CHECK FIRST!
|
||||
local _put_count = IN_ammount
|
||||
local _max_stack = GetItemMaxStack(IN_itemID)
|
||||
while true do
|
||||
local _portion = math.min(_max_stack, _put_count)
|
||||
IN_player:GetInventory():RemoveItem(cItem(IN_itemID, _portion))
|
||||
_put_count = _put_count - _portion
|
||||
if (_put_count == 0) then break end
|
||||
function TakeItemsFromPlayer( inPlayer, inItemID, inAmount ) -- MIGHT BE UNSAFE! CHECK FIRST!
|
||||
local removedItem = cItem( inItemID, inAmount )
|
||||
local inventoryGrid = inPlayer:GetInventory():GetInventoryGrid()
|
||||
local hotbarGrid = inPlayer:GetInventory():GetHotbarGrid()
|
||||
local itemsLeft = TakeItemsFromGrid( inventoryGrid, removedItem )
|
||||
if( itemsLeft > 0 ) then
|
||||
removedItem = cItem( inItemID, itemsLeft )
|
||||
TakeItemsFromGrid( hotbarGrid, removedItem )
|
||||
end
|
||||
end
|
||||
function GiveItemsToPlayer(IN_player, IN_itemID, IN_ammount) -- UNSAFE! CHECK FIRST!
|
||||
local _put_count = IN_ammount
|
||||
local _max_stack = GetItemMaxStack(IN_itemID)
|
||||
while true do
|
||||
local _portion = math.min(_max_stack, _put_count)
|
||||
IN_player:GetInventory():AddItem(cItem(IN_itemID, _portion))
|
||||
_put_count = _put_count - _portion
|
||||
if (_put_count == 0) then break end
|
||||
function GiveItemsToPlayer( inPlayer, inItemID, inAmount )
|
||||
local addedItem = cItem( inItemID, inAmount )
|
||||
local inventoryGrid = inPlayer:GetInventory():GetInventoryGrid()
|
||||
local hotbarGrid = inPlayer:GetInventory():GetHotbarGrid()
|
||||
local itemsAdded = inventoryGrid:AddItem( addedItem )
|
||||
if( itemsAdded < inAmount ) then
|
||||
addedItem.m_ItemCount = addedItem.m_ItemCount - itemsAdded
|
||||
hotbarGrid:AddItem( addedItem )
|
||||
end
|
||||
end
|
||||
-- This function returns item max stack for a given itemID. It uses vanilla max stack size, and uses several non-common items notations;
|
||||
-- Those are:
|
||||
-- oneonerecord (because aparently 11record wasn't the best idea in lua scripting application)
|
||||
-- carrotonastick (because it wasn't added to items.txt yet)
|
||||
-- waitrecord (for same reason)
|
||||
-- oneonerecord( because aparently 11record wasn't the best idea in lua scripting application )
|
||||
-- carrotonastick( because it wasn't added to items.txt yet )
|
||||
-- waitrecord( for same reason )
|
||||
-- Feel free to ignore the difference, or to add those to items.txt
|
||||
function GetItemMaxStack(IN_itemID)
|
||||
local _result = 64
|
||||
-- Tools and swords
|
||||
if (IN_itemID == woodensword) then _result = 1 end
|
||||
if (IN_itemID == woodenshovel) then _result = 1 end
|
||||
if (IN_itemID == woodenpickaxe) then _result = 1 end
|
||||
if (IN_itemID == woodenaxe) then _result = 1 end
|
||||
if (IN_itemID == woodenhoe) then _result = 1 end
|
||||
if (IN_itemID == stonesword) then _result = 1 end
|
||||
if (IN_itemID == stoneshovel) then _result = 1 end
|
||||
if (IN_itemID == stonepickaxe) then _result = 1 end
|
||||
if (IN_itemID == stoneaxe) then _result = 1 end
|
||||
if (IN_itemID == stonehoe) then _result = 1 end
|
||||
if (IN_itemID == ironsword) then _result = 1 end
|
||||
if (IN_itemID == ironshovel) then _result = 1 end
|
||||
if (IN_itemID == ironpickaxe) then _result = 1 end
|
||||
if (IN_itemID == ironaxe) then _result = 1 end
|
||||
if (IN_itemID == ironhoe) then _result = 1 end
|
||||
if (IN_itemID == diamondsword) then _result = 1 end
|
||||
if (IN_itemID == diamondshovel) then _result = 1 end
|
||||
if (IN_itemID == diamondpickaxe) then _result = 1 end
|
||||
if (IN_itemID == diamondaxe) then _result = 1 end
|
||||
if (IN_itemID == diamondhoe) then _result = 1 end
|
||||
if (IN_itemID == goldensword) then _result = 1 end
|
||||
if (IN_itemID == goldenshovel) then _result = 1 end
|
||||
if (IN_itemID == goldenpickaxe) then _result = 1 end
|
||||
if (IN_itemID == goldenaxe) then _result = 1 end
|
||||
if (IN_itemID == goldenhoe) then _result = 1 end
|
||||
|
||||
if (IN_itemID == flintandsteel) then _result = 1 end
|
||||
if (IN_itemID == bow) then _result = 1 end
|
||||
if (IN_itemID == sign) then _result = 16 end
|
||||
if (IN_itemID == woodendoor) then _result = 1 end
|
||||
if (IN_itemID == irondoor) then _result = 1 end
|
||||
if (IN_itemID == cake) then _result = 1 end
|
||||
if (IN_itemID == cauldron) then _result = 1 end
|
||||
if (IN_itemID == mushroomstew) then _result = 1 end
|
||||
if (IN_itemID == painting) then _result = 1 end
|
||||
if (IN_itemID == bucket) then _result = 16 end
|
||||
if (IN_itemID == waterbucket) then _result = 1 end
|
||||
if (IN_itemID == lavabucket) then _result = 1 end
|
||||
if (IN_itemID == minecart) then _result = 1 end
|
||||
if (IN_itemID == saddle) then _result = 1 end
|
||||
if (IN_itemID == snowball) then _result = 16 end
|
||||
if (IN_itemID == boat) then _result = 1 end
|
||||
if (IN_itemID == milkbucket) then _result = 1 end
|
||||
if (IN_itemID == storageminecart) then _result = 1 end
|
||||
if (IN_itemID == poweredminecart) then _result = 1 end
|
||||
if (IN_itemID == egg) then _result = 16 end
|
||||
if (IN_itemID == fishingrod) then _result = 1 end
|
||||
if (IN_itemID == bed) then _result = 1 end
|
||||
if (IN_itemID == map) then _result = 1 end
|
||||
if (IN_itemID == shears) then _result = 1 end
|
||||
if (IN_itemID == enderpearl) then _result = 16 end
|
||||
if (IN_itemID == potion) then _result = 1 end
|
||||
if (IN_itemID == spawnegg) then _result = 1 end
|
||||
if (IN_itemID == bookandquill) then _result = 1 end
|
||||
if (IN_itemID == writtenbook) then _result = 1 end
|
||||
if (IN_itemID == carrotonastick) then _result = 1 end
|
||||
|
||||
if (IN_itemID == goldrecord) then _result = 1 end
|
||||
if (IN_itemID == greenrecord) then _result = 1 end
|
||||
if (IN_itemID == blocksrecord) then _result = 1 end
|
||||
if (IN_itemID == chirprecord) then _result = 1 end
|
||||
if (IN_itemID == farrecord) then _result = 1 end
|
||||
if (IN_itemID == mallrecord) then _result = 1 end
|
||||
if (IN_itemID == mellohirecord) then _result = 1 end
|
||||
if (IN_itemID == stalrecord) then _result = 1 end
|
||||
if (IN_itemID == stradrecord) then _result = 1 end
|
||||
if (IN_itemID == wardrecord) then _result = 1 end
|
||||
if (IN_itemID == oneonerecord) then _result = 1 end
|
||||
if (IN_itemID == waitrecord) then _result = 1 end
|
||||
|
||||
--if (IN_itemID == xxxxxxxxx) then _result = 1 end
|
||||
|
||||
if (IN_itemID == leatherhelmet) then _result = 1 end
|
||||
if (IN_itemID == leatherchestplate) then _result = 1 end
|
||||
if (IN_itemID == leatherpants) then _result = 1 end
|
||||
if (IN_itemID == leatherboots) then _result = 1 end
|
||||
|
||||
if (IN_itemID == chainmailhelmet) then _result = 1 end
|
||||
if (IN_itemID == chainmailchestplate) then _result = 1 end
|
||||
if (IN_itemID == chainmailpants) then _result = 1 end
|
||||
if (IN_itemID == chainmailboots) then _result = 1 end
|
||||
|
||||
if (IN_itemID == ironhelmet) then _result = 1 end
|
||||
if (IN_itemID == ironchestplate) then _result = 1 end
|
||||
if (IN_itemID == ironpants) then _result = 1 end
|
||||
if (IN_itemID == ironboots) then _result = 1 end
|
||||
|
||||
if (IN_itemID == diamondhelmet) then _result = 1 end
|
||||
if (IN_itemID == diamondchestplate) then _result = 1 end
|
||||
if (IN_itemID == diamondpants) then _result = 1 end
|
||||
if (IN_itemID == diamondboots) then _result = 1 end
|
||||
|
||||
if (IN_itemID == goldenhelmet) then _result = 1 end
|
||||
if (IN_itemID == goldenchestplate) then _result = 1 end
|
||||
if (IN_itemID == goldenpants) then _result = 1 end
|
||||
if (IN_itemID == goldenboots) then _result = 1 end
|
||||
return _result
|
||||
function GetItemMaxStack( inItemID )
|
||||
local testerItem = cItem( inItemID )
|
||||
LOGINFO( "This function serves no real purpose now, maybe consider using cItem:GetMaxStackSize()?" )
|
||||
return testerItem:GetMaxStackSize()
|
||||
end
|
||||
function ItemIsArmor(IN_itemID)
|
||||
local _result = false
|
||||
if (IN_itemID == leatherhelmet) then _result = true end
|
||||
if (IN_itemID == leatherchestplate) then _result = true end
|
||||
if (IN_itemID == leatherpants) then _result = true end
|
||||
if (IN_itemID == leatherboots) then _result = true end
|
||||
function ItemIsArmor( inItemID, inCheckForHorseArmor )
|
||||
inCheckForHorseArmor = inCheckForHorseArmor or false
|
||||
if( inItemID == E_ITEM_LEATHER_CAP ) then return true end
|
||||
if( inItemID == E_ITEM_LEATHER_TUNIC ) then return true end
|
||||
if( inItemID == E_ITEM_LEATHER_PANTS ) then return true end
|
||||
if( inItemID == E_ITEM_LEATHER_BOOTS ) then return true end
|
||||
|
||||
if (IN_itemID == chainmailhelmet) then _result = true end
|
||||
if (IN_itemID == chainmailchestplate) then _result = true end
|
||||
if (IN_itemID == chainmailpants) then _result = true end
|
||||
if (IN_itemID == chainmailboots) then _result = true end
|
||||
if( inItemID == E_ITEM_CHAIN_HELMET ) then return true end
|
||||
if( inItemID == E_ITEM_CHAIN_CHESTPLATE ) then return true end
|
||||
if( inItemID == E_ITEM_CHAIN_LEGGINGS ) then return true end
|
||||
if( inItemID == E_ITEM_CHAIN_BOOTS ) then return true end
|
||||
|
||||
if (IN_itemID == ironhelmet) then _result = true end
|
||||
if (IN_itemID == ironchestplate) then _result = true end
|
||||
if (IN_itemID == ironpants) then _result = true end
|
||||
if (IN_itemID == ironboots) then _result = true end
|
||||
if( inItemID == E_ITEM_IRON_HELMET ) then return true end
|
||||
if( inItemID == E_ITEM_IRON_CHESTPLATE ) then return true end
|
||||
if( inItemID == E_ITEM_IRON_LEGGINGS ) then return true end
|
||||
if( inItemID == E_ITEM_IRON_BOOTS ) then return true end
|
||||
|
||||
if (IN_itemID == diamondhelmet) then _result = true end
|
||||
if (IN_itemID == diamondchestplate) then _result = true end
|
||||
if (IN_itemID == diamondpants) then _result = true end
|
||||
if (IN_itemID == diamondboots) then _result = true end
|
||||
if( inItemID == E_ITEM_DIAMOND_HELMET ) then return true end
|
||||
if( inItemID == E_ITEM_DIAMOND_CHESTPLATE ) then return true end
|
||||
if( inItemID == E_ITEM_DIAMOND_LEGGINGS ) then return true end
|
||||
if( inItemID == E_ITEM_DIAMOND_BOOTS ) then return true end
|
||||
|
||||
if (IN_itemID == goldenhelmet) then _result = true end
|
||||
if (IN_itemID == goldenchestplate) then _result = true end
|
||||
if (IN_itemID == goldenpants) then _result = true end
|
||||
if (IN_itemID == goldenboots) then _result = true end
|
||||
return _result
|
||||
end
|
||||
-- Returns full-length playername for a short name (usefull for parsing commands)
|
||||
function GetExactPlayername(IN_playername)
|
||||
local _result = IN_playername
|
||||
local function SetProcessingPlayername(IN_player)
|
||||
_result = IN_player:GetName()
|
||||
if( inItemID == E_ITEM_GOLD_HELMET ) then return true end
|
||||
if( inItemID == E_ITEM_GOLD_CHESTPLATE ) then return true end
|
||||
if( inItemID == E_ITEM_GOLD_LEGGINGS ) then return true end
|
||||
if( inItemID == E_ITEM_GOLD_BOOTS ) then return true end
|
||||
|
||||
if( inCheckForHorseArmor ) then
|
||||
if( inItemID == E_ITEM_IRON_HORSE_ARMOR ) then return true end
|
||||
if( inItemID == E_ITEM_GOLD_HORSE_ARMOR ) then return true end
|
||||
if( inItemID == E_ITEM_DIAMOND_HORSE_ARMOR ) then return true end
|
||||
end
|
||||
cRoot:Get():FindAndDoWithPlayer(IN_playername, SetProcessingPlayername)
|
||||
return false
|
||||
end
|
||||
-- Returns full-length playername for a short name( usefull for parsing commands )
|
||||
function GetExactPlayername( inPlayerName )
|
||||
local _result = inPlayerName
|
||||
local function SetProcessingPlayername( inPlayer )
|
||||
_result = inPlayer:GetName()
|
||||
end
|
||||
cRoot:Get():FindAndDoWithPlayer( inPlayerName, SetProcessingPlayername )
|
||||
return _result
|
||||
end
|
||||
function GetPlayerByName(IN_playername)
|
||||
function GetPlayerByName( inPlayerName )
|
||||
local _player
|
||||
local PlayerSetter = function (Player)
|
||||
local PlayerSetter = function( Player )
|
||||
_player = Player
|
||||
end
|
||||
cRoot:Get():FindAndDoWithPlayer(IN_playername, PlayerSetter)
|
||||
cRoot:Get():FindAndDoWithPlayer( inPlayerName, PlayerSetter )
|
||||
return _player
|
||||
end
|
||||
--[[
|
||||
Not-so-usual math _functions
|
||||
]]
|
||||
-- Rounds floating point number. Because lua guys think this function doesn't deserve to be presented in lua's math
|
||||
function round(IN_x)
|
||||
if (IN_x%2 ~= 0.5) then
|
||||
return math.floor(IN_x+0.5)
|
||||
function round( inX )
|
||||
if( inX%2 ~= 0.5 ) then
|
||||
return math.floor( inX + 0.5 )
|
||||
end
|
||||
return IN_x-0.5
|
||||
return inX - 0.5
|
||||
end
|
||||
--[[
|
||||
Functions I use for filework and stringswork
|
||||
]]
|
||||
function PluralString(IN_value, IN_singular_string, IN_plural_string)
|
||||
local _value_string = tostring(IN_value)
|
||||
if (_value_string[#_value_string] == "1") then
|
||||
return IN_singular_string
|
||||
function PluralString( inValue, inSingularString, inPluralString )
|
||||
local _value_string = tostring( inValue )
|
||||
if( _value_string[#_value_string] == "1" ) then
|
||||
return inSingularString
|
||||
end
|
||||
return IN_plural_string
|
||||
return inPluralString
|
||||
end
|
||||
function PluralItemName(IN_itemID, IN_ammount) -- BEWARE! TEMPORAL SOLUTION THERE! :D
|
||||
local _value_string = tostring(IN_value)
|
||||
function PluralItemName( inItemID, inAmount ) -- BEWARE! TEMPORAL SOLUTION THERE! :D
|
||||
local _value_string = tostring( inValue )
|
||||
local _name = ""
|
||||
if (_value_string[#_value_string] == "1") then
|
||||
if( _value_string[#_value_string] == "1" ) then
|
||||
-- singular names
|
||||
_name = ItemTypeToString(IN_itemID)
|
||||
_name = ItemTypeToString( inItemID )
|
||||
else
|
||||
-- plural names
|
||||
_name = ItemTypeToString(IN_itemID).."s"
|
||||
_name = ItemTypeToString( inItemID ).."s"
|
||||
end
|
||||
return _name
|
||||
end
|
||||
-- for filewriting purposes. 0 = false, 1 = true
|
||||
function StringToBool(value)
|
||||
if value=="1" then return true end
|
||||
function StringToBool( inValue )
|
||||
if( inValue == "1" ) then return true end
|
||||
return false
|
||||
end
|
||||
-- same, but reversal
|
||||
function BoolToString(value)
|
||||
if value==true then return 1 end
|
||||
function BoolToString( inValue )
|
||||
if( inValue == true ) then return 1 end
|
||||
return 0
|
||||
end
|
6
MCServer/Plugins/InfoDump.deproj
Normal file
6
MCServer/Plugins/InfoDump.deproj
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<file>
|
||||
<filename>InfoDump.lua</filename>
|
||||
</file>
|
||||
</project>
|
361
MCServer/Plugins/InfoDump.lua
Normal file
361
MCServer/Plugins/InfoDump.lua
Normal file
@ -0,0 +1,361 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
-- InfoDump.lua
|
||||
|
||||
-- Goes through all subfolders, loads Info.lua and dumps its g_PluginInfo into various text formats
|
||||
-- This is used for generating plugin documentation for the forum and for GitHub's INFO.md files
|
||||
|
||||
-- This script requires LuaRocks with LFS installed, instructions are printed when this is not present.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- Check Lua version. We use 5.1-specific construct when loading the plugin info, 5.2 is not compatible!
|
||||
if (_VERSION ~= "Lua 5.1") then
|
||||
print("Unsupported Lua version. This script requires Lua version 5.1, this Lua is version " .. (_VERSION or "<nil>"));
|
||||
return;
|
||||
end
|
||||
|
||||
-- Try to load lfs, do not abort if not found
|
||||
local lfs, err = pcall(
|
||||
function()
|
||||
return require("lfs")
|
||||
end
|
||||
);
|
||||
|
||||
-- Rather, print a nice message with instructions:
|
||||
if not(lfs) then
|
||||
print([[
|
||||
Cannot load LuaFileSystem
|
||||
Install it through luarocks by executing the following command:
|
||||
sudo luarocks install luafilesystem
|
||||
|
||||
If you don't have luarocks installed, you need to install them using your OS's package manager, usually:
|
||||
sudo apt-get install luarocks
|
||||
On windows, a binary distribution can be downloaded from the LuaRocks homepage, http://luarocks.org/en/Download
|
||||
]]);
|
||||
|
||||
print("Original error text: ", err);
|
||||
return;
|
||||
end
|
||||
|
||||
-- We now know that LFS is present, get it normally:
|
||||
lfs = require("lfs");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- Replaces generic formatting with forum-specific formatting
|
||||
-- Also removes the single line-ends
|
||||
local function ForumizeString(a_Str)
|
||||
assert(type(a_Str) == "string");
|
||||
|
||||
-- Remove the indentation, unless in the code tag:
|
||||
-- Only one code or /code tag per line is supported!
|
||||
local IsInCode = false;
|
||||
local function RemoveIndentIfNotInCode(s)
|
||||
if (IsInCode) then
|
||||
-- we're in code section, check if this line terminates it
|
||||
IsInCode = (s:find("{%%/code}") ~= nil);
|
||||
return s .. "\n";
|
||||
else
|
||||
-- we're not in code section, check if this line starts it
|
||||
IsInCode = (s:find("{%%code}") ~= nil);
|
||||
return s:gsub("^%s*", "") .. "\n";
|
||||
end
|
||||
end
|
||||
a_Str = a_Str:gsub("(.-)\n", RemoveIndentIfNotInCode);
|
||||
|
||||
-- Replace multiple line ends with {%p} and single line ends with a space,
|
||||
-- so that manual word-wrap in the Info.lua file doesn't wrap in the forum.
|
||||
a_Str = a_Str:gsub("\n\n", "{%%p}");
|
||||
a_Str = a_Str:gsub("\n", " ");
|
||||
|
||||
-- Replace the generic formatting:
|
||||
a_Str = a_Str:gsub("{%%p}", "\n\n");
|
||||
a_Str = a_Str:gsub("{%%b}", "[b]"):gsub("{%%/b}", "[/b]");
|
||||
a_Str = a_Str:gsub("{%%i}", "[i]"):gsub("{%%/i}", "[/i]");
|
||||
a_Str = a_Str:gsub("{%%list}", "[list]"):gsub("{%%/list}", "[/list]");
|
||||
a_Str = a_Str:gsub("{%%li}", "[*]"):gsub("{%%/li}", "");
|
||||
-- TODO: Other formatting
|
||||
|
||||
return a_Str;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- Builds an array of categories, each containing all the commands belonging to the category,
|
||||
-- and the category description, if available.
|
||||
-- Returns the array table, each item has the following format:
|
||||
-- { Name = "CategoryName", Description = "CategoryDescription", Commands = {{CommandString = "/cmd verb", Info = {...}}, ...}}
|
||||
local function BuildCategories(a_PluginInfo)
|
||||
-- The returned result
|
||||
-- This will contain both an array and a dict of the categories, to allow fast search
|
||||
local res = {};
|
||||
|
||||
-- For each command add a reference to it into all of its categories:
|
||||
local function AddCommands(a_CmdPrefix, a_Commands)
|
||||
for cmd, info in pairs(a_Commands) do
|
||||
local NewCmd =
|
||||
{
|
||||
CommandString = a_CmdPrefix .. cmd,
|
||||
Info = info,
|
||||
}
|
||||
|
||||
if ((info.HelpString ~= nil) and (info.HelpString ~= "")) then
|
||||
-- Add to each specified category:
|
||||
local Category = info.Category;
|
||||
if (type(Category) == "string") then
|
||||
Category = {Category};
|
||||
end
|
||||
for idx, cat in ipairs(Category or {""}) do
|
||||
local CatEntry = res[cat];
|
||||
if (CatEntry == nil) then
|
||||
-- First time we came across this category, create it:
|
||||
local NewCat = {Name = cat, Description = "", Commands = {NewCmd}};
|
||||
table.insert(res, NewCat);
|
||||
res[cat] = NewCat;
|
||||
else
|
||||
-- We already have this category, just add the command to its list of commands:
|
||||
table.insert(CatEntry.Commands, NewCmd);
|
||||
end
|
||||
end -- for idx, cat - Category[]
|
||||
end -- if (HelpString valid)
|
||||
|
||||
-- Recurse all subcommands:
|
||||
if (info.Subcommands ~= nil) then
|
||||
AddCommands(a_CmdPrefix .. cmd .. " ", info.Subcommands);
|
||||
end
|
||||
end -- for cmd, info - a_Commands[]
|
||||
end -- AddCommands()
|
||||
|
||||
AddCommands("", a_PluginInfo.Commands);
|
||||
|
||||
-- Assign descriptions to categories:
|
||||
for name, desc in pairs(a_PluginInfo.Categories or {}) do
|
||||
local CatEntry = res[name];
|
||||
if (CatEntry ~= nil) then
|
||||
-- The result has this category, add the description:
|
||||
CatEntry.Description = desc.Description;
|
||||
end
|
||||
end
|
||||
|
||||
-- Alpha-sort each category's command list:
|
||||
for idx, cat in ipairs(res) do
|
||||
table.sort(cat.Commands,
|
||||
function (cmd1, cmd2)
|
||||
return (string.lower(cmd1.CommandString) < string.lower(cmd2.CommandString));
|
||||
end
|
||||
);
|
||||
end
|
||||
|
||||
return res;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- Writes the specified command detailed help array to the output file, in the forum dump format
|
||||
local function WriteCommandParameterCombinationsForum(a_CmdString, a_ParameterCombinations, f)
|
||||
assert(type(a_CmdString) == "string");
|
||||
assert(type(a_ParameterCombinations) == "table");
|
||||
assert(f ~= nil);
|
||||
|
||||
if (#a_ParameterCombinations == 0) then
|
||||
-- No explicit parameter combinations to write
|
||||
return;
|
||||
end
|
||||
|
||||
f:write("The following parameter combinations are recognized:\n");
|
||||
for idx, combination in ipairs(a_ParameterCombinations) do
|
||||
f:write("[color=blue]", a_CmdString, "[/color] [color=green]", combination.Params, "[/color]");
|
||||
if (combination.Help ~= nil) then
|
||||
f:write(" - ", ForumizeString(combination.Help));
|
||||
end
|
||||
if (combination.Permission ~= nil) then
|
||||
f:write(" (Requires permission '[color=red]", combination.Permission, "[/color]')");
|
||||
end
|
||||
f:write("\n");
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- Writes all commands in the specified category to the output file, in the forum dump format
|
||||
local function WriteCommandsCategoryForum(a_Category, f)
|
||||
-- Write category name:
|
||||
local CategoryName = a_Category.Name;
|
||||
if (CategoryName == "") then
|
||||
CategoryName = "General";
|
||||
end
|
||||
f:write("\n[size=Large]", ForumizeString(a_Category.DisplayName or CategoryName), "[/size]\n");
|
||||
|
||||
-- Write description:
|
||||
if (a_Category.Description ~= "") then
|
||||
f:write(ForumizeString(a_Category.Description), "\n");
|
||||
end
|
||||
|
||||
-- Write commands:
|
||||
f:write("\n[list]");
|
||||
for idx2, cmd in ipairs(a_Category.Commands) do
|
||||
f:write("\n[b]", cmd.CommandString, "[/b] - ", ForumizeString(cmd.Info.HelpString or "UNDOCUMENTED"), "\n");
|
||||
if (cmd.Info.Permission ~= nil) then
|
||||
f:write("Permission required: [color=red]", cmd.Info.Permission, "[/color]\n");
|
||||
end
|
||||
if (cmd.Info.DetailedDescription ~= nil) then
|
||||
f:write(cmd.Info.DetailedDescription);
|
||||
end
|
||||
if (cmd.Info.ParameterCombinations ~= nil) then
|
||||
WriteCommandParameterCombinationsForum(cmd.CommandString, cmd.Info.ParameterCombinations, f);
|
||||
end
|
||||
end
|
||||
f:write("[/list]\n\n")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local function DumpCommandsForum(a_PluginInfo, f)
|
||||
-- Copy all Categories from a dictionary into an array:
|
||||
local Categories = BuildCategories(a_PluginInfo);
|
||||
|
||||
-- Sort the categories by name:
|
||||
table.sort(Categories,
|
||||
function(cat1, cat2)
|
||||
return (string.lower(cat1.Name) < string.lower(cat2.Name));
|
||||
end
|
||||
);
|
||||
|
||||
if (#Categories == 0) then
|
||||
return;
|
||||
end
|
||||
|
||||
f:write("\n[size=X-Large]Commands[/size]\n");
|
||||
|
||||
-- Dump per-category commands:
|
||||
for idx, cat in ipairs(Categories) do
|
||||
WriteCommandsCategoryForum(cat, f);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local function DumpAdditionalInfoForum(a_PluginInfo, f)
|
||||
local AInfo = a_PluginInfo.AdditionalInfo;
|
||||
if ((AInfo == nil) or (type(AInfo) ~= "table")) then
|
||||
-- There is no AdditionalInfo in a_PluginInfo
|
||||
return;
|
||||
end
|
||||
|
||||
for idx, info in ipairs(a_PluginInfo.AdditionalInfo) do
|
||||
if ((info.Title ~= nil) and (info.Contents ~= nil)) then
|
||||
f:write("\n[size=X-Large]", ForumizeString(info.Title), "[/size]\n");
|
||||
f:write(ForumizeString(info.Contents), "\n");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local function DumpPluginInfoForum(a_PluginFolder, a_PluginInfo)
|
||||
-- Open the output file:
|
||||
local f, msg = io.open(a_PluginInfo.Name .. "_forum.txt", "w");
|
||||
if (f == nil) then
|
||||
print("\tCannot dump forum info for plugin " .. a_PluginFolder .. ": " .. msg);
|
||||
return;
|
||||
end
|
||||
|
||||
-- Write the description:
|
||||
f:write(ForumizeString(a_PluginInfo.Description), "\n");
|
||||
DumpAdditionalInfoForum(a_PluginInfo, f);
|
||||
DumpCommandsForum(a_PluginInfo, f);
|
||||
|
||||
f:close();
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local function DumpPluginInfoGitHub()
|
||||
-- TODO
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- Tries to load the g_PluginInfo from the plugin's Info.lua file
|
||||
-- Returns the g_PluginInfo table on success, or nil and error message on failure
|
||||
local function LoadPluginInfo(a_FolderName)
|
||||
-- Check if the Info file is present at all:
|
||||
local Attribs = lfs.attributes(a_FolderName .. "/Info.lua");
|
||||
if ((Attribs == nil) or (Attribs.mode ~= "file")) then
|
||||
return nil;
|
||||
end
|
||||
|
||||
-- Load and compile the Info file:
|
||||
local cfg, err = loadfile(a_FolderName .. "/Info.lua");
|
||||
if (cfg == nil) then
|
||||
return nil, "Cannot open 'Info.lua': " .. err;
|
||||
end
|
||||
|
||||
-- Execute the loaded file in a sandbox:
|
||||
-- This is Lua-5.1-specific and won't work in Lua 5.2!
|
||||
local Sandbox = {};
|
||||
setfenv(cfg, Sandbox);
|
||||
cfg();
|
||||
if (Sandbox.g_PluginInfo == nil) then
|
||||
return nil, "Info.lua doesn't contain the g_PluginInfo declaration";
|
||||
end
|
||||
return Sandbox.g_PluginInfo;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local function ProcessPluginFolder(a_FolderName)
|
||||
local PluginInfo, Msg = LoadPluginInfo(a_FolderName);
|
||||
if (PluginInfo == nil) then
|
||||
if (Msg ~= nil) then
|
||||
print("\tCannot load Info.lua: " .. Msg);
|
||||
end
|
||||
return;
|
||||
end
|
||||
DumpPluginInfoForum(a_FolderName, PluginInfo);
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print("Processing plugin subfolders:");
|
||||
for fnam in lfs.dir(".") do
|
||||
if ((fnam ~= ".") and (fnam ~= "..")) then
|
||||
local Attributes = lfs.attributes(fnam);
|
||||
if (Attributes ~= nil) then
|
||||
if (Attributes.mode == "directory") then
|
||||
print(fnam);
|
||||
ProcessPluginFolder(fnam);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 70d95481e323874b147e3296a2bd0c35563b0bea
|
||||
Subproject commit 9edfee93048f214175cbed7eb2a3f77f7ac4abb2
|
@ -27,7 +27,7 @@ LOG("headers: ");
|
||||
for k, v in pairs(headers or {}) do
|
||||
LOG(" " .. k .. ": " .. v);
|
||||
end
|
||||
LOG("body length: " .. string.length(body));
|
||||
LOG("body length: " .. string.len(body));
|
||||
|
||||
|
||||
|
||||
|
BIN
MCServer/favicon.png
Normal file
BIN
MCServer/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
30
MCServer/settings_apidump.ini
Normal file
30
MCServer/settings_apidump.ini
Normal file
@ -0,0 +1,30 @@
|
||||
; This settings file is used by the $/MakeLuaAPI.cmd script
|
||||
; It is copied over settings.ini so that the APIDump plugin gets loaded upon server start
|
||||
|
||||
[Server]
|
||||
Description=MCServer - in C++!
|
||||
MaxPlayers=100
|
||||
HardcoreEnabled=0
|
||||
Port=25565
|
||||
PortsIPv6=
|
||||
DefaultViewDistance=10
|
||||
|
||||
[RCON]
|
||||
Enabled=0
|
||||
|
||||
[Authentication]
|
||||
Authenticate=1
|
||||
Server=session.minecraft.net
|
||||
Address=/game/checkserver.jsp?user=%USERNAME%&serverId=%SERVERID%
|
||||
|
||||
[Worlds]
|
||||
; World=secondworld
|
||||
DefaultWorld=world
|
||||
|
||||
[Plugins]
|
||||
Plugin=APIDump
|
||||
|
||||
[DeadlockDetect]
|
||||
Enabled=0
|
||||
IntervalSec=20
|
||||
|
@ -29,6 +29,7 @@ if "a%ftpsite%" == "a" (
|
||||
:: Create the API documentation by running the server and stopping it right after it starts:
|
||||
|
||||
cd MCServer
|
||||
copy /Y settings_apidump.ini settings.ini
|
||||
echo stop | MCServer
|
||||
cd ..
|
||||
|
||||
|
@ -44,6 +44,7 @@ if "a%ftpsite%" == "a" (
|
||||
|
||||
|
||||
:: Get the date and time into vars:
|
||||
:: This is locale-dependent!
|
||||
For /f "tokens=2-4 delims=/. " %%a in ('date /t') do (
|
||||
set MYYEAR=%%c
|
||||
set MYMONTH=%%b
|
||||
@ -66,13 +67,11 @@ if errorlevel 1 goto haderror
|
||||
|
||||
|
||||
:: Update the external plugins to the latest revision:
|
||||
cd MCServer\Plugins\Core
|
||||
git pull
|
||||
git submodule update
|
||||
if errorlevel 1 goto haderror
|
||||
cd ..\ProtectionAreas
|
||||
git pull
|
||||
if errorlevel 1 goto haderror
|
||||
cd ..\..\..
|
||||
|
||||
|
||||
|
||||
|
||||
:: Get the Git commit ID into an environment var
|
||||
For /f "tokens=1 delims=/. " %%a in ('git log -1 --oneline --no-abbrev-commit') do (set COMMITID=%%a)
|
||||
@ -114,9 +113,23 @@ if errorlevel 1 goto haderror
|
||||
|
||||
|
||||
|
||||
:: Generate the .example.ini files by running the server without any ini files:
|
||||
cd MCServer
|
||||
del groups.ini
|
||||
del settings.ini
|
||||
del webadmin.ini
|
||||
echo stop | MCServer
|
||||
cd ..
|
||||
|
||||
|
||||
|
||||
:: Copy all the example ini files into the Install folder for zipping:
|
||||
copy MCServer\*.example.ini Install\
|
||||
copy MCServer\groups.ini Install\groups.example.ini
|
||||
copy MCServer\settings.ini Install\settings.example.ini
|
||||
copy MCServer\webadmin.ini Install\webadmin.example.ini
|
||||
|
||||
|
||||
|
||||
|
||||
:: Use 7-zip to compress the resulting files into a single file:
|
||||
set FILESUFFIX=%MYYEAR%_%MYMONTH%_%MYDAY%_%MYTIME%_%COMMITID%
|
||||
|
@ -1,6 +1,8 @@
|
||||
MCServer
|
||||
========
|
||||
|
||||
**Current Protocol Supported:** Minecraft v1.2 -> v1.7
|
||||
|
||||
MCServer is a performant C++ Minecraft server designed for use in memory and cpu-limited places, or just to make regular server perform better.
|
||||
|
||||
MCServer can run on PCs, Macs, and *nix. This includes android phones and tablets as well as Raspberry Pis.
|
||||
@ -26,8 +28,9 @@ MCServer is licensed under the Apache license V2, and we welcome anybody to fork
|
||||
Other Stuff
|
||||
-----------
|
||||
|
||||
For other stuff, including plugins and discussion, check the [forums](http://forum.mc-server.org) and [wiki](http://mc-server.org/wiki/).
|
||||
For other stuff, including plugins and discussion, check the [forums](http://forum.mc-server.org) and [wiki](http://wiki.mc-server.org/).
|
||||
|
||||
Earn bitcoins for commits or donate to reward the MCServer developers: [![tip for next commit](http://tip4commit.com/projects/74.svg)](http://tip4commit.com/projects/74)
|
||||
|
||||
Travis CI: [![Build Status](https://travis-ci.org/mc-server/MCServer.png?branch=master)](https://travis-ci.org/mc-server/MCServer)
|
||||
|
||||
|
1
Tools/BiomeVisualiser/.gitignore
vendored
1
Tools/BiomeVisualiser/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
Debug/
|
||||
logs/
|
||||
Release/
|
||||
Release profiled/
|
||||
|
@ -40,10 +40,10 @@ bool cBiomeRenderer::Render(cPixmap & a_Pixmap)
|
||||
int Hei = a_Pixmap.GetHeight();
|
||||
|
||||
// Hint the approximate view area to the biome source so that it can adjust its caches:
|
||||
int MinBlockX = ( - m_OriginX) / m_Zoom;
|
||||
int MaxBlockX = (Wid - m_OriginX) / m_Zoom;
|
||||
int MinBlockZ = ( - m_OriginY) / m_Zoom;
|
||||
int MaxBlockZ = (Hei - m_OriginY) / m_Zoom;
|
||||
int MinBlockX = ( - m_OriginX) * m_Zoom;
|
||||
int MaxBlockX = (Wid - m_OriginX) * m_Zoom;
|
||||
int MinBlockZ = ( - m_OriginY) * m_Zoom;
|
||||
int MaxBlockZ = (Hei - m_OriginY) * m_Zoom;
|
||||
m_Cache.HintViewArea(MinBlockX / 16 - 1, MaxBlockX / 16 + 1, MinBlockZ / 16 - 1, MaxBlockZ / 16 + 1);
|
||||
|
||||
// Hold one current chunk of biome data:
|
||||
@ -55,12 +55,12 @@ bool cBiomeRenderer::Render(cPixmap & a_Pixmap)
|
||||
|
||||
for (int y = 0; y < Hei; y++)
|
||||
{
|
||||
int BlockZ = (y - m_OriginY) / m_Zoom;
|
||||
int BlockZ = (y - m_OriginY) * m_Zoom;
|
||||
int ChunkZ = (BlockZ >= 0) ? (BlockZ / 16) : ((BlockZ + 1) / 16 - 1);
|
||||
int RelZ = BlockZ - ChunkZ * 16;
|
||||
for (int x = 0; x < Wid; x++)
|
||||
{
|
||||
int BlockX = (x - m_OriginX) / m_Zoom;
|
||||
int BlockX = (x - m_OriginX) * m_Zoom;
|
||||
int ChunkX = (BlockX >= 0) ? (BlockX / 16) : ((BlockX + 1) / 16 - 1);
|
||||
int RelX = BlockX - ChunkX * 16;
|
||||
if ((ChunkZ != CurChunkZ) || (ChunkX != CurChunkX))
|
||||
|
@ -37,6 +37,11 @@ public:
|
||||
|
||||
void MoveViewBy(int a_OffsX, int a_OffsY);
|
||||
|
||||
void SetZoom(int a_NewZoom)
|
||||
{
|
||||
m_Zoom = a_NewZoom;
|
||||
}
|
||||
|
||||
protected:
|
||||
cBiomeCache m_Cache;
|
||||
|
||||
|
@ -67,17 +67,41 @@ void cBiomeViewWnd::InitBiomeView(void)
|
||||
|
||||
|
||||
|
||||
void cBiomeViewWnd::SetZoom(int a_NewZoom)
|
||||
{
|
||||
m_Renderer.SetZoom(a_NewZoom);
|
||||
Redraw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cBiomeViewWnd::Redraw(void)
|
||||
{
|
||||
if (m_Renderer.Render(m_Pixmap))
|
||||
{
|
||||
SetTimer(m_Wnd, TIMER_RERENDER, 200, NULL);
|
||||
}
|
||||
InvalidateRect(m_Wnd, NULL, FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LRESULT cBiomeViewWnd::WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (a_Msg)
|
||||
{
|
||||
case WM_CLOSE: return OnClose();
|
||||
case WM_COMMAND: return OnCommand(wParam, lParam);
|
||||
case WM_CHAR: return OnChar (wParam, lParam);
|
||||
case WM_CLOSE: return OnClose ();
|
||||
case WM_COMMAND: return OnCommand (wParam, lParam);
|
||||
case WM_LBUTTONDOWN: return OnLButtonDown(wParam, lParam);
|
||||
case WM_LBUTTONUP: return OnLButtonUp (wParam, lParam);
|
||||
case WM_MOUSEMOVE: return OnMouseMove (wParam, lParam);
|
||||
case WM_PAINT: return OnPaint();
|
||||
case WM_TIMER: return OnTimer(wParam);
|
||||
case WM_PAINT: return OnPaint ();
|
||||
case WM_TIMER: return OnTimer (wParam);
|
||||
}
|
||||
return ::DefWindowProc(a_Wnd, a_Msg, wParam, lParam);
|
||||
}
|
||||
@ -86,6 +110,32 @@ LRESULT cBiomeViewWnd::WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lPa
|
||||
|
||||
|
||||
|
||||
LRESULT cBiomeViewWnd::OnChar(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case '1': SetZoom(1); break;
|
||||
case '2': SetZoom(2); break;
|
||||
case '3': SetZoom(3); break;
|
||||
case '4': SetZoom(4); break;
|
||||
case '5': SetZoom(5); break;
|
||||
case '6': SetZoom(6); break;
|
||||
case '7': SetZoom(7); break;
|
||||
case '8': SetZoom(8); break;
|
||||
case 27:
|
||||
{
|
||||
// Esc pressed, exit
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LRESULT cBiomeViewWnd::OnClose(void)
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
@ -126,12 +176,8 @@ LRESULT cBiomeViewWnd::OnMouseMove(WPARAM wParam, LPARAM lParam)
|
||||
POINT pnt;
|
||||
GetCursorPos(&pnt);
|
||||
m_Renderer.MoveViewBy(pnt.x - m_MouseDown.x, pnt.y - m_MouseDown.y);
|
||||
if (m_Renderer.Render(m_Pixmap))
|
||||
{
|
||||
SetTimer(m_Wnd, TIMER_RERENDER, 200, NULL);
|
||||
}
|
||||
m_MouseDown = pnt;
|
||||
InvalidateRect(m_Wnd, NULL, FALSE);
|
||||
Redraw();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -48,9 +48,13 @@ protected:
|
||||
|
||||
void InitBiomeView(void);
|
||||
|
||||
void SetZoom(int a_NewZoom);
|
||||
void Redraw(void);
|
||||
|
||||
LRESULT WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
// Message handlers:
|
||||
LRESULT OnChar (WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnClose (void);
|
||||
LRESULT OnCommand (WPARAM wParam, LPARAM lParam);
|
||||
LRESULT OnLButtonDown(WPARAM wParam, LPARAM lParam);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1250"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="BiomeVisualiser"
|
||||
ProjectGUID="{6DF3D88B-AD47-45B6-B831-1BDE74F86B5C}"
|
||||
RootNamespace="BiomeVisualiser"
|
||||
@ -272,6 +272,10 @@
|
||||
RelativePath=".\BiomeColors.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BiomeColors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BiomeRenderer.cpp"
|
||||
>
|
||||
@ -501,10 +505,6 @@
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\BiomeColors.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
@ -2390,12 +2390,12 @@ bool cConnection::HandleServerStatusResponse(void)
|
||||
{
|
||||
Response.assign(Response.substr(0, idx + sizeof(DescSearch) - 1) + "ProtoProxy: " + Response.substr(idx + sizeof(DescSearch) - 1));
|
||||
}
|
||||
cByteBuffer Packet(1000);
|
||||
cByteBuffer Packet(Response.size() + 50);
|
||||
Packet.WriteVarInt(0); // Packet type - status response
|
||||
Packet.WriteVarUTF8String(Response);
|
||||
AString Pkt;
|
||||
Packet.ReadAll(Pkt);
|
||||
cByteBuffer ToClient(1000);
|
||||
cByteBuffer ToClient(Response.size() + 50);
|
||||
ToClient.WriteVarUTF8String(Pkt);
|
||||
CLIENTSEND(ToClient);
|
||||
return true;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="windows-1250"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="CryptoPP"
|
||||
ProjectGUID="{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}"
|
||||
RootNamespace="cryptlib"
|
||||
@ -60,6 +60,7 @@
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4702"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="MCServer"
|
||||
ProjectGUID="{32012054-0C96-4C43-AB27-174FF8E72D66}"
|
||||
RootNamespace="MCServer"
|
||||
@ -442,6 +442,14 @@
|
||||
RelativePath="..\src\Authenticator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\BiomeDef.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\BiomeDef.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\BlockArea.cpp"
|
||||
>
|
||||
@ -494,10 +502,6 @@
|
||||
RelativePath="..\src\Chunk.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\Chunk.inl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\ChunkDef.h"
|
||||
>
|
||||
@ -1582,6 +1586,10 @@
|
||||
RelativePath="..\src\OSSupport\ListenThread.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\OSSupport\Queue.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\OSSupport\Semaphore.cpp"
|
||||
>
|
||||
@ -2017,10 +2025,6 @@
|
||||
RelativePath="..\src\Bindings\PluginManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\Bindings\tolua_base.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\Bindings\WebPlugin.cpp"
|
||||
>
|
||||
|
@ -186,6 +186,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
|
@ -2,15 +2,15 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{de7b3b89-9cfa-4441-97a1-a41eb499d273}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{3c30caed-20a3-4bd8-b12e-fdd1e13455e5}</UniqueIdentifier>
|
||||
<Extensions>.cpp</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{1ddea6e2-83c2-4c5f-962a-7ad7f117cc85}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{770573d2-b90d-43f4-ac1c-464ab10c46ec}</UniqueIdentifier>
|
||||
<Extensions>.;.h</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Miscellaneous">
|
||||
<UniqueIdentifier>{41edc228-f641-4aea-ad4b-14a4918be0a3}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{1ac058bb-f217-4ac3-a14b-9c6ba021e030}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -224,7 +224,6 @@
|
||||
<ResourceCompile Include="MCServer.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\Entities\Floater.h" />
|
||||
<ClInclude Include="resource_MCServer.h" />
|
||||
<ClInclude Include="..\src\Authenticator.h" />
|
||||
<ClInclude Include="..\src\BlockArea.h" />
|
||||
@ -234,8 +233,9 @@
|
||||
<ClInclude Include="..\src\ByteBuffer.h" />
|
||||
<ClInclude Include="..\src\ChatColor.h" />
|
||||
<ClInclude Include="..\src\Chunk.h" />
|
||||
<ClInclude Include="..\src\Chunk.inl.h" />
|
||||
<ClInclude Include="..\src\ChunkDef.h" />
|
||||
<ClInclude Include="..\src\BiomeDef.h" />
|
||||
<ClInclude Include="..\src\BiomeDef.cpp" />
|
||||
<ClInclude Include="..\src\ChunkMap.h" />
|
||||
<ClInclude Include="..\src\ChunkSender.h" />
|
||||
<ClInclude Include="..\src\ClientHandle.h" />
|
||||
@ -325,6 +325,7 @@
|
||||
<ClInclude Include="..\src\Entities\Entity.h" />
|
||||
<ClInclude Include="..\src\Entities\ExpOrb.h" />
|
||||
<ClInclude Include="..\src\Entities\FallingBlock.h" />
|
||||
<ClInclude Include="..\src\Entities\Floater.h" />
|
||||
<ClInclude Include="..\src\Entities\Minecart.h" />
|
||||
<ClInclude Include="..\src\Entities\Pawn.h" />
|
||||
<ClInclude Include="..\src\Entities\Pickup.h" />
|
||||
@ -351,6 +352,7 @@
|
||||
<ClInclude Include="..\src\OSSupport\GZipFile.h" />
|
||||
<ClInclude Include="..\src\OSSupport\IsThread.h" />
|
||||
<ClInclude Include="..\src\OSSupport\ListenThread.h" />
|
||||
<ClInclude Include="..\src\OSSupport\Queue.h" />
|
||||
<ClInclude Include="..\src\OSSupport\Semaphore.h" />
|
||||
<ClInclude Include="..\src\OSSupport\Sleep.h" />
|
||||
<ClInclude Include="..\src\OSSupport\Socket.h" />
|
||||
@ -468,6 +470,7 @@
|
||||
<ClInclude Include="..\src\Items\ItemComparator.h" />
|
||||
<ClInclude Include="..\src\items\ItemDoor.h" />
|
||||
<ClInclude Include="..\src\items\ItemDye.h" />
|
||||
<ClInclude Include="..\src\Items\ItemFishingRod.h" />
|
||||
<ClInclude Include="..\src\Items\ItemFlowerPot.h" />
|
||||
<ClInclude Include="..\src\items\ItemFood.h" />
|
||||
<ClInclude Include="..\src\items\ItemHandler.h" />
|
||||
@ -629,7 +632,6 @@
|
||||
<ClCompile Include="..\src\Cuboid.cpp" />
|
||||
<ClCompile Include="..\src\DeadlockDetect.cpp" />
|
||||
<ClCompile Include="..\src\Enchantments.cpp" />
|
||||
<ClCompile Include="..\src\Entities\Floater.cpp" />
|
||||
<ClCompile Include="..\src\FastRandom.cpp" />
|
||||
<ClCompile Include="..\src\FurnaceRecipe.cpp" />
|
||||
<ClCompile Include="..\src\Globals.cpp">
|
||||
@ -763,6 +765,7 @@
|
||||
<ClCompile Include="..\src\Entities\Entity.cpp" />
|
||||
<ClCompile Include="..\src\Entities\ExpOrb.cpp" />
|
||||
<ClCompile Include="..\src\Entities\FallingBlock.cpp" />
|
||||
<ClCompile Include="..\src\Entities\Floater.cpp" />
|
||||
<ClCompile Include="..\src\Entities\Minecart.cpp" />
|
||||
<ClCompile Include="..\src\Entities\Pawn.cpp" />
|
||||
<ClCompile Include="..\src\Entities\Pickup.cpp" />
|
||||
|
@ -10,73 +10,73 @@
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Mobs">
|
||||
<UniqueIdentifier>{977716f7-b383-498a-950f-49afc6d551f6}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{813698c3-b2c1-4f3d-a89c-7ac6239fff97}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Entities">
|
||||
<UniqueIdentifier>{14ac2998-63d0-4bb3-97e3-1bd0007ffc74}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{b120a538-d8b9-4576-8675-36cf01fd69fc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\UI">
|
||||
<UniqueIdentifier>{272cba2d-aa26-4c69-b6fa-94465078e351}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{85037cf1-81a5-47c7-8c2e-899ea706b8e7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Simulator">
|
||||
<UniqueIdentifier>{1fabcea5-dba3-4265-b691-5795c69c4471}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{46c9cb22-7c7f-4589-b9b2-1fc79d2bdbdf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\OSSupport">
|
||||
<UniqueIdentifier>{c29beffd-33f6-44eb-8310-3e0462cdddf9}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{f12178cb-2ecb-4e48-9a8d-ba3e2e73cfbc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\OSSupport\Android Specific">
|
||||
<UniqueIdentifier>{430cae6d-cfb2-49a2-9fb2-614fde244868}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{488bc224-735f-405c-83de-870373cb52cb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Bindings">
|
||||
<UniqueIdentifier>{87060076-8ef4-4535-88ee-7a609e4391ae}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{41c0d7c9-43b5-4d17-b50e-3c8ac3aa2905}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\External">
|
||||
<UniqueIdentifier>{4e33e863-d055-4476-bb95-efd5ebc115d3}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{2c71a15a-8c65-4be7-bdfb-e083f4841c4a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\WorldStorage">
|
||||
<UniqueIdentifier>{ae97007e-0940-4f87-9786-8ed1d201e52c}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{2227f719-f0ac-444e-af14-230853017c45}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Generating">
|
||||
<UniqueIdentifier>{99483c91-c76c-47c7-838d-ba25c2066c79}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{eb070b55-ba10-4bce-ba06-5d785a055e54}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Blocks">
|
||||
<UniqueIdentifier>{51b8f5f3-83b3-4068-8825-503f19b42542}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{779dac55-c718-4fe1-8b67-547d431b9ebc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Items">
|
||||
<UniqueIdentifier>{959da118-757d-44c1-a4bd-d3345cfeb637}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{89847a5d-608a-4137-a766-1557276b4fcf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Protocol">
|
||||
<UniqueIdentifier>{be413233-b7df-4ef1-9eb3-8aa1de96bf3e}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e159d08d-daec-46de-9b60-9f8e660da91d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\SQLite">
|
||||
<UniqueIdentifier>{224e8323-4bcc-4d7e-bdba-09fa22f42d66}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{0278092b-abe5-4276-81cf-59e4079e5bc7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\LuaExpat">
|
||||
<UniqueIdentifier>{f9ad84f7-9199-45d1-a609-128f60baa996}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e4879cf2-e769-4e1d-8905-0f6c40ee5bc1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\BlockEntities">
|
||||
<UniqueIdentifier>{74088e2e-f7dc-478a-ae7f-bcfcb1a13dcc}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{d641a9d4-f5dc-4808-bee6-194306505244}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\HTTPServer">
|
||||
<UniqueIdentifier>{5e5eae6e-3154-4f85-868e-2682d072a5b2}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{a1e39415-2aca-4779-a558-2567a9de304f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Config files">
|
||||
<UniqueIdentifier>{124dfea0-3dcd-45c0-a196-ec9bd6e00b6a}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{eb5f3060-03ed-4548-8bde-340454d3d23a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Plugins">
|
||||
<UniqueIdentifier>{bc156df0-b3f8-4bf2-a434-59e63f5eafcc}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{7c681450-041a-4846-acf6-951c1f4e32a4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Plugins\Core">
|
||||
<UniqueIdentifier>{2bbb71f4-860a-4fc4-b9d9-ac05f806fea1}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{e961964c-9fb7-4513-89fa-05e0b760e0f1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Plugins\ChatLog">
|
||||
<UniqueIdentifier>{05facd8b-76e8-4bc5-9135-831b49ac5c65}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{70696c83-2307-43c6-8851-81aa3baa8523}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Plugins\Debuggers">
|
||||
<UniqueIdentifier>{6b70646e-a784-4617-8b26-941de4f8fd20}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{d3b692db-0684-4b89-9d38-2e5af12e9a6e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Plugins\APIDump">
|
||||
<UniqueIdentifier>{a2b234d1-1013-47c0-8a44-f3b294d83d19}</UniqueIdentifier>
|
||||
<UniqueIdentifier>{6eee304c-f055-4758-a248-a125e1af7e73}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -117,9 +117,6 @@
|
||||
<ClInclude Include="..\src\Chunk.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\Chunk.inl.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\ChunkDef.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
@ -390,6 +387,9 @@
|
||||
<ClInclude Include="..\src\Entities\FallingBlock.h">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\Entities\Floater.h">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\Entities\Minecart.h">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClInclude>
|
||||
@ -468,6 +468,9 @@
|
||||
<ClInclude Include="..\src\OSSupport\ListenThread.h">
|
||||
<Filter>Source Files\OSSupport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\OSSupport\Queue.h">
|
||||
<Filter>Source Files\OSSupport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\OSSupport\Semaphore.h">
|
||||
<Filter>Source Files\OSSupport</Filter>
|
||||
</ClInclude>
|
||||
@ -798,6 +801,9 @@
|
||||
<ClInclude Include="..\src\items\ItemDye.h">
|
||||
<Filter>Source Files\Items</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\Items\ItemFishingRod.h">
|
||||
<Filter>Source Files\Items</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\Items\ItemFlowerPot.h">
|
||||
<Filter>Source Files\Items</Filter>
|
||||
</ClInclude>
|
||||
@ -945,9 +951,6 @@
|
||||
<ClInclude Include="..\src\HTTPServer\NameValueParser.h">
|
||||
<Filter>Source Files\HTTPServer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\Entities\Floater.h">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\webadmin\template.html">
|
||||
@ -1372,6 +1375,9 @@
|
||||
<ClCompile Include="..\src\Entities\FallingBlock.cpp">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Entities\Floater.cpp">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Entities\Minecart.cpp">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClCompile>
|
||||
@ -1660,9 +1666,6 @@
|
||||
<ClCompile Include="..\src\HTTPServer\NameValueParser.cpp">
|
||||
<Filter>Source Files\HTTPServer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Entities\Floater.cpp">
|
||||
<Filter>Source Files\Entities</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\lib\sqlite\urls.txt">
|
||||
|
@ -163,6 +163,7 @@
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\lib\tolua++\src\bin\tolua.c" />
|
||||
<ClCompile Include="..\lib\tolua++\src\lib\tolua_event.c" />
|
||||
<ClCompile Include="..\lib\tolua++\src\lib\tolua_is.c" />
|
||||
<ClCompile Include="..\lib\tolua++\src\lib\tolua_map.c" />
|
||||
|
@ -7,6 +7,9 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\lib\tolua++\src\bin\tolua.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\lib\tolua++\src\lib\tolua_event.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -545,7 +545,7 @@ inline void SecureWipeArray(T *buf, size_t n)
|
||||
}
|
||||
|
||||
// this function uses wcstombs(), which assumes that setlocale() has been called
|
||||
static std::string StringNarrow(const wchar_t *str, bool throwOnError = true)
|
||||
inline std::string StringNarrow(const wchar_t *str, bool throwOnError = true)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
|
@ -137,7 +137,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect)
|
||||
{
|
||||
valuename = line.substr(0, pLeft);
|
||||
value = line.substr(pLeft + 1);
|
||||
SetValue(keyname, valuename, value);
|
||||
AddValue(keyname, valuename, value);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -344,55 +344,79 @@ AString cIniFile::GetValueName(const AString & keyname, const int valueID) const
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValue(const int keyID, const int valueID, const AString & value)
|
||||
void cIniFile::AddValue(const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value)
|
||||
{
|
||||
if ((keyID < (int)keys.size()) && (valueID < (int)keys[keyID].names.size()))
|
||||
int keyID = FindKey(a_KeyName);
|
||||
if (keyID == noID)
|
||||
{
|
||||
keys[keyID].values[valueID] = value;
|
||||
keyID = int(AddKeyName(a_KeyName));
|
||||
}
|
||||
return false;
|
||||
|
||||
keys[keyID].names.push_back(a_ValueName);
|
||||
keys[keyID].values.push_back(a_Value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValue(const AString & keyname, const AString & valuename, const AString & value, bool const create)
|
||||
void cIniFile::AddValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value)
|
||||
{
|
||||
int keyID = FindKey(keyname);
|
||||
AddValue(a_KeyName, a_ValueName, Printf("%d", a_Value));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cIniFile::AddValueF(const AString & a_KeyName, const AString & a_ValueName, const double a_Value)
|
||||
{
|
||||
AddValue(a_KeyName, a_ValueName, Printf("%f", a_Value));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValue(const int keyID, const int valueID, const AString & value)
|
||||
{
|
||||
if (((size_t)keyID >= keys.size()) || ((size_t)valueID >= keys[keyID].names.size()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
keys[keyID].values[valueID] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValue(const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists)
|
||||
{
|
||||
int keyID = FindKey(a_KeyName);
|
||||
if (keyID == noID)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
keyID = int(AddKeyName(keyname));
|
||||
}
|
||||
else
|
||||
if (!a_CreateIfNotExists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
keyID = AddKeyName(a_KeyName);
|
||||
}
|
||||
|
||||
int valueID = FindValue(int(keyID), valuename);
|
||||
int valueID = FindValue(keyID, a_ValueName);
|
||||
if (valueID == noID)
|
||||
{
|
||||
if (!create)
|
||||
if (!a_CreateIfNotExists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
keys[keyID].names.resize(keys[keyID].names.size() + 1, valuename);
|
||||
keys[keyID].values.resize(keys[keyID].values.size() + 1, value);
|
||||
keys[keyID].names.push_back(a_ValueName);
|
||||
keys[keyID].values.push_back(a_Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!create)
|
||||
{
|
||||
keys[keyID].values[valueID] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
keys[keyID].names.resize(keys[keyID].names.size() + 1, valuename);
|
||||
keys[keyID].values.resize(keys[keyID].values.size() + 1, value);
|
||||
}
|
||||
keys[keyID].values[valueID] = a_Value;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -402,37 +426,32 @@ bool cIniFile::SetValue(const AString & keyname, const AString & valuename, cons
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValueI(const AString & keyname, const AString & valuename, const int value, bool const create)
|
||||
bool cIniFile::SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists)
|
||||
{
|
||||
AString Data;
|
||||
Printf(Data, "%d", value);
|
||||
return SetValue(keyname, valuename, Data, create);
|
||||
return SetValue(a_KeyName, a_ValueName, Printf("%d", a_Value), a_CreateIfNotExists);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValueF(const AString & keyname, const AString & valuename, double const value, bool const create)
|
||||
bool cIniFile::SetValueF(const AString & a_KeyName, const AString & a_ValueName, double const a_Value, const bool a_CreateIfNotExists)
|
||||
{
|
||||
AString Data;
|
||||
Printf(Data, "%f", value);
|
||||
return SetValue(keyname, valuename, Data, create);
|
||||
return SetValue(a_KeyName, a_ValueName, Printf("%f", a_Value), a_CreateIfNotExists);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cIniFile::SetValueV(const AString & keyname, const AString & valuename, char * format, ...)
|
||||
bool cIniFile::SetValueV(const AString & a_KeyName, const AString & a_ValueName, const char * a_Format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
va_start(args, a_Format);
|
||||
AString Data;
|
||||
AppendVPrintf(Data, format, args);
|
||||
AppendVPrintf(Data, a_Format, args);
|
||||
va_end(args);
|
||||
return SetValue(keyname, valuename, Data);
|
||||
return SetValue(a_KeyName, a_ValueName, Data);
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,22 +122,32 @@ public:
|
||||
return (GetValueSetI(keyname, valuename, defValue ? 1 : 0) != 0);
|
||||
}
|
||||
|
||||
// Sets value of [keyname] valuename =.
|
||||
// Specify the optional paramter as false (0) if you do not want it to create
|
||||
// the key if it doesn't exist. Returns true if data entered, false otherwise.
|
||||
// Overloaded to accept string, int, and double.
|
||||
bool SetValue( const int keyID, const int valueID, const AString & value);
|
||||
bool SetValue( const AString & keyname, const AString & valuename, const AString & value, const bool create = true);
|
||||
bool SetValueI( const AString & keyname, const AString & valuename, const int value, const bool create = true);
|
||||
bool SetValueB( const AString & keyname, const AString & valuename, const bool value, const bool create = true)
|
||||
// Adds a new value to the specified key.
|
||||
// If a value of the same name already exists, creates another one (non-standard INI file)
|
||||
void AddValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value);
|
||||
void AddValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value);
|
||||
void AddValueB(const AString & a_KeyName, const AString & a_ValueName, const bool a_Value)
|
||||
{
|
||||
return SetValueI( keyname, valuename, int(value), create);
|
||||
return AddValueI(a_KeyName, a_ValueName, a_Value ? 1 : 0);
|
||||
}
|
||||
bool SetValueF( const AString & keyname, const AString & valuename, const double value, const bool create = true);
|
||||
void AddValueF(const AString & a_KeyName, const AString & a_ValueName, const double a_Value);
|
||||
|
||||
// Overwrites the value of [keyname].valuename
|
||||
// Specify the optional parameter as false (0) if you do not want the value created if it doesn't exist.
|
||||
// Returns true if value set, false otherwise.
|
||||
// Overloaded to accept string, int, and double.
|
||||
bool SetValue (const int keyID, const int valueID, const AString & value);
|
||||
bool SetValue (const AString & a_KeyName, const AString & a_ValueName, const AString & a_Value, const bool a_CreateIfNotExists = true);
|
||||
bool SetValueI(const AString & a_KeyName, const AString & a_ValueName, const int a_Value, const bool a_CreateIfNotExists = true);
|
||||
bool SetValueB(const AString & a_KeyName, const AString & a_ValueName, const bool a_Value, const bool a_CreateIfNotExists = true)
|
||||
{
|
||||
return SetValueI(a_KeyName, a_ValueName, int(a_Value), a_CreateIfNotExists);
|
||||
}
|
||||
bool SetValueF(const AString & a_KeyName, const AString & a_ValueName, const double a_Value, const bool a_CreateIfNotExists = true);
|
||||
|
||||
// tolua_end
|
||||
|
||||
bool SetValueV( const AString & keyname, const AString & valuename, char *format, ...);
|
||||
bool SetValueV( const AString & a_KeyName, const AString & a_ValueName, const char * a_Format, ...);
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
@ -25,6 +25,11 @@ else()
|
||||
add_library(lua ${SOURCE})
|
||||
endif()
|
||||
|
||||
# Tell Lua what dynamic loader to use (for LuaRocks):
|
||||
if (UNIX)
|
||||
target_link_libraries(lua m dl)
|
||||
add_definitions(-DLUA_USE_DLOPEN)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(lua m ${DYNAMIC_LOADER})
|
||||
endif()
|
||||
|
998
lib/lua/Makefile
998
lib/lua/Makefile
@ -1,998 +0,0 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
.PHONY : default_target
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
# Remove some rules from gmake that .SUFFIXES does not remove.
|
||||
SUFFIXES =
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
# Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/bin/cmake -E remove -f
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /home/tycho/MCServer
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /home/tycho/MCServer
|
||||
|
||||
#=============================================================================
|
||||
# Targets provided globally by CMake.
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
|
||||
/usr/bin/cmake -i .
|
||||
.PHONY : edit_cache
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache/fast: edit_cache
|
||||
.PHONY : edit_cache/fast
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
.PHONY : rebuild_cache
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache/fast: rebuild_cache
|
||||
.PHONY : rebuild_cache/fast
|
||||
|
||||
# The main all target
|
||||
all: cmake_check_build_system
|
||||
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles /home/tycho/MCServer/lib/lua/CMakeFiles/progress.marks
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/lua/all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles 0
|
||||
.PHONY : all
|
||||
|
||||
# The main clean target
|
||||
clean:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/lua/clean
|
||||
.PHONY : clean
|
||||
|
||||
# The main clean target
|
||||
clean/fast: clean
|
||||
.PHONY : clean/fast
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall: all
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/lua/preinstall
|
||||
.PHONY : preinstall
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall/fast:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/lua/preinstall
|
||||
.PHONY : preinstall/fast
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
.PHONY : depend
|
||||
|
||||
# Convenience name for target.
|
||||
lib/lua/CMakeFiles/lua.dir/rule:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/lua/CMakeFiles/lua.dir/rule
|
||||
.PHONY : lib/lua/CMakeFiles/lua.dir/rule
|
||||
|
||||
# Convenience name for target.
|
||||
lua: lib/lua/CMakeFiles/lua.dir/rule
|
||||
.PHONY : lua
|
||||
|
||||
# fast build rule for target.
|
||||
lua/fast:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/build
|
||||
.PHONY : lua/fast
|
||||
|
||||
src/lapi.o: src/lapi.c.o
|
||||
.PHONY : src/lapi.o
|
||||
|
||||
# target to build an object file
|
||||
src/lapi.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lapi.c.o
|
||||
.PHONY : src/lapi.c.o
|
||||
|
||||
src/lapi.i: src/lapi.c.i
|
||||
.PHONY : src/lapi.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lapi.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lapi.c.i
|
||||
.PHONY : src/lapi.c.i
|
||||
|
||||
src/lapi.s: src/lapi.c.s
|
||||
.PHONY : src/lapi.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lapi.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lapi.c.s
|
||||
.PHONY : src/lapi.c.s
|
||||
|
||||
src/lauxlib.o: src/lauxlib.c.o
|
||||
.PHONY : src/lauxlib.o
|
||||
|
||||
# target to build an object file
|
||||
src/lauxlib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lauxlib.c.o
|
||||
.PHONY : src/lauxlib.c.o
|
||||
|
||||
src/lauxlib.i: src/lauxlib.c.i
|
||||
.PHONY : src/lauxlib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lauxlib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lauxlib.c.i
|
||||
.PHONY : src/lauxlib.c.i
|
||||
|
||||
src/lauxlib.s: src/lauxlib.c.s
|
||||
.PHONY : src/lauxlib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lauxlib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lauxlib.c.s
|
||||
.PHONY : src/lauxlib.c.s
|
||||
|
||||
src/lbaselib.o: src/lbaselib.c.o
|
||||
.PHONY : src/lbaselib.o
|
||||
|
||||
# target to build an object file
|
||||
src/lbaselib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lbaselib.c.o
|
||||
.PHONY : src/lbaselib.c.o
|
||||
|
||||
src/lbaselib.i: src/lbaselib.c.i
|
||||
.PHONY : src/lbaselib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lbaselib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lbaselib.c.i
|
||||
.PHONY : src/lbaselib.c.i
|
||||
|
||||
src/lbaselib.s: src/lbaselib.c.s
|
||||
.PHONY : src/lbaselib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lbaselib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lbaselib.c.s
|
||||
.PHONY : src/lbaselib.c.s
|
||||
|
||||
src/lcode.o: src/lcode.c.o
|
||||
.PHONY : src/lcode.o
|
||||
|
||||
# target to build an object file
|
||||
src/lcode.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lcode.c.o
|
||||
.PHONY : src/lcode.c.o
|
||||
|
||||
src/lcode.i: src/lcode.c.i
|
||||
.PHONY : src/lcode.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lcode.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lcode.c.i
|
||||
.PHONY : src/lcode.c.i
|
||||
|
||||
src/lcode.s: src/lcode.c.s
|
||||
.PHONY : src/lcode.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lcode.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lcode.c.s
|
||||
.PHONY : src/lcode.c.s
|
||||
|
||||
src/ldblib.o: src/ldblib.c.o
|
||||
.PHONY : src/ldblib.o
|
||||
|
||||
# target to build an object file
|
||||
src/ldblib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldblib.c.o
|
||||
.PHONY : src/ldblib.c.o
|
||||
|
||||
src/ldblib.i: src/ldblib.c.i
|
||||
.PHONY : src/ldblib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ldblib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldblib.c.i
|
||||
.PHONY : src/ldblib.c.i
|
||||
|
||||
src/ldblib.s: src/ldblib.c.s
|
||||
.PHONY : src/ldblib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ldblib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldblib.c.s
|
||||
.PHONY : src/ldblib.c.s
|
||||
|
||||
src/ldebug.o: src/ldebug.c.o
|
||||
.PHONY : src/ldebug.o
|
||||
|
||||
# target to build an object file
|
||||
src/ldebug.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldebug.c.o
|
||||
.PHONY : src/ldebug.c.o
|
||||
|
||||
src/ldebug.i: src/ldebug.c.i
|
||||
.PHONY : src/ldebug.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ldebug.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldebug.c.i
|
||||
.PHONY : src/ldebug.c.i
|
||||
|
||||
src/ldebug.s: src/ldebug.c.s
|
||||
.PHONY : src/ldebug.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ldebug.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldebug.c.s
|
||||
.PHONY : src/ldebug.c.s
|
||||
|
||||
src/ldo.o: src/ldo.c.o
|
||||
.PHONY : src/ldo.o
|
||||
|
||||
# target to build an object file
|
||||
src/ldo.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldo.c.o
|
||||
.PHONY : src/ldo.c.o
|
||||
|
||||
src/ldo.i: src/ldo.c.i
|
||||
.PHONY : src/ldo.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ldo.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldo.c.i
|
||||
.PHONY : src/ldo.c.i
|
||||
|
||||
src/ldo.s: src/ldo.c.s
|
||||
.PHONY : src/ldo.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ldo.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldo.c.s
|
||||
.PHONY : src/ldo.c.s
|
||||
|
||||
src/ldump.o: src/ldump.c.o
|
||||
.PHONY : src/ldump.o
|
||||
|
||||
# target to build an object file
|
||||
src/ldump.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldump.c.o
|
||||
.PHONY : src/ldump.c.o
|
||||
|
||||
src/ldump.i: src/ldump.c.i
|
||||
.PHONY : src/ldump.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ldump.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldump.c.i
|
||||
.PHONY : src/ldump.c.i
|
||||
|
||||
src/ldump.s: src/ldump.c.s
|
||||
.PHONY : src/ldump.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ldump.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ldump.c.s
|
||||
.PHONY : src/ldump.c.s
|
||||
|
||||
src/lfunc.o: src/lfunc.c.o
|
||||
.PHONY : src/lfunc.o
|
||||
|
||||
# target to build an object file
|
||||
src/lfunc.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lfunc.c.o
|
||||
.PHONY : src/lfunc.c.o
|
||||
|
||||
src/lfunc.i: src/lfunc.c.i
|
||||
.PHONY : src/lfunc.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lfunc.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lfunc.c.i
|
||||
.PHONY : src/lfunc.c.i
|
||||
|
||||
src/lfunc.s: src/lfunc.c.s
|
||||
.PHONY : src/lfunc.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lfunc.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lfunc.c.s
|
||||
.PHONY : src/lfunc.c.s
|
||||
|
||||
src/lgc.o: src/lgc.c.o
|
||||
.PHONY : src/lgc.o
|
||||
|
||||
# target to build an object file
|
||||
src/lgc.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lgc.c.o
|
||||
.PHONY : src/lgc.c.o
|
||||
|
||||
src/lgc.i: src/lgc.c.i
|
||||
.PHONY : src/lgc.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lgc.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lgc.c.i
|
||||
.PHONY : src/lgc.c.i
|
||||
|
||||
src/lgc.s: src/lgc.c.s
|
||||
.PHONY : src/lgc.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lgc.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lgc.c.s
|
||||
.PHONY : src/lgc.c.s
|
||||
|
||||
src/linit.o: src/linit.c.o
|
||||
.PHONY : src/linit.o
|
||||
|
||||
# target to build an object file
|
||||
src/linit.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/linit.c.o
|
||||
.PHONY : src/linit.c.o
|
||||
|
||||
src/linit.i: src/linit.c.i
|
||||
.PHONY : src/linit.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/linit.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/linit.c.i
|
||||
.PHONY : src/linit.c.i
|
||||
|
||||
src/linit.s: src/linit.c.s
|
||||
.PHONY : src/linit.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/linit.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/linit.c.s
|
||||
.PHONY : src/linit.c.s
|
||||
|
||||
src/liolib.o: src/liolib.c.o
|
||||
.PHONY : src/liolib.o
|
||||
|
||||
# target to build an object file
|
||||
src/liolib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/liolib.c.o
|
||||
.PHONY : src/liolib.c.o
|
||||
|
||||
src/liolib.i: src/liolib.c.i
|
||||
.PHONY : src/liolib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/liolib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/liolib.c.i
|
||||
.PHONY : src/liolib.c.i
|
||||
|
||||
src/liolib.s: src/liolib.c.s
|
||||
.PHONY : src/liolib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/liolib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/liolib.c.s
|
||||
.PHONY : src/liolib.c.s
|
||||
|
||||
src/llex.o: src/llex.c.o
|
||||
.PHONY : src/llex.o
|
||||
|
||||
# target to build an object file
|
||||
src/llex.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/llex.c.o
|
||||
.PHONY : src/llex.c.o
|
||||
|
||||
src/llex.i: src/llex.c.i
|
||||
.PHONY : src/llex.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/llex.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/llex.c.i
|
||||
.PHONY : src/llex.c.i
|
||||
|
||||
src/llex.s: src/llex.c.s
|
||||
.PHONY : src/llex.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/llex.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/llex.c.s
|
||||
.PHONY : src/llex.c.s
|
||||
|
||||
src/lmathlib.o: src/lmathlib.c.o
|
||||
.PHONY : src/lmathlib.o
|
||||
|
||||
# target to build an object file
|
||||
src/lmathlib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lmathlib.c.o
|
||||
.PHONY : src/lmathlib.c.o
|
||||
|
||||
src/lmathlib.i: src/lmathlib.c.i
|
||||
.PHONY : src/lmathlib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lmathlib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lmathlib.c.i
|
||||
.PHONY : src/lmathlib.c.i
|
||||
|
||||
src/lmathlib.s: src/lmathlib.c.s
|
||||
.PHONY : src/lmathlib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lmathlib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lmathlib.c.s
|
||||
.PHONY : src/lmathlib.c.s
|
||||
|
||||
src/lmem.o: src/lmem.c.o
|
||||
.PHONY : src/lmem.o
|
||||
|
||||
# target to build an object file
|
||||
src/lmem.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lmem.c.o
|
||||
.PHONY : src/lmem.c.o
|
||||
|
||||
src/lmem.i: src/lmem.c.i
|
||||
.PHONY : src/lmem.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lmem.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lmem.c.i
|
||||
.PHONY : src/lmem.c.i
|
||||
|
||||
src/lmem.s: src/lmem.c.s
|
||||
.PHONY : src/lmem.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lmem.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lmem.c.s
|
||||
.PHONY : src/lmem.c.s
|
||||
|
||||
src/loadlib.o: src/loadlib.c.o
|
||||
.PHONY : src/loadlib.o
|
||||
|
||||
# target to build an object file
|
||||
src/loadlib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/loadlib.c.o
|
||||
.PHONY : src/loadlib.c.o
|
||||
|
||||
src/loadlib.i: src/loadlib.c.i
|
||||
.PHONY : src/loadlib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/loadlib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/loadlib.c.i
|
||||
.PHONY : src/loadlib.c.i
|
||||
|
||||
src/loadlib.s: src/loadlib.c.s
|
||||
.PHONY : src/loadlib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/loadlib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/loadlib.c.s
|
||||
.PHONY : src/loadlib.c.s
|
||||
|
||||
src/lobject.o: src/lobject.c.o
|
||||
.PHONY : src/lobject.o
|
||||
|
||||
# target to build an object file
|
||||
src/lobject.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lobject.c.o
|
||||
.PHONY : src/lobject.c.o
|
||||
|
||||
src/lobject.i: src/lobject.c.i
|
||||
.PHONY : src/lobject.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lobject.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lobject.c.i
|
||||
.PHONY : src/lobject.c.i
|
||||
|
||||
src/lobject.s: src/lobject.c.s
|
||||
.PHONY : src/lobject.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lobject.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lobject.c.s
|
||||
.PHONY : src/lobject.c.s
|
||||
|
||||
src/lopcodes.o: src/lopcodes.c.o
|
||||
.PHONY : src/lopcodes.o
|
||||
|
||||
# target to build an object file
|
||||
src/lopcodes.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lopcodes.c.o
|
||||
.PHONY : src/lopcodes.c.o
|
||||
|
||||
src/lopcodes.i: src/lopcodes.c.i
|
||||
.PHONY : src/lopcodes.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lopcodes.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lopcodes.c.i
|
||||
.PHONY : src/lopcodes.c.i
|
||||
|
||||
src/lopcodes.s: src/lopcodes.c.s
|
||||
.PHONY : src/lopcodes.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lopcodes.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lopcodes.c.s
|
||||
.PHONY : src/lopcodes.c.s
|
||||
|
||||
src/loslib.o: src/loslib.c.o
|
||||
.PHONY : src/loslib.o
|
||||
|
||||
# target to build an object file
|
||||
src/loslib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/loslib.c.o
|
||||
.PHONY : src/loslib.c.o
|
||||
|
||||
src/loslib.i: src/loslib.c.i
|
||||
.PHONY : src/loslib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/loslib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/loslib.c.i
|
||||
.PHONY : src/loslib.c.i
|
||||
|
||||
src/loslib.s: src/loslib.c.s
|
||||
.PHONY : src/loslib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/loslib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/loslib.c.s
|
||||
.PHONY : src/loslib.c.s
|
||||
|
||||
src/lparser.o: src/lparser.c.o
|
||||
.PHONY : src/lparser.o
|
||||
|
||||
# target to build an object file
|
||||
src/lparser.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lparser.c.o
|
||||
.PHONY : src/lparser.c.o
|
||||
|
||||
src/lparser.i: src/lparser.c.i
|
||||
.PHONY : src/lparser.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lparser.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lparser.c.i
|
||||
.PHONY : src/lparser.c.i
|
||||
|
||||
src/lparser.s: src/lparser.c.s
|
||||
.PHONY : src/lparser.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lparser.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lparser.c.s
|
||||
.PHONY : src/lparser.c.s
|
||||
|
||||
src/lstate.o: src/lstate.c.o
|
||||
.PHONY : src/lstate.o
|
||||
|
||||
# target to build an object file
|
||||
src/lstate.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstate.c.o
|
||||
.PHONY : src/lstate.c.o
|
||||
|
||||
src/lstate.i: src/lstate.c.i
|
||||
.PHONY : src/lstate.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lstate.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstate.c.i
|
||||
.PHONY : src/lstate.c.i
|
||||
|
||||
src/lstate.s: src/lstate.c.s
|
||||
.PHONY : src/lstate.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lstate.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstate.c.s
|
||||
.PHONY : src/lstate.c.s
|
||||
|
||||
src/lstring.o: src/lstring.c.o
|
||||
.PHONY : src/lstring.o
|
||||
|
||||
# target to build an object file
|
||||
src/lstring.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstring.c.o
|
||||
.PHONY : src/lstring.c.o
|
||||
|
||||
src/lstring.i: src/lstring.c.i
|
||||
.PHONY : src/lstring.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lstring.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstring.c.i
|
||||
.PHONY : src/lstring.c.i
|
||||
|
||||
src/lstring.s: src/lstring.c.s
|
||||
.PHONY : src/lstring.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lstring.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstring.c.s
|
||||
.PHONY : src/lstring.c.s
|
||||
|
||||
src/lstrlib.o: src/lstrlib.c.o
|
||||
.PHONY : src/lstrlib.o
|
||||
|
||||
# target to build an object file
|
||||
src/lstrlib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstrlib.c.o
|
||||
.PHONY : src/lstrlib.c.o
|
||||
|
||||
src/lstrlib.i: src/lstrlib.c.i
|
||||
.PHONY : src/lstrlib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lstrlib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstrlib.c.i
|
||||
.PHONY : src/lstrlib.c.i
|
||||
|
||||
src/lstrlib.s: src/lstrlib.c.s
|
||||
.PHONY : src/lstrlib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lstrlib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lstrlib.c.s
|
||||
.PHONY : src/lstrlib.c.s
|
||||
|
||||
src/ltable.o: src/ltable.c.o
|
||||
.PHONY : src/ltable.o
|
||||
|
||||
# target to build an object file
|
||||
src/ltable.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltable.c.o
|
||||
.PHONY : src/ltable.c.o
|
||||
|
||||
src/ltable.i: src/ltable.c.i
|
||||
.PHONY : src/ltable.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ltable.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltable.c.i
|
||||
.PHONY : src/ltable.c.i
|
||||
|
||||
src/ltable.s: src/ltable.c.s
|
||||
.PHONY : src/ltable.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ltable.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltable.c.s
|
||||
.PHONY : src/ltable.c.s
|
||||
|
||||
src/ltablib.o: src/ltablib.c.o
|
||||
.PHONY : src/ltablib.o
|
||||
|
||||
# target to build an object file
|
||||
src/ltablib.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltablib.c.o
|
||||
.PHONY : src/ltablib.c.o
|
||||
|
||||
src/ltablib.i: src/ltablib.c.i
|
||||
.PHONY : src/ltablib.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ltablib.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltablib.c.i
|
||||
.PHONY : src/ltablib.c.i
|
||||
|
||||
src/ltablib.s: src/ltablib.c.s
|
||||
.PHONY : src/ltablib.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ltablib.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltablib.c.s
|
||||
.PHONY : src/ltablib.c.s
|
||||
|
||||
src/ltm.o: src/ltm.c.o
|
||||
.PHONY : src/ltm.o
|
||||
|
||||
# target to build an object file
|
||||
src/ltm.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltm.c.o
|
||||
.PHONY : src/ltm.c.o
|
||||
|
||||
src/ltm.i: src/ltm.c.i
|
||||
.PHONY : src/ltm.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/ltm.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltm.c.i
|
||||
.PHONY : src/ltm.c.i
|
||||
|
||||
src/ltm.s: src/ltm.c.s
|
||||
.PHONY : src/ltm.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/ltm.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/ltm.c.s
|
||||
.PHONY : src/ltm.c.s
|
||||
|
||||
src/lua.o: src/lua.c.o
|
||||
.PHONY : src/lua.o
|
||||
|
||||
# target to build an object file
|
||||
src/lua.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lua.c.o
|
||||
.PHONY : src/lua.c.o
|
||||
|
||||
src/lua.i: src/lua.c.i
|
||||
.PHONY : src/lua.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lua.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lua.c.i
|
||||
.PHONY : src/lua.c.i
|
||||
|
||||
src/lua.s: src/lua.c.s
|
||||
.PHONY : src/lua.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lua.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lua.c.s
|
||||
.PHONY : src/lua.c.s
|
||||
|
||||
src/luac.o: src/luac.c.o
|
||||
.PHONY : src/luac.o
|
||||
|
||||
# target to build an object file
|
||||
src/luac.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/luac.c.o
|
||||
.PHONY : src/luac.c.o
|
||||
|
||||
src/luac.i: src/luac.c.i
|
||||
.PHONY : src/luac.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/luac.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/luac.c.i
|
||||
.PHONY : src/luac.c.i
|
||||
|
||||
src/luac.s: src/luac.c.s
|
||||
.PHONY : src/luac.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/luac.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/luac.c.s
|
||||
.PHONY : src/luac.c.s
|
||||
|
||||
src/lundump.o: src/lundump.c.o
|
||||
.PHONY : src/lundump.o
|
||||
|
||||
# target to build an object file
|
||||
src/lundump.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lundump.c.o
|
||||
.PHONY : src/lundump.c.o
|
||||
|
||||
src/lundump.i: src/lundump.c.i
|
||||
.PHONY : src/lundump.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lundump.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lundump.c.i
|
||||
.PHONY : src/lundump.c.i
|
||||
|
||||
src/lundump.s: src/lundump.c.s
|
||||
.PHONY : src/lundump.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lundump.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lundump.c.s
|
||||
.PHONY : src/lundump.c.s
|
||||
|
||||
src/lvm.o: src/lvm.c.o
|
||||
.PHONY : src/lvm.o
|
||||
|
||||
# target to build an object file
|
||||
src/lvm.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lvm.c.o
|
||||
.PHONY : src/lvm.c.o
|
||||
|
||||
src/lvm.i: src/lvm.c.i
|
||||
.PHONY : src/lvm.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lvm.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lvm.c.i
|
||||
.PHONY : src/lvm.c.i
|
||||
|
||||
src/lvm.s: src/lvm.c.s
|
||||
.PHONY : src/lvm.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lvm.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lvm.c.s
|
||||
.PHONY : src/lvm.c.s
|
||||
|
||||
src/lzio.o: src/lzio.c.o
|
||||
.PHONY : src/lzio.o
|
||||
|
||||
# target to build an object file
|
||||
src/lzio.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lzio.c.o
|
||||
.PHONY : src/lzio.c.o
|
||||
|
||||
src/lzio.i: src/lzio.c.i
|
||||
.PHONY : src/lzio.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lzio.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lzio.c.i
|
||||
.PHONY : src/lzio.c.i
|
||||
|
||||
src/lzio.s: src/lzio.c.s
|
||||
.PHONY : src/lzio.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lzio.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/lzio.c.s
|
||||
.PHONY : src/lzio.c.s
|
||||
|
||||
src/print.o: src/print.c.o
|
||||
.PHONY : src/print.o
|
||||
|
||||
# target to build an object file
|
||||
src/print.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/print.c.o
|
||||
.PHONY : src/print.c.o
|
||||
|
||||
src/print.i: src/print.c.i
|
||||
.PHONY : src/print.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/print.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/print.c.i
|
||||
.PHONY : src/print.c.i
|
||||
|
||||
src/print.s: src/print.c.s
|
||||
.PHONY : src/print.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/print.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/lua/CMakeFiles/lua.dir/build.make lib/lua/CMakeFiles/lua.dir/src/print.c.s
|
||||
.PHONY : src/print.c.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@echo "... all (the default if no target is provided)"
|
||||
@echo "... clean"
|
||||
@echo "... depend"
|
||||
@echo "... edit_cache"
|
||||
@echo "... lua"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... src/lapi.o"
|
||||
@echo "... src/lapi.i"
|
||||
@echo "... src/lapi.s"
|
||||
@echo "... src/lauxlib.o"
|
||||
@echo "... src/lauxlib.i"
|
||||
@echo "... src/lauxlib.s"
|
||||
@echo "... src/lbaselib.o"
|
||||
@echo "... src/lbaselib.i"
|
||||
@echo "... src/lbaselib.s"
|
||||
@echo "... src/lcode.o"
|
||||
@echo "... src/lcode.i"
|
||||
@echo "... src/lcode.s"
|
||||
@echo "... src/ldblib.o"
|
||||
@echo "... src/ldblib.i"
|
||||
@echo "... src/ldblib.s"
|
||||
@echo "... src/ldebug.o"
|
||||
@echo "... src/ldebug.i"
|
||||
@echo "... src/ldebug.s"
|
||||
@echo "... src/ldo.o"
|
||||
@echo "... src/ldo.i"
|
||||
@echo "... src/ldo.s"
|
||||
@echo "... src/ldump.o"
|
||||
@echo "... src/ldump.i"
|
||||
@echo "... src/ldump.s"
|
||||
@echo "... src/lfunc.o"
|
||||
@echo "... src/lfunc.i"
|
||||
@echo "... src/lfunc.s"
|
||||
@echo "... src/lgc.o"
|
||||
@echo "... src/lgc.i"
|
||||
@echo "... src/lgc.s"
|
||||
@echo "... src/linit.o"
|
||||
@echo "... src/linit.i"
|
||||
@echo "... src/linit.s"
|
||||
@echo "... src/liolib.o"
|
||||
@echo "... src/liolib.i"
|
||||
@echo "... src/liolib.s"
|
||||
@echo "... src/llex.o"
|
||||
@echo "... src/llex.i"
|
||||
@echo "... src/llex.s"
|
||||
@echo "... src/lmathlib.o"
|
||||
@echo "... src/lmathlib.i"
|
||||
@echo "... src/lmathlib.s"
|
||||
@echo "... src/lmem.o"
|
||||
@echo "... src/lmem.i"
|
||||
@echo "... src/lmem.s"
|
||||
@echo "... src/loadlib.o"
|
||||
@echo "... src/loadlib.i"
|
||||
@echo "... src/loadlib.s"
|
||||
@echo "... src/lobject.o"
|
||||
@echo "... src/lobject.i"
|
||||
@echo "... src/lobject.s"
|
||||
@echo "... src/lopcodes.o"
|
||||
@echo "... src/lopcodes.i"
|
||||
@echo "... src/lopcodes.s"
|
||||
@echo "... src/loslib.o"
|
||||
@echo "... src/loslib.i"
|
||||
@echo "... src/loslib.s"
|
||||
@echo "... src/lparser.o"
|
||||
@echo "... src/lparser.i"
|
||||
@echo "... src/lparser.s"
|
||||
@echo "... src/lstate.o"
|
||||
@echo "... src/lstate.i"
|
||||
@echo "... src/lstate.s"
|
||||
@echo "... src/lstring.o"
|
||||
@echo "... src/lstring.i"
|
||||
@echo "... src/lstring.s"
|
||||
@echo "... src/lstrlib.o"
|
||||
@echo "... src/lstrlib.i"
|
||||
@echo "... src/lstrlib.s"
|
||||
@echo "... src/ltable.o"
|
||||
@echo "... src/ltable.i"
|
||||
@echo "... src/ltable.s"
|
||||
@echo "... src/ltablib.o"
|
||||
@echo "... src/ltablib.i"
|
||||
@echo "... src/ltablib.s"
|
||||
@echo "... src/ltm.o"
|
||||
@echo "... src/ltm.i"
|
||||
@echo "... src/ltm.s"
|
||||
@echo "... src/lua.o"
|
||||
@echo "... src/lua.i"
|
||||
@echo "... src/lua.s"
|
||||
@echo "... src/luac.o"
|
||||
@echo "... src/luac.i"
|
||||
@echo "... src/luac.s"
|
||||
@echo "... src/lundump.o"
|
||||
@echo "... src/lundump.i"
|
||||
@echo "... src/lundump.s"
|
||||
@echo "... src/lvm.o"
|
||||
@echo "... src/lvm.i"
|
||||
@echo "... src/lvm.s"
|
||||
@echo "... src/lzio.o"
|
||||
@echo "... src/lzio.i"
|
||||
@echo "... src/lzio.s"
|
||||
@echo "... src/print.o"
|
||||
@echo "... src/print.i"
|
||||
@echo "... src/print.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
@ -21,5 +21,5 @@ endif()
|
||||
add_library(sqlite ${SOURCE})
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(sqlite dl)
|
||||
target_link_libraries(sqlite ${DYNAMIC_LOADER})
|
||||
endif()
|
||||
|
@ -1,338 +0,0 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
.PHONY : default_target
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
# Remove some rules from gmake that .SUFFIXES does not remove.
|
||||
SUFFIXES =
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
# Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/bin/cmake -E remove -f
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /home/tycho/MCServer
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /home/tycho/MCServer
|
||||
|
||||
#=============================================================================
|
||||
# Targets provided globally by CMake.
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
|
||||
/usr/bin/cmake -i .
|
||||
.PHONY : edit_cache
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache/fast: edit_cache
|
||||
.PHONY : edit_cache/fast
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
.PHONY : rebuild_cache
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache/fast: rebuild_cache
|
||||
.PHONY : rebuild_cache/fast
|
||||
|
||||
# The main all target
|
||||
all: cmake_check_build_system
|
||||
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles /home/tycho/MCServer/lib/tolua++/CMakeFiles/progress.marks
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles 0
|
||||
.PHONY : all
|
||||
|
||||
# The main clean target
|
||||
clean:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/clean
|
||||
.PHONY : clean
|
||||
|
||||
# The main clean target
|
||||
clean/fast: clean
|
||||
.PHONY : clean/fast
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall: all
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/preinstall
|
||||
.PHONY : preinstall
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall/fast:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/preinstall
|
||||
.PHONY : preinstall/fast
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
.PHONY : depend
|
||||
|
||||
# Convenience name for target.
|
||||
lib/tolua++/CMakeFiles/tolua.dir/rule:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/CMakeFiles/tolua.dir/rule
|
||||
.PHONY : lib/tolua++/CMakeFiles/tolua.dir/rule
|
||||
|
||||
# Convenience name for target.
|
||||
tolua: lib/tolua++/CMakeFiles/tolua.dir/rule
|
||||
.PHONY : tolua
|
||||
|
||||
# fast build rule for target.
|
||||
tolua/fast:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/build
|
||||
.PHONY : tolua/fast
|
||||
|
||||
# Convenience name for target.
|
||||
lib/tolua++/CMakeFiles/tolualib.dir/rule:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/CMakeFiles/tolualib.dir/rule
|
||||
.PHONY : lib/tolua++/CMakeFiles/tolualib.dir/rule
|
||||
|
||||
# Convenience name for target.
|
||||
tolualib: lib/tolua++/CMakeFiles/tolualib.dir/rule
|
||||
.PHONY : tolualib
|
||||
|
||||
# fast build rule for target.
|
||||
tolualib/fast:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/build
|
||||
.PHONY : tolualib/fast
|
||||
|
||||
src/bin/tolua.o: src/bin/tolua.c.o
|
||||
.PHONY : src/bin/tolua.o
|
||||
|
||||
# target to build an object file
|
||||
src/bin/tolua.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.o
|
||||
.PHONY : src/bin/tolua.c.o
|
||||
|
||||
src/bin/tolua.i: src/bin/tolua.c.i
|
||||
.PHONY : src/bin/tolua.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/bin/tolua.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.i
|
||||
.PHONY : src/bin/tolua.c.i
|
||||
|
||||
src/bin/tolua.s: src/bin/tolua.c.s
|
||||
.PHONY : src/bin/tolua.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/bin/tolua.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.s
|
||||
.PHONY : src/bin/tolua.c.s
|
||||
|
||||
src/bin/toluabind.o: src/bin/toluabind.c.o
|
||||
.PHONY : src/bin/toluabind.o
|
||||
|
||||
# target to build an object file
|
||||
src/bin/toluabind.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.o
|
||||
.PHONY : src/bin/toluabind.c.o
|
||||
|
||||
src/bin/toluabind.i: src/bin/toluabind.c.i
|
||||
.PHONY : src/bin/toluabind.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/bin/toluabind.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.i
|
||||
.PHONY : src/bin/toluabind.c.i
|
||||
|
||||
src/bin/toluabind.s: src/bin/toluabind.c.s
|
||||
.PHONY : src/bin/toluabind.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/bin/toluabind.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.s
|
||||
.PHONY : src/bin/toluabind.c.s
|
||||
|
||||
src/lib/tolua_event.o: src/lib/tolua_event.c.o
|
||||
.PHONY : src/lib/tolua_event.o
|
||||
|
||||
# target to build an object file
|
||||
src/lib/tolua_event.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.o
|
||||
.PHONY : src/lib/tolua_event.c.o
|
||||
|
||||
src/lib/tolua_event.i: src/lib/tolua_event.c.i
|
||||
.PHONY : src/lib/tolua_event.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lib/tolua_event.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.i
|
||||
.PHONY : src/lib/tolua_event.c.i
|
||||
|
||||
src/lib/tolua_event.s: src/lib/tolua_event.c.s
|
||||
.PHONY : src/lib/tolua_event.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lib/tolua_event.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.s
|
||||
.PHONY : src/lib/tolua_event.c.s
|
||||
|
||||
src/lib/tolua_is.o: src/lib/tolua_is.c.o
|
||||
.PHONY : src/lib/tolua_is.o
|
||||
|
||||
# target to build an object file
|
||||
src/lib/tolua_is.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.o
|
||||
.PHONY : src/lib/tolua_is.c.o
|
||||
|
||||
src/lib/tolua_is.i: src/lib/tolua_is.c.i
|
||||
.PHONY : src/lib/tolua_is.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lib/tolua_is.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.i
|
||||
.PHONY : src/lib/tolua_is.c.i
|
||||
|
||||
src/lib/tolua_is.s: src/lib/tolua_is.c.s
|
||||
.PHONY : src/lib/tolua_is.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lib/tolua_is.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.s
|
||||
.PHONY : src/lib/tolua_is.c.s
|
||||
|
||||
src/lib/tolua_map.o: src/lib/tolua_map.c.o
|
||||
.PHONY : src/lib/tolua_map.o
|
||||
|
||||
# target to build an object file
|
||||
src/lib/tolua_map.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.o
|
||||
.PHONY : src/lib/tolua_map.c.o
|
||||
|
||||
src/lib/tolua_map.i: src/lib/tolua_map.c.i
|
||||
.PHONY : src/lib/tolua_map.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lib/tolua_map.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.i
|
||||
.PHONY : src/lib/tolua_map.c.i
|
||||
|
||||
src/lib/tolua_map.s: src/lib/tolua_map.c.s
|
||||
.PHONY : src/lib/tolua_map.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lib/tolua_map.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.s
|
||||
.PHONY : src/lib/tolua_map.c.s
|
||||
|
||||
src/lib/tolua_push.o: src/lib/tolua_push.c.o
|
||||
.PHONY : src/lib/tolua_push.o
|
||||
|
||||
# target to build an object file
|
||||
src/lib/tolua_push.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.o
|
||||
.PHONY : src/lib/tolua_push.c.o
|
||||
|
||||
src/lib/tolua_push.i: src/lib/tolua_push.c.i
|
||||
.PHONY : src/lib/tolua_push.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lib/tolua_push.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.i
|
||||
.PHONY : src/lib/tolua_push.c.i
|
||||
|
||||
src/lib/tolua_push.s: src/lib/tolua_push.c.s
|
||||
.PHONY : src/lib/tolua_push.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lib/tolua_push.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.s
|
||||
.PHONY : src/lib/tolua_push.c.s
|
||||
|
||||
src/lib/tolua_to.o: src/lib/tolua_to.c.o
|
||||
.PHONY : src/lib/tolua_to.o
|
||||
|
||||
# target to build an object file
|
||||
src/lib/tolua_to.c.o:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.o
|
||||
.PHONY : src/lib/tolua_to.c.o
|
||||
|
||||
src/lib/tolua_to.i: src/lib/tolua_to.c.i
|
||||
.PHONY : src/lib/tolua_to.i
|
||||
|
||||
# target to preprocess a source file
|
||||
src/lib/tolua_to.c.i:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.i
|
||||
.PHONY : src/lib/tolua_to.c.i
|
||||
|
||||
src/lib/tolua_to.s: src/lib/tolua_to.c.s
|
||||
.PHONY : src/lib/tolua_to.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
src/lib/tolua_to.c.s:
|
||||
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.s
|
||||
.PHONY : src/lib/tolua_to.c.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@echo "... all (the default if no target is provided)"
|
||||
@echo "... clean"
|
||||
@echo "... depend"
|
||||
@echo "... edit_cache"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... tolua"
|
||||
@echo "... tolualib"
|
||||
@echo "... src/bin/tolua.o"
|
||||
@echo "... src/bin/tolua.i"
|
||||
@echo "... src/bin/tolua.s"
|
||||
@echo "... src/bin/toluabind.o"
|
||||
@echo "... src/bin/toluabind.i"
|
||||
@echo "... src/bin/toluabind.s"
|
||||
@echo "... src/lib/tolua_event.o"
|
||||
@echo "... src/lib/tolua_event.i"
|
||||
@echo "... src/lib/tolua_event.s"
|
||||
@echo "... src/lib/tolua_is.o"
|
||||
@echo "... src/lib/tolua_is.i"
|
||||
@echo "... src/lib/tolua_is.s"
|
||||
@echo "... src/lib/tolua_map.o"
|
||||
@echo "... src/lib/tolua_map.i"
|
||||
@echo "... src/lib/tolua_map.s"
|
||||
@echo "... src/lib/tolua_push.o"
|
||||
@echo "... src/lib/tolua_push.i"
|
||||
@echo "... src/lib/tolua_push.s"
|
||||
@echo "... src/lib/tolua_to.o"
|
||||
@echo "... src/lib/tolua_to.i"
|
||||
@echo "... src/lib/tolua_to.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
@ -1,8 +1,6 @@
|
||||
|
||||
$#include "../Globals.h"
|
||||
|
||||
$#include "tolua_base.h"
|
||||
|
||||
// Typedefs from Globals.h, so that we don't have to process that file:
|
||||
typedef long long Int64;
|
||||
typedef int Int32;
|
||||
@ -14,6 +12,7 @@ typedef unsigned short UInt16;
|
||||
|
||||
|
||||
$cfile "../ChunkDef.h"
|
||||
$cfile "../BiomeDef.h"
|
||||
|
||||
$cfile "../../lib/inifile/iniFile.h"
|
||||
|
||||
|
@ -2,16 +2,21 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
project (MCServer)
|
||||
|
||||
# NOTE: This CMake file is processed only for Unix builds; Windows(MSVC) builds handle all the subfolders in /src in a single file, /src/CMakeLists.txt
|
||||
|
||||
include_directories ("${PROJECT_SOURCE_DIR}/../")
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
#add any new generated bindings here
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Bindings.cpp ${CMAKE_CURRENT_BINARY_DIR}/Bindings.h
|
||||
#command execuded to regerate bindings
|
||||
ADD_CUSTOM_COMMAND(
|
||||
# add any new generated bindings here
|
||||
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h
|
||||
|
||||
# command execuded to regerate bindings
|
||||
COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
|
||||
#add any new generation dependencies here
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
||||
# add any new generation dependencies here
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/virtual_method_hooks.lua ${CMAKE_CURRENT_SOURCE_DIR}/AllToLua.pkg tolua
|
||||
)
|
||||
)
|
||||
|
||||
#add cpp files here
|
||||
add_library(Bindings PluginManager LuaState WebPlugin Bindings ManualBindings LuaWindow Plugin PluginLua WebPlugin)
|
||||
|
@ -228,6 +228,9 @@ bool cLuaState::PushFunction(const char * a_FunctionName)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Push the error handler for lua_pcall()
|
||||
lua_pushcfunction(m_LuaState, &ReportFnCallErrors);
|
||||
|
||||
lua_getglobal(m_LuaState, a_FunctionName);
|
||||
if (!lua_isfunction(m_LuaState, -1))
|
||||
{
|
||||
@ -249,6 +252,9 @@ bool cLuaState::PushFunction(int a_FnRef)
|
||||
ASSERT(IsValid());
|
||||
ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack
|
||||
|
||||
// Push the error handler for lua_pcall()
|
||||
lua_pushcfunction(m_LuaState, &ReportFnCallErrors);
|
||||
|
||||
lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_FnRef); // same as lua_getref()
|
||||
if (!lua_isfunction(m_LuaState, -1))
|
||||
{
|
||||
@ -264,27 +270,29 @@ bool cLuaState::PushFunction(int a_FnRef)
|
||||
|
||||
|
||||
|
||||
bool cLuaState::PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnName)
|
||||
bool cLuaState::PushFunction(const cTableRef & a_TableRef)
|
||||
{
|
||||
ASSERT(IsValid());
|
||||
ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack
|
||||
|
||||
lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_TableRef); // Get the table ref
|
||||
// Push the error handler for lua_pcall()
|
||||
lua_pushcfunction(m_LuaState, &ReportFnCallErrors);
|
||||
|
||||
lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_TableRef.GetTableRef()); // Get the table ref
|
||||
if (!lua_istable(m_LuaState, -1))
|
||||
{
|
||||
// Not a table, bail out
|
||||
lua_pop(m_LuaState, 1);
|
||||
return false;
|
||||
}
|
||||
lua_getfield(m_LuaState, -1, a_FnName);
|
||||
lua_getfield(m_LuaState, -1, a_TableRef.GetFnName());
|
||||
if (lua_isnil(m_LuaState, -1) || !lua_isfunction(m_LuaState, -1))
|
||||
{
|
||||
// Not a valid function, bail out
|
||||
lua_pop(m_LuaState, 2);
|
||||
return false;
|
||||
}
|
||||
lua_remove(m_LuaState, -2); // Remove the table ref from the stack
|
||||
m_CurrentFunctionName = "<table_callback>";
|
||||
Printf(m_CurrentFunctionName, "<table-callback %s>", a_TableRef.GetFnName());
|
||||
m_NumCurrentFunctionArgs = 0;
|
||||
return true;
|
||||
}
|
||||
@ -297,7 +305,7 @@ void cLuaState::Push(const AString & a_String)
|
||||
{
|
||||
ASSERT(IsValid());
|
||||
|
||||
tolua_pushcppstring(m_LuaState, a_String);
|
||||
lua_pushlstring(m_LuaState, a_String.data(), a_String.size());
|
||||
m_NumCurrentFunctionArgs += 1;
|
||||
}
|
||||
|
||||
@ -468,6 +476,18 @@ void cLuaState::Push(cItems * a_Items)
|
||||
|
||||
|
||||
|
||||
void cLuaState::Push(const cItems & a_Items)
|
||||
{
|
||||
ASSERT(IsValid());
|
||||
|
||||
tolua_pushusertype(m_LuaState, (void *)&a_Items, "cItems");
|
||||
m_NumCurrentFunctionArgs += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cLuaState::Push(cClientHandle * a_Client)
|
||||
{
|
||||
ASSERT(IsValid());
|
||||
@ -720,11 +740,13 @@ void cLuaState::GetReturn(int a_StackPos, double & a_ReturnedVal)
|
||||
bool cLuaState::CallFunction(int a_NumResults)
|
||||
{
|
||||
ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
|
||||
ASSERT(lua_isfunction(m_LuaState, -m_NumCurrentFunctionArgs - 1));
|
||||
ASSERT(lua_isfunction(m_LuaState, -m_NumCurrentFunctionArgs - 1)); // The function to call
|
||||
ASSERT(lua_isfunction(m_LuaState, -m_NumCurrentFunctionArgs - 2)); // The error handler
|
||||
|
||||
int s = lua_pcall(m_LuaState, m_NumCurrentFunctionArgs, a_NumResults, 0);
|
||||
if (ReportErrors(s))
|
||||
int s = lua_pcall(m_LuaState, m_NumCurrentFunctionArgs, a_NumResults, -m_NumCurrentFunctionArgs - 2);
|
||||
if (s != 0)
|
||||
{
|
||||
// The error has already been printed together with the stacktrace
|
||||
LOGWARNING("Error in %s calling function %s()", m_SubsystemName.c_str(), m_CurrentFunctionName.c_str());
|
||||
m_NumCurrentFunctionArgs = -1;
|
||||
m_CurrentFunctionName.clear();
|
||||
@ -951,16 +973,25 @@ bool cLuaState::ReportErrors(lua_State * a_LuaState, int a_Status)
|
||||
|
||||
|
||||
void cLuaState::LogStackTrace(void)
|
||||
{
|
||||
LogStackTrace(m_LuaState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cLuaState::LogStackTrace(lua_State * a_LuaState)
|
||||
{
|
||||
LOGWARNING("Stack trace:");
|
||||
lua_Debug entry;
|
||||
int depth = 0;
|
||||
while (lua_getstack(m_LuaState, depth, &entry))
|
||||
while (lua_getstack(a_LuaState, depth, &entry))
|
||||
{
|
||||
int status = lua_getinfo(m_LuaState, "Sln", &entry);
|
||||
int status = lua_getinfo(a_LuaState, "Sln", &entry);
|
||||
assert(status);
|
||||
|
||||
LOGWARNING(" %s(%d): %s", entry.short_src, entry.currentline, entry.name ? entry.name : "?");
|
||||
LOGWARNING(" %s(%d): %s", entry.short_src, entry.currentline, entry.name ? entry.name : "(no name)");
|
||||
depth++;
|
||||
}
|
||||
LOGWARNING("Stack trace end");
|
||||
@ -993,6 +1024,17 @@ AString cLuaState::GetTypeText(int a_StackPos)
|
||||
|
||||
|
||||
|
||||
int cLuaState::ReportFnCallErrors(lua_State * a_LuaState)
|
||||
{
|
||||
LOGWARNING("LUA: %s", lua_tostring(a_LuaState, -1));
|
||||
LogStackTrace(a_LuaState);
|
||||
return 1; // We left the error message on the stack as the return value
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cLuaState::cRef:
|
||||
|
||||
|
@ -85,6 +85,23 @@ public:
|
||||
} ;
|
||||
|
||||
|
||||
/** Used for calling functions stored in a reference-stored table */
|
||||
class cTableRef
|
||||
{
|
||||
int m_TableRef;
|
||||
const char * m_FnName;
|
||||
public:
|
||||
cTableRef(int a_TableRef, const char * a_FnName) :
|
||||
m_TableRef(a_TableRef),
|
||||
m_FnName(a_FnName)
|
||||
{
|
||||
}
|
||||
|
||||
int GetTableRef(void) const { return m_TableRef; }
|
||||
const char * GetFnName(void) const { return m_FnName; }
|
||||
} ;
|
||||
|
||||
|
||||
/// A dummy class that's used only to delimit function args from return values for cLuaState::Call()
|
||||
class cRet
|
||||
{
|
||||
@ -133,24 +150,6 @@ public:
|
||||
/// Returns true if a_FunctionName is a valid Lua function that can be called
|
||||
bool HasFunction(const char * a_FunctionName);
|
||||
|
||||
/** Pushes the function of the specified name onto the stack.
|
||||
Returns true if successful. Logs a warning on failure (incl. m_SubsystemName)
|
||||
*/
|
||||
bool PushFunction(const char * a_FunctionName);
|
||||
|
||||
/** Pushes a function that has been saved into the global registry, identified by a_FnRef.
|
||||
Returns true if successful. Logs a warning on failure
|
||||
*/
|
||||
bool PushFunction(int a_FnRef);
|
||||
|
||||
/** Pushes a function that is stored in a table ref.
|
||||
Returns true if successful, false on failure. Doesn't log failure.
|
||||
*/
|
||||
bool PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnName);
|
||||
|
||||
/// Pushes a usertype of the specified class type onto the stack
|
||||
void PushUserType(void * a_Object, const char * a_Type);
|
||||
|
||||
// Push a value onto the stack
|
||||
void Push(const AString & a_String);
|
||||
void Push(const AStringVector & a_Vector);
|
||||
@ -165,6 +164,7 @@ public:
|
||||
void Push(cMonster * a_Monster);
|
||||
void Push(cItem * a_Item);
|
||||
void Push(cItems * a_Items);
|
||||
void Push(const cItems & a_Items);
|
||||
void Push(cClientHandle * a_ClientHandle);
|
||||
void Push(cPickup * a_Pickup);
|
||||
void Push(cChunkDesc * a_ChunkDesc);
|
||||
@ -240,12 +240,33 @@ public:
|
||||
return CallFunction(0);
|
||||
}
|
||||
|
||||
/// Call any 0-param 1-return Lua function in a single line:
|
||||
template<
|
||||
typename FnT, typename RetT1
|
||||
>
|
||||
bool Call(FnT a_FnName, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!CallFunction(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
GetReturn(-1, a_Ret1);
|
||||
lua_pop(m_LuaState, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Call any 1-param 1-return Lua function in a single line:
|
||||
template<
|
||||
typename FnT, typename ArgT1, typename RetT1
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -266,6 +287,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -287,6 +309,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -309,6 +332,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -332,6 +356,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -357,6 +382,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -383,6 +409,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -410,6 +437,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -438,6 +466,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -467,6 +496,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, ArgT10 a_Arg10, const cRet & a_Mark, RetT1 & a_Ret1)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -496,6 +526,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -517,6 +548,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -540,6 +572,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -564,6 +597,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -589,6 +623,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -616,6 +651,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -644,6 +680,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -673,6 +710,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -703,6 +741,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -734,6 +773,7 @@ public:
|
||||
>
|
||||
bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5)
|
||||
{
|
||||
UNUSED(a_Mark);
|
||||
if (!PushFunction(a_FnName))
|
||||
{
|
||||
return false;
|
||||
@ -761,25 +801,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid bool. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, bool & a_ReturnedVal);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid string. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, AString & a_ReturnedVal);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, int & a_ReturnedVal);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, double & a_ReturnedVal);
|
||||
|
||||
/**
|
||||
Calls the function that has been pushed onto the stack by PushFunction(),
|
||||
with arguments pushed by PushXXX().
|
||||
Returns true if successful, logs a warning on failure.
|
||||
*/
|
||||
bool CallFunction(int a_NumReturnValues);
|
||||
|
||||
/// Returns true if the specified parameters on the stack are of the specified usertable type; also logs warning if not. Used for static functions
|
||||
bool CheckParamUserTable(int a_StartParam, const char * a_UserTable, int a_EndParam = -1);
|
||||
|
||||
@ -807,6 +828,9 @@ public:
|
||||
/// Logs all items in the current stack trace to the server console
|
||||
void LogStackTrace(void);
|
||||
|
||||
/// Logs all items in the current stack trace to the server console
|
||||
static void LogStackTrace(lua_State * a_LuaState);
|
||||
|
||||
/// Returns the type of the item on the specified position in the stack
|
||||
AString GetTypeText(int a_StackPos);
|
||||
|
||||
@ -826,6 +850,47 @@ protected:
|
||||
|
||||
/// Number of arguments currently pushed (for the Push / Call chain)
|
||||
int m_NumCurrentFunctionArgs;
|
||||
|
||||
|
||||
/** Pushes the function of the specified name onto the stack.
|
||||
Returns true if successful. Logs a warning on failure (incl. m_SubsystemName)
|
||||
*/
|
||||
bool PushFunction(const char * a_FunctionName);
|
||||
|
||||
/** Pushes a function that has been saved into the global registry, identified by a_FnRef.
|
||||
Returns true if successful. Logs a warning on failure
|
||||
*/
|
||||
bool PushFunction(int a_FnRef);
|
||||
|
||||
/** Pushes a function that is stored in a referenced table by name
|
||||
Returns true if successful. Logs a warning on failure
|
||||
*/
|
||||
bool PushFunction(const cTableRef & a_TableRef);
|
||||
|
||||
/// Pushes a usertype of the specified class type onto the stack
|
||||
void PushUserType(void * a_Object, const char * a_Type);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid bool. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, bool & a_ReturnedVal);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid string. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, AString & a_ReturnedVal);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, int & a_ReturnedVal);
|
||||
|
||||
/// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged
|
||||
void GetReturn(int a_StackPos, double & a_ReturnedVal);
|
||||
|
||||
/**
|
||||
Calls the function that has been pushed onto the stack by PushFunction(),
|
||||
with arguments pushed by PushXXX().
|
||||
Returns true if successful, logs a warning on failure.
|
||||
*/
|
||||
bool CallFunction(int a_NumReturnValues);
|
||||
|
||||
/** Used as the error reporting function for function calls */
|
||||
static int ReportFnCallErrors(lua_State * a_LuaState);
|
||||
} ;
|
||||
|
||||
|
||||
|
@ -991,7 +991,6 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
|
||||
const cPluginManager::PluginMap & AllPlugins = self->GetAllPlugins();
|
||||
|
||||
lua_newtable(tolua_S);
|
||||
int newTable = lua_gettop(tolua_S);
|
||||
int index = 1;
|
||||
cPluginManager::PluginMap::const_iterator iter = AllPlugins.begin();
|
||||
while (iter != AllPlugins.end())
|
||||
@ -1137,16 +1136,17 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
|
||||
{
|
||||
/*
|
||||
Function signatures:
|
||||
cPluginManager.AddHook(HOOK_TYPE, CallbackFunction) -- (1) recommended
|
||||
cPluginManager:Get():AddHook(HOOK_TYPE, CallbackFunction) -- (2) accepted silently
|
||||
cPluginManager:Get():AddHook(Plugin, HOOK_TYPE) -- (3) old style (#121), accepted but complained about
|
||||
cPluginManager.AddHook(Plugin, HOOK_TYPE) -- (4) old style (#121) mangled, accepted but complained about
|
||||
cPluginManager:AddHook(HOOK_TYPE, CallbackFunction) -- (1) recommended
|
||||
cPluginManager.AddHook(HOOK_TYPE, CallbackFunction) -- (2) accepted silently (#401 deprecates this)
|
||||
cPluginManager:Get():AddHook(HOOK_TYPE, CallbackFunction) -- (3) accepted silently
|
||||
cPluginManager:Get():AddHook(Plugin, HOOK_TYPE) -- (4) old style (#121), accepted but complained about in the console
|
||||
cPluginManager.AddHook(Plugin, HOOK_TYPE) -- (5) old style (#121) mangled, accepted but complained about in the console
|
||||
*/
|
||||
|
||||
cLuaState S(tolua_S);
|
||||
cPluginManager * PlgMgr = cPluginManager::Get();
|
||||
|
||||
// If the first param is a cPluginManager, use it instead of the global one:
|
||||
// If the first param is a cPluginManager instance, use it instead of the global one:
|
||||
int ParamIdx = 1;
|
||||
tolua_Error err;
|
||||
if (tolua_isusertype(S, 1, "cPluginManager", 0, &err))
|
||||
@ -1161,6 +1161,11 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
|
||||
}
|
||||
ParamIdx += 1;
|
||||
}
|
||||
else if (tolua_isusertable(S, 1, "cPluginManager", 0, &err))
|
||||
{
|
||||
// Style 1, use the global PlgMgr, but increment ParamIdx
|
||||
ParamIdx++;
|
||||
}
|
||||
|
||||
if (lua_isnumber(S, ParamIdx) && lua_isfunction(S, ParamIdx + 1))
|
||||
{
|
||||
@ -1177,7 +1182,7 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
|
||||
|
||||
AString ParamDesc;
|
||||
Printf(ParamDesc, "%s, %s, %s", S.GetTypeText(1).c_str(), S.GetTypeText(2).c_str(), S.GetTypeText(3).c_str());
|
||||
LOGWARNING("cPluginManager.AddHook(): bad parameters. Expected HOOK_TYPE and CallbackFunction, got %s. Hook not added.", ParamDesc.c_str());
|
||||
LOGWARNING("cPluginManager:AddHook(): bad parameters. Expected HOOK_TYPE and CallbackFunction, got %s. Hook not added.", ParamDesc.c_str());
|
||||
S.LogStackTrace();
|
||||
return 0;
|
||||
}
|
||||
@ -1877,7 +1882,6 @@ static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
|
||||
const cWebPlugin::TabNameList & TabNames = self->GetTabNames();
|
||||
|
||||
lua_newtable(tolua_S);
|
||||
int newTable = lua_gettop(tolua_S);
|
||||
int index = 1;
|
||||
cWebPlugin::TabNameList::const_iterator iter = TabNames.begin();
|
||||
while(iter != TabNames.end())
|
||||
@ -1898,6 +1902,35 @@ static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
|
||||
|
||||
|
||||
|
||||
static int tolua_cClientHandle_SendPluginMessage(lua_State * L)
|
||||
{
|
||||
cLuaState S(L);
|
||||
if (
|
||||
!S.CheckParamUserType(1, "cClientHandle") ||
|
||||
!S.CheckParamString(2, 3) ||
|
||||
!S.CheckParamEnd(4)
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
cClientHandle * Client = (cClientHandle *)tolua_tousertype(L, 1, NULL);
|
||||
if (Client == NULL)
|
||||
{
|
||||
LOGWARNING("ClientHandle is nil in cClientHandle:SendPluginMessage()");
|
||||
S.LogStackTrace();
|
||||
return 0;
|
||||
}
|
||||
AString Channel, Message;
|
||||
Channel.assign(lua_tostring(L, 2), lua_strlen(L, 2));
|
||||
Message.assign(lua_tostring(L, 3), lua_strlen(L, 3));
|
||||
Client->SendPluginMessage(Channel, Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
|
||||
{
|
||||
tolua_Error tolua_err;
|
||||
@ -1947,118 +1980,72 @@ public:
|
||||
|
||||
virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override
|
||||
{
|
||||
if (!m_LuaState.PushFunctionFromRefTable(m_TableRef, "OnNextBlock"))
|
||||
bool res = false;
|
||||
if (!m_LuaState.Call(
|
||||
cLuaState::cTableRef(m_TableRef, "OnNextBlock"),
|
||||
a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_EntryFace,
|
||||
cLuaState::Return, res
|
||||
))
|
||||
{
|
||||
// No such function in the table, skip the callback
|
||||
return false;
|
||||
}
|
||||
m_LuaState.Push(a_BlockX);
|
||||
m_LuaState.Push(a_BlockY);
|
||||
m_LuaState.Push(a_BlockZ);
|
||||
m_LuaState.Push(a_BlockType);
|
||||
m_LuaState.Push(a_BlockMeta);
|
||||
m_LuaState.Push(a_EntryFace);
|
||||
if (!m_LuaState.CallFunction(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool res = false;
|
||||
if (lua_isboolean(m_LuaState, -1))
|
||||
{
|
||||
res = (lua_toboolean(m_LuaState, -1) != 0);
|
||||
}
|
||||
lua_pop(m_LuaState, 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace) override
|
||||
{
|
||||
if (!m_LuaState.PushFunctionFromRefTable(m_TableRef, "OnNextBlockNoData"))
|
||||
bool res = false;
|
||||
if (!m_LuaState.Call(
|
||||
cLuaState::cTableRef(m_TableRef, "OnNextBlockNoData"),
|
||||
a_BlockX, a_BlockY, a_BlockZ, a_EntryFace,
|
||||
cLuaState::Return, res
|
||||
))
|
||||
{
|
||||
// No such function in the table, skip the callback
|
||||
return false;
|
||||
}
|
||||
m_LuaState.Push(a_BlockX);
|
||||
m_LuaState.Push(a_BlockY);
|
||||
m_LuaState.Push(a_BlockZ);
|
||||
m_LuaState.Push(a_EntryFace);
|
||||
if (!m_LuaState.CallFunction(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool res = false;
|
||||
if (lua_isboolean(m_LuaState, -1))
|
||||
{
|
||||
res = (lua_toboolean(m_LuaState, -1) != 0);
|
||||
}
|
||||
lua_pop(m_LuaState, 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override
|
||||
{
|
||||
if (!m_LuaState.PushFunctionFromRefTable(m_TableRef, "OnOutOfWorld"))
|
||||
bool res = false;
|
||||
if (!m_LuaState.Call(
|
||||
cLuaState::cTableRef(m_TableRef, "OnOutOfWorld"),
|
||||
a_BlockX, a_BlockY, a_BlockZ,
|
||||
cLuaState::Return, res
|
||||
))
|
||||
{
|
||||
// No such function in the table, skip the callback
|
||||
return false;
|
||||
}
|
||||
m_LuaState.Push(a_BlockX);
|
||||
m_LuaState.Push(a_BlockY);
|
||||
m_LuaState.Push(a_BlockZ);
|
||||
if (!m_LuaState.CallFunction(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool res = false;
|
||||
if (lua_isboolean(m_LuaState, -1))
|
||||
{
|
||||
res = (lua_toboolean(m_LuaState, -1) != 0);
|
||||
}
|
||||
lua_pop(m_LuaState, 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override
|
||||
{
|
||||
if (!m_LuaState.PushFunctionFromRefTable(m_TableRef, "OnIntoWorld"))
|
||||
bool res = false;
|
||||
if (!m_LuaState.Call(
|
||||
cLuaState::cTableRef(m_TableRef, "OnIntoWorld"),
|
||||
a_BlockX, a_BlockY, a_BlockZ,
|
||||
cLuaState::Return, res
|
||||
))
|
||||
{
|
||||
// No such function in the table, skip the callback
|
||||
return false;
|
||||
}
|
||||
m_LuaState.Push(a_BlockX);
|
||||
m_LuaState.Push(a_BlockY);
|
||||
m_LuaState.Push(a_BlockZ);
|
||||
if (!m_LuaState.CallFunction(1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool res = false;
|
||||
if (lua_isboolean(m_LuaState, -1))
|
||||
{
|
||||
res = (lua_toboolean(m_LuaState, -1) != 0);
|
||||
}
|
||||
lua_pop(m_LuaState, 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
virtual void OnNoMoreHits(void) override
|
||||
{
|
||||
if (!m_LuaState.PushFunctionFromRefTable(m_TableRef, "OnNoMoreHits"))
|
||||
{
|
||||
// No such function in the table, skip the callback
|
||||
return;
|
||||
}
|
||||
m_LuaState.CallFunction(0);
|
||||
m_LuaState.Call(cLuaState::cTableRef(m_TableRef, "OnNoMoreHits"));
|
||||
}
|
||||
|
||||
virtual void OnNoChunk(void) override
|
||||
{
|
||||
if (!m_LuaState.PushFunctionFromRefTable(m_TableRef, "OnNoChunk"))
|
||||
{
|
||||
// No such function in the table, skip the callback
|
||||
return;
|
||||
}
|
||||
m_LuaState.CallFunction(0);
|
||||
m_LuaState.Call(cLuaState::cTableRef(m_TableRef, "OnNoChunk"));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -2286,6 +2273,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
|
||||
tolua_beginmodule(tolua_S, "cClientHandle");
|
||||
tolua_constant(tolua_S, "MAX_VIEW_DISTANCE", cClientHandle::MAX_VIEW_DISTANCE);
|
||||
tolua_constant(tolua_S, "MIN_VIEW_DISTANCE", cClientHandle::MIN_VIEW_DISTANCE);
|
||||
tolua_function(tolua_S, "SendPluginMessage", tolua_cClientHandle_SendPluginMessage);
|
||||
tolua_endmodule(tolua_S);
|
||||
|
||||
tolua_beginmodule(tolua_S, "cItemGrid");
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
|
||||
virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
|
||||
virtual bool OnPlayerEating (cPlayer & a_Player) = 0;
|
||||
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) = 0;
|
||||
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) = 0;
|
||||
virtual bool OnPlayerJoined (cPlayer & a_Player) = 0;
|
||||
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) = 0;
|
||||
virtual bool OnPlayerMoved (cPlayer & a_Player) = 0;
|
||||
@ -82,6 +84,8 @@ public:
|
||||
virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) = 0;
|
||||
virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
|
||||
virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) = 0;
|
||||
virtual bool OnPluginMessage (cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message) = 0;
|
||||
virtual bool OnPluginsLoaded (void) = 0;
|
||||
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
|
||||
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) = 0;
|
||||
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) = 0;
|
||||
|
@ -90,6 +90,8 @@ bool cPluginLua::Initialize(void)
|
||||
|
||||
// Load all files for this plugin, and execute them
|
||||
AStringVector Files = cFile::GetFolderContents(PluginPath.c_str());
|
||||
|
||||
int numFiles = 0;
|
||||
for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr)
|
||||
{
|
||||
if (itr->rfind(".lua") == AString::npos)
|
||||
@ -102,8 +104,19 @@ bool cPluginLua::Initialize(void)
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
numFiles++;
|
||||
}
|
||||
} // for itr - Files[]
|
||||
|
||||
if (numFiles == 0)
|
||||
{
|
||||
LOGWARNING("No lua files found: plugin %s is missing.", GetName().c_str());
|
||||
Close();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Call intialize function
|
||||
bool res = false;
|
||||
if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res))
|
||||
@ -630,6 +643,46 @@ bool cPluginLua::OnPlayerEating(cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnPlayerFished(cPlayer & a_Player, const cItems & a_Reward)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
bool res = false;
|
||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHED];
|
||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||
{
|
||||
m_LuaState.Call((int)(**itr), &a_Player, a_Reward, cLuaState::Return, res);
|
||||
if (res)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnPlayerFishing(cPlayer & a_Player, cItems & a_Reward)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
bool res = false;
|
||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_FISHING];
|
||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||
{
|
||||
m_LuaState.Call((int)(**itr), &a_Player, a_Reward, cLuaState::Return, res);
|
||||
if (res)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnPlayerJoined(cPlayer & a_Player)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
@ -910,6 +963,44 @@ bool cPluginLua::OnPlayerUsingItem(cPlayer & a_Player, int a_BlockX, int a_Block
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnPluginMessage(cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
bool res = false;
|
||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLUGIN_MESSAGE];
|
||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||
{
|
||||
m_LuaState.Call((int)(**itr), &a_Client, a_Channel, a_Message);
|
||||
if (res)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnPluginsLoaded(void)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
bool res = false;
|
||||
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLUGINS_LOADED];
|
||||
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
|
||||
{
|
||||
bool ret = false;
|
||||
m_LuaState.Call((int)(**itr), cLuaState::Return, ret);
|
||||
res = res || ret;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginLua::OnPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
@ -1324,6 +1415,8 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
|
||||
case cPluginManager::HOOK_PLAYER_USED_ITEM: return "OnPlayerUsedItem";
|
||||
case cPluginManager::HOOK_PLAYER_USING_BLOCK: return "OnPlayerUsingBlock";
|
||||
case cPluginManager::HOOK_PLAYER_USING_ITEM: return "OnPlayerUsingItem";
|
||||
case cPluginManager::HOOK_PLUGIN_MESSAGE: return "OnPluginMessage";
|
||||
case cPluginManager::HOOK_PLUGINS_LOADED: return "OnPluginsLoaded";
|
||||
case cPluginManager::HOOK_POST_CRAFTING: return "OnPostCrafting";
|
||||
case cPluginManager::HOOK_PRE_CRAFTING: return "OnPreCrafting";
|
||||
case cPluginManager::HOOK_SPAWNED_ENTITY: return "OnSpawnedEntity";
|
||||
@ -1337,8 +1430,17 @@ const char * cPluginLua::GetHookFnName(int a_HookType)
|
||||
case cPluginManager::HOOK_WEATHER_CHANGED: return "OnWeatherChanged";
|
||||
case cPluginManager::HOOK_WEATHER_CHANGING: return "OnWeatherChanging";
|
||||
case cPluginManager::HOOK_WORLD_TICK: return "OnWorldTick";
|
||||
default: return NULL;
|
||||
|
||||
case cPluginManager::HOOK_NUM_HOOKS:
|
||||
{
|
||||
// Satisfy a warning that all enum values should be used in a switch
|
||||
// but don't want a default branch, so that we catch new hooks missing from this list.
|
||||
break;
|
||||
}
|
||||
} // switch (a_Hook)
|
||||
LOGWARNING("Requested name of an unknown hook type function: %d (max is %d)", a_HookType, cPluginManager::HOOK_MAX);
|
||||
ASSERT(!"Unknown hook requested!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
virtual bool OnPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
|
||||
virtual bool OnPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
|
||||
virtual bool OnPlayerEating (cPlayer & a_Player) override;
|
||||
virtual bool OnPlayerFished (cPlayer & a_Player, const cItems & a_Reward) override;
|
||||
virtual bool OnPlayerFishing (cPlayer & a_Player, cItems & a_Reward) override;
|
||||
virtual bool OnPlayerJoined (cPlayer & a_Player) override;
|
||||
virtual bool OnPlayerMoved (cPlayer & a_Player) override;
|
||||
virtual bool OnPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) override;
|
||||
@ -79,6 +81,8 @@ public:
|
||||
virtual bool OnPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
|
||||
virtual bool OnPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
|
||||
virtual bool OnPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override;
|
||||
virtual bool OnPluginMessage (cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message) override;
|
||||
virtual bool OnPluginsLoaded (void) override;
|
||||
virtual bool OnPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||
virtual bool OnPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||
virtual bool OnSpawnedEntity (cWorld & a_World, cEntity & a_Entity) override;
|
||||
|
@ -118,7 +118,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
int KeyNum = a_SettingsIni.FindKey("Plugins");
|
||||
|
||||
// If it does, how many plugins are there?
|
||||
unsigned int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
|
||||
int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0);
|
||||
|
||||
if (KeyNum == -1)
|
||||
{
|
||||
@ -126,7 +126,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
}
|
||||
else if (NumPlugins > 0)
|
||||
{
|
||||
for(unsigned int i = 0; i < NumPlugins; i++)
|
||||
for (int i = 0; i < NumPlugins; i++)
|
||||
{
|
||||
AString ValueName = a_SettingsIni.GetValueName(KeyNum, i);
|
||||
if (ValueName.compare("Plugin") == 0)
|
||||
@ -136,7 +136,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
{
|
||||
if (m_Plugins.find(PluginFile) != m_Plugins.end())
|
||||
{
|
||||
LoadPlugin( PluginFile );
|
||||
LoadPlugin(PluginFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,6 +155,7 @@ void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni)
|
||||
{
|
||||
LOG("-- Loaded 1 Plugin --");
|
||||
}
|
||||
CallHookPluginsLoaded();
|
||||
}
|
||||
|
||||
|
||||
@ -693,6 +694,48 @@ bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems a_Reward)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHED);
|
||||
if (Plugins == m_Hooks.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->OnPlayerFished(a_Player, a_Reward))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookPlayerFishing(cPlayer & a_Player, cItems a_Reward)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_FISHING);
|
||||
if (Plugins == m_Hooks.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->OnPlayerFishing(a_Player, a_Reward))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_JOINED);
|
||||
@ -987,6 +1030,46 @@ bool cPluginManager::CallHookPlayerUsingItem(cPlayer & a_Player, int a_BlockX, i
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookPluginMessage(cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLUGIN_MESSAGE);
|
||||
if (Plugins == m_Hooks.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->OnPluginMessage(a_Client, a_Channel, a_Message))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookPluginsLoaded(void)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_PLUGINS_LOADED);
|
||||
if (Plugins == m_Hooks.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool res = false;
|
||||
for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr)
|
||||
{
|
||||
res = !(*itr)->OnPluginsLoaded() || res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING);
|
||||
|
@ -80,6 +80,8 @@ public: // tolua_export
|
||||
HOOK_PLAYER_BREAKING_BLOCK,
|
||||
HOOK_PLAYER_BROKEN_BLOCK,
|
||||
HOOK_PLAYER_EATING,
|
||||
HOOK_PLAYER_FISHED,
|
||||
HOOK_PLAYER_FISHING,
|
||||
HOOK_PLAYER_JOINED,
|
||||
HOOK_PLAYER_LEFT_CLICK,
|
||||
HOOK_PLAYER_MOVING,
|
||||
@ -94,6 +96,8 @@ public: // tolua_export
|
||||
HOOK_PLAYER_USED_ITEM,
|
||||
HOOK_PLAYER_USING_BLOCK,
|
||||
HOOK_PLAYER_USING_ITEM,
|
||||
HOOK_PLUGIN_MESSAGE,
|
||||
HOOK_PLUGINS_LOADED,
|
||||
HOOK_POST_CRAFTING,
|
||||
HOOK_PRE_CRAFTING,
|
||||
HOOK_SPAWNED_ENTITY,
|
||||
@ -167,6 +171,8 @@ public: // tolua_export
|
||||
bool CallHookPlayerBreakingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
bool CallHookPlayerEating (cPlayer & a_Player);
|
||||
bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward);
|
||||
bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward);
|
||||
bool CallHookPlayerJoined (cPlayer & a_Player);
|
||||
bool CallHookPlayerMoving (cPlayer & a_Player);
|
||||
bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
|
||||
@ -181,6 +187,8 @@ public: // tolua_export
|
||||
bool CallHookPlayerUsedItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
|
||||
bool CallHookPlayerUsingBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
|
||||
bool CallHookPlayerUsingItem (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);
|
||||
bool CallHookPluginMessage (cClientHandle & a_Client, const AString & a_Channel, const AString & a_Message);
|
||||
bool CallHookPluginsLoaded (void);
|
||||
bool CallHookPostCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||
bool CallHookPreCrafting (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||
bool CallHookSpawnedEntity (cWorld & a_World, cEntity & a_Entity);
|
||||
@ -271,7 +279,7 @@ private:
|
||||
bool m_bReloadPlugins;
|
||||
|
||||
cPluginManager();
|
||||
~cPluginManager();
|
||||
virtual ~cPluginManager();
|
||||
|
||||
/// Reloads all plugins, defaulting to settings.ini for settings location
|
||||
void ReloadPluginsNow(void);
|
||||
|
@ -2,12 +2,18 @@
|
||||
// tolua++.h
|
||||
|
||||
// Redirection file, needed because ToLua++ generates the Bindings.cpp file with >> #include "tolua++.h" <<
|
||||
// Only used from Bindings.cpp
|
||||
|
||||
|
||||
|
||||
|
||||
#include "tolua++/include/tolua++.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Disable specific warnings for the generated Bindings.cpp file:
|
||||
#pragma warning(disable: 4800) // 'int' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,128 +0,0 @@
|
||||
#ifndef TOLUA_BASE_H
|
||||
#define TOLUA_BASE_H
|
||||
|
||||
#pragma warning(disable:4800) // This file is ONLY included by Bindings.cpp and it throws lots of C4800 warnings
|
||||
|
||||
#include "tolua++/include/tolua++.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ToluaBase {
|
||||
|
||||
int lua_instance;
|
||||
|
||||
protected:
|
||||
|
||||
lua_State* lua_state;
|
||||
|
||||
void lua_stacktrace(lua_State* L) const
|
||||
{
|
||||
lua_Debug entry;
|
||||
int depth = 0;
|
||||
|
||||
while (lua_getstack(L, depth, &entry))
|
||||
{
|
||||
lua_getinfo(L, "Sln", &entry);
|
||||
|
||||
LOGERROR("%s(%d): %s", entry.short_src, entry.currentline, entry.name ? entry.name : "?");
|
||||
depth++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool report_errors(int status) const
|
||||
{
|
||||
if ( status!=0 )
|
||||
{
|
||||
const char* s = lua_tostring(lua_state, -1);
|
||||
LOGERROR("-- %s", s );
|
||||
//lua_pop(lua_state, 1);
|
||||
LOGERROR("Stack:");
|
||||
lua_stacktrace( lua_state );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool push_method(const char* name, lua_CFunction f) const {
|
||||
|
||||
if (!lua_state) return false;
|
||||
|
||||
lua_getref(lua_state, lua_instance);
|
||||
lua_pushstring(lua_state, name);
|
||||
//LOGINFO("1. push_method() Stack size: %i", lua_gettop( lua_state ) );
|
||||
lua_gettable(lua_state, -2);
|
||||
//LOGINFO("2. push_method() Stack size: %i", lua_gettop( lua_state ) );
|
||||
|
||||
if (lua_isnil(lua_state, -1)) {
|
||||
|
||||
// pop the table
|
||||
lua_pop(lua_state, 2);
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
if (f) {
|
||||
if (lua_iscfunction(lua_state, -1)) {
|
||||
lua_pop(lua_state, 2);
|
||||
return false;
|
||||
};
|
||||
/* // not for now
|
||||
lua_pushcfunction(lua_state, f);
|
||||
if (lua_rawequal(lua_state, -1, -2)) {
|
||||
|
||||
// avoid recursion, pop both functions and the table
|
||||
lua_pop(lua_state, 3);
|
||||
return false;
|
||||
};
|
||||
|
||||
// pop f
|
||||
lua_pop(lua_state, 1);
|
||||
*/
|
||||
};
|
||||
|
||||
// swap table with function
|
||||
lua_insert(lua_state, -2);
|
||||
};
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
void dbcall(lua_State* L, int nargs, int nresults) const {
|
||||
|
||||
// using lua_call for now
|
||||
int s = lua_pcall(L, nargs, nresults, 0);
|
||||
report_errors( s );
|
||||
};
|
||||
public:
|
||||
|
||||
int GetInstance() { return lua_instance; }
|
||||
lua_State* GetLuaState() { return lua_state; }
|
||||
|
||||
void tolua__set_instance(lua_State* L, lua_Object lo) {
|
||||
|
||||
lua_state = L;
|
||||
|
||||
lua_pushvalue(L, lo);
|
||||
lua_instance = lua_ref(lua_state, 1);
|
||||
};
|
||||
|
||||
ToluaBase() {
|
||||
|
||||
lua_state = NULL;
|
||||
};
|
||||
|
||||
~ToluaBase() {
|
||||
|
||||
if (lua_state) {
|
||||
|
||||
lua_unref(lua_state, lua_instance);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
131
src/BiomeDef.cpp
Normal file
131
src/BiomeDef.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
|
||||
// BiomeDef.cpp
|
||||
|
||||
// Implements biome helper functions
|
||||
|
||||
#include "Globals.h"
|
||||
#include "BiomeDef.h"
|
||||
|
||||
|
||||
EMCSBiome StringToBiome(const AString & a_BiomeString)
|
||||
{
|
||||
// If it is a number, return it:
|
||||
int res = atoi(a_BiomeString.c_str());
|
||||
if ((res != 0) || (a_BiomeString.compare("0") == 0))
|
||||
{
|
||||
// It was a valid number
|
||||
return (EMCSBiome)res;
|
||||
}
|
||||
|
||||
// Convert using the built-in map:
|
||||
static struct {
|
||||
EMCSBiome m_Biome;
|
||||
const char * m_String;
|
||||
} BiomeMap[] =
|
||||
{
|
||||
{biOcean, "Ocean"} ,
|
||||
{biPlains, "Plains"},
|
||||
{biDesert, "Desert"},
|
||||
{biExtremeHills, "ExtremeHills"},
|
||||
{biForest, "Forest"},
|
||||
{biTaiga, "Taiga"},
|
||||
{biSwampland, "Swampland"},
|
||||
{biRiver, "River"},
|
||||
{biNether, "Hell"},
|
||||
{biNether, "Nether"},
|
||||
{biEnd, "Sky"},
|
||||
{biEnd, "End"},
|
||||
{biFrozenOcean, "FrozenOcean"},
|
||||
{biFrozenRiver, "FrozenRiver"},
|
||||
{biIcePlains, "IcePlains"},
|
||||
{biIcePlains, "Tundra"},
|
||||
{biIceMountains, "IceMountains"},
|
||||
{biMushroomIsland, "MushroomIsland"},
|
||||
{biMushroomShore, "MushroomShore"},
|
||||
{biBeach, "Beach"},
|
||||
{biDesertHills, "DesertHills"},
|
||||
{biForestHills, "ForestHills"},
|
||||
{biTaigaHills, "TaigaHills"},
|
||||
{biExtremeHillsEdge, "ExtremeHillsEdge"},
|
||||
{biJungle, "Jungle"},
|
||||
{biJungleHills, "JungleHills"},
|
||||
|
||||
// Release 1.7 biomes:
|
||||
{biJungleEdge, "JungleEdge"},
|
||||
{biDeepOcean, "DeepOcean"},
|
||||
{biStoneBeach, "StoneBeach"},
|
||||
{biColdBeach, "ColdBeach"},
|
||||
{biBirchForest, "BirchForest"},
|
||||
{biBirchForestHills, "BirchForestHills"},
|
||||
{biRoofedForest, "RoofedForest"},
|
||||
{biColdTaiga, "ColdTaiga"},
|
||||
{biColdTaigaHills, "ColdTaigaHills"},
|
||||
{biMegaTaiga, "MegaTaiga"},
|
||||
{biMegaTaigaHills, "MegaTaigaHills"},
|
||||
{biExtremeHillsPlus, "ExtremeHillsPlus"},
|
||||
{biSavanna, "Savanna"},
|
||||
{biSavannaPlateau, "SavannaPlateau"},
|
||||
{biMesa, "Mesa"},
|
||||
{biMesaPlateauF, "MesaPlateauF"},
|
||||
{biMesaPlateau, "MesaPlateau"},
|
||||
|
||||
// Release 1.7 variants:
|
||||
{biSunflowerPlains, "SunflowerPlains"},
|
||||
{biDesertM, "DesertM"},
|
||||
{biExtremeHillsM, "ExtremeHillsM"},
|
||||
{biFlowerForest, "FlowerForest"},
|
||||
{biTaigaM, "TaigaM"},
|
||||
{biSwamplandM, "SwamplandM"},
|
||||
{biIcePlainsSpikes, "IcePlainsSpikes"},
|
||||
{biJungleM, "JungleM"},
|
||||
{biJungleEdgeM, "JungleEdgeM"},
|
||||
{biBirchForestM, "BirchForestM"},
|
||||
{biBirchForestHillsM, "BirchForestHillsM"},
|
||||
{biRoofedForestM, "RoofedForestM"},
|
||||
{biColdTaigaM, "ColdTaigaM"},
|
||||
{biMegaSpruceTaiga, "MegaSpruceTaiga"},
|
||||
{biMegaSpruceTaigaHills, "MegaSpruceTaigaHills"},
|
||||
{biExtremeHillsPlusM, "ExtremeHillsPlusM"},
|
||||
{biSavannaM, "SavannaM"},
|
||||
{biSavannaPlateauM, "SavannaPlateauM"},
|
||||
{biMesaBryce, "MesaBryce"},
|
||||
{biMesaPlateauFM, "MesaPlateauFM"},
|
||||
{biMesaPlateauM, "MesaPlateauM"},
|
||||
} ;
|
||||
|
||||
for (size_t i = 0; i < ARRAYCOUNT(BiomeMap); i++)
|
||||
{
|
||||
if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
|
||||
{
|
||||
return BiomeMap[i].m_Biome;
|
||||
}
|
||||
} // for i - BiomeMap[]
|
||||
return (EMCSBiome)-1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool IsBiomeNoDownfall(EMCSBiome a_Biome)
|
||||
{
|
||||
switch (a_Biome)
|
||||
{
|
||||
case biDesert:
|
||||
case biDesertHills:
|
||||
case biDesertM:
|
||||
case biSavanna:
|
||||
case biSavannaM:
|
||||
case biSavannaPlateau:
|
||||
case biSavannaPlateauM:
|
||||
case biNether:
|
||||
case biEnd:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
107
src/BiomeDef.h
Normal file
107
src/BiomeDef.h
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
// BiomeDef.h
|
||||
|
||||
// Defines relevant information and methods related to biomes
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// tolua_begin
|
||||
/** Biome IDs
|
||||
The first batch corresponds to the clientside biomes, used by MineCraft.
|
||||
BiomeIDs over 255 are used by MCServer internally and are translated to MC biomes before sending them to client
|
||||
*/
|
||||
enum EMCSBiome
|
||||
{
|
||||
biOcean = 0,
|
||||
biPlains = 1,
|
||||
biDesert = 2,
|
||||
biExtremeHills = 3,
|
||||
biForest = 4,
|
||||
biTaiga = 5,
|
||||
biSwampland = 6,
|
||||
biRiver = 7,
|
||||
biHell = 8, // same as Nether
|
||||
biNether = 8,
|
||||
biSky = 9, // same as biEnd
|
||||
biEnd = 9,
|
||||
biFrozenOcean = 10,
|
||||
biFrozenRiver = 11,
|
||||
biIcePlains = 12,
|
||||
biTundra = 12, // same as Ice Plains
|
||||
biIceMountains = 13,
|
||||
biMushroomIsland = 14,
|
||||
biMushroomShore = 15,
|
||||
biBeach = 16,
|
||||
biDesertHills = 17,
|
||||
biForestHills = 18,
|
||||
biTaigaHills = 19,
|
||||
biExtremeHillsEdge = 20,
|
||||
biJungle = 21,
|
||||
biJungleHills = 22,
|
||||
|
||||
// Release 1.7 biomes:
|
||||
biJungleEdge = 23,
|
||||
biDeepOcean = 24,
|
||||
biStoneBeach = 25,
|
||||
biColdBeach = 26,
|
||||
biBirchForest = 27,
|
||||
biBirchForestHills = 28,
|
||||
biRoofedForest = 29,
|
||||
biColdTaiga = 30,
|
||||
biColdTaigaHills = 31,
|
||||
biMegaTaiga = 32,
|
||||
biMegaTaigaHills = 33,
|
||||
biExtremeHillsPlus = 34,
|
||||
biSavanna = 35,
|
||||
biSavannaPlateau = 36,
|
||||
biMesa = 37,
|
||||
biMesaPlateauF = 38,
|
||||
biMesaPlateau = 39,
|
||||
|
||||
// Automatically capture the maximum consecutive biome value into biMaxBiome:
|
||||
biNumBiomes, // True number of biomes, since they are zero-based
|
||||
biMaxBiome = biNumBiomes - 1, // The maximum biome value
|
||||
|
||||
// Add this number to the biomes to get the variant
|
||||
biVariant = 128,
|
||||
|
||||
// Release 1.7 biome variants:
|
||||
biSunflowerPlains = 129,
|
||||
biDesertM = 130,
|
||||
biExtremeHillsM = 131,
|
||||
biFlowerForest = 132,
|
||||
biTaigaM = 133,
|
||||
biSwamplandM = 134,
|
||||
biIcePlainsSpikes = 140,
|
||||
biJungleM = 149,
|
||||
biJungleEdgeM = 151,
|
||||
biBirchForestM = 155,
|
||||
biBirchForestHillsM = 156,
|
||||
biRoofedForestM = 157,
|
||||
biColdTaigaM = 158,
|
||||
biMegaSpruceTaiga = 160,
|
||||
biMegaSpruceTaigaHills = 161,
|
||||
biExtremeHillsPlusM = 162,
|
||||
biSavannaM = 163,
|
||||
biSavannaPlateauM = 164,
|
||||
biMesaBryce = 165,
|
||||
biMesaPlateauFM = 166,
|
||||
biMesaPlateauM = 167,
|
||||
} ;
|
||||
|
||||
/// Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns -1 on failure.
|
||||
extern EMCSBiome StringToBiome(const AString & a_BiomeString);
|
||||
|
||||
/// Returns true if the biome has no downfall - deserts and savannas
|
||||
extern bool IsBiomeNoDownfall(EMCSBiome a_Biome);
|
||||
|
||||
|
||||
// tolua_end
|
@ -28,6 +28,8 @@ template<typename Combinator> void InternalMergeBlocks(
|
||||
Combinator a_Combinator
|
||||
)
|
||||
{
|
||||
UNUSED(a_SrcSizeY);
|
||||
UNUSED(a_DstSizeY);
|
||||
for (int y = 0; y < a_SizeY; y++)
|
||||
{
|
||||
int SrcBaseY = (y + a_SrcOffY) * a_SrcSizeX * a_SrcSizeZ;
|
||||
@ -826,7 +828,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
|
||||
int yd = dy - dx / 2;
|
||||
int zd = dz - dx / 2;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight);
|
||||
|
||||
@ -858,7 +860,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
|
||||
int xd = dx - dy / 2;
|
||||
int zd = dz - dy / 2;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight);
|
||||
|
||||
@ -892,7 +894,7 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
|
||||
int xd = dx - dz / 2;
|
||||
int yd = dy - dz / 2;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
RelSetData(a_RelX1, a_RelY1, a_RelZ1, a_DataTypes, a_BlockType, a_BlockMeta, a_BlockLight, a_BlockSkyLight);
|
||||
|
||||
|
@ -87,7 +87,11 @@ public:
|
||||
virtual void SendTo(cClientHandle & a_Client) = 0;
|
||||
|
||||
/// Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking. By default does nothing.
|
||||
virtual bool Tick(float a_Dt, cChunk & a_Chunk) { return false; }
|
||||
virtual bool Tick(float a_Dt, cChunk & /* a_Chunk */)
|
||||
{
|
||||
UNUSED(a_Dt);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
/// Position in absolute block coordinates
|
||||
|
@ -73,6 +73,7 @@ protected:
|
||||
// cItemGrid::cListener overrides:
|
||||
virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum)
|
||||
{
|
||||
UNUSED(a_SlotNum);
|
||||
ASSERT(a_Grid == &m_Contents);
|
||||
if (m_World != NULL)
|
||||
{
|
||||
|
@ -70,8 +70,8 @@ void cFurnaceEntity::UsedBy(cPlayer * a_Player)
|
||||
if (a_Player->GetWindow() != Window)
|
||||
{
|
||||
a_Player->OpenWindow(Window);
|
||||
BroadcastProgress(PROGRESSBAR_FUEL, m_LastProgressFuel);
|
||||
BroadcastProgress(PROGRESSBAR_SMELTING, m_LastProgressCook);
|
||||
BroadcastProgress(PROGRESSBAR_FUEL, (short)m_LastProgressFuel);
|
||||
BroadcastProgress(PROGRESSBAR_SMELTING, (short)m_LastProgressCook);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -445,14 +445,14 @@ void cFurnaceEntity::UpdateProgressBars(void)
|
||||
int CurFuel = (m_FuelBurnTime > 0) ? (200 - 200 * m_TimeBurned / m_FuelBurnTime) : 0;
|
||||
if ((CurFuel / 8) != (m_LastProgressFuel / 8))
|
||||
{
|
||||
BroadcastProgress(PROGRESSBAR_FUEL, CurFuel);
|
||||
BroadcastProgress(PROGRESSBAR_FUEL, (short)CurFuel);
|
||||
m_LastProgressFuel = CurFuel;
|
||||
}
|
||||
|
||||
int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0;
|
||||
if ((CurCook / 8) != (m_LastProgressCook / 8))
|
||||
{
|
||||
BroadcastProgress(PROGRESSBAR_SMELTING, CurCook);
|
||||
BroadcastProgress(PROGRESSBAR_SMELTING, (short)CurCook);
|
||||
m_LastProgressCook = CurCook;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
// tolua_end
|
||||
|
||||
void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = 0; }
|
||||
void SetBurnTimes(int a_FuelBurnTime, int a_TimeBurned) {m_FuelBurnTime = a_FuelBurnTime; m_TimeBurned = a_TimeBurned; }
|
||||
void SetCookTimes(int a_NeedCookTime, int a_TimeCooked) {m_NeedCookTime = a_NeedCookTime; m_TimeCooked = a_TimeCooked; }
|
||||
|
||||
protected:
|
||||
|
@ -488,7 +488,6 @@ bool cHopperEntity::MoveItemsToFurnace(cChunk & a_Chunk, int a_BlockX, int a_Blo
|
||||
// Feed the fuel slot of the furnace
|
||||
return MoveItemsToSlot(*Furnace, cFurnaceEntity::fsFuel);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
// tolua_end
|
||||
|
||||
virtual void UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override { };
|
||||
virtual void SendTo(cClientHandle &) override { };
|
||||
|
||||
private:
|
||||
int m_Record;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
// tolua_end
|
||||
|
||||
virtual void UsedBy(cPlayer * a_Player) override;
|
||||
virtual void SendTo(cClientHandle & a_Client) override { };
|
||||
virtual void SendTo(cClientHandle &) override { };
|
||||
|
||||
private:
|
||||
char m_Pitch;
|
||||
|
100
src/BlockID.cpp
100
src/BlockID.cpp
@ -267,106 +267,6 @@ AString ItemToFullString(const cItem & a_Item)
|
||||
|
||||
|
||||
|
||||
EMCSBiome StringToBiome(const AString & a_BiomeString)
|
||||
{
|
||||
// If it is a number, return it:
|
||||
int res = atoi(a_BiomeString.c_str());
|
||||
if ((res != 0) || (a_BiomeString.compare("0") == 0))
|
||||
{
|
||||
// It was a valid number
|
||||
return (EMCSBiome)res;
|
||||
}
|
||||
|
||||
// Convert using the built-in map:
|
||||
static struct {
|
||||
EMCSBiome m_Biome;
|
||||
const char * m_String;
|
||||
} BiomeMap[] =
|
||||
{
|
||||
{biOcean, "Ocean"} ,
|
||||
{biPlains, "Plains"},
|
||||
{biDesert, "Desert"},
|
||||
{biExtremeHills, "ExtremeHills"},
|
||||
{biForest, "Forest"},
|
||||
{biTaiga, "Taiga"},
|
||||
{biSwampland, "Swampland"},
|
||||
{biRiver, "River"},
|
||||
{biNether, "Hell"},
|
||||
{biNether, "Nether"},
|
||||
{biEnd, "Sky"},
|
||||
{biEnd, "End"},
|
||||
{biFrozenOcean, "FrozenOcean"},
|
||||
{biFrozenRiver, "FrozenRiver"},
|
||||
{biIcePlains, "IcePlains"},
|
||||
{biIcePlains, "Tundra"},
|
||||
{biIceMountains, "IceMountains"},
|
||||
{biMushroomIsland, "MushroomIsland"},
|
||||
{biMushroomShore, "MushroomShore"},
|
||||
{biBeach, "Beach"},
|
||||
{biDesertHills, "DesertHills"},
|
||||
{biForestHills, "ForestHills"},
|
||||
{biTaigaHills, "TaigaHills"},
|
||||
{biExtremeHillsEdge, "ExtremeHillsEdge"},
|
||||
{biJungle, "Jungle"},
|
||||
{biJungleHills, "JungleHills"},
|
||||
|
||||
// Release 1.7 biomes:
|
||||
{biJungleEdge, "JungleEdge"},
|
||||
{biDeepOcean, "DeepOcean"},
|
||||
{biStoneBeach, "StoneBeach"},
|
||||
{biColdBeach, "ColdBeach"},
|
||||
{biBirchForest, "BirchForest"},
|
||||
{biBirchForestHills, "BirchForestHills"},
|
||||
{biRoofedForest, "RoofedForest"},
|
||||
{biColdTaiga, "ColdTaiga"},
|
||||
{biColdTaigaHills, "ColdTaigaHills"},
|
||||
{biMegaTaiga, "MegaTaiga"},
|
||||
{biMegaTaigaHills, "MegaTaigaHills"},
|
||||
{biExtremeHillsPlus, "ExtremeHillsPlus"},
|
||||
{biSavanna, "Savanna"},
|
||||
{biSavannaPlateau, "SavannaPlateau"},
|
||||
{biMesa, "Mesa"},
|
||||
{biMesaPlateauF, "MesaPlateauF"},
|
||||
{biMesaPlateau, "MesaPlateau"},
|
||||
|
||||
// Release 1.7 variants:
|
||||
{biSunflowerPlains, "SunflowerPlains"},
|
||||
{biDesertM, "DesertM"},
|
||||
{biExtremeHillsM, "ExtremeHillsM"},
|
||||
{biFlowerForest, "FlowerForest"},
|
||||
{biTaigaM, "TaigaM"},
|
||||
{biSwamplandM, "SwamplandM"},
|
||||
{biIcePlainsSpikes, "IcePlainsSpikes"},
|
||||
{biJungleM, "JungleM"},
|
||||
{biJungleEdgeM, "JungleEdgeM"},
|
||||
{biBirchForestM, "BirchForestM"},
|
||||
{biBirchForestHillsM, "BirchForestHillsM"},
|
||||
{biRoofedForestM, "RoofedForestM"},
|
||||
{biColdTaigaM, "ColdTaigaM"},
|
||||
{biMegaSpruceTaiga, "MegaSpruceTaiga"},
|
||||
{biMegaSpruceTaigaHills, "MegaSpruceTaigaHills"},
|
||||
{biExtremeHillsPlusM, "ExtremeHillsPlusM"},
|
||||
{biSavannaM, "SavannaM"},
|
||||
{biSavannaPlateauM, "SavannaPlateauM"},
|
||||
{biMesaBryce, "MesaBryce"},
|
||||
{biMesaPlateauFM, "MesaPlateauFM"},
|
||||
{biMesaPlateauM, "MesaPlateauM"},
|
||||
} ;
|
||||
|
||||
for (size_t i = 0; i < ARRAYCOUNT(BiomeMap); i++)
|
||||
{
|
||||
if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
|
||||
{
|
||||
return BiomeMap[i].m_Biome;
|
||||
}
|
||||
} // for i - BiomeMap[]
|
||||
return (EMCSBiome)-1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int StringToMobType(const AString & a_MobString)
|
||||
{
|
||||
static struct {
|
||||
|
@ -876,9 +876,6 @@ extern AString ItemTypeToString(short a_ItemType);
|
||||
/// Translates a full item into a fully-specified string (including meta and count). If the ItemType is not recognized, the ItemType number is output into the string.
|
||||
extern AString ItemToFullString(const cItem & a_Item);
|
||||
|
||||
/// Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns -1 on failure.
|
||||
extern EMCSBiome StringToBiome(const AString & a_BiomeString);
|
||||
|
||||
/// Translates a mob string ("ocelot") to mobtype (E_ENTITY_TYPE_OCELOT)
|
||||
extern int StringToMobType(const AString & a_MobString);
|
||||
|
||||
|
@ -36,7 +36,14 @@ public:
|
||||
/** Called on each block encountered along the path, including the first block (path start), if chunk data is not loaded
|
||||
When this callback returns true, the tracing is aborted.
|
||||
*/
|
||||
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace) { return false; }
|
||||
virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ, char a_EntryFace)
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
UNUSED(a_EntryFace);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Called when the path goes out of world, either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
|
||||
The coords specify the exact point at which the path exited the world.
|
||||
@ -44,7 +51,13 @@ public:
|
||||
Note that some paths can go out of the world and come back again (parabola),
|
||||
in such a case this callback is followed by OnIntoWorld() and further OnNextBlock() calls
|
||||
*/
|
||||
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) { return false; }
|
||||
virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Called when the path goes into the world, from either below (a_BlockY < 0) or above (a_BlockY >= cChunkDef::Height)
|
||||
The coords specify the exact point at which the path entered the world.
|
||||
@ -52,7 +65,13 @@ public:
|
||||
Note that some paths can go out of the world and come back again (parabola),
|
||||
in such a case this callback is followed by further OnNextBlock() calls
|
||||
*/
|
||||
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) { return false; }
|
||||
virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ)
|
||||
{
|
||||
UNUSED(a_BlockX);
|
||||
UNUSED(a_BlockY);
|
||||
UNUSED(a_BlockZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Called when the path is sure not to hit any more blocks.
|
||||
Note that for some shapes this might never happen (line with constant Y)
|
||||
|
@ -20,8 +20,8 @@ public:
|
||||
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
||||
{
|
||||
// Reset meta to 0
|
||||
// TODO: More drops?
|
||||
a_Pickups.push_back(cItem(E_ITEM_GLOWSTONE_DUST, 1, 0));
|
||||
MTRand r1;
|
||||
a_Pickups.push_back(cItem(E_ITEM_GLOWSTONE_DUST, (char)(2 + r1.randInt(2)), 0));
|
||||
}
|
||||
} ;
|
||||
|
||||
|
@ -99,7 +99,11 @@ public:
|
||||
virtual bool DoesIgnoreBuildCollision(void);
|
||||
|
||||
/// <summary>Similar to DoesIgnoreBuildCollision(void), but is used for cases where block meta/player item-in-hand is needed to determine collision (thin snow)</summary>
|
||||
virtual bool DoesIgnoreBuildCollision(cPlayer * a_Player, NIBBLETYPE a_Meta) { return DoesIgnoreBuildCollision(); }
|
||||
virtual bool DoesIgnoreBuildCollision(cPlayer *, NIBBLETYPE a_Meta)
|
||||
{
|
||||
UNUSED(a_Meta);
|
||||
return DoesIgnoreBuildCollision();
|
||||
}
|
||||
|
||||
/// <summary>Returns if this block drops if it gets destroyed by an unsuitable situation. Default: true</summary>
|
||||
virtual bool DoesDropOnUnsuitable(void);
|
||||
|
@ -773,7 +773,7 @@ void cByteBuffer::ReadAll(AString & a_Data)
|
||||
|
||||
|
||||
|
||||
bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes)
|
||||
bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes)
|
||||
{
|
||||
if (!a_Dst.CanWriteBytes(a_NumBytes) || !CanReadBytes(a_NumBytes))
|
||||
{
|
||||
@ -781,9 +781,10 @@ bool cByteBuffer::ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes)
|
||||
return false;
|
||||
}
|
||||
char buf[1024];
|
||||
while (a_NumBytes > 0)
|
||||
// > 0 without generating warnings about unsigned comparisons where size_t is unsigned
|
||||
while (a_NumBytes != 0)
|
||||
{
|
||||
int num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
|
||||
size_t num = (a_NumBytes > sizeof(buf)) ? sizeof(buf) : a_NumBytes;
|
||||
VERIFY(ReadBuf(buf, num));
|
||||
VERIFY(a_Dst.Write(buf, num));
|
||||
a_NumBytes -= num;
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
void ReadAll(AString & a_Data);
|
||||
|
||||
/// Reads the specified number of bytes and writes it into the destinatio bytebuffer. Returns true on success.
|
||||
bool ReadToByteBuffer(cByteBuffer & a_Dst, int a_NumBytes);
|
||||
bool ReadToByteBuffer(cByteBuffer & a_Dst, size_t a_NumBytes);
|
||||
|
||||
/// Removes the bytes that have been read from the ringbuffer
|
||||
void CommitRead(void);
|
||||
|
@ -14,7 +14,7 @@ set(FOLDERS ${FOLDERS} WorldStorage Mobs Entities Simulator UI BlockEntities)
|
||||
|
||||
|
||||
|
||||
if (NOT WIN32)
|
||||
if (NOT MSVC)
|
||||
foreach(folder ${FOLDERS})
|
||||
add_subdirectory(${folder})
|
||||
endforeach(folder)
|
||||
@ -62,18 +62,25 @@ else ()
|
||||
endif()
|
||||
|
||||
|
||||
if (UNIX)
|
||||
set(EXECUTABLE ../MCServer/MCServer)
|
||||
else ()
|
||||
set(EXECUTABLE MCServer)
|
||||
endif ()
|
||||
|
||||
set(EXECUTABLE MCServer)
|
||||
|
||||
add_executable(${EXECUTABLE} ${SOURCE})
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/MCServer)
|
||||
|
||||
if (MSVC)
|
||||
# MSVC generator adds a "Debug" or "Release" postfixes to the EXECUTABLE_OUTPUT_PATH, we need to cancel them:
|
||||
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES PREFIX "../")
|
||||
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES IMPORT_PREFIX "../")
|
||||
endif()
|
||||
|
||||
|
||||
# Make the debug executable have a "_debug" suffix
|
||||
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES DEBUG_POSTFIX "_debug")
|
||||
|
||||
|
||||
# Precompiled headers (2nd part)
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
SET_TARGET_PROPERTIES(
|
||||
${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/Yu\"Globals.h\""
|
||||
OBJECT_DEPENDS "$(IntDir)/$(TargetName.pch)"
|
||||
@ -81,7 +88,7 @@ if (WIN32)
|
||||
endif ()
|
||||
|
||||
|
||||
if (NOT WIN32)
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(${EXECUTABLE} OSSupport HTTPServer Bindings Items Blocks)
|
||||
target_link_libraries(${EXECUTABLE} Protocol Generating WorldStorage)
|
||||
target_link_libraries(${EXECUTABLE} Mobs Entities Simulator UI BlockEntities)
|
||||
|
@ -527,9 +527,11 @@ void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner)
|
||||
|
||||
// MG TODO : check that "Level" really means Y
|
||||
|
||||
/*
|
||||
NIBBLETYPE SkyLight = 0;
|
||||
|
||||
NIBBLETYPE BlockLight = 0;
|
||||
*/
|
||||
|
||||
if (IsLightValid())
|
||||
{
|
||||
@ -2324,8 +2326,8 @@ BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const
|
||||
void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta)
|
||||
{
|
||||
int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
|
||||
a_BlockType = cChunkDef::GetBlock (m_BlockTypes, a_RelX, a_RelY, a_RelZ);
|
||||
a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, a_RelX, a_RelY, a_RelZ);
|
||||
a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx);
|
||||
a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, Idx);
|
||||
}
|
||||
|
||||
|
||||
@ -2898,10 +2900,6 @@ NIBBLETYPE cChunk::GetTimeAlteredLight(NIBBLETYPE a_Skylight) const
|
||||
|
||||
|
||||
|
||||
#if !C_CHUNK_USE_INLINE
|
||||
# include "cChunk.inl.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
23
src/Chunk.h
23
src/Chunk.h
@ -12,19 +12,6 @@
|
||||
|
||||
|
||||
|
||||
#define C_CHUNK_USE_INLINE 1
|
||||
|
||||
// Do not touch
|
||||
#if C_CHUNK_USE_INLINE
|
||||
#define __C_CHUNK_INLINE__ inline
|
||||
#else
|
||||
#define __C_CHUNK_INLINE__
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Json
|
||||
{
|
||||
class Value;
|
||||
@ -436,8 +423,6 @@ private:
|
||||
void RemoveBlockEntity(cBlockEntity * a_BlockEntity);
|
||||
void AddBlockEntity (cBlockEntity * a_BlockEntity);
|
||||
|
||||
void SpreadLightOfBlock(NIBBLETYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff);
|
||||
|
||||
/// Creates a block entity for each block that needs a block entity and doesn't have one in the list
|
||||
void CreateBlockEntities(void);
|
||||
|
||||
@ -482,11 +467,3 @@ typedef std::list<cChunkPtr> cChunkPtrList;
|
||||
|
||||
|
||||
|
||||
|
||||
#if C_CHUNK_USE_INLINE
|
||||
#include "Chunk.inl.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
|
||||
#ifndef __C_CHUNK_INL_H__
|
||||
#define __C_CHUNK_INL_H__
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__C_CHUNK_INLINE__
|
||||
void cChunk::SpreadLightOfBlock(NIBBLETYPE * a_LightBuffer, int a_X, int a_Y, int a_Z, char a_Falloff)
|
||||
{
|
||||
unsigned char CurrentLight = cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z );
|
||||
cChunkDef::SetNibble( a_LightBuffer, a_X-1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X-1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
||||
cChunkDef::SetNibble( a_LightBuffer, a_X+1, a_Y, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X+1, a_Y, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
||||
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y-1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y-1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
||||
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y+1, a_Z, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y+1, a_Z ), MAX(0,CurrentLight-a_Falloff) ) );
|
||||
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z-1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z-1 ), MAX(0,CurrentLight-a_Falloff) ) );
|
||||
cChunkDef::SetNibble( a_LightBuffer, a_X, a_Y, a_Z+1, MAX(cChunkDef::GetNibble( a_LightBuffer, a_X, a_Y, a_Z+1 ), MAX(0,CurrentLight-a_Falloff) ) );
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Vector3i.h"
|
||||
#include "BiomeDef.h"
|
||||
|
||||
|
||||
|
||||
@ -57,97 +58,6 @@ typedef unsigned char HEIGHTTYPE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// tolua_begin
|
||||
/** Biome IDs
|
||||
The first batch corresponds to the clientside biomes, used by MineCraft.
|
||||
BiomeIDs over 255 are used by MCServer internally and are translated to MC biomes before sending them to client
|
||||
*/
|
||||
enum EMCSBiome
|
||||
{
|
||||
biOcean = 0,
|
||||
biPlains = 1,
|
||||
biDesert = 2,
|
||||
biExtremeHills = 3,
|
||||
biForest = 4,
|
||||
biTaiga = 5,
|
||||
biSwampland = 6,
|
||||
biRiver = 7,
|
||||
biHell = 8, // same as Nether
|
||||
biNether = 8,
|
||||
biSky = 9, // same as biEnd
|
||||
biEnd = 9,
|
||||
biFrozenOcean = 10,
|
||||
biFrozenRiver = 11,
|
||||
biIcePlains = 12,
|
||||
biTundra = 12, // same as Ice Plains
|
||||
biIceMountains = 13,
|
||||
biMushroomIsland = 14,
|
||||
biMushroomShore = 15,
|
||||
biBeach = 16,
|
||||
biDesertHills = 17,
|
||||
biForestHills = 18,
|
||||
biTaigaHills = 19,
|
||||
biExtremeHillsEdge = 20,
|
||||
biJungle = 21,
|
||||
biJungleHills = 22,
|
||||
|
||||
// Release 1.7 biomes:
|
||||
biJungleEdge = 23,
|
||||
biDeepOcean = 24,
|
||||
biStoneBeach = 25,
|
||||
biColdBeach = 26,
|
||||
biBirchForest = 27,
|
||||
biBirchForestHills = 28,
|
||||
biRoofedForest = 29,
|
||||
biColdTaiga = 30,
|
||||
biColdTaigaHills = 31,
|
||||
biMegaTaiga = 32,
|
||||
biMegaTaigaHills = 33,
|
||||
biExtremeHillsPlus = 34,
|
||||
biSavanna = 35,
|
||||
biSavannaPlateau = 36,
|
||||
biMesa = 37,
|
||||
biMesaPlateauF = 38,
|
||||
biMesaPlateau = 39,
|
||||
|
||||
// Automatically capture the maximum consecutive biome value into biMaxBiome:
|
||||
biNumBiomes, // True number of biomes, since they are zero-based
|
||||
biMaxBiome = biNumBiomes - 1, // The maximum biome value
|
||||
|
||||
// Add this number to the biomes to get the variant
|
||||
biVariant = 128,
|
||||
|
||||
// Release 1.7 biome variants:
|
||||
biSunflowerPlains = 129,
|
||||
biDesertM = 130,
|
||||
biExtremeHillsM = 131,
|
||||
biFlowerForest = 132,
|
||||
biTaigaM = 133,
|
||||
biSwamplandM = 134,
|
||||
biIcePlainsSpikes = 140,
|
||||
biJungleM = 149,
|
||||
biJungleEdgeM = 151,
|
||||
biBirchForestM = 155,
|
||||
biBirchForestHillsM = 156,
|
||||
biRoofedForestM = 157,
|
||||
biColdTaigaM = 158,
|
||||
biMegaSpruceTaiga = 160,
|
||||
biMegaSpruceTaigaHills = 161,
|
||||
biExtremeHillsPlusM = 162,
|
||||
biSavannaM = 163,
|
||||
biSavannaPlateauM = 164,
|
||||
biMesaBryce = 165,
|
||||
biMesaPlateauFM = 166,
|
||||
biMesaPlateauM = 167,
|
||||
} ;
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
|
||||
|
||||
/// Constants used throughout the code, useful typedefs and utility functions
|
||||
class cChunkDef
|
||||
{
|
||||
@ -182,6 +92,7 @@ public:
|
||||
/// Converts absolute block coords into relative (chunk + block) coords:
|
||||
inline static void AbsoluteToRelative(/* in-out */ int & a_X, int & a_Y, int & a_Z, /* out */ int & a_ChunkX, int & a_ChunkZ )
|
||||
{
|
||||
UNUSED(a_Y);
|
||||
BlockToChunk(a_X, a_Z, a_ChunkX, a_ChunkZ);
|
||||
|
||||
a_X = a_X - a_ChunkX * Width;
|
||||
|
@ -991,7 +991,7 @@ bool cChunkMap::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ)
|
||||
|
||||
int cChunkMap::GetHeight(int a_BlockX, int a_BlockZ)
|
||||
{
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
cCSLock Lock(m_CSLayers);
|
||||
int ChunkX, ChunkZ, BlockY = 0;
|
||||
|
@ -264,7 +264,7 @@ void cChunkSender::BlockEntity(cBlockEntity * a_Entity)
|
||||
|
||||
|
||||
|
||||
void cChunkSender::Entity(cEntity * a_Entity)
|
||||
void cChunkSender::Entity(cEntity *)
|
||||
{
|
||||
// Nothing needed yet, perhaps in the future when we save entities into chunks we'd like to send them upon load, too ;)
|
||||
}
|
||||
|
@ -543,6 +543,15 @@ void cClientHandle::HandlePlayerPos(double a_PosX, double a_PosY, double a_PosZ,
|
||||
|
||||
|
||||
|
||||
void cClientHandle::HandlePluginMessage(const AString & a_Channel, const AString & a_Message)
|
||||
{
|
||||
cPluginManager::Get()->CallHookPluginMessage(*this, a_Channel, a_Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status)
|
||||
{
|
||||
LOGD("HandleLeftClick: {%i, %i, %i}; Face: %i; Stat: %i",
|
||||
@ -1409,6 +1418,7 @@ void cClientHandle::SendData(const char * a_Data, int a_Size)
|
||||
|
||||
void cClientHandle::MoveToWorld(cWorld & a_World, bool a_SendRespawnPacket)
|
||||
{
|
||||
UNUSED(a_World);
|
||||
ASSERT(m_Player != NULL);
|
||||
|
||||
if (a_SendRespawnPacket)
|
||||
@ -1968,6 +1978,15 @@ void cClientHandle::SendPlayerSpawn(const cPlayer & a_Player)
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendPluginMessage(const AString & a_Channel, const AString & a_Message)
|
||||
{
|
||||
m_Protocol->SendPluginMessage(a_Channel, a_Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cClientHandle::SendRemoveEntityEffect(const cEntity & a_Entity, int a_EffectID)
|
||||
{
|
||||
m_Protocol->SendRemoveEntityEffect(a_Entity, a_EffectID);
|
||||
|
@ -120,6 +120,7 @@ public:
|
||||
void SendPlayerMoveLook (void);
|
||||
void SendPlayerPosition (void);
|
||||
void SendPlayerSpawn (const cPlayer & a_Player);
|
||||
void SendPluginMessage (const AString & a_Channel, const AString & a_Message); // Exported in ManualBindings.cpp
|
||||
void SendRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID);
|
||||
void SendRespawn (void);
|
||||
void SendExperience (void);
|
||||
@ -178,6 +179,7 @@ public:
|
||||
void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround);
|
||||
void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay)
|
||||
void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround);
|
||||
void HandlePluginMessage (const AString & a_Channel, const AString & a_Message);
|
||||
void HandleRespawn (void);
|
||||
void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, const cItem & a_HeldItem);
|
||||
void HandleSlotSelected (short a_SlotNum);
|
||||
|
@ -38,6 +38,7 @@ class cNullCommandOutputCallback :
|
||||
virtual void Out(const AString & a_Text) override
|
||||
{
|
||||
// Do nothing
|
||||
UNUSED(a_Text);
|
||||
}
|
||||
} ;
|
||||
|
||||
|
@ -563,34 +563,6 @@ namespace ItemCategory
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// Returns true if the biome has no downfall - deserts and savannas
|
||||
inline bool IsBiomeNoDownfall(EMCSBiome a_Biome)
|
||||
{
|
||||
switch (a_Biome)
|
||||
{
|
||||
case biDesert:
|
||||
case biDesertHills:
|
||||
case biDesertM:
|
||||
case biSavanna:
|
||||
case biSavannaM:
|
||||
case biSavannaPlateau:
|
||||
case biSavannaPlateauM:
|
||||
case biNether:
|
||||
case biEnd:
|
||||
{
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
|
@ -351,10 +351,14 @@ public:
|
||||
// tolua_end
|
||||
|
||||
/// Called when the specified player right-clicks this entity
|
||||
virtual void OnRightClicked(cPlayer & a_Player) {};
|
||||
virtual void OnRightClicked(cPlayer &) {};
|
||||
|
||||
/// Returns the list of drops for this pawn when it is killed. May check a_Killer for special handling (sword of looting etc.). Called from KilledBy().
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) {}
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL)
|
||||
{
|
||||
UNUSED(a_Drops);
|
||||
UNUSED(a_Killer);
|
||||
}
|
||||
|
||||
protected:
|
||||
static cCriticalSection m_CSCount;
|
||||
@ -420,11 +424,13 @@ protected:
|
||||
void Dereference( cEntity*& a_EntityPtr );
|
||||
|
||||
private:
|
||||
// Measured in degrees (MAX 360°)
|
||||
// Measured in degrees, [-180, +180)
|
||||
double m_HeadYaw;
|
||||
|
||||
// Measured in meter/second (m/s)
|
||||
Vector3d m_Speed;
|
||||
// Measured in degrees (MAX 360°)
|
||||
|
||||
// Measured in degrees, [-180, +180)
|
||||
Vector3d m_Rot;
|
||||
|
||||
/// Position of the entity's XZ center and Y bottom
|
||||
|
@ -908,8 +908,8 @@ bool cPlayer::IsGameModeSurvival(void) const
|
||||
|
||||
bool cPlayer::IsGameModeAdventure(void) const
|
||||
{
|
||||
return (m_GameMode == gmCreative) || // Either the player is explicitly in Adventure
|
||||
((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Adventure
|
||||
return (m_GameMode == gmAdventure) || // Either the player is explicitly in Adventure
|
||||
((m_GameMode == gmNotSet) && m_World->IsGameModeAdventure()); // or they inherit from the world and the world is Adventure
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
|
||||
|
||||
virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override { };
|
||||
virtual void HandlePhysics(float a_Dt, cChunk &) override { UNUSED(a_Dt); };
|
||||
|
||||
/// Returns the curently equipped weapon; empty item if none
|
||||
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
|
||||
@ -114,7 +114,7 @@ public:
|
||||
double GetEyeHeight(void) const; // tolua_export
|
||||
Vector3d GetEyePosition(void) const; // tolua_export
|
||||
inline bool IsOnGround(void) const {return m_bTouchGround; } // tolua_export
|
||||
inline const double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc.
|
||||
inline double GetStance(void) const { return GetPosY() + 1.62; } // tolua_export // TODO: Proper stance when crouching etc.
|
||||
inline cInventory & GetInventory(void) { return m_Inventory; } // tolua_export
|
||||
inline const cInventory & GetInventory(void) const { return m_Inventory; }
|
||||
|
||||
|
@ -52,7 +52,11 @@ public:
|
||||
virtual void OnHitSolidBlock(const Vector3d & a_HitPos, char a_HitFace);
|
||||
|
||||
/// Called by the physics blocktracer when the entity hits another entity
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) {}
|
||||
virtual void OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
|
||||
{
|
||||
UNUSED(a_EntityHit);
|
||||
UNUSED(a_HitPos);
|
||||
}
|
||||
|
||||
/// Called by Chunk when the projectile is eligible for player collection
|
||||
virtual void CollectedBy(cPlayer * a_Dest);
|
||||
|
@ -285,7 +285,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints &
|
||||
void cCaveTunnel::Smooth(void)
|
||||
{
|
||||
cCaveDefPoints Pts;
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
if (!RefineDefPoints(m_Points, Pts))
|
||||
{
|
||||
@ -331,7 +331,7 @@ void cCaveTunnel::FinishLinear(void)
|
||||
int yd = dy - dx / 2;
|
||||
int zd = dz - dx / 2;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R));
|
||||
|
||||
@ -363,7 +363,7 @@ void cCaveTunnel::FinishLinear(void)
|
||||
int xd = dx - dy / 2;
|
||||
int zd = dz - dy / 2;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R));
|
||||
|
||||
@ -397,7 +397,7 @@ void cCaveTunnel::FinishLinear(void)
|
||||
int xd = dx - dz / 2;
|
||||
int yd = dy - dz / 2;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
m_Points.push_back(cCaveDefPoint(PrevX, PrevY, PrevZ, R));
|
||||
|
||||
@ -509,6 +509,7 @@ void cCaveTunnel::ProcessChunk(
|
||||
case E_BLOCK_GRAVEL:
|
||||
case E_BLOCK_SAND:
|
||||
case E_BLOCK_SANDSTONE:
|
||||
case E_BLOCK_SOULSAND:
|
||||
case E_BLOCK_NETHERRACK:
|
||||
case E_BLOCK_COAL_ORE:
|
||||
case E_BLOCK_IRON_ORE:
|
||||
|
@ -2,13 +2,11 @@
|
||||
#include "Globals.h"
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "../World.h"
|
||||
#include "inifile/iniFile.h"
|
||||
#include "../Root.h"
|
||||
#include "../Bindings/PluginManager.h"
|
||||
#include "ChunkDesc.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "Noise3DGenerator.h"
|
||||
#include "../MersenneTwister.h"
|
||||
|
||||
|
||||
|
||||
@ -29,8 +27,9 @@ const unsigned int QUEUE_SKIP_LIMIT = 500;
|
||||
|
||||
cChunkGenerator::cChunkGenerator(void) :
|
||||
super("cChunkGenerator"),
|
||||
m_World(NULL),
|
||||
m_Generator(NULL)
|
||||
m_Generator(NULL),
|
||||
m_PluginInterface(NULL),
|
||||
m_ChunkSink(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -47,10 +46,12 @@ cChunkGenerator::~cChunkGenerator()
|
||||
|
||||
|
||||
|
||||
bool cChunkGenerator::Start(cWorld * a_World, cIniFile & a_IniFile)
|
||||
bool cChunkGenerator::Start(cPluginInterface & a_PluginInterface, cChunkSink & a_ChunkSink, cIniFile & a_IniFile)
|
||||
{
|
||||
m_PluginInterface = &a_PluginInterface;
|
||||
m_ChunkSink = &a_ChunkSink;
|
||||
|
||||
MTRand rnd;
|
||||
m_World = a_World;
|
||||
m_Seed = a_IniFile.GetValueSetI("Seed", "Seed", rnd.randInt());
|
||||
AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable");
|
||||
|
||||
@ -73,7 +74,7 @@ bool cChunkGenerator::Start(cWorld * a_World, cIniFile & a_IniFile)
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Generator->Initialize(a_World, a_IniFile);
|
||||
m_Generator->Initialize(a_IniFile);
|
||||
|
||||
return super::Start();
|
||||
}
|
||||
@ -237,14 +238,14 @@ void cChunkGenerator::Execute(void)
|
||||
}
|
||||
|
||||
// Hack for regenerating chunks: if Y != 0, the chunk is considered invalid, even if it has its data set
|
||||
if ((coords.m_ChunkY == 0) && m_World->IsChunkValid(coords.m_ChunkX, coords.m_ChunkZ))
|
||||
if ((coords.m_ChunkY == 0) && m_ChunkSink->IsChunkValid(coords.m_ChunkX, coords.m_ChunkZ))
|
||||
{
|
||||
LOGD("Chunk [%d, %d] already generated, skipping generation", coords.m_ChunkX, coords.m_ChunkZ);
|
||||
// Already generated, ignore request
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SkipEnabled && !m_World->HasChunkAnyClients(coords.m_ChunkX, coords.m_ChunkZ))
|
||||
if (SkipEnabled && !m_ChunkSink->HasChunkAnyClients(coords.m_ChunkX, coords.m_ChunkZ))
|
||||
{
|
||||
LOGWARNING("Chunk generator overloaded, skipping chunk [%d, %d]", coords.m_ChunkX, coords.m_ChunkZ);
|
||||
continue;
|
||||
@ -253,9 +254,6 @@ void cChunkGenerator::Execute(void)
|
||||
LOGD("Generating chunk [%d, %d, %d]", coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ);
|
||||
DoGenerate(coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ);
|
||||
|
||||
// Save the chunk right after generating, so that we don't have to generate it again on next run
|
||||
m_World->GetStorage().QueueSaveChunk(coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ);
|
||||
|
||||
NumChunksGenerated++;
|
||||
} // while (!bStop)
|
||||
}
|
||||
@ -265,27 +263,20 @@ void cChunkGenerator::Execute(void)
|
||||
|
||||
void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
||||
{
|
||||
ASSERT(m_PluginInterface != NULL);
|
||||
ASSERT(m_ChunkSink != NULL);
|
||||
|
||||
cChunkDesc ChunkDesc(a_ChunkX, a_ChunkZ);
|
||||
cRoot::Get()->GetPluginManager()->CallHookChunkGenerating(m_World, a_ChunkX, a_ChunkZ, &ChunkDesc);
|
||||
m_PluginInterface->CallHookChunkGenerating(ChunkDesc);
|
||||
m_Generator->DoGenerate(a_ChunkX, a_ChunkZ, ChunkDesc);
|
||||
cRoot::Get()->GetPluginManager()->CallHookChunkGenerated(m_World, a_ChunkX, a_ChunkZ, &ChunkDesc);
|
||||
m_PluginInterface->CallHookChunkGenerated(ChunkDesc);
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Verify that the generator has produced valid data:
|
||||
ChunkDesc.VerifyHeightmap();
|
||||
#endif
|
||||
|
||||
cChunkDef::BlockNibbles BlockMetas;
|
||||
ChunkDesc.CompressBlockMetas(BlockMetas);
|
||||
|
||||
m_World->SetChunkData(
|
||||
a_ChunkX, a_ChunkZ,
|
||||
ChunkDesc.GetBlockTypes(), BlockMetas,
|
||||
NULL, NULL, // We don't have lighting, chunk will be lighted when needed
|
||||
&ChunkDesc.GetHeightMap(), &ChunkDesc.GetBiomeMap(),
|
||||
ChunkDesc.GetEntities(), ChunkDesc.GetBlockEntities(),
|
||||
true
|
||||
);
|
||||
m_ChunkSink->OnChunkGenerated(ChunkDesc);
|
||||
}
|
||||
|
||||
|
||||
@ -304,9 +295,8 @@ cChunkGenerator::cGenerator::cGenerator(cChunkGenerator & a_ChunkGenerator) :
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::cGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile)
|
||||
void cChunkGenerator::cGenerator::Initialize(cIniFile & a_IniFile)
|
||||
{
|
||||
m_World = a_World;
|
||||
UNUSED(a_IniFile);
|
||||
}
|
||||
|
||||
@ -319,7 +309,7 @@ EMCSBiome cChunkGenerator::cGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ)
|
||||
cChunkDef::BiomeMap Biomes;
|
||||
int Y = 0;
|
||||
int ChunkX, ChunkZ;
|
||||
cWorld::AbsoluteToRelative(a_BlockX, Y, a_BlockZ, ChunkX, Y, ChunkZ);
|
||||
cChunkDef::AbsoluteToRelative(a_BlockX, Y, a_BlockZ, ChunkX, ChunkZ);
|
||||
GenerateBiomes(ChunkX, ChunkZ, Biomes);
|
||||
return cChunkDef::GetBiome(Biomes, a_BlockX, a_BlockZ);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ If the generator queue is overloaded, the generator skips chunks with no clients
|
||||
|
||||
|
||||
// fwd:
|
||||
class cWorld;
|
||||
class cIniFile;
|
||||
class cChunkDesc;
|
||||
|
||||
@ -40,7 +39,7 @@ class cChunkGenerator :
|
||||
typedef cIsThread super;
|
||||
|
||||
public:
|
||||
/// The interface that a class has to implement to become a generator
|
||||
/** The interface that a class has to implement to become a generator */
|
||||
class cGenerator
|
||||
{
|
||||
public:
|
||||
@ -48,7 +47,7 @@ public:
|
||||
virtual ~cGenerator() {} ; // Force a virtual destructor
|
||||
|
||||
/// Called to initialize the generator on server startup.
|
||||
virtual void Initialize(cWorld * a_World, cIniFile & a_IniFile);
|
||||
virtual void Initialize(cIniFile & a_IniFile);
|
||||
|
||||
/// Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading.
|
||||
virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
|
||||
@ -61,14 +60,59 @@ public:
|
||||
|
||||
protected:
|
||||
cChunkGenerator & m_ChunkGenerator;
|
||||
cWorld * m_World;
|
||||
} ;
|
||||
|
||||
|
||||
/** The interface through which the plugins are called for their OnChunkGenerating / OnChunkGenerated hooks. */
|
||||
class cPluginInterface
|
||||
{
|
||||
public:
|
||||
// Force a virtual destructor
|
||||
virtual ~cPluginInterface() {}
|
||||
|
||||
/** Called when the chunk is about to be generated.
|
||||
The generator may be partly or fully overriden by the implementation
|
||||
*/
|
||||
virtual void CallHookChunkGenerating(cChunkDesc & a_ChunkDesc) = 0;
|
||||
|
||||
/** Called after the chunk is generated, before it is handed to the chunk sink.
|
||||
a_ChunkDesc contains the generated chunk data. Implementation may modify this data.
|
||||
*/
|
||||
virtual void CallHookChunkGenerated(cChunkDesc & a_ChunkDesc) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
/** The interface through which the generated chunks are handed to the cWorld or whoever created us. */
|
||||
class cChunkSink
|
||||
{
|
||||
public:
|
||||
// Force a virtual destructor
|
||||
virtual ~cChunkSink() {}
|
||||
|
||||
/** Called after the chunk has been generated
|
||||
The interface may store the chunk, send it over network, whatever.
|
||||
The chunk is not expected to be modified, but the generator will survive if the implementation
|
||||
changes the data within. All changes are ignored, though.
|
||||
*/
|
||||
virtual void OnChunkGenerated(cChunkDesc & a_ChunkDesc) = 0;
|
||||
|
||||
/** Called just before the chunk generation is started,
|
||||
to verify that it hasn't been generated in the meantime.
|
||||
If this callback returns true, the chunk is not generated.
|
||||
*/
|
||||
virtual bool IsChunkValid(int a_ChunkX, int a_ChunkZ) = 0;
|
||||
|
||||
/** Called when the generator is overloaded to skip chunks that are no longer needed.
|
||||
If this callback returns false, the chunk is not generated.
|
||||
*/
|
||||
virtual bool HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
cChunkGenerator (void);
|
||||
~cChunkGenerator();
|
||||
|
||||
bool Start(cWorld * a_World, cIniFile & a_IniFile);
|
||||
bool Start(cPluginInterface & a_PluginInterface, cChunkSink & a_ChunkSink, cIniFile & a_IniFile);
|
||||
void Stop(void);
|
||||
|
||||
/// Queues the chunk for generation; removes duplicate requests
|
||||
@ -91,8 +135,6 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
cWorld * m_World;
|
||||
|
||||
int m_Seed;
|
||||
|
||||
cCriticalSection m_CS;
|
||||
@ -102,6 +144,13 @@ private:
|
||||
|
||||
cGenerator * m_Generator; ///< The actual generator engine used to generate chunks
|
||||
|
||||
/** The plugin interface that may modify the generated chunks */
|
||||
cPluginInterface * m_PluginInterface;
|
||||
|
||||
/** The destination where the generated chunks are sent */
|
||||
cChunkSink * m_ChunkSink;
|
||||
|
||||
|
||||
// cIsThread override:
|
||||
virtual void Execute(void) override;
|
||||
|
||||
|
@ -589,7 +589,22 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc)
|
||||
for (int y = 0; y < SEGMENT_HEIGHT; y++)
|
||||
{
|
||||
int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT;
|
||||
a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_NETHERRACK : E_BLOCK_AIR);
|
||||
BLOCKTYPE Block = E_BLOCK_AIR;
|
||||
if (Val < m_Threshold) // Don't calculate if the block should be Netherrack or Soulsand when it's already decided that it's air.
|
||||
{
|
||||
NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(BaseX + x)) / 8;
|
||||
NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(BaseZ + z)) / 8;
|
||||
NOISE_DATATYPE CompBlock = m_Noise1.CubicNoise3D(NoiseX, (float) (y + Segment) / 2, NoiseY);
|
||||
if (CompBlock < -0.5)
|
||||
{
|
||||
Block = E_BLOCK_SOULSAND;
|
||||
}
|
||||
else
|
||||
{
|
||||
Block = E_BLOCK_NETHERRACK;
|
||||
}
|
||||
}
|
||||
a_ChunkDesc.SetBlockType(x, y + Segment, z, Block);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,88 @@
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cTerrainCompositionGen:
|
||||
cTerrainCompositionGen * cTerrainCompositionGen::CreateCompositionGen(cIniFile & a_IniFile, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen, int a_Seed)
|
||||
{
|
||||
AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", "");
|
||||
if (CompoGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator] CompositionGen value not set in world.ini, using \"Biomal\".");
|
||||
CompoGenName = "Biomal";
|
||||
a_IniFile.SetValue("Generator", "CompositionGen", CompoGenName);
|
||||
}
|
||||
|
||||
cTerrainCompositionGen * res = NULL;
|
||||
if (NoCaseCompare(CompoGenName, "sameblock") == 0)
|
||||
{
|
||||
res = new cCompoGenSameBlock;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0)
|
||||
{
|
||||
res = new cCompoGenDebugBiomes;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "classic") == 0)
|
||||
{
|
||||
res = new cCompoGenClassic;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "DistortedHeightmap") == 0)
|
||||
{
|
||||
res = new cDistortedHeightmap(a_Seed, a_BiomeGen);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "end") == 0)
|
||||
{
|
||||
res = new cEndGen(a_Seed);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "nether") == 0)
|
||||
{
|
||||
res = new cCompoGenNether(a_Seed);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "Noise3D") == 0)
|
||||
{
|
||||
res = new cNoise3DComposable(a_Seed);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "biomal") == 0)
|
||||
{
|
||||
res = new cCompoGenBiomal(a_Seed);
|
||||
|
||||
/*
|
||||
// Performance-testing:
|
||||
LOGINFO("Measuring performance of cCompoGenBiomal...");
|
||||
clock_t BeginTick = clock();
|
||||
for (int x = 0; x < 500; x++)
|
||||
{
|
||||
cChunkDesc Desc(200 + x * 8, 200 + x * 8);
|
||||
a_BiomeGen->GenBiomes(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetBiomeMap());
|
||||
a_HeightGen->GenHeightMap(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetHeightMap());
|
||||
res->ComposeTerrain(Desc);
|
||||
}
|
||||
clock_t Duration = clock() - BeginTick;
|
||||
LOGINFO("CompositionGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC);
|
||||
//*/
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGWARN("Unknown CompositionGen \"%s\", using \"Biomal\" instead.", CompoGenName.c_str());
|
||||
a_IniFile.DeleteValue("Generator", "CompositionGen");
|
||||
a_IniFile.SetValue("Generator", "CompositionGen", "Biomal");
|
||||
return CreateCompositionGen(a_IniFile, a_BiomeGen, a_HeightGen, a_Seed);
|
||||
}
|
||||
ASSERT(res != NULL);
|
||||
|
||||
// Read the settings from the ini file:
|
||||
res->InitializeCompoGen(a_IniFile);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cComposableGenerator:
|
||||
|
||||
cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) :
|
||||
super(a_ChunkGenerator),
|
||||
m_BiomeGen(NULL),
|
||||
@ -80,9 +157,9 @@ cComposableGenerator::~cComposableGenerator()
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile)
|
||||
void cComposableGenerator::Initialize(cIniFile & a_IniFile)
|
||||
{
|
||||
super::Initialize(a_World, a_IniFile);
|
||||
super::Initialize(a_IniFile);
|
||||
|
||||
InitBiomeGen(a_IniFile);
|
||||
InitHeightGen(a_IniFile);
|
||||
@ -173,60 +250,8 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
|
||||
|
||||
void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "");
|
||||
if (HeightGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator] HeightGen value not set in world.ini, using \"Biomal\".");
|
||||
HeightGenName = "Biomal";
|
||||
}
|
||||
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
bool CacheOffByDefault = false;
|
||||
if (NoCaseCompare(HeightGenName, "flat") == 0)
|
||||
{
|
||||
m_HeightGen = new cHeiGenFlat;
|
||||
CacheOffByDefault = true; // We're generating faster than a cache would retrieve data
|
||||
}
|
||||
else if (NoCaseCompare(HeightGenName, "classic") == 0)
|
||||
{
|
||||
m_HeightGen = new cHeiGenClassic(Seed);
|
||||
}
|
||||
else if (NoCaseCompare(HeightGenName, "DistortedHeightmap") == 0)
|
||||
{
|
||||
m_HeightGen = new cDistortedHeightmap(Seed, *m_BiomeGen);
|
||||
}
|
||||
else if (NoCaseCompare(HeightGenName, "End") == 0)
|
||||
{
|
||||
m_HeightGen = new cEndGen(Seed);
|
||||
}
|
||||
else if (NoCaseCompare(HeightGenName, "Noise3D") == 0)
|
||||
{
|
||||
m_HeightGen = new cNoise3DComposable(Seed);
|
||||
}
|
||||
else // "biomal" or <not found>
|
||||
{
|
||||
if (NoCaseCompare(HeightGenName, "biomal") != 0)
|
||||
{
|
||||
LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str());
|
||||
}
|
||||
m_HeightGen = new cHeiGenBiomal(Seed, *m_BiomeGen);
|
||||
|
||||
/*
|
||||
// Performance-testing:
|
||||
LOGINFO("Measuring performance of cHeiGenBiomal...");
|
||||
clock_t BeginTick = clock();
|
||||
for (int x = 0; x < 500; x++)
|
||||
{
|
||||
cChunkDef::HeightMap Heights;
|
||||
m_HeightGen->GenHeightMap(x * 5, x * 5, Heights);
|
||||
}
|
||||
clock_t Duration = clock() - BeginTick;
|
||||
LOGINFO("HeightGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC);
|
||||
//*/
|
||||
}
|
||||
|
||||
// Read the settings:
|
||||
m_HeightGen->InitializeHeightGen(a_IniFile);
|
||||
m_HeightGen = cTerrainHeightGen::CreateHeightGen(a_IniFile, *m_BiomeGen, m_ChunkGenerator.GetSeed(), CacheOffByDefault);
|
||||
|
||||
// Add a cache, if requested:
|
||||
int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64);
|
||||
@ -251,67 +276,7 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
|
||||
|
||||
void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
||||
{
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", "");
|
||||
if (CompoGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator] CompositionGen value not set in world.ini, using \"Biomal\".");
|
||||
CompoGenName = "Biomal";
|
||||
}
|
||||
if (NoCaseCompare(CompoGenName, "sameblock") == 0)
|
||||
{
|
||||
m_CompositionGen = new cCompoGenSameBlock;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0)
|
||||
{
|
||||
m_CompositionGen = new cCompoGenDebugBiomes;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "classic") == 0)
|
||||
{
|
||||
m_CompositionGen = new cCompoGenClassic;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "DistortedHeightmap") == 0)
|
||||
{
|
||||
m_CompositionGen = new cDistortedHeightmap(Seed, *m_BiomeGen);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "end") == 0)
|
||||
{
|
||||
m_CompositionGen = new cEndGen(Seed);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "nether") == 0)
|
||||
{
|
||||
m_CompositionGen = new cCompoGenNether(Seed);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "Noise3D") == 0)
|
||||
{
|
||||
m_CompositionGen = new cNoise3DComposable(m_ChunkGenerator.GetSeed());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NoCaseCompare(CompoGenName, "biomal") != 0)
|
||||
{
|
||||
LOGWARN("Unknown CompositionGen \"%s\", using \"biomal\" instead.", CompoGenName.c_str());
|
||||
}
|
||||
m_CompositionGen = new cCompoGenBiomal(Seed);
|
||||
|
||||
/*
|
||||
// Performance-testing:
|
||||
LOGINFO("Measuring performance of cCompoGenBiomal...");
|
||||
clock_t BeginTick = clock();
|
||||
for (int x = 0; x < 500; x++)
|
||||
{
|
||||
cChunkDesc Desc(200 + x * 8, 200 + x * 8);
|
||||
m_BiomeGen->GenBiomes(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetBiomeMap());
|
||||
m_HeightGen->GenHeightMap(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetHeightMap());
|
||||
m_CompositionGen->ComposeTerrain(Desc);
|
||||
}
|
||||
clock_t Duration = clock() - BeginTick;
|
||||
LOGINFO("CompositionGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC);
|
||||
//*/
|
||||
}
|
||||
|
||||
// Read the settings from the ini file:
|
||||
m_CompositionGen->InitializeCompoGen(a_IniFile);
|
||||
m_CompositionGen = cTerrainCompositionGen::CreateCompositionGen(a_IniFile, *m_BiomeGen, *m_HeightGen, m_ChunkGenerator.GetSeed());
|
||||
|
||||
int CompoGenCacheSize = a_IniFile.GetValueSetI("Generator", "CompositionGenCacheSize", 64);
|
||||
if (CompoGenCacheSize > 1)
|
||||
@ -404,13 +369,14 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
|
||||
|
||||
eDimension Dimension = StringToDimension(a_IniFile.GetValue("General", "Dimension", "Overworld"));
|
||||
AStringVector Str = StringSplitAndTrim(Structures, ",");
|
||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
||||
{
|
||||
// Finishers, alpha-sorted:
|
||||
if (NoCaseCompare(*itr, "BottomLava") == 0)
|
||||
{
|
||||
int DefaultBottomLavaLevel = (m_World->GetDimension() == dimNether) ? 30 : 10;
|
||||
int DefaultBottomLavaLevel = (Dimension == dimNether) ? 30 : 10;
|
||||
int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", DefaultBottomLavaLevel);
|
||||
m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel));
|
||||
}
|
||||
@ -424,7 +390,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "LavaSprings") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, *m_World));
|
||||
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, Dimension));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Lilypads") == 0)
|
||||
{
|
||||
@ -444,7 +410,7 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "WaterSprings") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, *m_World));
|
||||
m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, Dimension));
|
||||
}
|
||||
} // for itr - Str[]
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
virtual void InitializeBiomeGen(cIniFile & a_IniFile) {}
|
||||
|
||||
/// Creates the correct BiomeGen descendant based on the ini file settings and the seed provided.
|
||||
/// a_CacheOffByDefault gets set to whether the cache should be enabled by default
|
||||
/// a_CacheOffByDefault gets set to whether the cache should be disabled by default
|
||||
/// Used in BiomeVisualiser, too.
|
||||
/// Implemented in BioGen.cpp!
|
||||
static cBiomeGen * CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a_CacheOffByDefault);
|
||||
@ -77,6 +77,13 @@ public:
|
||||
|
||||
/// Reads parameters from the ini file, prepares generator for use.
|
||||
virtual void InitializeHeightGen(cIniFile & a_IniFile) {}
|
||||
|
||||
/** Creates the correct TerrainHeightGen descendant based on the ini file settings and the seed provided.
|
||||
a_BiomeGen is the underlying biome generator, some height generators may depend on it to generate more biomes
|
||||
a_CacheOffByDefault gets set to whether the cache should be disabled by default
|
||||
Implemented in HeiGen.cpp!
|
||||
*/
|
||||
static cTerrainHeightGen * CreateHeightGen(cIniFile & a_IniFile, cBiomeGen & a_BiomeGen, int a_Seed, bool & a_CacheOffByDefault);
|
||||
} ;
|
||||
|
||||
|
||||
@ -97,6 +104,12 @@ public:
|
||||
|
||||
/// Reads parameters from the ini file, prepares generator for use.
|
||||
virtual void InitializeCompoGen(cIniFile & a_IniFile) {}
|
||||
|
||||
/** Creates the correct TerrainCompositionGen descendant based on the ini file settings and the seed provided.
|
||||
a_BiomeGen is the underlying biome generator, some composition generators may depend on it to generate more biomes
|
||||
a_HeightGen is the underlying height generator, some composition generators may depend on it providing additional values
|
||||
*/
|
||||
static cTerrainCompositionGen * CreateCompositionGen(cIniFile & a_IniFile, cBiomeGen & a_BiomeGen, cTerrainHeightGen & a_HeightGen, int a_Seed);
|
||||
} ;
|
||||
|
||||
|
||||
@ -149,7 +162,7 @@ public:
|
||||
cComposableGenerator(cChunkGenerator & a_ChunkGenerator);
|
||||
virtual ~cComposableGenerator();
|
||||
|
||||
virtual void Initialize(cWorld * a_World, cIniFile & a_IniFile) override;
|
||||
virtual void Initialize(cIniFile & a_IniFile) override;
|
||||
virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
|
||||
virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) override;
|
||||
|
||||
|
@ -774,10 +774,11 @@ void cDistortedHeightmap::ComposeColumn(cChunkDesc & a_ChunkDesc, int a_RelX, in
|
||||
return;
|
||||
}
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled biome");
|
||||
return;
|
||||
}
|
||||
} // switch (Biome)
|
||||
ASSERT(!"Unexpected fallthrough");
|
||||
}
|
||||
|
||||
|
||||
|
@ -520,7 +520,7 @@ void cFinishGenPreSimulator::StationarizeFluid(
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cFinishGenFluidSprings:
|
||||
|
||||
cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile & a_IniFile, const cWorld & a_World) :
|
||||
cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile & a_IniFile, eDimension a_Dimension) :
|
||||
m_Noise(a_Seed + a_Fluid * 100), // Need to take fluid into account, otherwise water and lava springs generate next to each other
|
||||
m_HeightDistribution(255),
|
||||
m_Fluid(a_Fluid)
|
||||
@ -528,8 +528,8 @@ cFinishGenFluidSprings::cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cI
|
||||
bool IsWater = (a_Fluid == E_BLOCK_WATER);
|
||||
AString SectionName = IsWater ? "WaterSprings" : "LavaSprings";
|
||||
AString DefaultHeightDistribution;
|
||||
int DefaultChance;
|
||||
switch (a_World.GetDimension())
|
||||
int DefaultChance = 0;
|
||||
switch (a_Dimension)
|
||||
{
|
||||
case dimNether:
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ class cFinishGenFluidSprings :
|
||||
public cFinishGen
|
||||
{
|
||||
public:
|
||||
cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile & a_IniFile, const cWorld & a_World);
|
||||
cFinishGenFluidSprings(int a_Seed, BLOCKTYPE a_Fluid, cIniFile & a_IniFile, eDimension a_Dimension);
|
||||
|
||||
protected:
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user