everything everywhere

all at once
This commit is contained in:
Kae 2023-06-20 14:33:09 +10:00
parent 6741a057e5
commit 6352e8e319
1172 changed files with 265928 additions and 1 deletions

12
.gitignore vendored
View File

@ -1,3 +1,15 @@
build/
dist/
attic/
lib/
tiled/
assets/user/
assets/devel/
mods/*.pak
mods/*
*.sln
*.suo
*.vcxproj*
CMakeLists.txt.user CMakeLists.txt.user
CMakeCache.txt CMakeCache.txt
CMakeFiles CMakeFiles

View File

@ -1 +1,3 @@
# OpenStarbound # OpenStarbound
Open-source Starbound fork

115
cmake/FindDirectX.cmake Normal file
View File

@ -0,0 +1,115 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Find DirectX SDK
# Define:
# DirectX_FOUND
# DirectX_INCLUDE_DIR
# DirectX_LIBRARY
# DirectX_ROOT_DIR
if(WIN32) # The only platform it makes sense to check for DirectX SDK
include(FindPkgMacros)
findpkg_begin(DirectX)
# Get path, convert backslashes as ${ENV_DXSDK_DIR}
getenv_path(DXSDK_DIR)
getenv_path(DIRECTX_HOME)
getenv_path(DIRECTX_ROOT)
getenv_path(DIRECTX_BASE)
# construct search paths
set(DirectX_PREFIX_PATH
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
"C:/apps_x86/Microsoft DirectX SDK*"
"C:/Program Files (x86)/Microsoft DirectX SDK*"
"C:/apps/Microsoft DirectX SDK*"
"C:/Program Files/Microsoft DirectX SDK*"
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
)
create_search_paths(DirectX)
# redo search if prefix path changed
clear_if_changed(DirectX_PREFIX_PATH
DirectX_LIBRARY
DirectX_INCLUDE_DIR
DirectX_ROOT_DIR
)
find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH})
# dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86
# lib files are in DirectX_ROOT_DIR/Lib/x64|x86
if(${CMAKE_TARGET_ARCHITECTURE} STREQUAL "x86_64")
set(DirectX_LIBPATH_SUFFIX "x64")
else()
set(DirectX_LIBPATH_SUFFIX "x86")
endif()
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXERR9_LIBRARY NAMES dxerr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DINPUT8_LIBRARY NAMES dinput8 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_XINPUT_LIBRARY NAMES xinput HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
if(DirectX_INCLUDE_DIR)
set(DirectX_ROOT_DIR "${DirectX_INCLUDE_DIR}/..")
endif(DirectX_INCLUDE_DIR)
findpkg_finish(DirectX)
set(DirectX_LIBRARIES
${DirectX_LIBRARIES}
${DirectX_D3DX9_LIBRARY}
${DirectX_DXERR9_LIBRARY}
${DirectX_DXGUID_LIBRARY}
${DirectX_DINPUT8_LIBRARY}
${DirectX_DXGI_LIBRARY}
${DirectX_D3DCOMPILER_LIBRARY}
)
# look for D3D10.1 components
if (DirectX_FOUND)
find_path(DirectX_D3D10_INCLUDE_DIR NAMES d3d10_1shader.h HINTS ${DirectX_INCLUDE_DIR} NO_DEFAULT_PATH)
get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH)
message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}")
find_library(DirectX_D3D10_LIBRARY NAMES d3d10 HINTS ${DirectX_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(DirectX_D3DX10_LIBRARY NAMES d3dx10 HINTS ${DirectX_LIBRARY_DIR} NO_DEFAULT_PATH)
if (DirectX_D3D10_INCLUDE_DIR AND DirectX_D3D10_LIBRARY AND DirectX_D3DX10_LIBRARY)
set(DirectX_D3D10_FOUND TRUE)
set(DirectX_D3D10_INCLUDE_DIRS ${DirectX_D3D10_INCLUDE_DIR})
set(DirectX_D3D10_LIBRARIES ${DirectX_D3D10_LIBRARY} ${DirectX_D3DX10_LIBRARY})
endif ()
endif ()
# look for D3D11 components
if (DirectX_FOUND)
find_path(DirectX_D3D11_INCLUDE_DIR NAMES D3D11Shader.h HINTS ${DirectX_INCLUDE_DIR} NO_DEFAULT_PATH)
get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH)
message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}")
find_library(DirectX_D3D11_LIBRARY NAMES d3d11 d3d11_beta HINTS ${DirectX_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIBRARY_DIR} NO_DEFAULT_PATH)
if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY AND DirectX_D3DX11_LIBRARY)
set(DirectX_D3D11_FOUND TRUE)
set(DirectX_D3D11_INCLUDE_DIRS ${DirectX_D3D11_INCLUDE_DIR})
set(DirectX_D3D11_LIBRARIES ${DirectX_D3D11_LIBRARY} ${DirectX_D3DX11_LIBRARY})
endif ()
endif ()
endif(WIN32)

View File

@ -0,0 +1,31 @@
# Variables defined by this module:
#
# DISCORD_API_FOUND System has discord api libs/headers
# DISCORD_API_LIBRARY The discord api library
# DISCORD_API_INCLUDE_DIR The location of discord api headers
find_path(DISCORD_API_ROOT_DIR
NAMES include/discord_game_sdk.h
)
find_library(DISCORD_API_LIBRARY
NAMES discord_game_sdk
HINTS ${DISCORD_API_ROOT_DIR}/lib
)
find_path(DISCORD_API_INCLUDE_DIR
NAMES discord_game_sdk.h
HINTS ${DISCORD_API_ROOT_DIR}/include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DiscordApi DEFAULT_MSG
DISCORD_API_LIBRARY
DISCORD_API_INCLUDE_DIR
)
mark_as_advanced(
DISCORD_API_ROOT_DIR
DISCORD_API_LIBRARY
DISCORD_API_INCLUDE_DIR
)

67
cmake/FindGLEW.cmake Normal file
View File

@ -0,0 +1,67 @@
# Copyright (c) 2007 NVIDIA Corporation
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
#
# Try to find GLEW library and include pathi. Once done this will define:
# GLEW_FOUND
# GLEW_INCLUDE_DIR
# GLEW_LIBRARY
IF (WIN32)
FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
$ENV{PROGRAMFILES}/GLEW/include
${PROJECT_SOURCE_DIR}/src/nvgl/glew/include
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES glew GLEW glew32 glew32s
PATHS
$ENV{PROGRAMFILES}/GLEW/lib
${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
DOC "The GLEW library")
ELSE (WIN32)
FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where GL/glew.h resides")
FIND_LIBRARY( GLEW_LIBRARY
NAMES GLEW glew
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
DOC "The GLEW library")
ENDIF (WIN32)
IF (GLEW_INCLUDE_DIR)
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ELSE (GLEW_INCLUDE_DIR)
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
ENDIF (GLEW_INCLUDE_DIR)
MARK_AS_ADVANCED( GLEW_FOUND )

44
cmake/FindJeMalloc.cmake Normal file
View File

@ -0,0 +1,44 @@
# - Try to find jemalloc headers and libraries.
#
# Usage of this module as follows:
#
# find_package(JeMalloc)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# JEMALLOC_ROOT_DIR Set this variable to the root installation of
# jemalloc if the module has problems finding
# the proper installation path.
#
# Variables defined by this module:
#
# JEMALLOC_FOUND System has jemalloc libs/headers
# JEMALLOC_LIBRARIES The jemalloc library/libraries
# JEMALLOC_INCLUDE_DIR The location of jemalloc headers
find_path(JEMALLOC_ROOT_DIR
NAMES include/jemalloc/jemalloc.h
)
find_library(JEMALLOC_LIBRARY
NAMES jemalloc
HINTS ${JEMALLOC_ROOT_DIR}/lib
)
find_path(JEMALLOC_INCLUDE_DIR
NAMES jemalloc/jemalloc.h
HINTS ${JEMALLOC_ROOT_DIR}/include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JeMalloc DEFAULT_MSG
JEMALLOC_LIBRARY
JEMALLOC_INCLUDE_DIR
)
mark_as_advanced(
JEMALLOC_ROOT_DIR
JEMALLOC_LIBRARY
JEMALLOC_INCLUDE_DIR
)

80
cmake/FindLua52.cmake Normal file
View File

@ -0,0 +1,80 @@
# Locate Lua library
# This module defines
# LUA52_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include <lua/lua.h>
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua52 lua5.2 lua-5.2 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)

57
cmake/FindOggVorbis.cmake Normal file
View File

@ -0,0 +1,57 @@
# - Try to find the OggVorbis libraries
# Once done this will define
#
# OGGVORBIS_FOUND - system has OggVorbis
# OGGVORBIS_VERSION - set either to 1 or 2
# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
# OGG_LIBRARY - The Ogg library
# VORBIS_LIBRARY - The Vorbis library
# VORBISFILE_LIBRARY - The VorbisFile library
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include (CheckLibraryExists)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
find_library(OGG_LIBRARY NAMES ogg)
find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
set(OGGVORBIS_FOUND TRUE)
set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
set (OGGVORBIS_VERSION)
set(OGGVORBIS_FOUND FALSE)
endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
if (OGGVORBIS_FOUND)
if (NOT OggVorbis_FIND_QUIETLY)
message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
endif (NOT OggVorbis_FIND_QUIETLY)
else (OGGVORBIS_FOUND)
if (OggVorbis_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find OggVorbis libraries")
endif (OggVorbis_FIND_REQUIRED)
if (NOT OggVorbis_FIND_QUITELY)
message(STATUS "Could NOT find OggVorbis libraries")
endif (NOT OggVorbis_FIND_QUITELY)
endif (OGGVORBIS_FOUND)

142
cmake/FindPkgMacros.cmake Normal file
View File

@ -0,0 +1,142 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
##################################################################
# Provides some common functionality for the FindPackage modules
##################################################################
# Begin processing of package
macro(findpkg_begin PREFIX)
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS "Looking for ${PREFIX}...")
endif ()
endmacro(findpkg_begin)
# Display a status message unless FIND_QUIETLY is set
macro(pkg_message PREFIX)
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS ${ARGN})
endif ()
endmacro(pkg_message)
# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes
macro(getenv_path VAR)
set(ENV_${VAR} $ENV{${VAR}})
# replace won't work if var is blank
if (ENV_${VAR})
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
endif ()
endmacro(getenv_path)
# Construct search paths for includes and libraries from a PREFIX_PATH
macro(create_search_paths PREFIX)
foreach(dir ${${PREFIX}_PREFIX_PATH})
set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
${dir}/include ${dir}/include/${PREFIX} ${dir}/Headers)
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
${dir}/lib ${dir}/lib/${PREFIX} ${dir}/Libs)
endforeach(dir)
set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
endmacro(create_search_paths)
# clear cache variables if a certain variable changed
macro(clear_if_changed TESTVAR)
# test against internal check variable
if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
message(STATUS "${TESTVAR} changed.")
foreach(var ${ARGN})
set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
endforeach(var)
endif ()
set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE)
endmacro(clear_if_changed)
# Try to get some hints from pkg-config, if available
macro(use_pkgconfig PREFIX PKGNAME)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(${PREFIX} ${PKGNAME})
endif ()
endmacro (use_pkgconfig)
# Couple a set of release AND debug libraries (or frameworks)
macro(make_library_set PREFIX)
if (${PREFIX}_FWK)
set(${PREFIX} ${${PREFIX}_FWK})
elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
elseif (${PREFIX}_REL)
set(${PREFIX} ${${PREFIX}_REL})
elseif (${PREFIX}_DBG)
set(${PREFIX} ${${PREFIX}_DBG})
endif ()
endmacro(make_library_set)
# Generate debug names from given release names
macro(get_debug_names PREFIX)
foreach(i ${${PREFIX}})
set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
endforeach(i)
endmacro(get_debug_names)
# Add the parent dir from DIR to VAR
macro(add_parent_dir VAR DIR)
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
endmacro(add_parent_dir)
# Do the final processing for the package find.
macro(findpkg_finish PREFIX)
# skip if already processed during this run
if (NOT ${PREFIX}_FOUND)
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
set(${PREFIX}_FOUND TRUE)
set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}")
endif ()
else ()
if (NOT ${PREFIX}_FIND_QUIETLY)
message(STATUS "Could not locate ${PREFIX}")
endif ()
if (${PREFIX}_FIND_REQUIRED)
message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.")
endif ()
endif ()
mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK)
endif ()
endmacro(findpkg_finish)
# Slightly customised framework finder
MACRO(findpkg_framework fwk)
IF(APPLE)
SET(${fwk}_FRAMEWORK_PATH
${${fwk}_FRAMEWORK_SEARCH_PATH}
${CMAKE_FRAMEWORK_PATH}
~/Library/Frameworks
/Library/Frameworks
/System/Library/Frameworks
/Network/Library/Frameworks
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
)
FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
SET(fwkpath ${dir}/${fwk}.framework)
IF(EXISTS ${fwkpath})
SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
${fwkpath}/Headers ${fwkpath}/PrivateHeaders)
if (NOT ${fwk}_LIBRARY_FWK)
SET(${fwk}_LIBRARY_FWK "-framework ${fwk}")
endif ()
ENDIF(EXISTS ${fwkpath})
ENDFOREACH(dir)
ENDIF(APPLE)
ENDMACRO(findpkg_framework)

165
cmake/FindSDL2.cmake Normal file
View File

@ -0,0 +1,165 @@
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL2
# SDL2_INCLUDE_DIR, where to find SDL.h
#
# This module responds to the the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDL2main which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL2_LIBRARY
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
#
#
# $SDL2DIR is an environment variable that would
# correspond to the ./configure --prefix=$SDL2DIR
# used in building SDL2.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL guidelines.
# Added a search for SDL2main which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
# This needed to change because "proper" SDL convention
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL2/ (see FreeBSD).
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
SET(SDL2_SEARCH_PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
${SDL2_PATH}
)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES include/SDL2 include
PATHS ${SDL2_SEARCH_PATHS}
)
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't
# necessarily need it.
FIND_LIBRARY(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# SDL2 may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
IF(NOT APPLE)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
IF(SDL2_LIBRARY_TEMP)
# For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY)
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(SDL2MAIN_LIBRARY)
ENDIF(NOT SDL2_BUILDING_LIBRARY)
# For OS X, SDL2 uses Carbon, Cocoa, CoreAudio, AudioUnit, ForceFeedback,
# IOKit, and iconv as a backend so it must link to those. CMake doesn't
# display the -framework Cocoa string in the UI even though it actually is
# there if I modify a pre-used variable. I think it has something to do with
# the CACHE STRING. So I use a temporary variable until the end so I can set
# the "real" variable in one-shot.
IF(APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Carbon -framework Cocoa -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework ForceFeedback -framework IOKit -framework CoreVideo -liconv")
ENDIF(APPLE)
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
IF(NOT APPLE)
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(NOT APPLE)
# For MinGW library
IF(MINGW)
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
ENDIF(MINGW)
# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
ENDIF(SDL2_LIBRARY_TEMP)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)

31
cmake/FindSteamApi.cmake Normal file
View File

@ -0,0 +1,31 @@
# Variables defined by this module:
#
# STEAM_API_FOUND System has steam api libs/headers
# STEAM_API_LIBRARY The steam api library
# STEAM_API_INCLUDE_DIR The location of steam api headers
find_path(STEAM_API_ROOT_DIR
NAMES include/steam/steam_api.h
)
find_library(STEAM_API_LIBRARY
NAMES steam_api
HINTS ${STEAM_API_ROOT_DIR}/lib
)
find_path(STEAM_API_INCLUDE_DIR
NAMES steam/steam_api.h
HINTS ${STEAM_API_ROOT_DIR}/include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SteamApi DEFAULT_MSG
STEAM_API_LIBRARY
STEAM_API_INCLUDE_DIR
)
mark_as_advanced(
STEAM_API_ROOT_DIR
STEAM_API_LIBRARY
STEAM_API_INCLUDE_DIR
)

View File

@ -0,0 +1,130 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()

View File

@ -0,0 +1,38 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
set(HEAD_HASH "${HEAD_REF}")
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

134
cmake/TargetArch.cmake Normal file
View File

@ -0,0 +1,134 @@
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
#if defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
|| defined(__ARM_ARCH_6T2__) \\
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
#error cmake_ARCH armv5
#else
#error cmake_ARCH arm
#endif
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|| defined(_M_MPPC) || defined(_M_PPC)
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
#error cmake_ARCH ppc64
#else
#error cmake_ARCH ppc
#endif
#endif
#error cmake_ARCH unknown
")
# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple
function(target_architecture output_var)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
# First let's normalize the order of the values
# Note that it's not possible to compile PowerPC applications if you are using
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
# disable it by default
# See this page for more information:
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()
# Now add all the architectures in our normalized order
if(osx_arch_ppc)
list(APPEND ARCH ppc)
endif()
if(osx_arch_i386)
list(APPEND ARCH i386)
endif()
if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
enable_language(C)
# Detect the architecture in a rather creative way...
# This compiles a small C program which is a series of ifdefs that selects a
# particular #error preprocessor directive whose message string contains the
# target architecture. The program will always fail to compile (both because
# file is not a valid C program, and obviously because of the presence of the
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/arch.c"
COMPILE_OUTPUT_VARIABLE ARCH
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)
# Parse the architecture name from the compiler output
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
# Get rid of the value marker leaving just the architecture name
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
# If we are compiling with an unknown architecture this variable should
# already be set to "unknown" but in the case that it's empty (i.e. due
# to a typo in the code), then set it to unknown
if (NOT ARCH)
set(ARCH unknown)
endif()
endif()
set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()

768
doc/OPENSOURCE.md Normal file
View File

@ -0,0 +1,768 @@
Open Source Software used in Starbound and Accompanying Utilities
=================================================================
[The Lua Scripting Language](www.lua.org)
-----------------------------------------
> The MIT License (MIT)
> Copyright (C) 1994-2015 Lua.org, PUC-Rio.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of
> this software and associated documentation files (the "Software"), to deal in
> the Software without restriction, including without limitation the rights to
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
> of the Software, and to permit persons to whom the Software is furnished to do
> so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.
[SDL - Simple DirectMedia Layer](libsdl.org)
--------------------------------------------
> Simple DirectMedia Layer
> Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
>
> This software is provided 'as-is', without any express or implied
> warranty. In no event will the authors be held liable for any damages
> arising from the use of this software.
>
> Permission is granted to anyone to use this software for any purpose,
> including commercial applications, and to alter it and redistribute it
> freely, subject to the following restrictions:
>
> 1. The origin of this software must not be misrepresented; you must not
> claim that you wrote the original software. If you use this software
> in a product, an acknowledgment in the product documentation would be
> appreciated but is not required.
> 2. Altered source versions must be plainly marked as such, and must not be
> misrepresented as being the original software.
> 3. This notice may not be removed or altered from any source distribution.
[libpng PNG reference library](libpng.org)
------------------------------------------
> COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
>
> If you modify libpng you may insert additional notices immediately following
> this sentence.
>
> This code is released under the libpng license.
>
> libpng versions 1.0.7, July 1, 2000, through 1.6.18, July 23, 2015, are
> Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, and are
> distributed according to the same disclaimer and license as libpng-1.0.6
> with the following individuals added to the list of Contributing Authors:
>
> Simon-Pierre Cadieux
> Mans Rullgard
> Cosmin Truta
> Gilles Vollant
> James Yu
>
> and with the following additions to the disclaimer:
>
> There is no warranty against interference with your enjoyment of the
> library or against infringement. There is no warranty that our
> efforts or the library will fulfill any of your particular purposes
> or needs. This library is provided with all faults, and the entire
> risk of satisfactory quality, performance, accuracy, and effort is with
> the user.
>
> libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
> Copyright (c) 1998-2000 Glenn Randers-Pehrson, and are distributed according
> to the same disclaimer and license as libpng-0.96, with the following
> individuals added to the list of Contributing Authors:
>
> Tom Lane
> Glenn Randers-Pehrson
> Eric S. Raymond
> Willem van Schaik
>
> libpng versions 0.89, June 1996, through 0.96, May 1997, are
> Copyright (c) 1996-1997 Andreas Dilger, and are
> distributed according to the same disclaimer and license as libpng-0.88,
> with the following individuals added to the list of Contributing Authors:
>
> John Bowler
> Kevin Bracey
> Sam Bushell
> Magnus Holmgren
> Greg Roelofs
> Tom Tanner
>
> libpng versions 0.5, May 1995, through 0.88, January 1996, are
> Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
>
> For the purposes of this copyright and license, "Contributing Authors"
> is defined as the following set of individuals:
>
> Andreas Dilger
> Dave Martindale
> Guy Eric Schalnat
> Paul Schmidt
> Tim Wegner
>
> The PNG Reference Library is supplied "AS IS". The Contributing Authors
> and Group 42, Inc. disclaim all warranties, expressed or implied,
> including, without limitation, the warranties of merchantability and of
> fitness for any purpose. The Contributing Authors and Group 42, Inc.
> assume no liability for direct, indirect, incidental, special, exemplary,
> or consequential damages, which may result from the use of the PNG
> Reference Library, even if advised of the possibility of such damage.
>
> Permission is hereby granted to use, copy, modify, and distribute this
> source code, or portions hereof, for any purpose, without fee, subject
> to the following restrictions:
>
> 1. The origin of this source code must not be misrepresented.
>
> 2. Altered versions must be plainly marked as such and must not
> be misrepresented as being the original source.
>
> 3. This Copyright notice may not be removed or altered from any
> source or altered source distribution.
>
> The Contributing Authors and Group 42, Inc. specifically permit, without
> fee, and encourage the use of this source code as a component to
> supporting the PNG file format in commercial products. If you use this
> source code in a product, acknowledgment is not required but would be
> appreciated.
[zlib compresison library](www.xiph.org)
---------------------------------------------------------
> Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
>
> This software is provided 'as-is', without any express or implied
> warranty. In no event will the authors be held liable for any damages
> arising from the use of this software.
>
> Permission is granted to anyone to use this software for any purpose,
> including commercial applications, and to alter it and redistribute it
> freely, subject to the following restrictions:
>
> 1. The origin of this software must not be misrepresented; you must not
> claim that you wrote the original software. If you use this software
> in a product, an acknowledgment in the product documentation would be
> appreciated but is not required.
> 2. Altered source versions must be plainly marked as such, and must not be
> misrepresented as being the original software.
> 3. This notice may not be removed or altered from any source distribution.
>
> Jean-loup Gailly Mark Adler
> jloup@gzip.org madler@alumni.caltech.edu
[libogg and libvorbis multimedia libraries](www.xiph.org)
---------------------------------------------------------
> Copyright (c) 2002-2015 Xiph.org Foundation
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions
> are met:
>
> - Redistributions of source code must retain the above copyright
> notice, this list of conditions and the following disclaimer.
>
> - Redistributions in binary form must reproduce the above copyright
> notice, this list of conditions and the following disclaimer in the
> documentation and/or other materials provided with the distribution.
>
> - Neither the name of the Xiph.org Foundation nor the names of its
> contributors may be used to endorse or promote products derived from
> this software without specific prior written permission.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[FreeType Font Engine](www.freetype.org)
----------------------------------------
> Portions of this software are copyright © 2015 The FreeType
> Project (www.freetype.org). All rights reserved.
[jemalloc custom allocator](www.cannonware.com/jemalloc/)
---------------------------------------------------------
> Copyright (C) 2002-2015 Jason Evans <jasone@canonware.com>.
> All rights reserved.
> Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
> Copyright (C) 2009-2015 Facebook, Inc. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met:
> 1. Redistributions of source code must retain the above copyright notice(s),
> this list of conditions and the following disclaimer.
> 2. Redistributions in binary form must reproduce the above copyright notice(s),
> this list of conditions and the following disclaimer in the documentation
> and/or other materials provided with the distribution.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
> OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
> EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
> OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[The xxHash algorithm implementation by Yann Collet](github.com/Cyan4973/xxHash)
--------------------------------------------------------------------------------
> Copyright (c) 2012-2014, Yann Collet
> All rights reserved.
>
> Redistribution and use in source and binary forms, with or without modification,
> are permitted provided that the following conditions are met:
>
> * Redistributions of source code must retain the above copyright notice, this
> list of conditions and the following disclaimer.
>
> * Redistributions in binary form must reproduce the above copyright notice, this
> list of conditions and the following disclaimer in the documentation and/or
> other materials provided with the distribution.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
> ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
> ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[Modified Tinyformat library by Chris Foster](github.com/c42f/tinyformat)
-------------------------------------------------------------------------
> Copyright (C) 2011, Chris Foster [chris42f (at) gmail (d0t) com]
>
> Boost Software License - Version 1.0
>
> Permission is hereby granted, free of charge, to any person or organization
> obtaining a copy of the software and accompanying documentation covered by
> this license (the "Software") to use, reproduce, display, distribute,
> execute, and transmit the Software, and to prepare derivative works of the
> Software, and to permit third-parties to whom the Software is furnished to
> do so, all subject to the following:
>
> The copyright notices in the Software and this entire statement, including
> the above license grant, this restriction and the following disclaimer,
> must be included in all copies of the Software, in whole or in part, and
> all derivative works of the Software, unless such copies or derivative
> works are solely in the form of machine-executable object code generated by
> a source language processor.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
> SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
> FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
> ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS IN THE SOFTWARE.
[The OpenGL Extension Wrangler Library](glew.sourceforge.net)
-------------------------------------------------------------
> The OpenGL Extension Wrangler Library
> Copyright (C) 2008-2015, Nigel Stewart <nigels[]users sourceforge net>
> Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
> Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
> Copyright (C) 2002, Lev Povalahev
> All rights reserved.
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met:
>
> * Redistributions of source code must retain the above copyright notice,
> this list of conditions and the following disclaimer.
> * Redistributions in binary form must reproduce the above copyright notice,
> this list of conditions and the following disclaimer in the documentation
> and/or other materials provided with the distribution.
> * The name of the author may be used to endorse or promote products
> derived from this software without specific prior written permission.
>
> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
> THE POSSIBILITY OF SUCH DAMAGE.
Open Source Software used by the Mod Upoading Tool
==================================================
[Qt GUI Toolkit](www.qt.io)
---------------------------
> GNU LESSER GENERAL PUBLIC LICENSE
> Version 2.1, February 1999
>
> Copyright (C) 1991, 1999 Free Software Foundation, Inc.
> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> Everyone is permitted to copy and distribute verbatim copies
> of this license document, but changing it is not allowed.
>
> [This is the first released version of the Lesser GPL. It also counts
> as the successor of the GNU Library Public License, version 2, hence
> the version number 2.1.]
>
> Preamble
>
> The licenses for most software are designed to take away your
> freedom to share and change it. By contrast, the GNU General Public
> Licenses are intended to guarantee your freedom to share and change
> free software--to make sure the software is free for all its users.
>
> This license, the Lesser General Public License, applies to some
> specially designated software packages--typically libraries--of the
> Free Software Foundation and other authors who decide to use it. You
> can use it too, but we suggest you first think carefully about whether
> this license or the ordinary General Public License is the better
> strategy to use in any particular case, based on the explanations below.
>
> When we speak of free software, we are referring to freedom of use,
> not price. Our General Public Licenses are designed to make sure that
> you have the freedom to distribute copies of free software (and charge
> for this service if you wish); that you receive source code or can get
> it if you want it; that you can change the software and use pieces of
> it in new free programs; and that you are informed that you can do
> these things.
>
> To protect your rights, we need to make restrictions that forbid
> distributors to deny you these rights or to ask you to surrender these
> rights. These restrictions translate to certain responsibilities for
> you if you distribute copies of the library or if you modify it.
>
> For example, if you distribute copies of the library, whether gratis
> or for a fee, you must give the recipients all the rights that we gave
> you. You must make sure that they, too, receive or can get the source
> code. If you link other code with the library, you must provide
> complete object files to the recipients, so that they can relink them
> with the library after making changes to the library and recompiling
> it. And you must show them these terms so they know their rights.
>
> We protect your rights with a two-step method: (1) we copyright the
> library, and (2) we offer you this license, which gives you legal
> permission to copy, distribute and/or modify the library.
>
> To protect each distributor, we want to make it very clear that
> there is no warranty for the free library. Also, if the library is
> modified by someone else and passed on, the recipients should know
> that what they have is not the original version, so that the original
> author's reputation will not be affected by problems that might be
> introduced by others.
>
> Finally, software patents pose a constant threat to the existence of
> any free program. We wish to make sure that a company cannot
> effectively restrict the users of a free program by obtaining a
> restrictive license from a patent holder. Therefore, we insist that
> any patent license obtained for a version of the library must be
> consistent with the full freedom of use specified in this license.
>
> Most GNU software, including some libraries, is covered by the
> ordinary GNU General Public License. This license, the GNU Lesser
> General Public License, applies to certain designated libraries, and
> is quite different from the ordinary General Public License. We use
> this license for certain libraries in order to permit linking those
> libraries into non-free programs.
>
> When a program is linked with a library, whether statically or using
> a shared library, the combination of the two is legally speaking a
> combined work, a derivative of the original library. The ordinary
> General Public License therefore permits such linking only if the
> entire combination fits its criteria of freedom. The Lesser General
> Public License permits more lax criteria for linking other code with
> the library.
>
> We call this license the "Lesser" General Public License because it
> does Less to protect the user's freedom than the ordinary General
> Public License. It also provides other free software developers Less
> of an advantage over competing non-free programs. These disadvantages
> are the reason we use the ordinary General Public License for many
> libraries. However, the Lesser license provides advantages in certain
> special circumstances.
>
> For example, on rare occasions, there may be a special need to
> encourage the widest possible use of a certain library, so that it becomes
> a de-facto standard. To achieve this, non-free programs must be
> allowed to use the library. A more frequent case is that a free
> library does the same job as widely used non-free libraries. In this
> case, there is little to gain by limiting the free library to free
> software only, so we use the Lesser General Public License.
>
> In other cases, permission to use a particular library in non-free
> programs enables a greater number of people to use a large body of
> free software. For example, permission to use the GNU C Library in
> non-free programs enables many more people to use the whole GNU
> operating system, as well as its variant, the GNU/Linux operating
> system.
>
> Although the Lesser General Public License is Less protective of the
> users' freedom, it does ensure that the user of a program that is
> linked with the Library has the freedom and the wherewithal to run
> that program using a modified version of the Library.
>
> The precise terms and conditions for copying, distribution and
> modification follow. Pay close attention to the difference between a
> "work based on the library" and a "work that uses the library". The
> former contains code derived from the library, whereas the latter must
> be combined with the library in order to run.
>
> GNU LESSER GENERAL PUBLIC LICENSE
> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
>
> 0. This License Agreement applies to any software library or other
> program which contains a notice placed by the copyright holder or
> other authorized party saying it may be distributed under the terms of
> this Lesser General Public License (also called "this License").
> Each licensee is addressed as "you".
>
> A "library" means a collection of software functions and/or data
> prepared so as to be conveniently linked with application programs
> (which use some of those functions and data) to form executables.
>
> The "Library", below, refers to any such software library or work
> which has been distributed under these terms. A "work based on the
> Library" means either the Library or any derivative work under
> copyright law: that is to say, a work containing the Library or a
> portion of it, either verbatim or with modifications and/or translated
> straightforwardly into another language. (Hereinafter, translation is
> included without limitation in the term "modification".)
>
> "Source code" for a work means the preferred form of the work for
> making modifications to it. For a library, complete source code means
> all the source code for all modules it contains, plus any associated
> interface definition files, plus the scripts used to control compilation
> and installation of the library.
>
> Activities other than copying, distribution and modification are not
> covered by this License; they are outside its scope. The act of
> running a program using the Library is not restricted, and output from
> such a program is covered only if its contents constitute a work based
> on the Library (independent of the use of the Library in a tool for
> writing it). Whether that is true depends on what the Library does
> and what the program that uses the Library does.
>
> 1. You may copy and distribute verbatim copies of the Library's
> complete source code as you receive it, in any medium, provided that
> you conspicuously and appropriately publish on each copy an
> appropriate copyright notice and disclaimer of warranty; keep intact
> all the notices that refer to this License and to the absence of any
> warranty; and distribute a copy of this License along with the
> Library.
>
> You may charge a fee for the physical act of transferring a copy,
> and you may at your option offer warranty protection in exchange for a
> fee.
>
> 2. You may modify your copy or copies of the Library or any portion
> of it, thus forming a work based on the Library, and copy and
> distribute such modifications or work under the terms of Section 1
> above, provided that you also meet all of these conditions:
>
> a) The modified work must itself be a software library.
>
> b) You must cause the files modified to carry prominent notices
> stating that you changed the files and the date of any change.
>
> c) You must cause the whole of the work to be licensed at no
> charge to all third parties under the terms of this License.
>
> d) If a facility in the modified Library refers to a function or a
> table of data to be supplied by an application program that uses
> the facility, other than as an argument passed when the facility
> is invoked, then you must make a good faith effort to ensure that,
> in the event an application does not supply such function or
> table, the facility still operates, and performs whatever part of
> its purpose remains meaningful.
>
> (For example, a function in a library to compute square roots has
> a purpose that is entirely well-defined independent of the
> application. Therefore, Subsection 2d requires that any
> application-supplied function or table used by this function must
> be optional: if the application does not supply it, the square
> root function must still compute square roots.)
>
> These requirements apply to the modified work as a whole. If
> identifiable sections of that work are not derived from the Library,
> and can be reasonably considered independent and separate works in
> themselves, then this License, and its terms, do not apply to those
> sections when you distribute them as separate works. But when you
> distribute the same sections as part of a whole which is a work based
> on the Library, the distribution of the whole must be on the terms of
> this License, whose permissions for other licensees extend to the
> entire whole, and thus to each and every part regardless of who wrote
> it.
>
> Thus, it is not the intent of this section to claim rights or contest
> your rights to work written entirely by you; rather, the intent is to
> exercise the right to control the distribution of derivative or
> collective works based on the Library.
>
> In addition, mere aggregation of another work not based on the Library
> with the Library (or with a work based on the Library) on a volume of
> a storage or distribution medium does not bring the other work under
> the scope of this License.
>
> 3. You may opt to apply the terms of the ordinary GNU General Public
> License instead of this License to a given copy of the Library. To do
> this, you must alter all the notices that refer to this License, so
> that they refer to the ordinary GNU General Public License, version 2,
> instead of to this License. (If a newer version than version 2 of the
> ordinary GNU General Public License has appeared, then you can specify
> that version instead if you wish.) Do not make any other change in
> these notices.
>
> Once this change is made in a given copy, it is irreversible for
> that copy, so the ordinary GNU General Public License applies to all
> subsequent copies and derivative works made from that copy.
>
> This option is useful when you wish to copy part of the code of
> the Library into a program that is not a library.
>
> 4. You may copy and distribute the Library (or a portion or
> derivative of it, under Section 2) in object code or executable form
> under the terms of Sections 1 and 2 above provided that you accompany
> it with the complete corresponding machine-readable source code, which
> must be distributed under the terms of Sections 1 and 2 above on a
> medium customarily used for software interchange.
>
> If distribution of object code is made by offering access to copy
> from a designated place, then offering equivalent access to copy the
> source code from the same place satisfies the requirement to
> distribute the source code, even though third parties are not
> compelled to copy the source along with the object code.
>
> 5. A program that contains no derivative of any portion of the
> Library, but is designed to work with the Library by being compiled or
> linked with it, is called a "work that uses the Library". Such a
> work, in isolation, is not a derivative work of the Library, and
> therefore falls outside the scope of this License.
>
> However, linking a "work that uses the Library" with the Library
> creates an executable that is a derivative of the Library (because it
> contains portions of the Library), rather than a "work that uses the
> library". The executable is therefore covered by this License.
> Section 6 states terms for distribution of such executables.
>
> When a "work that uses the Library" uses material from a header file
> that is part of the Library, the object code for the work may be a
> derivative work of the Library even though the source code is not.
> Whether this is true is especially significant if the work can be
> linked without the Library, or if the work is itself a library. The
> threshold for this to be true is not precisely defined by law.
>
> If such an object file uses only numerical parameters, data
> structure layouts and accessors, and small macros and small inline
> functions (ten lines or less in length), then the use of the object
> file is unrestricted, regardless of whether it is legally a derivative
> work. (Executables containing this object code plus portions of the
> Library will still fall under Section 6.)
>
> Otherwise, if the work is a derivative of the Library, you may
> distribute the object code for the work under the terms of Section 6.
> Any executables containing that work also fall under Section 6,
> whether or not they are linked directly with the Library itself.
>
> 6. As an exception to the Sections above, you may also combine or
> link a "work that uses the Library" with the Library to produce a
> work containing portions of the Library, and distribute that work
> under terms of your choice, provided that the terms permit
> modification of the work for the customer's own use and reverse
> engineering for debugging such modifications.
>
> You must give prominent notice with each copy of the work that the
> Library is used in it and that the Library and its use are covered by
> this License. You must supply a copy of this License. If the work
> during execution displays copyright notices, you must include the
> copyright notice for the Library among them, as well as a reference
> directing the user to the copy of this License. Also, you must do one
> of these things:
>
> a) Accompany the work with the complete corresponding
> machine-readable source code for the Library including whatever
> changes were used in the work (which must be distributed under
> Sections 1 and 2 above); and, if the work is an executable linked
> with the Library, with the complete machine-readable "work that
> uses the Library", as object code and/or source code, so that the
> user can modify the Library and then relink to produce a modified
> executable containing the modified Library. (It is understood
> that the user who changes the contents of definitions files in the
> Library will not necessarily be able to recompile the application
> to use the modified definitions.)
>
> b) Use a suitable shared library mechanism for linking with the
> Library. A suitable mechanism is one that (1) uses at run time a
> copy of the library already present on the user's computer system,
> rather than copying library functions into the executable, and (2)
> will operate properly with a modified version of the library, if
> the user installs one, as long as the modified version is
> interface-compatible with the version that the work was made with.
>
> c) Accompany the work with a written offer, valid for at
> least three years, to give the same user the materials
> specified in Subsection 6a, above, for a charge no more
> than the cost of performing this distribution.
>
> d) If distribution of the work is made by offering access to copy
> from a designated place, offer equivalent access to copy the above
> specified materials from the same place.
>
> e) Verify that the user has already received a copy of these
> materials or that you have already sent this user a copy.
>
> For an executable, the required form of the "work that uses the
> Library" must include any data and utility programs needed for
> reproducing the executable from it. However, as a special exception,
> the materials to be distributed need not include anything that is
> normally distributed (in either source or binary form) with the major
> components (compiler, kernel, and so on) of the operating system on
> which the executable runs, unless that component itself accompanies
> the executable.
>
> It may happen that this requirement contradicts the license
> restrictions of other proprietary libraries that do not normally
> accompany the operating system. Such a contradiction means you cannot
> use both them and the Library together in an executable that you
> distribute.
>
> 7. You may place library facilities that are a work based on the
> Library side-by-side in a single library together with other library
> facilities not covered by this License, and distribute such a combined
> library, provided that the separate distribution of the work based on
> the Library and of the other library facilities is otherwise
> permitted, and provided that you do these two things:
>
> a) Accompany the combined library with a copy of the same work
> based on the Library, uncombined with any other library
> facilities. This must be distributed under the terms of the
> Sections above.
>
> b) Give prominent notice with the combined library of the fact
> that part of it is a work based on the Library, and explaining
> where to find the accompanying uncombined form of the same work.
>
> 8. You may not copy, modify, sublicense, link with, or distribute
> 0the Library except as expressly provided under this License. Any
> attempt otherwise to copy, modify, sublicense, link with, or
> distribute the Library is void, and will automatically terminate your
> rights under this License. However, parties who have received copies,
> or rights, from you under this License will not have their licenses
> terminated so long as such parties remain in full compliance.
>
> 9. You are not required to accept this License, since you have not
> signed it. However, nothing else grants you permission to modify or
> distribute the Library or its derivative works. These actions are
> prohibited by law if you do not accept this License. Therefore, by
> modifying or distributing the Library (or any work based on the
> Library), you indicate your acceptance of this License to do so, and
> all its terms and conditions for copying, distributing or modifying
> the Library or works based on it.
>
> 10. Each time you redistribute the Library (or any work based on the
> Library), the recipient automatically receives a license from the
> original licensor to copy, distribute, link with or modify the Library
> subject to these terms and conditions. You may not impose any further
> restrictions on the recipients' exercise of the rights granted herein.
> You are not responsible for enforcing compliance by third parties with
> this License.
>
> 11. If, as a consequence of a court judgment or allegation of patent
> infringement or for any other reason (not limited to patent issues),
> conditions are imposed on you (whether by court order, agreement or
> otherwise) that contradict the conditions of this License, they do not
> excuse you from the conditions of this License. If you cannot
> distribute so as to satisfy simultaneously your obligations under this
> License and any other pertinent obligations, then as a consequence you
> may not distribute the Library at all. For example, if a patent
> license would not permit royalty-free redistribution of the Library by
> all those who receive copies directly or indirectly through you, then
> the only way you could satisfy both it and this License would be to
> refrain entirely from distribution of the Library.
>
> If any portion of this section is held invalid or unenforceable under any
> particular circumstance, the balance of the section is intended to apply,
> and the section as a whole is intended to apply in other circumstances.
>
> It is not the purpose of this section to induce you to infringe any
> patents or other property right claims or to contest validity of any
> such claims; this section has the sole purpose of protecting the
> integrity of the free software distribution system which is
> implemented by public license practices. Many people have made
> generous contributions to the wide range of software distributed
> through that system in reliance on consistent application of that
> system; it is up to the author/donor to decide if he or she is willing
> to distribute software through any other system and a licensee cannot
> impose that choice.
>
> This section is intended to make thoroughly clear what is believed to
> be a consequence of the rest of this License.
>
> 12. If the distribution and/or use of the Library is restricted in
> certain countries either by patents or by copyrighted interfaces, the
> original copyright holder who places the Library under this License may add
> an explicit geographical distribution limitation excluding those countries,
> so that distribution is permitted only in or among countries not thus
> excluded. In such case, this License incorporates the limitation as if
> written in the body of this License.
>
> 13. The Free Software Foundation may publish revised and/or new
> versions of the Lesser General Public License from time to time.
> Such new versions will be similar in spirit to the present version,
> but may differ in detail to address new problems or concerns.
>
> Each version is given a distinguishing version number. If the Library
> specifies a version number of this License which applies to it and
> "any later version", you have the option of following the terms and
> conditions either of that version or of any later version published by
> the Free Software Foundation. If the Library does not specify a
> license version number, you may choose any version ever published by
> the Free Software Foundation.
>
> 14. If you wish to incorporate parts of the Library into other free
> programs whose distribution conditions are incompatible with these,
> write to the author to ask for permission. For software which is
> copyrighted by the Free Software Foundation, write to the Free
> Software Foundation; we sometimes make exceptions for this. Our
> decision will be guided by the two goals of preserving the free status
> of all derivatives of our free software and of promoting the sharing
> and reuse of software generally.
>
> NO WARRANTY
>
> 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
> WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
> EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
> OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
> KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
> LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
> THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
>
> 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
> WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
> AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
> FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
> CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
> LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
> RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
> FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
> SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
> DAMAGES.

187
doc/lua/activeitem.md Normal file
View File

@ -0,0 +1,187 @@
The activeItem table contains bindings which provide functionality for the ActiveItem and for the item's 'owner' (a ToolUser entity currently holding the item).
---
#### `EntityId` activeItem.ownerEntityId()
Returns the entity id of the owner entity.
---
#### `DamageTeam` activeItem.ownerTeam()
Returns the damage team of the owner entity.
---
#### `Vec2F` activeItem.ownerAimPosition()
Returns the world aim position of the owner entity.
---
#### `float` activeItem.ownerPowerMultiplier()
Returns the power multiplier of the owner entity.
---
#### `String` activeItem.fireMode()
Returns the current fire mode of the item, which can be "none", "primary" or "alt". Single-handed items held in the off hand will receive right click as "primary" rather than "alt".
---
#### `String` activeItem.hand()
Returns the name of the hand that the item is currently held in, which can be "primary" or "alt".
---
#### `Vec2F` activeItem.handPosition([`Vec2F` offset])
Takes an input position (defaults to [0, 0]) relative to the item and returns a position relative to the owner entity.
---
#### `LuaTable` activeItem.aimAngleAndDirection(`float` aimVerticalOffset, `Vec2F` targetPosition)
Returns a table containing the `float` aim angle and `int` facing direction that would be used for the item to aim at the specified target position with the specified vertical offset. This takes into account the position of the shoulder, distance of the hand from the body, and a lot of other complex factors and should be used to control aimable weapons or tools based on the owner's aim position.
---
#### `float` activeItem.aimAngle(`float` aimVerticalOffset, `Vec2F` targetPosition)
Similar to activeItem.aimAngleAndDirection but only returns the aim angle that would be calculated with the entity's current facing direction. Necessary if, for example, an item needs to aim behind the owner.
---
#### `void` activeItem.setHoldingItem(`bool` holdingItem)
Sets whether the owner is visually holding the item.
---
#### `void` activeItem.setBackArmFrame([`String` armFrame])
Sets the arm image frame that the item should use when held behind the player, or clears it to the default rotation arm frame if no frame is specified.
---
#### `void` activeItem.setFrontArmFrame([`String` armFrame])
Sets the arm image frame that the item should use when held in front of the player, or clears it to the default rotation arm frame if no frame is specified.
---
#### `void` activeItem.setTwoHandedGrip(`bool` twoHandedGrip)
Sets whether the item should be visually held with both hands. Does not alter the functional handedness requirement of the item.
---
#### `void` activeItem.setRecoil(`bool` recoil)
Sets whether the item is in a recoil state, which will translate both the item and the arm holding it slightly toward the back of the character.
---
#### `void` activeItem.setOutsideOfHand(`bool` outsideOfHand)
Sets whether the item should be visually rendered outside the owner's hand. Items outside of the hand will be rendered in front of the arm when held in front and behind the arm when held behind.
---
#### `void` activeItem.setArmAngle(`float` angle)
Sets the angle to which the owner's arm holding the item should be rotated.
---
#### `void` activeItem.setFacingDirection(`float` direction)
Sets the item's requested facing direction, which controls the owner's facing. Positive direction values will face right while negative values will face left. If the owner holds two items which request opposing facing directions, the direction requested by the item in the primary hand will take precedence.
---
#### `void` activeItem.setDamageSources([`List<DamageSource>` damageSources])
Sets a list of active damage sources with coordinates relative to the owner's position or clears them if unspecified.
---
#### `void` activeItem.setItemDamageSources([`List<DamageSource>` damageSources])
Sets a list of active damage sources with coordinates relative to the item's hand position or clears them if unspecified.
---
#### `void` activeItem.setShieldPolys([`List<PolyF>` shieldPolys])
Sets a list of active shield polygons with coordinates relative to the owner's position or clears them if unspecified.
---
#### `void` activeItem.setItemShieldPolys([`List<PolyF>` shieldPolys])
Sets a list of active shield polygons with coordinates relative to the item's hand position or clears them if unspecified.
---
#### `void` activeItem.setForceRegions([`List<PhysicsForceRegion>` forceRegions])
Sets a list of active physics force regions with coordinates relative to the owner's position or clears them if unspecified.
---
#### `void` activeItem.setItemForceRegions([`List<PhysicsForceRegion>` forceRegions])
Sets a list of active physics force regions with coordinates relative to the item's hand position or clears them if unspecified.
---
#### `void` activeItem.setCursor([`String` cursor])
Sets the item's overriding cursor image or clears it if unspecified.
---
#### `void` activeItem.setScriptedAnimationParameter(`String` parameter, `Json` value)
Sets a parameter to be used by the item's scripted animator.
---
#### `void` activeItem.setInventoryIcon(`String` image)
Sets the inventory icon of the item.
---
#### `void` activeItem.setInstanceValue(`String` parameter, `Json` value)
Sets an instance value (parameter) of the item.
---
#### `LuaValue` activeItem.callOtherHandScript(`String` functionName, [`LuaValue` args ...])
Attempts to call the specified function name with the specified argument values in the context of an ActiveItem held in the opposing hand and synchronously returns the result if successful.
---
#### `void` activeItem.interact(`String` interactionType, `Json` config, [`EntityId` sourceEntityId])
Triggers an interact action on the owner as if they had initiated an interaction and the result had returned the specified interaction type and configuration. Can be used to e.g. open GUI windows normally triggered by player interaction with entities.
---
#### `void` activeItem.emote(`String` emote)
Triggers the owner to perform the specified emote.
---
#### `void` activeItem.setCameraFocusEntity([`EntityId` entity])
If the owner is a player, sets that player's camera to be centered on the position of the specified entity, or recenters the camera on the player's position if no entity id is specified.

View File

@ -0,0 +1,43 @@
The activeItemAnimation table contains bindings available to client-side animation scripts for active items.
---
#### `Vec2F` activeItemAnimation.ownerPosition()
Returns the current entity position of the item's owner.
---
#### `Vec2F` activeItemAnimation.ownerAimPosition()
Returns the current world aim position of the item's owner.
---
#### `float` activeItemAnimation.ownerArmAngle()
Returns the current angle of the arm holding the item.
---
#### `int` activeItemAnimation.ownerFacingDirection()
Returns the current facing direction of the item's owner. Will return 1 for right or -1 for left.
---
#### `Vec2F` activeItemAnimation.handPosition([`Vec2F` offset])
Takes an input position (defaults to [0, 0]) relative to the item and returns a position relative to the owner entity.
---
#### `Vec2F` activeItemAnimation.partPoint(`String` partName, `String` propertyName)
Returns a transformation of the specified `Vec2F` parameter configured on the specified animation part, relative to the owner's position.
---
#### `PolyF` activeItemAnimation.partPoly(`String` partName, `String` propertyName)
Returns a transformation of the specified `PolyF` parameter configured on the specified animation part, relative to the owner's position.

View File

@ -0,0 +1,417 @@
# actor mcontroller
The `mcontroller` table sometimes contains functions relating to the actor movement controller.
This section of mcontroller documentation refers to the ActorMovementController lua bindings. There is other documentation referring to the mcontroller table for base MovementControllers.
* monsters
* npcs
* tech
* companion system scripts
* status effects
* quest scripts
* active items
---
#### `RectF` mcontroller.boundBox()
Returns a rect containing the entire collision of the movement controller, in local coordinates.
---
#### `PolyF` mcontroller.collisionPoly()
Returns the collision poly of the movement controller, in local coordinates.
---
#### `PolyF` mcontroller.collisionBody()
Returns the collision poly of the movement controller, in world coordinates.
---
#### `float` mcontroller.mass()
Returns the configured mass of the movement controller.
---
#### `Vec2F` mcontroller.position()
Returns the current position of the movement controller.
---
#### `float` mcontroller.xPosition()
Returns the current horizontal position of the movement controller.
---
#### `float` mcontroller.yPosition()
Returns the current vertical position of the movement controller.
---
#### `Vec2F` mcontroller.velocity()
Returns the current velocity of the movement controller.
---
#### `float` mcontroller.xVelocity()
Returns the current horizontal speed of the movement controller.
---
#### `float` mcontroller.yVelocity()
Returns the current vertical speed of the movement controller.
---
#### `float` mcontroller.rotation()
Returns the current rotation of the movement controller in radians.
---
#### `bool` mcontroller.isColliding()
Returns whether the movement controller is currently colliding with world geometry or a PhysicsMovingCollision.
---
#### `bool` mcontroller.isNullColliding()
Returns whether the movement controller is currently colliding with null world geometry. Null collision occurs in unloaded sectors.
---
#### `bool` mcontroller.isCollisionStuck()
Returns whether the movement controller is currently stuck colliding. Movement controllers can stick if the `stickyCollision` movement parameter is set.
---
#### `float` mcontroller.stickingDirection()
Returns the angle that the movement controller is currently stuck at, in radians.
---
#### `float` mcontroller.liquidPercentage()
Returns the percentage of the collision poly currently submerged in liquid;
---
#### `LiquidId` mcontroller.liquidId()
Returns the liquid ID of the liquid that the movement controller is currently submerged in. If this is several liquids this returns the most plentiful one.
---
#### `bool` mcontroller.onGround()
Returns whether the movement controller is currently on ground.
---
#### `bool` mcontroller.zeroG()
Returns `true` if the movement controller is at a world position without gravity or if gravity has been disabled.
---
#### `bool` mcontroller.atWorldLimit([`bool` bottomOnly])
Returns `true` if the movement controller is touching the bottom or the top (unless bottomOnly is specified) of the world.
---
##### `void` mcontroller.setAnchorState(`EntityId` anchorableEntity, size_t anchorPosition)
Anchors the movement controller to an anchorable entity at the given anchor index.
---
##### `void` mcontroller.resetAnchorState()
Reset the anchor state.
---
##### `EntityId`, `int` mcontroller.anchorState()
Returns ID of anchored entity and index of the anchor position.
---
#### `void` mcontroller.setPosition(`Vec2F` position)
Sets the position of the movement controller.
---
#### `void` mcontroller.setXPosition(`float` x)
Sets the horizontal position of the movement controller.
---
#### `void` mcontroller.setYPosition(`float` y)
Sets the vertical position of the movement controller.
---
#### `void` mcontroller.translate(`Vec2F` direction)
Moves the movement controller by the vector provided.
---
#### `void` mcontroller.setVelocity(`Vec2F` velocity)
Sets the velocity of the movement controller.
---
#### `void` mcontroller.setXVelocity(`Vec2F` xVelocity)
Sets the horizontal velocity of the movement controller.
---
#### `void` mcontroller.setYVelocity(`Vec2F` yVelocity)
Sets the vertical velocity of the movement controller.
---
#### `void` mcontroller.addMomentum(`Vec2F` momentum)
Adds (momentum / mass) velocity to the movement controller.
---
#### `void` mcontroller.setRotation(`float` angle)
Sets the rotation of the movement controller. Angle is in radians.
---
##### `ActorMovementParameters` mcontroller.baseParameters()
Returns the base movement parameters.
---
##### `bool` mcontroller.walking()
Returns whether the actor movement controller is currently walking.
---
##### `bool` mcontroller.running()
Returns whether the actor movement controller is currently running.
---
##### `int` mcontroller.movingDirection()
Returns the direction that the actor movement controller is currently moving in. -1 for left, 1 for right.
---
##### `int` mcontroller.facingDirection()
Returns the facing direction. -1 for left, 1 for right.
---
##### `bool` mcontroller.crouching()
Returns whether the controller is currently crouching.
---
##### `bool` mcontroller.flying()
Returns whether the controller is currently flying.
---
##### `bool` mcontroller.falling()
Returns whether the controller is currently falling.
---
##### `bool` mcontroller.canJump()
Returns whether the controller can currently jump.
---
##### `bool` mcontroller.jumping()
Returns whether the controller is currently jumping.
---
##### `bool` mcontroller.groundMovement()
Returns whether the controller is currently in a ground movement state. Movement controllers can be in ground movement even when onGround returns false.
---
##### `bool` mcontroller.liquidMovement()
Returns whether the controller is currently in liquid movement mode.
---
## controls
The actor movement controller has a set of controls. Controls can be set anywhere and are accumulated and evaluated after all scripts are run. Controls will either override previously set controls, or combine them.
Controls are either cleared before every script update, or can be set to be manually cleared.
---
##### `void` mcontroller.controlRotation(`float` rotation)
Rotates the controller. Each control adds to the previous one.
---
##### `void` mcontroller.controlAcceleration(`Vec2F` acceleration)
Controls acceleration. Each control adds to the previous one.
---
##### `void` mcontroller.controlForce()
Controls force. Each control adds to the previous one.
---
##### `void` mcontroller.controlApproachVelocity(`Vec2F` targetVelocity, `float` maxControlForce)
Approaches the targetVelocity using the force provided. If the current velocity is higher than the provided targetVelocity, the targetVelocity will still be approached, effectively slowing down the entity.
Each control overrides the previous one.
---
#### `void` mcontroller.controlApproachVelocityAlongAngle(`float` angle, `float` targetVelocity, `float` maxControlForce, `bool` positiveOnly = false)
Approaches the targetVelocity but only along the provided angle, not affecting velocity in the perpendicular axis. If positiveOnly, then it will not slow down the movementController if it is already moving faster than targetVelocity.
Each control overrides the previous one.
---
#### `void` mcontroller.controlApproachXVelocity(`float` targetVelocity, `float` maxControlForce)
Approaches an X velocity. Same as using approachVelocityAlongAngle with angle 0.
Each control overrides the previous one.
---
#### `void` mcontroller.controlApproachYVelocity(`float` targetVelocity, `float` maxControlForce)
Approaches a Y velocity. Same as using approachVelocityAlongAngle with angle (Pi / 2).
Each control overrides the previous one.
---
##### `void` mcontroller.controlParameters(`ActorMovementParameters` parameters)
Changes movement parameters. Parameters are merged into the base parameters.
Each control is merged into the previous one.
---
##### `void` mcontroller.controlModifiers(`ActorMovementModifiers` modifiers)
Changes movement modifiers. Modifiers are merged into the base modifiers.
Each control is merged into the previous one.
---
##### `void` mcontroller.controlMove(`float` direction, `bool` run)
Controls movement in a direction.
Each control replaces the previous one.
---
##### `void` mcontroller.controlFace(`float` direction)
Controls the facing direction.
Each control replaces the previous one.
---
##### `void` mcontroller.controlDown()
Controls dropping through platforms.
---
##### `void` mcontroller.controlCrouch()
Controls crouching.
---
##### `void` mcontroller.controlJump()
Controls starting a jump. Only has an effect if canJump is true.
---
##### `void` mcontroller.controlHoldJump()
Keeps holding jump. Will not trigger a new jump, and can be held in the air.
---
##### `void` mcontroller.controlFly(`Vec2F` direction)
Controls flying in the specified direction (or {0, 0} to stop) with the configured flightSpeed parameter.
Each control overrides the previous one.
---
##### `bool` mcontroller.autoClearControls()
Returns whether the controller is currently set to auto clear controls before each script update.
---
##### `void` mcontroller.setAutoClearControls(`bool` enabled)
Set whether to automatically clear controls before each script update.
---
##### `void` mcontroller.clearControls()
Manually clear all controls.

243
doc/lua/animator.md Normal file
View File

@ -0,0 +1,243 @@
# animator
The *animator* table contains functions that relate to an attached networked animator. Networked animators are found in:
* tech
* monsters
* vehicles
* status effects
* active items
---
#### `bool` animator.setAnimationState(`String` stateType, `String` State, `bool` startNew = false)
Sets an animation state. If startNew is true, restart the animation loop if it's already active. Returns whether the state was set.
---
#### `String` animator.animationState(`String` stateType)
Returns the current state for a state type.
---
#### `Json` animator.animationStateProperty(`String` stateType, `String` propertyName)
Returns the value of the specified property for a state type.
---
#### `void` animator.setGlobalTag(`String` tagName, `String` tagValue)
Sets a global animator tag. A global tag replaces any tag <tagName> with the specified tagValue across all animation parts.
---
#### `void` animator.setPartTag(`String` partType, `String` tagName, `String` tagValue)
Sets a local animator tag. A part tag replaces any tag <tagName> with the specified tagValue in the partType animation part only.
---
#### `void` animator.setFlipped(`bool` flipped)
Sets whether the animator should be flipped horizontally.
---
#### `void` animator.setAnimationRate(`float` rate)
Sets the animation rate of the animator.
---
#### `void` animator.rotateGroup(`String` rotationGroup, `float` targetAngle, `bool` immediate)
Rotates a rotation group to the specified angle. If immediate, ignore rotation speed.
*NOTE:* Rotation groups have largely been replaced by transformation groups and should only be used in a context where maintaining a rotation speed is important. When possible use transformation groups.
---
#### `float` animator.currentRotationAngle(`String` rotationGroup)
Returns the current angle for a rotation group.
---
#### `bool` animator.hasTransformationGroup(`String` transformationGroup)
Returns whether the animator contains the specified transformation group.
---
#### `void` animator.translateTransformationGroup(`String` transformationGroup, `Vec2F` translate)
Translates the specified transformation group.
---
#### `void` animator.rotateTransformationGroup(`String` transformationGroup, `float` rotation, [`Vec2F` rotationCenter])
Rotates the specified transformation group by the specified angle in radians, optionally around the specified center point.
---
#### `void` animator.scaleTransformationGroup(`String` transformationGroup, `float` scale, [`Vec2F` scaleCenter])
#### `void` animator.scaleTransformationGroup(`String` transformationGroup, `Vec2F` scale, [`Vec2F` scaleCenter])
Scales the specified transformation group by the specified scale. Optionally scale it from a scaleCenter.
---
#### `void` animator.transformTransformationGroup(`String` transformationGroup, `float` a, `float` b, `float` c, `float` d, `float` tx, `float` ty)
Applies a custom Mat3 transform to the specified transformationGroup. The applied matrix will be:
[a, b, tx,
c, d, ty,
0, 0, 1]
---
#### `void` animator.resetTransformationGroup(`String` transformationGroup)
Resets a transformationGroup to the identity transform.
[1, 0, 0
0, 1, 0,
0, 1, 1]
---
#### `void` animator.setParticleEmitterActive(`String` emitterName, `bool` active)
Sets a particle emitter to be active or inactive.
---
#### `void` animator.setParticleEmitterEmissionRate(`String` emitterName, `float` emissionRate)
Sets the rate at which a particle emitter emits particles while active.
---
#### `void` animator.setParticleEmitterBurstCount(`String` emitterName, `unsigned` burstCount)
Sets the amount of each particle the emitter will emit when using burstParticleEmitter.
---
#### `void` animator.setParticleEmitterOffsetRegion(`String` emitterName, `RectF` offsetRegion)
Sets an offset region for the particle emitter. Any particles spawned will have a randomized offset within the region added to their position.
---
#### `void` animator.burstParticleEmitter(`String` emitterName)
Spawns the entire set of particles `burstCount` times, where `burstCount` can be configured in the animator or set by setParticleEmitterBurstCount.
---
#### `void` animator.setLightActive(`String` lightName, bool active)
Sets a light to be active/inactive.
---
#### `void` animator.setLightPosition(`String` lightName, Vec2F position)
Sets the position of a light.
---
#### `void` animator.setLightColor(`String` lightName, Color color)
Sets the color of a light. Brighter color gives a higher light intensity.
---
#### `void` animator.setLightPointAngle(`String` lightName, float angle)
Sets the angle of a pointLight.
---
#### `bool` animator.hasSound(`String` soundName)
Returns whether the animator has a sound by the name of `soundName`
---
#### `void` animator.setSoundPool(`String` soundName, `List<String>` soundPool)
Sets the list of sound assets to pick from when playing a sound.
---
#### `void` animator.setSoundPosition(`String` soundName, `Vec2F` position)
Sets the position that a sound is played at.
---
#### `void` animator.playSound(`String` soundName, [`int` loops = 0])
Plays a sound. Optionally loop `loops` times. 0 plays the sound once (no loops), -1 loops indefinitely.
---
#### `void` animator.setSoundVolume(`String` soundName, `float` volume, [`float` rampTime = 0.0])
Sets the volume of a sound. Optionally smoothly transition the volume over `rampTime` seconds.
---
#### `void` animator.setSoundPitch(`String` soundName, `float` pitch, [`float` rampTime = 0.0])
Sets the relative pitch of a sound. Optionally smoothly transition the pitch over `rampTime` seconds.
---
#### `void` animator.stopAllSounds(`String` soundName)
Stops all instances of the specified sound.
---
#### `void` animator.setEffectActive(`String` effect, `bool` enabled)
Sets a configured effect to be active/inactive.
---
#### `Vec2F` animator.partPoint(`String` partName, `String` propertyName)
Returns a `Vec2F` configured in a part's properties with all of the part's transformations applied to it.
---
#### `PolyF` animator.partPoly(`String` partName, `String` propertyName)
Returns a `PolyF` configured in a part's properties with all the part's transformations applied to it.
---
#### `Json` animator.partProperty(`String` partName, `String` propertyName)
Returns an animation part property without applying any transformations.
---
#### `Json` animator.transformPoint(`String` partName, `Vec2F` point)
Applies the specified part's transformation on the given point.
---
#### `Json` animator.transformPoly(`String` partName, `PolyF` poly)
Applies the specified part's transformation on the given poly.

238
doc/lua/celestial.md Normal file
View File

@ -0,0 +1,238 @@
# celestial
The *celestial* table contains functions that relate to the client sky, flying the player ship, system positions for planets, system objects, and the celestial database. It is available in the following contexts:
* script pane
---
#### `bool` celestial.skyFlying()
Returns whether the client sky is currently flying.
---
#### `String` celestial.skyFlyingType()
Returns the type of flying the client sky is currently performing.
---
#### `String` celestial.skyWarpPhase()
Returns the current warp phase of the client sky, if warping.
---
#### `float` celestial.skyWarpProgress()
Returns a value between 0 and 1 for how far through warping the sky is currently.
---
#### `bool` celestial.skyInHyperspace()
Returns whether the sky is currently under hyperspace flight.
---
#### `void` celestial.flyShip(`Vec3I` system, `SystemLocation` destination)
Flies the player ship to the specified SystemLocation in the specified system.
SystemLocation is either of the following types: Null, CelestialCoordinate, Object, Vec2F
The locations are specified as a pair of type and value
```
local system = celestial.currentSystem().location
local location = nil -- Null
location = {"coordinate", {location = system, planet = 1, satellite = 0}} -- CelestialCoordinate
location = {"object", "11112222333344445555666677778888"} -- Object (UUID)
location = {0.0, 0.0} -- Vec2F (position in space)
celestial.flyShip(system, location)
```
---
#### `bool` celestial.flying()
Returns whether the player ship is flying
---
#### `Vec2F` celestial.shipSystemPosition()
Returns the current position of the ship in the system.
---
#### `SystemLocation` celestial.shipDestination()
Returns the current destination of the player ship.
---
#### `SystemLocation` celestial.shipLocation()
Returns the current system location of the player ship.
---
#### `CelestialCoordinate` celestial.currentSystem()
Returns the CelestialCoordinate for system the ship is currently in.
---
#### `float` celestial.planetSize(`CelestialCoordinate` planet)
Returns the diameter of the specified planet in system space.
---
#### `Vec2F` celestial.planetPosition(`CelestialCoordinate` planet)
Returns the position of the specified planet in system space.
---
#### `CelestialParameters` celestial.planetParameters(`CelestialCoordinate` planet)
Returns the celestial parameters for the specified planet.
---
#### `VisitableParameters` celestial.visitableParameters(`CelestialCoordinate` planet)
Returns the visitable parameters for the specified visitable planet. For unvisitable planets, returns nil.
---
#### `String` celestial.planetName(`CelestialCoordinate` planet)
Returns the name of the specified planet.
---
#### `uint64_t` celestial.planetSeed(`CelestialCoordinate` planet)
Returns the seed for the specified planet.
---
#### `float` celestial.clusterSize(`CelestialCoordinate` planet)
Returns the diameter of the specified planet and its orbiting moons.
---
#### `List<String>` celestial.planetOres(`CelestialCoordinate` planet)
Returns a list of ores available on the specified planet.
---
#### `Vec2F` celestial.systemPosition(`SystemLocation` location)
Returns the position of the specified location in the *current system*.
---
#### `Vec2F` celestial.orbitPosition(`Orbit` orbit)
Returns the calculated position of the provided orbit.
```
local orbit = {
target = planet, -- the orbit target
direction = 1, -- orbit direction
enterTime = 0, -- time the orbit was entered, universe epoch time
enterPosition = {1, 0} -- the position that the orbit was entered at, relative to the target
}
```
---
#### `List<Uuid>` celestial.systemObjects()
Returns a list of the Uuids for objects in the current system.
---
#### `String` celestial.objectType(`Uuid` uuid)
Returns the type of the specified object.
---
#### `Json` celestial.objectParameters(`Uuid` uuid)
Returns the parameters for the specified object.
---
#### `WorldId` celestial.objectWarpActionWorld(`Uuid` uuid)
Returns the warp action world ID for the specified object.
---
#### `Json` celestial.objectOrbit(`Uuid` uuid)
Returns the orbit of the specified object, if any.
---
#### `Maybe<Vec2F>` celestial.objectPosition(`Uuid` uuid)
Returns the position of the specified object, if any.
---
#### `Json` celestial.objectTypeConfig(`String` typeName)
Returns the configuration of the specified object type.
---
#### `Uuid` celestial.systemSpawnObject(`String` typeName, [`Vec2F` position], [`Uuid` uuid], [`Json` parameters])
Spawns an object of typeName at position. Optionally with the specified UUID and parameters.
If no position is specified, one is automatically chosen in a spawnable range.
Objects are limited to be spawned outside a distance of `/systemworld.config:clientSpawnObjectPadding` from any planet surface (including moons), star surface, planetary orbit (including moons), or permanent objects orbits, and at most within `clientSpawnObjectPadding` from the outermost orbit.
---
#### `List<Uuid>` celestial.playerShips()
Returns a list of the player ships in the current system.
---
#### `playerShipPosition` celestial.playerShipPosition(`Uuid` uuid)
Returns the position of the specified player ship.
---
#### `Maybe<bool>` celestial.hasChildren(`CelestialCoordinate` coordinate)
Returns definitively whether the coordinate has orbiting children. `nil` return means the coordinate is not loaded.
---
#### `List<CelestialCoordinate>` celestial.children(`CelestialCoordinate` coordinate)
Returns the children for the specified celestial coordinate. For systems, return planets, for planets, return moons.
---
#### `List<int>` celestial.childOrbits(`CelestialCoordinate` coordinate)
Returns the child orbits for the specified celestial coordinate.
---
#### `List<CelestialCoordinate>` celestial.scanSystems(`RectI` region, [`Set<String>` includedTypes])
Returns a list of systems in the given region. If includedTypes is specified, this will return only systems whose typeName parameter is included in the set. This scans for systems asynchronously, meaning it may not return all systems if they have not been generated or sent to the client. Use `scanRegionFullyLoaded` to see if this is the case.
---
#### `List<pair<Vec2I, Vec2I>>` celestial.scanConstellationLines(`RectI` region)
Returns the constellation lines for the specified universe region.
---
#### `bool` celestial.scanRegionFullyLoaded(`RectI` region)
Returns whether the specified universe region has been fully loaded.
---
#### `List<pair<String, float>>` celestial.centralBodyImages(`CelestialCoordinate` system)
Returns the images with scales for the central body (star) for the specified system coordinate.
---
#### `List<pair<String, float>>` celestial.planetaryObjectImages(`CelestialCoordinate` coordinate)
Returns the smallImages with scales for the specified planet or moon.
---
#### `List<pair<String, float>>` celestial.worldImages(`CelestialCoordinate` coordinate)
Returns the generated world images with scales for the specified planet or moon.
---
#### `List<pair<String, float>>` celestial.starImages(`CelestialCoordinate` system, `float` twinkleTime)
Returns the star image for the specified system. Requires a twinkle time to provide the correct image frame.

View File

@ -0,0 +1,7 @@
The command processor has a single binding for performing admin checks, available on the *CommandProcessor* table.
---
#### `String` CommandProcessor.adminCheck(`ConnectionId` connectionId, `String` actionDescription)
Checks whether the specified connection id is authorized to perform admin actions and returns `nil` if authorization is succesful. If unauthorized, returns a `String` error message to display to the client requesting the action, which may include the specified action description, such as "Insufficient privileges to do the time warp again."

9
doc/lua/config.md Normal file
View File

@ -0,0 +1,9 @@
# config
The `config` lua bindings relate to anything that has a configuration and needs to access configuration parameters.
---
#### `Json` config.getParameter(`String` parameter, `Json` default)
Returns the value for the specified config parameter. If there is no value set, returns the default.

19
doc/lua/containerpane.md Normal file
View File

@ -0,0 +1,19 @@
These pane bindings are available to container interface panes and include functions not specifically related to widgets within the pane.
---
#### `EntityId` pane.containerEntityId()
Returns the entity id of the container that this pane is connected to.
---
#### `EntityId` pane.playerEntityId()
Returns the entity id of the player that opened this pane.
---
#### `void` pane.dismiss()
Closes the pane.

69
doc/lua/entity.md Normal file
View File

@ -0,0 +1,69 @@
# entity
The *entity* table contains functions that are common among all entities. Every function refers to the entity the script context is running on.
Accessible in:
* companion system scripts
* quests
* tech
* primary status script
* status effects
* monsters
* npcs
* objects
* active items
---
#### `EntityId` entity.id()
Returns the id number of the entity.
---
#### `LuaTable` entity.damageTeam()
Returns a table of the entity's damage team type and team number. Ex: {type = "enemy", team = 0}
---
#### `bool` entity.isValidTarget(`EntityId` entityId)
Returns whether the provided entity is a valid target of the current entity. An entity is a valid target if they can be damaged, and in the case of monsters and NPCs if they are aggressive.
---
#### `Vec2F` entity.distanceToEntity(`EntityId` entityId)
Returns the vector distance from the current entity to the provided entity.
---
#### `bool` entity.entityInSight(`EntityId` entityId)
Returns whether the provided entity is in line of sight of the current entity.
---
#### `Vec2F` entity.position()
Returns the position of the current entity.
---
#### `String` entity.entityType()
Returns the type of the current entity.
---
#### `String` entity.uniqueId()
Returns the unique ID of the entity. Returns nil if there is no unique ID.
---
#### `bool` entity.persistent()
Returns `true` if the entity is persistent (will be saved to disk on sector unload) or `false` otherwise.

159
doc/lua/item.md Normal file
View File

@ -0,0 +1,159 @@
# item
The `item` table is available in all scripted items and contains functions relating to the item itself.
---
#### `String` item.name()
Returns the name of the item.
---
#### `size_t` item.count()
Returns the stack count of the item.
---
#### `size_t` item.setCount(`size_t` count)
Sets the item count. Returns any overflow.
---
#### `size_t` item.maxStack()
Returns the max number of this item that will fit in a stack.
---
#### `bool` item.matches(`ItemDescriptor` desc, [`bool` exactMatch])
Returns whether the item matches the specified item. If exactMatch is `true` then both the items' names and parameters are compared, otherwise only the items' names.
---
#### `bool` item.consume(`size_t` count)
Consumes items from the stack. Returns whether the full count was successfuly consumed.
---
#### `bool` item.empty()
Returns whether the item stack is empty.
---
#### `ItemDescriptor` item.descriptor()
Returns an item descriptor for the item.
---
#### `String` item.description()
Returns the description for the item.
---
#### `String` item.friendlyName()
Returns the short description for the item.
---
#### `int` item.rarity()
Returns the rarity for the item.
* 0 = common
* 1 = uncommon
* 2 = rare
* 3 = legendary
* 4 = essential
---
#### `String` item.rarityString()
Returns the rarity as a string.
---
#### `size_t` item.price()
Returns the item price.
---
#### `unsigned` item.fuelAmount()
Returns the item fuel amount.
---
#### `Json` item.iconDrawables()
Returns a list of the item's icon drawables.
---
#### `Json` item.dropDrawables()
Returns a list of the item's itemdrop drawables.
---
#### `String` item.largeImage()
Returns the item's configured large image, if any.
---
#### `String` item.tooltipKind()
Returns the item's tooltip kind.
---
#### `String` item.category()
Returns the item's category
---
#### `String` item.pickupSound()
Returns the item's pickup sound.
---
#### `bool` item.twoHanded()
Returns whether the item is two handed.
---
#### `float` item.timeToLive()
Returns the items's time to live.
---
#### `Json` item.learnBlueprintsOnPickup()
Returns a list of the blueprints learned on picking up this item.
---
#### `bool` item.hasItemTag(`String` itemTag)
Returns whether the set of item tags for this item contains the specified tag.
---
#### `Json` item.pickupQuestTemplates()
Returns a list of quests acquired on picking up this item.

68
doc/lua/localanimator.md Normal file
View File

@ -0,0 +1,68 @@
The *localAnimator* table provides bindings used by client side animation scripts (e.g. on objects and active items) to set drawables/lights and perform rendering actions.
---
#### `void` localAnimator.playAudio(`String` sound, [`int` loops], [`float` volume])
Immediately plays the specified sound, optionally with the specified loop count and volume.
---
#### `void` localAnimator.spawnParticle(`Json` particleConfig, `Vec2F` position)
Immediately spawns a particle with the specified name or configuration at the specified position.
---
#### `void` localAnimator.addDrawable(`Drawable` drawable, [`String` renderLayer])
Adds the specified drawable to the animator's list of drawables to be rendered. If a render layer is specified, this drawable will be drawn on that layer instead of the parent entity's render layer. Drawables set in this way are retained between script ticks and must be cleared manually using localAnimator.clearDrawables().
The drawable object must specify exactly one of the following keys to define its type:
* [`pair<Vec2F, Vec2F>` __line__] - Defines this drawable as a line between the specified two points.
* [`List<Vec2F>` __poly__] - Defines the drawable as a polygon composed of the specified points.
* [`String` __image__] - Defines the drawable as an image with the specified asset path.
The following additional keys may be specified for any drawable type:
* [`Vec2F` __position__] - Relative position of the drawable.
* [`Color` __color__] - Color for the drawable. Defaults to white.
* [`bool` __fullbright__] - Specifies whether the drawable is fullbright (ignores world lighting).
The following additional key may be specified for line drawables:
* [`float` __width__] - Specifies the width of the line to be rendered.
The following transformation options may be specified for image drawables. Note that if a __transformation__ is specified, it will be used instead of other specific transformation operations.
* [`Mat3F` __transformation__]
* [`bool` __centered__]
* [`float` __rotation__]
* [`bool` __mirrored__]
* [`float` __scale__]
---
#### `void` localAnimator.clearDrawables()
Clears the list of drawables to be rendered.
---
#### `void` localAnimator.addLightSource(`Json` lightSource)
Adds the specified light source to the animator's list of light sources to be rendered. Light sources set in this way are retained between script ticks and must be cleared manually using localAnimator.clearLightSources(). The configuration object for the light source accepts the following keys:
* `Vec2F` __position__
* `Color` __color__
* [`bool` __pointLight__]
* [`float` __pointBeam__]
* [`float` __beamAngle__]
* [`float` __beamAmbience__]
---
#### `void` localAnimator.clearLightSources()
Clears the list of light sources to be rendered.

21
doc/lua/message.md Normal file
View File

@ -0,0 +1,21 @@
The message table contains a single function, setHandler, which allows entities to receive messages sent using world.sendEntityMessage. Entities which can receive messages include:
* monster
* NPC
* object
* vehicle
* stagehand
* projectile
Additionally, messages can be handled by a variety of script contexts that run on the player:
* activeitem
* quest
* playercompanions
* status
---
#### `void` message.setHandler(`String` messageName, `LuaFunction` handler)
Messages of the specified message type received by this script context will call the specified function. The first two arguments passed to the handler function will be the `String` messageName and a `bool` indicating whether the message is from a local entity, followed by any arguments sent with the message.

172
doc/lua/monster.md Normal file
View File

@ -0,0 +1,172 @@
The monster table contains bindings specific to monsters which are available in addition to their common tables.
---
#### `String` monster.type()
Returns the monster's configured monster type.
---
#### `String` monster.seed()
Returns a string representation of the monster's random seed.
---
#### `Json` monster.uniqueParameters()
Returns a table of the monster's unique (override) parameters.
---
#### `unsigned` monster.familyIndex()
Returns the monster's family index.
---
#### `float` monster.level()
Returns the monster's level.
---
#### `void` monster.setDamageOnTouch(`bool` enabled)
Enables or disables the monster's touch damage.
---
#### `void` monster.setDamageSources([`List<DamageSource>` damageSources])
Sets the monster's active damage sources (or clears them if unspecified).
---
#### `void` monster.setDamageParts(`StringSet` damageParts)
Sets the monster's active damage parts. Damage parts must be defined in the monster's configuration parameters. A damage part specifies a damage source and an animation part to anchor the damage source to. The anchor part's transformation will be applied to the damage source's damage poly, and if a vector, the damage source's knockback.
```js
"animationDamageParts" : {
"beam" : {
"anchorPart" : "partName", // animation part to anchor the damage source to
"checkLineCollision" : false, // optional, if the damage source is a line, check for collision along the line
"bounces" : 0, // optional, if the damage source is a line and it checks for collision
"damageSource" : {
"line" : [ [0.0, 0.0], [5.0, 0.0] ],
"damage" : 10,
"damageSourceKind" : "default",
"teamType" : "enemy",
"teamNumber" : 2
}
}
}
```
```lua
monster.setDamageParts({"beam"}) -- sets the "beam" damage part active
```
---
#### `void` monster.setAggressive(`bool` aggressive)
Sets whether the monster is currently aggressive.
---
#### `void` monster.setDropPool(`Json` dropPool)
Sets the monster's drop pool, which determines the items that it will drop on death. This can be specified as the `String` name of a treasure pool, or as a `Map<String, String>` to specify different drop pools for different damage types. If specified as a map, the pool should contain a "default" entry for unhandled damage types.
---
#### `Vec2F` monster.toAbsolutePosition(`Vec2F` relativePosition)
Returns an absolute world position calculated from the given relative position.
---
#### `Vec2F` monster.mouthPosition()
Returns the world position of the monster's mouth.
---
#### `void` monster.flyTo(`Vec2F` position)
Causes the monster to controlFly toward the given world position.
---
#### `void` monster.setDeathParticleBurst([`String` particleEmitter)
Sets the name of the particle emitter (configured in the animation) to burst when the monster dies, or clears it if unspecified.
---
#### `void` monster.setDeathSound([`String` sound])
Sets the name of the sound (configured in the animation) to play when the monster dies, or clears it if unspecified.
---
#### `void` monster.setPhysicsForces(`List<PhysicsForceRegion>` forceRegions)
Sets a list of physics force regions that the monster will project, used for applying forces to other nearby entities. Set an empty list to clear the force regions.
---
#### `void` monster.setName(`String` name)
Sets the monster's name.
---
#### `void` monster.setDisplayNametag(`bool` enabled)
Sets whether the monster should display its nametag.
---
#### `bool` monster.say(`String` line, [`Map<String, String>` tags])
Causes the monster to say the line, optionally replacing any specified tags in the text. Returns `true` if anything is said (i.e. the line is not empty) and `false` otherwise.
---
#### `bool` monster.sayPortrait(`String` line, `String` portrait, [`Map<String, String>` tags])
Similar to monster.say, but uses a portrait chat bubble with the specified portrait image.
---
#### `void` monster.setDamageTeam(`DamageTeam` team)
Sets the monster's current damage team type and number.
---
#### `void` monster.setUniqueId([`String` uniqueId])
Sets the monster's unique entity id, or clears it if unspecified.
---
#### `void` monster.setDamageBar(`String` damageBarType)
Sets the type of damage bar that the monster should display. Valid options are "default", "none" and "special".
---
#### `void` monster.setInteractive(`bool` interactive)
Sets whether the monster is currently interactive.
---
#### `void` monster.setAnimationParameter(`String` key, `Json` value)
Sets a networked scripted animator parameter to be used in a client side rendering script using animationConfig.getParameter.

View File

@ -0,0 +1,248 @@
# mcontroller
The `mcontroller` table contains functions relating to the movement controller.
This section of mcontroller documentation refers to the MovementController lua bindings. Other documentation may refer to ActorMovementController lua bindings. MovementController is used in:
* projectiles
* vehicles
---
#### `MovementParameters` mcontroller.parameters()
Returns a table containing the movement parameters for the movement controller.
---
#### `void` mcontroller.applyParameters(`Json` parameters)
Applies the given parameters to the movement controller. The provided parameters are merged into the current movement parameters.
---
#### `void` mcontroller.resetParameters()
Resets movement parameters to their original state.
---
#### `float` mcontroller.mass()
Returns the configured mass of the movement controller.
---
#### `Vec2F` mcontroller.position()
Returns the current position of the movement controller.
---
#### `float` mcontroller.xPosition()
Returns the current horizontal position of the movement controller.
---
#### `float` mcontroller.yPosition()
Returns the current vertical position of the movement controller.
---
#### `Vec2F` mcontroller.velocity()
Returns the current velocity of the movement controller.
---
#### `float` mcontroller.xVelocity()
Returns the current horizontal speed of the movement controller.
---
#### `float` mcontroller.yVelocity()
Returns the current vertical speed of the movement controller.
---
#### `float` mcontroller.rotation()
Returns the current rotation of the movement controller in radians.
---
#### `PolyF` mcontroller.collisionPoly()
Returns the collision poly of the movement controller, in local coordinates.
---
#### `PolyF` mcontroller.collisionBody()
Returns the collision poly of the movement controller, in world coordinates.
---
#### `RectF` mcontroller.collisionBoundBox()
Returns a rect containing the entire collision poly of the movement controller, in world coordinates.
---
#### `RectF` mcontroller.localBoundBox()
Returns a rect containing the entire collision of the movement controller, in local coordinates.
---
#### `bool` mcontroller.isColliding()
Returns whether the movement controller is currently colliding with world geometry or a PhysicsMovingCollision.
---
#### `bool` mcontroller.isNullColliding()
Returns whether the movement controller is currently colliding with null world geometry. Null collision occurs in unloaded sectors.
---
#### `bool` mcontroller.isCollisionStuck()
Returns whether the movement controller is currently stuck colliding. Movement controllers can stick if the `stickyCollision` movement parameter is set.
---
#### `float` mcontroller.stickingDirection()
Returns the angle that the movement controller is currently stuck at, in radians.
---
#### `float` mcontroller.liquidPercentage()
Returns the percentage of the collision poly currently submerged in liquid;
---
#### `LiquidId` mcontroller.liquidId()
Returns the liquid ID of the liquid that the movement controller is currently submerged in. If this is several liquids this returns the most plentiful one.
---
#### `bool` mcontroller.onGround()
Returns whether the movement controller is currently on ground.
---
#### `bool` mcontroller.zeroG()
Returns `true` if the movement controller is at a world position without gravity or if gravity has been disabled.
---
#### `bool` mcontroller.atWorldLimit([`bool` bottomOnly])
Returns `true` if the movement controller is touching the bottom or the top (unless bottomOnly is specified) of the world.
---
#### `void` mcontroller.setPosition(`Vec2F` position)
Sets the position of the movement controller.
---
#### `void` mcontroller.setXPosition(`float` x)
Sets the horizontal position of the movement controller.
---
#### `void` mcontroller.setYPosition(`float` y)
Sets the vertical position of the movement controller.
---
#### `void` mcontroller.translate(`Vec2F` direction)
Moves the movement controller by the vector provided.
---
#### `void` mcontroller.setVelocity(`Vec2F` velocity)
Sets the velocity of the movement controller.
---
#### `void` mcontroller.setXVelocity(`Vec2F` xVelocity)
Sets the horizontal velocity of the movement controller.
---
#### `void` mcontroller.setYVelocity(`Vec2F` yVelocity)
Sets the vertical velocity of the movement controller.
---
#### `void` mcontroller.addMomentum(`Vec2F` momentum)
Adds (momentum / mass) velocity to the movement controller.
---
#### `void` mcontroller.setRotation(`float` angle)
Sets the rotation of the movement controller. Angle is in radians.
---
#### `void` mcontroller.rotate(`float` angle)
Rotates the movement controller by an angle relative to its current angle. Angle is in radians.
---
#### `void` mcontroller.accelerate(`Vec2F` acceleration)
Accelerates the movement controller by the given acceleration for one tick.
---
#### `void` mcontroller.force(`Vec2F` force)
Accelerates the movement controller by (force / mass) for one tick.
---
#### `void` mcontroller.approachVelocity(`Vec2F` targetVelocity, `float` maxControlForce)
Approaches the targetVelocity using the force provided. If the current velocity is higher than the provided targetVelocity, the targetVelocity will still be approached, effectively slowing down the entity.
---
#### `void` mcontroller.approachVelocityAlongAngle(`float` angle, `float` targetVelocity, `float` maxControlForce, `bool` positiveOnly = false)
Approaches the targetVelocity but only along the provided angle, not affecting velocity in the perpendicular axis. If positiveOnly, then it will not slow down the movementController if it is already moving faster than targetVelocity.
---
#### `void` mcontroller.approachXVelocity(`float` targetVelocity, `float` maxControlForce)
Approaches an X velocity. Same as using approachVelocityAlongAngle with angle 0.
---
#### `void` mcontroller.approachYVelocity(`float` targetVelocity, `float` maxControlForce)
Approaches a Y velocity. Same as using approachVelocityAlongAngle with angle (Pi / 2).

283
doc/lua/npc.md Normal file
View File

@ -0,0 +1,283 @@
# npc
The `npc` table is for functions relating directly to the current npc. It is available only in NPC scripts.
---
#### `Vec2F` npc.toAbsolutePosition(`Vec2F` offset)
Returns the specified local position in world space.
---
#### `String` npc.species()
Returns the species of the npc.
---
#### `String` npc.gender()
Returns the gender of the npc
---
#### `Json` npc.humanoidIdentity()
Returns the specific humanoid identity of the npc, containing information such as hair style and idle pose.
---
#### `String` npc.npcType()
Returns the npc type of the npc.
---
#### `uint64_t` npc.seed()
Returns the seed used to generate this npc.
---
#### `float` npc.level()
Returns the level of the npc.
---
#### `List<String>` npc.dropPools()
Returns the list of treasure pools that will spawn when the npc dies.
---
#### `void` npc.setDropPools(`List<String>` pools)
Sets the list of treasure pools that will spawn when the npc dies.
---
#### `float` npc.energy()
Returns the current energy of the npc. Same as `status.resource("energy")`
---
#### `float` npc.maxEnergy()
Returns the current energy of the npc. Same as `status.maxResource("energy")`
---
#### `bool` npc.say(`String` line, [`Map<String,String>` tags], [`Json` config])
Makes the npc say a string. Optionally pass in tags to replace text tags. Optionally give config options for the chat message.
Returns whether the chat message was successfully added.
Available options:
```
{
drawBorder = true,
fontSize = 8,
color = {255, 255, 255},
sound = "/sfx/humanoid/avian_chatter_male1.ogg"
}
```
---
#### `bool` npc.sayPortrait(`String` line, `String` portrait, [`Map<String,String>` tags], [`Json` config])
Makes the npc say a line, with a portrait chat bubble. Optionally pass in tags to replace text tags. Optionally give config options for the chat message.
Returns whether the chat message was successfully added.
Available options:
```
{
drawMoreIndicator = true,
sound = "/sfx/humanoid/avian_chatter_male1.ogg"
}
```
---
#### `void` npc.emote(`String` emote)
Makes the npc show a facial emote.
---
#### `void` npc.dance(`String` dance)
Sets the current dance for the npc. Dances are defined in .dance files.
---
#### `void` npc.setInteractive(`bool` interactive)
Sets whether the npc should be interactive.
---
#### `bool` npc.setLounging(`EntityId` loungeable, [`size_t` anchorIndex])
Sets the npc to lounge in a loungeable. Optionally specify which anchor (seat) to use.
Returns whether the npc successfully lounged.
---
#### `void` npc.resetLounging()
Makes the npc stop lounging.
---
#### `bool` npc.isLounging()
Returns whether the npc is currently lounging.
---
#### `Maybe<EntityId>` npc.loungingIn()
Returns the EntityId of the loungeable the NPC is currently lounging in. Returns nil if not lounging.
---
#### `void` npc.setOfferedQuests(`JsonArray` quests)
Sets the list of quests the NPC will offer.
---
#### `void` npc.setTurnInQuests(`JsonArray` quests)
Sets the list of quests the played can turn in at this npc.
---
#### `bool` npc.setItemSlot(`String` slot, `ItemDescriptor` item)
Sets the specified item slot to contain the specified item.
Possible equipment items slots:
* head
* headCosmetic
* chest
* chestCosmetic
* legs
* legsCosmetic
* back
* backCosmetic
* primary
* alt
---
#### `ItemDescriptor` npc.getItemSlot(`String` slot)
Returns the item currently in the specified item slot.
---
#### `void` npc.disableWornArmor(`bool` disable)
Set whether the npc should not gain status effects from the equipped armor. Armor will still be visually equipped.
---
#### `void` npc.beginPrimaryFire()
Toggles `on` firing the item equipped in the `primary` item slot.
---
#### `void` npc.beginAltFire()
Toggles `on` firing the item equipped in the `alt` item slot.
---
#### `void` npc.endPrimaryFire()
Toggles `off` firing the item equipped in the `primary` item slot.
---
#### `void` npc.endAltFire()
Toggles `off` firing the item equipped in the `alt` item slot.
---
#### `void` npc.setShifting(`bool` shifting)
Sets whether tools should be used as though shift is held.
---
#### `void` npc.setDamageOnTouch(`bool` enabled)
Sets whether damage on touch should be enabled.
---
#### `Vec2F` npc.aimPosition()
Returns the current aim position in world space.
---
#### `void` npc.setAimPosition(`Vec2F` position)
Sets the aim position in world space.
---
#### `void` npc.setDeathParticleBurst(`String` emitter)
Sets a particle emitter to burst when the npc dies.
---
#### `void` npc.setStatusText(`String` status)
Sets the text to appear above the npc when it first appears on screen.
---
#### `void` npc.setDisplayNametag(`bool` display)
Sets whether the nametag should be displayed above the NPC.
---
#### `void` npc.setPersistent(`bool` persistent)
Sets whether this npc should persist after being unloaded.
---
#### `void` npc.setKeepAlive(`bool` keepAlive)
Sets whether to keep this npc alive. If true, the npc will never be unloaded as long as the world is loaded.
---
#### `void` npc.setDamageTeam(`Json` damageTeam)
Sets a damage team for the npc in the format: `{type = "enemy", team = 2}`
---
#### `void` npc.setAggressive(`bool` aggressive)
Sets whether the npc should be flagged as aggressive.
---
#### `void` npc.setUniqueId(`String` uniqueId)
Sets a unique ID for this npc that can be used to access it. A unique ID has to be unique for the world the npc is on, but not universally unique.

229
doc/lua/object.md Normal file
View File

@ -0,0 +1,229 @@
The object table contains bindings specific to objects which are available in addition to their common tables.
---
#### `String` object.name()
Returns the object's type name.
---
#### `int` object.direction()
Returns the object's facing direction. This will be 1 for right or -1 for left.
---
#### `Vec2F` object.position()
Returns the object's tile position. This is identical to entity.position(), so use that instead.
---
#### `void` object.setInteractive(`bool` interactive)
Sets whether the object is currently interactive.
---
#### `String` object.uniqueId()
Returns the object's unique entity id, or `nil` if no unique id is set. This should be identical to entity.uniqueId(), so use that instead.
---
#### `void` object.setUniqueId([`String` uniqueId])
Sets the objects unique entity id, or clears it if unspecified.
---
#### `RectF` object.boundBox()
Returns the object's metaBoundBox in world space.
---
#### `List<Vec2I>` object.spaces()
Returns a list of the tile spaces that the object occupies.
---
#### `void` object.setProcessingDirectives(`String` directives)
Sets the image processing directives that should be applied to the object's animation.
---
#### `void` object.setSoundEffectEnabled(`bool` enabled)
Enables or disables the object's persistent sound effect, if one is configured.
---
#### `void` object.smash([`bool` smash])
Breaks the object. If smash is `true` then it will be smashed, causing it to (by default) drop no items.
---
#### `float` object.level()
Returns the "level" parameter if set, otherwise returns the current world's threat level.
---
#### `Vec2F` object.toAbsolutePosition(`Vec2F` relativePosition)
Returns an absolute world position calculated from the given relative position.
---
#### `bool` object.say(`String` line, [`Map<String, String>` tags], [`Json` config])
Causes the object to say the line, optionally replacing any specified tags in the text, and using the provided additional chat configuration. Returns `true` if anything is said (i.e. the line is not empty) and `false` otherwise.
---
#### `bool` object.sayPortrait(`String` line, `String` portrait, [`Map<String, String>` tags], [`Json` config])
Similar to object.say, but uses a portrait chat bubble with the specified portrait image.
---
#### `bool` object.isTouching(`EntityId` entityId)
Returns `true` if the specified entity's collision area overlaps the object's bound box and `false` otherwise.
---
#### `void` object.setLightColor(`Color` color)
Sets the color of light for the object to emit. This is not the same as animator.setLightColor and the animator light configuration should be used for more featureful light sources.
---
#### `Color` object.getLightColor()
Returns the object's currently configured light color.
---
#### `unsigned` object.inputNodeCount()
Returns the number of wire input nodes the object has.
---
#### `unsigned` object.outputNodeCount()
Returns the number of wire output nodes the object has.
---
#### `Vec2I` object.getInputNodePosition(`unsigned` nodeIndex)
Returns the relative position of the specified wire input node.
---
#### `Vec2I` object.getOutputNodePosition(`unsigned` nodeIndex)
Returns the relative position of the specified wire output node.
---
#### `bool` object.getInputNodeLevel(`unsigned` nodeIndex)
Returns the current level of the specified wire input node.
---
#### `bool` object.getOutputNodeLevel(`unsigned` nodeIndex)
Returns the current level of the specified wire output node.
---
#### `bool` object.isInputNodeConnected(`unsigned` nodeIndex)
Returns `true` if any wires are currently connected to the specified wire input node and `false` otherwise.
---
#### `bool` object.isOutputNodeConnected(`unsigned` nodeIndex)
Returns `true` if any wires are currently connected to the specified wire output node and `false` otherwise
---
#### `Map<EntityId, unsigned>` object.getInputNodeIds(`unsigned` nodeIndex)
Returns a map of the entity id of each wire entity connected to the given wire input node and the index of that entity's output node to which the input node is connected.
---
#### `Map<EntityId, unsigned>` object.getOutputNodeIds(`unsigned` nodeIndex)
Returns a map of the entity id of each wire entity connected to the given wire output node and the index of that entity's input node to which the output node is connected.
---
#### `void` object.setOutputNodeLevel(`unsigned` nodeIndex, `bool` level)
Sets the level of the specified wire output node.
---
#### `void` object.setAllOutputNodes(`bool` level)
Sets the level of all wire output nodes.
---
#### `void` object.setOfferedQuests([`JsonArray` quests])
Sets the list of quests that the object will offer to start, or clears them if unspecified.
---
#### `void` object.setTurnInQuests([`JsonArray` quests])
Sets the list of quests that the object will accept turn-in for, or clears them if unspecified.
---
#### `void` object.setConfigParameter(`String` key, `Json` value)
Sets the specified override configuration parameter for the object.
---
#### `void` object.setAnimationParameter(`String` key, `Json` value)
Sets the specified animation parameter for the object's scripted animator.
---
#### `void` object.setMaterialSpaces([`JsonArray` spaces])
Sets the object's material spaces to the specified list, or clears them if unspecified. List entries should be in the form of `pair<Vec2I, String>` specifying the relative position and material name of materials to be set. __Objects should only set material spaces within their occupied tile spaces to prevent Bad Things TM from happening.__
---
#### `void` object.setDamageSources([`List<DamageSource>` damageSources])
Sets the object's active damage sources (or clears them if unspecified).
---
#### `float` object.health()
Returns the object's current health.
---
#### `void` object.setHealth(`float` health)
Sets the object's current health.

19
doc/lua/objectanimator.md Normal file
View File

@ -0,0 +1,19 @@
The objectAnimator table contains bindings available to client-side animation scripts for objects.
---
#### `Json` objectAnimator.getParameter(`String` parameter, `Json` default)
Returns the value for the specified object parameter. If there is no value set, returns the default.
---
#### `int` objectAnimator.direction()
Returns the object's facing direction. This will be 1 for right or -1 for left.
---
#### `Vec2F` objectAnimator.position()
Returns the object's tile position.

19
doc/lua/physics.md Normal file
View File

@ -0,0 +1,19 @@
The physics table is available to objects and used to control any collisions or force regions configured on those objects.
---
#### `void` physics.setForceEnabled(`String` force, `bool` enabled)
Enables or disables the specified physics force region.
---
#### `void` physics.setCollisionPosition(`String` collision, `Vec2F` position)
Moves the specified physics collision region to the specified position.
---
#### `void` physics.setCollisionEnabled(`String` collision, `bool` enabled)
Enables or disables the specified physics collision region.

529
doc/lua/player.md Normal file
View File

@ -0,0 +1,529 @@
The player table contains functions with privileged access to the player which run in a few contexts on the client such as scripted interface panes, quests, and player companions.
---
#### `EntityId` player.id()
Returns the player's entity id.
---
#### `String` player.uniqueId()
Returns the player's unique id.
---
#### `String` player.species()
Returns the player's species.
---
#### `String` player.gender()
Returns the player's gender.
---
#### `String` player.isAdmin()
Returns whether the player is admin.
---
#### `Json` player.getProperty(`String` name, `Json` default)
Returns the value assigned to the specified generic player property. If there is no value set, returns default.
---
#### `void` player.setProperty(`String` name, `Json` value)
Sets a generic player property to the specified value.
---
#### `void` player.addScannedObject(`String` name)
Adds the specified object to the player's scanned objects.
---
#### `void` player.removeScannedObject(`String` name)
Removes the specified object from the player's scanned objects.
---
#### `void` player.interact(`String` interactionType, `Json` config, [`EntityId` sourceEntityId])
Triggers an interact action on the player as if they had initiated an interaction and the result had returned the specified interaction type and configuration. Can be used to e.g. open GUI windows normally triggered by player interaction with entities.
---
#### `Json` player.shipUpgrades()
Returns a JSON object containing information about the player's current ship upgrades including "shipLevel", "maxFuel", "crewSize" and a list of "capabilities".
---
#### `void` player.upgradeShip(`Json` shipUpgrades)
Applies the specified ship upgrades to the player's ship.
---
#### `void` player.setUniverseFlag(`String` flagName)
Sets the specified universe flag on the player's current universe.
---
#### `void` player.giveBlueprint(`ItemDecriptor` item)
Teaches the player any recipes which can be used to craft the specified item.
---
#### `void` player.blueprintKnown(`ItemDecriptor` item)
Returns `true` if the player knows one or more recipes to create the specified item and `false` otherwise.
---
#### `void` player.makeTechAvailable(`String` tech)
Adds the specified tech to the player's list of available (unlockable) techs.
---
#### `void` player.makeTechUnavailable(`String` tech)
Removes the specified tech from player's list of available (unlockable) techs.
---
#### `void` player.enableTech(`String` tech)
Unlocks the specified tech, allowing it to be equipped through the tech GUI.
---
#### `void` player.equipTech(`String` tech)
Equips the specified tech.
---
#### `void` player.unequipTech(`String` tech)
Unequips the specified tech.
---
#### `JsonArray` player.availableTechs()
Returns a list of the techs currently available to the player.
---
#### `JsonArray` player.enabledTechs()
Returns a list of the techs currently unlocked by the player.
---
#### `String` player.equippedTech(`String` slot)
Returns the name of the tech the player has currently equipped in the specified slot, or `nil` if no tech is equipped in that slot.
---
#### `unsigned` player.currency(`String` currencyName)
Returns the player's current total reserves of the specified currency.
---
#### `void` player.addCurrency(`String` currencyName, `unsigned` amount)
Increases the player's reserve of the specified currency by the specified amount.
---
#### `bool` player.consumeCurrency(`String` currencyName, `unsigned` amount)
Attempts to consume the specified amount of the specified currency and returns `true` if successful and `false` otherwise.
---
#### `void` player.cleanupItems()
Triggers an immediate cleanup of the player's inventory, removing item stacks with 0 quantity. May rarely be required in special cases of making several sequential modifications to the player's inventory within a single tick.
---
#### `void` player.giveItem(`ItemDescriptor` item)
Adds the specified item to the player's inventory.
---
#### `bool` player.hasItem(`ItemDescriptor` item, [`bool` exactMatch])
Returns `true` if the player's inventory contains an item matching the specified descriptor and `false` otherwise. If exactMatch is `true` then parameters as well as item name must match.
---
#### `unsigned` player.hasCountOfItem(`ItemDescriptor` item, [`bool` exactMatch])
Returns the total number of items in the player's inventory matching the specified descriptor. If exactMatch is `true` then parameters as well as item name must match.
---
#### `ItemDescriptor` player.consumeItem(`ItemDescriptor` item, [`bool` consumePartial], [`bool` exactMatch])
Attempts to consume the specified item from the player's inventory and returns the item consumed if successful. If consumePartial is `true`, matching stacks totalling fewer items than the requested count may be consumed, otherwise the operation will only be performed if the full count can be consumed. If exactMatch is `true` then parameters as well as item name must match.
---
#### `Map<String, unsigned>` player.inventoryTags()
Returns a summary of all tags of all items in the player's inventory. Keys in the returned map are tag names and their corresponding values are the total count of items including that tag.
---
#### `JsonArray` player.itemsWithTag(`String` tag)
Returns a list of `ItemDescriptor`s for all items in the player's inventory that include the specified tag.
---
#### `void` player.consumeTaggedItem(`String` tag, `unsigned` count)
Consumes items from the player's inventory that include the matching tag, up to the specified count of items.
---
#### `bool` player.hasItemWithParameter(`String` parameter, `Json` value)
Returns `true` if the player's inventory contains at least one item which has the specified parameter set to the specified value.
---
#### `void` player.consumeItemWithParameter(`String` parameter, `Json` value, `unsigned` count)
Consumes items from the player's inventory that have the specified parameter set to the specified value, upt to the specified count of items.
---
#### `ItemDescriptor` player.getItemWithParameter(`String` parameter, `Json` value)
Returns the first item in the player's inventory that has the specified parameter set to the specified value, or `nil` if no such item is found.
---
#### `ItemDescriptor` player.primaryHandItem()
Returns the player's currently equipped primary hand item, or `nil` if no item is equipped.
---
#### `ItemDescriptor` player.altHandItem()
Returns the player's currently equipped alt hand item, or `nil` if no item is equipped.
---
#### `JsonArray` player.primaryHandItemTags()
Returns a list of the tags on the currently equipped primary hand item, or `nil` if no item is equipped.
---
#### `JsonArray` player.altHandItemTags()
Returns a list of the tags on the currently equipped alt hand item, or `nil` if no item is equipped.
---
#### `ItemDescriptor` player.essentialItem(`String` slotName)
Returns the contents of the specified essential slot, or `nil` if the slot is empty. Essential slot names are "beamaxe", "wiretool", "painttool" and "inspectiontool".
---
#### `void` player.giveEssentialItem(`String` slotName, `ItemDescriptor` item)
Sets the contents of the specified essential slot to the specified item.
---
#### `void` player.removeEssentialItem(`String` slotName)
Removes the essential item in the specified slot.
---
#### `ItemDescriptor` player.equippedItem(`String` slotName)
Returns the contents of the specified equipment slot, or `nil` if the slot is empty. Equipment slot names are "head", "chest", "legs", "back", "headCosmetic", "chestCosmetic", "legsCosmetic" and "backCosmetic".
---
#### `void` player.setEquippedItem(`String` slotName, `Json` item)
Sets the item in the specified equipment slot to the specified item.
---
#### `ItemDescriptor` player.swapSlotItem()
Returns the contents of the player's swap (cursor) slot, or `nil` if the slot is empty.
---
#### `void` player.setSwapSlotItem(`Json` item)
Sets the item in the player's swap (cursor) slot to the specified item.
---
#### `bool` player.canStartQuest(`Json` questDescriptor)
Returns `true` if the player meets all of the prerequisites to start the specified quest and `false` otherwise.
---
#### `QuestId` player.startQuest(`Json` questDescriptor, [`String` serverUuid], [`String` worldId])
Starts the specified quest, optionally using the specified server Uuid and world id, and returns the quest id of the started quest.
---
#### `bool` player.hasQuest(`String` questId)
Returns `true` if the player has a quest, in any state, with the specified quest id and `false` otherwise.
---
#### `bool` player.hasAcceptedQuest(`String` questId)
Returns `true` if the player has accepted a quest (which may be active, completed, or failed) with the specified quest id and `false` otherwise.
---
#### `bool` player.hasActiveQuest(`String` questId)
Returns `true` if the player has a currently active quest with the specified quest id and `false` otherwise.
---
#### `bool` player.hasCompletedQuest(`String` questId)
Returns `true` if the player has a completed quest with the specified quest id and `false` otherwise.
---
#### `Maybe<WorldId>` player.currentQuestWorld()
If the player's currently tracked quest has an associated world, returns the id of that world.
---
#### `List<pair<WorldId, bool>>` player.questWorlds()
Returns a list of world ids for worlds relevant to the player's current quests, along with a boolean indicating whether that quest is tracked.
---
#### `Maybe<Json>` player.currentQuestLocation()
If the player's currently tracked quest has an associated location (CelestialCoordinate, system orbit, UUID, or system position) returns that location.
---
#### `List<pair<Json, bool>>` player.questLocations()
Returns a list of locations for worlds relevant to the player's current quests, along with a boolean indicating whether that quest is tracked.
---
#### `void` player.enableMission(`String` missionName)
Adds the specified mission to the player's list of available missions.
---
#### `void` player.completeMission(`String` missionName)
Adds the specified mission to the player's list of completed missions.
---
#### `void` player.hasCompletedMission(`String` missionName)
Returns whether the player has completed the specified mission.
---
#### `void` player.radioMessage(`Json` messageConfig, [`float` delay])
Triggers the specified radio message for the player, either immediately or with the specified delay.
---
#### `String` player.worldId()
Returns a `String` representation of the world id of the player's current world.
---
#### `String` player.serverUuid()
Returns a `String` representation of the player's Uuid on the server.
---
#### `String` player.ownShipWorldId()
Returns a `String` representation of the world id of the player's ship world.
---
#### `bool` player.lounge(`EntityId` loungeableId, [`unsigned` anchorIndex])
Triggers the player to lounge in the specified loungeable entity at the specified lounge anchor index (default is 0).
---
#### `bool` player.isLounging()
Returns `true` if the player is currently occupying a loungeable entity and `false` otherwise.
---
#### `EntityId` player.loungingIn()
If the player is currently lounging, returns the entity id of what they are lounging in.
---
#### `double` player.playTime()
Returns the total played time for the player.
---
#### `bool` player.introComplete()
Returns `true` if the player is marked as having completed the intro instance and `false` otherwise.
---
#### `void` player.setIntroComplete(`bool` complete)
Sets whether the player is marked as having completed the intro instance.
---
#### `void` player.warp(`String` warpAction, [`String` animation], [`bool` deploy])
Immediately warps the player to the specified warp target, optionally using the specified warp animation and deployment.
---
#### `bool` player.canDeploy()
Returns whether the player has a deployable mech.
---
#### `bool` player.isDeployed()
Returns whether the player is currently deployed.
---
#### `RpcPromise` player.confirm(`Json` dialogConfig)
Displays a confirmation dialog to the player with the specified dialog configuration and returns an `RpcPromise` which can be used to retrieve the player's response to that dialog.
---
#### `void` player.playCinematic(`Json` cinematic, [`bool` unique])
Triggers the specified cinematic to be displayed for the player. If unique is `true` the cinematic will only be shown to that player once.
---
#### `void` player.recordEvent(`String` event, `Json` fields)
Triggers the specified event on the player with the specified fields. Used to record data e.g. for achievements.
---
#### `bool` player.worldHasOrbitBookmark(`Json` coordinate)
Returns whether the player has a bookmark for the specified celestial coordinate.
---
#### `List<pair<Vec3I, Json>>` player.orbitBookmarks()
Returns a list of orbit bookmarks with their system coordinates.
---
#### `List<Json>` player.systemBookmarks(`Json` systemCoordinate)
Returns a list of orbit bookmarks in the specified system.
---
#### `bool` player.addOrbitBookmark(`Json` systemCoordinate, `Json` bookmarkConfig)
Adds the specified bookmark to the player's bookmark list and returns `true` if the bookmark was successfully added (and was not already known) and `false` otherwise.
---
#### `bool` player.removeOrbitBookmark(`Json` systemCoordinate, `Json` bookmarkConfig)
Removes the specified bookmark from the player's bookmark list and returns `true` if the bookmark was successfully removed and `false` otherwise.
---
#### `List<Json>` player.teleportBookmarks()
Lists all of the player's teleport bookmarks.
---
#### `bool` player.addTeleportBookmark(`Json` bookmarkConfig)
Adds the specified bookmark to the player's bookmark list and returns `true` if the bookmark was successfully added (and was not already known) and `false` otherwise.
---
#### `bool` player.removeTeleportBoookmark(`Json` bookmarkConfig)
Removes the specified teleport bookmark.
---
#### `bool` player.isMapped(`Json` coordinate)
Returns whether the player has previously visited the specified coordinate.
---
#### `Json` player.mappedObjects(`Json` systemCoordinate)
Returns uuid, type, and orbits for all system objects in the specified system;
---
#### `List<String>` player.collectables(`String` collectionName)
Returns a list of names of the collectables the player has unlocked in the specified collection.

View File

@ -0,0 +1,13 @@
The playerCompanions table contains bindings used to manage player companions such as pets and crew members.
---
#### `JsonArray` playerCompanions.getCompanions(`String` companionType)
Returns a list of configurations for all companions of the specified type.
---
#### `void` playerCompanions.setCompanions(`String` companionType, `JsonArray` companions)
Sets the player's companions of the specified type to the specified list of companion configurations.

67
doc/lua/projectile.md Normal file
View File

@ -0,0 +1,67 @@
The projectile table contains bindings specific to projectiles which are available in addition to their common tables.
---
#### `Json` projectile.getParameter(`String` parameter, `Json` default)
Returns the value for the specified config parameter. If there is no value set, returns the default.
---
#### `void` projectile.die()
Destroys the projectile.
---
#### `EntityId` projectile.sourceEntity()
Returns the entity id of the projectile's source entity, or `nil` if no source entity is set.
---
#### `float` projectile.powerMultiplier()
Returns the projectile's power multiplier.
---
#### `float` projectile.power()
Returns the projectile's power (damage).
---
#### `void` projectile.setPower(`float` power)
Sets the projectile's power (damage).
---
#### `float` projectile.timeToLive()
Returns the projectile's current remaining time to live.
---
#### `void` projectile.setTimeToLive(`float` timeToLive)
Sets the projectile's current remaining time to live. Altering the time to live may cause visual disparity between the projectile's master and slave entities.
---
#### `bool` projectile.collision()
Returns `true` if the projectile has collided and `false` otherwise.
---
#### `void` projectile.processAction(`Json` action)
Immediately performs the specified action. Action should be specified in a format identical to a single entry in e.g. actionOnReap in the projectile's configuration. This function will not properly perform rendering actions as they will not be networked.
---
#### 'void' projectile.setReferenceVelocity(Maybe<`Vec2F`> velocity)
Sets the projectile's reference velocity (a base velocity to which movement is relative)

203
doc/lua/quest.md Normal file
View File

@ -0,0 +1,203 @@
# quest
The `quest` table contains functions relating directly to the quest whose script its run in.
---
#### `String` quest.state()
Returns the current state of the quest.
Possible states:
* "New"
* "Offer"
* "Active"
* "Complete"
* "Failed"
---
#### `void` quest.complete()
Immediately completes the quest.
---
#### `void` quest.fail()
Immediately fails the quest.
---
#### `void` quest.setCanTurnIn(`bool` turnIn)
Sets whether the quest can be turned in.
---
#### `String` quest.questId()
Returns the quest id.
---
#### `String` quest.templateId()
Returns the ID of the template used to make this quest.
---
#### `uint64_t` quest.seed()
Returns the seed used to generate the quest.
---
#### `Json` quest.questDescriptor()
Returns the quest descriptor including parameters.
---
#### `Json` quest.questArcDescriptor()
Returns the quest arc descriptor.
---
#### `Vec2F` quest.questArcPosition()
Returns the quest arc position. (?)
---
#### `String` quest.worldId()
Returns the world id for the quest arc.
---
#### `String` quest.serverUuid()
Returns the server uuid for the quest.
---
#### `QuestParameters` quest.parameters()
Returns all quest parameters.
---
#### `void` quest.setParameter(`String` name, `Json` value)
Sets a quest parameter.
---
#### `void` quest.setIndicators(`List<String>` indicators)
Set a list of quest parameters to use as custom indicators.
Example:
```
-- define indicators
local entityIndicator = {
type = "entity",
uniqueId = "techscientist"
}
local itemIndicator = {
type = "item",
item = "perfectlygenericitem"
}
local itemTagIndicator = {
type = "itemTag",
tag = "weapon"
}
local itemListIndicator = {
type = "itemList",
items = [ "perfectlygenericitem", "standingturret" ]
}
local monsterTypeIndicator = {
type = "monsterType",
typeName = "peblit"
}
-- set quest parameters for the indicators
quest.setParameter("entity", entityIndicator)
quest.setParameter("item", itemIndicator)
quest.setParameter("itemTag", itemTagIndicator)
quest.setParameter("itemList", itemListIndicator)
quest.setParameter("monsterType", monsterTypeIndicator)
-- add the set quest parameters to the indicators list
quest.setIndicators({"entity", "item", "itemTag", "itemList", "monsterType"})
```
---
#### `void` quest.setObjectiveList(`JsonArray` objectives)
Set the objectives for the quest tracker. Objectives are in the format {text, completed}
Example:
```lua
quest.setObjectiveList({
{"Gather 4 cotton", true},
{"Eat 2 cotton", false}
})
```
---
#### `void` quest.setProgress(`float` progress)
Sets the progress amount of the quest tracker progress bar. Set nil to hide. Progress is from 0.0 to 1.0.
---
#### `void` quest.setCompassDirection(`float` angle)
Set the angle of the quest tracker compass. Setting nil hides the compass.
---
#### `void` quest.setTitle(`String` title)
Sets the title of the quest in the quest log.
---
#### `void` quest.setText(`String` text)
Set the text for the quest in the quest log.
---
#### `void` quest.setCompletionText(`String` completionText)
Sets the text shown in the completion window when the quest is completed.
---
#### `void` quest.setFailureText(`String` failureText)
Sets the text shown in the completion window when the quest is failed.
---
#### `void` quest.setPortrait(`String` portraitName, `JsonArray` portrait)
Sets a portrait to a list of drawables.
---
#### `void` quest.setPortraitTitle(`String` portraitName, `String` title)
Sets a portrait title.
---
#### `void` quest.addReward(`ItemDescriptor` reward)
Add an item to the reward pool.

328
doc/lua/root.md Normal file
View File

@ -0,0 +1,328 @@
The `root` table contains functions that reference the game's currently loaded assets and don't relate to any more specific context such as a particular world or universe.
---
#### `Json` root.assetJson(`String` assetPath)
Returns the contents of the specified JSON asset file.
---
#### `Json` root.makeCurrentVersionedJson(`String` versioningIdentifier, `Json` content)
Returns a versioned JSON representation of the given JSON content with the given identifier and the most recent version as specified in `versioning.config`.
---
#### `Json` root.loadVersionedJson(`Json` versionedContent, `String` versioningIdentifier)
Returns the given JSON content and identifier after applying appropriate versioning scripts to bring it up to the most recent version as specified in `versioning.config`.
---
#### `double` root.evalFunction(`String` functionName, `double` input)
Returns the evaluation of the specified univariate function (as defined in a `.functions` file) for the given input value.
---
#### `double` root.evalFunction2(`String` functionName, `double` input1, `double` input2)
Returns the evaluation of the specified bivariate function (as defined in a `.2functions` file) for the given input values.
---
#### `Vec2U` root.imageSize(`String` imagePath)
Returns the pixel dimensions of the specified image asset.
---
#### `List<Vec2I>` root.imageSpaces(`String` imagePath, `Vec2F` worldPosition, `float` spaceScan, `bool` flip)
Returns a list of the world tile spaces the image would occupy if placed at the given position using the specified spaceScan value (the portion of a space that must be non-transparent for that space to count as filled).
---
#### `RectU` root.nonEmptyRegion(`String` imagePath)
Returns the rectangle containing the portion of the specified asset image that is non-transparent.
---
#### `Json` root.npcConfig(`String` npcType)
Returns a representation of the generated JSON configuration for an NPC of the given type.
---
#### `Json` root.npcVariant(`String` species, `String` npcType, `float` level, [`unsigned` seed], [`Json` parameters])
Generates an NPC with the specified species, type, level, seed and parameters, and returns its configuration.
---
#### `float` root.projectileGravityMultiplier(`String` projectileName)
Returns the gravity multiplier of the given projectile's movement controller configuration as configured in `physics.config`.
---
#### `Json` root.projectileConfig(`String` projectileName)
Returns a representation of the JSON configuration for the given projectile.
---
#### `Json` root.itemDescriptorsMatch(`ItemDescriptor` descriptor1, `ItemDescriptor` descriptor2, [`bool` exactMatch])
Returns `true` if the given item descriptors match. If exactMatch is `true` then both names and parameters will be compared, otherwise only names.
---
#### `JsonArray` root.recipesForItem(`String` itemName)
Returns a list of JSON configurations of all recipes which output the given item.
---
#### `String` root.itemType(`String` itemName)
Returns the item type name for the specified item.
---
#### `JsonArray` root.itemTags(`String` itemName)
Returns a list of the tags applied to the specified item.
---
#### `bool` root.itemHasTag(`String` itemName, `String` tagName)
Returns true if the given item's tags include the specified tag and false otherwise.
---
#### `Json` root.itemConfig(`ItemDescriptor` descriptor, [`float` level], [`unsigned` seed])
Generates an item from the specified descriptor, level and seed and returns a JSON object containing the `directory`, `config` and `parameters` for that item.
---
#### `ItemDescriptor` root.createItem(`ItemDescriptor` descriptor, [`float` level], [`unsigned` seed])
Generates an item from the specified descriptor, level and seed and returns a new item descriptor for the resulting item.
---
#### `Json` root.tenantConfig(`String` tenantName)
Returns the JSON configuration for the given tenant.
---
#### `JsonArray` root.getMatchingTenants(`map<String, unsigned>` colonyTags)
Returns an array of JSON configurations of tenants matching the given map of colony tags and corresponding object counts.
---
#### `JsonArray` root.liquidStatusEffects(`LiquidId` liquid)
Returns an array of status effects applied by the given liquid.
---
#### `String` root.generateName(`String` assetPath, [`unsigned` seed])
Returns a randomly generated name using the specified name gen config and seed.
---
#### `Json` root.questConfig(`String` questTemplateId)
Returns the JSON configuration of the specified quest template.
---
#### `JsonArray` root.npcPortrait(`String` portraitMode, `String` species, `String` npcType, `float` level, [`unsigned` seed], [`Json` parameters])
Generates an NPC with the specified type, level, seed and parameters and returns a portrait in the given portraitMode as a list of drawables.
---
#### `JsonArray` root.monsterPortrait(`String` typeName, [`Json` parameters])
Generates a monster of the given type with the given parameters and returns its portrait as a list of drawables.
---
#### `bool` root.isTreasurePool(`String` poolName)
Returns true if the given treasure pool exists and false otherwise. Can be used to guard against errors attempting to generate invalid treasure.
---
#### `JsonArray` root.createTreasure(`String` poolName, `float` level, [`unsigned` seed])
Generates an instance of the specified treasure pool, level and seed and returns the contents as a list of item descriptors.
---
#### `String` root.materialMiningSound(`String` materialName, [`String` modName])
Returns the path of the mining sound asset for the given material and mod combination, or `nil` if no mining sound is set.
---
#### `String` root.materialFootstepSound(`String` materialName, [`String` modName])
Returns the path of the footstep sound asset for the given material and mod combination, or `nil` if no footstep sound is set.
---
#### `float` root.materialHealth(`String` materialName)
Returns the configured health value for the specified material.
---
#### `Json` root.materialConfig(`String` materialName)
Returns a JSON object containing the `path` and base `config` for the specified material if it is a real material, or `nil` if it is a metamaterial or invalid.
---
#### `Json` root.modConfig(`String` modName)
Returns a JSON object containing the `path` and base `config` for the specified mod if it is a real mod, or `nil` if it is a metamod or invalid.
---
#### `Json` root.liquidConfig(`LiquidId` liquidId)
#### `Json` root.liquidConfig(`String` liquidName)
Returns a JSON object containing the `path` and base `config` for the specified liquid name or id if it is a real liquid, or `nil` if the liquid is empty or invalid.
---
#### `String` root.liquidName(`LiquidId` liquidId)
Returns the string name of the liquid with the given ID.
---
#### `LiquidId` root.liquidId(`String` liquidName)
Returns the numeric ID of the liquid with the given name.
---
#### `Json` root.monsterSkillParameter(`String` skillName, `String` parameterName)
Returns the value of the specified parameter for the specified monster skill.
---
#### `Json` root.monsterParameters(`String` monsterType, [uint64_t seed])
Returns the parameters for a monster type.
---
#### `ActorMovementParameters` root.monsterMovementSettings(`String` monsterType, [uint64_t seed])
Returns the configured base movement parameters for the specified monster type.
---
#### `Json` root.createBiome(`String` biomeName, `unsigned` seed, `float` verticalMidPoint, `float` threatLevel)
Generates a biome with the specified name, seed, vertical midpoint and threat level, and returns a JSON object containing the configuration for the generated biome.
---
#### `String` root.hasTech(`String` techName)
Returns `true` if a tech with the specified name exists and `false` otherwise.
---
#### `String` root.techType(`String` techName)
Returns the type (tech slot) of the specified tech.
---
#### `Json` root.techConfig(`String` techName)
Returns the JSON configuration for the specified tech.
---
#### `String` root.treeStemDirectory(`String` stemName)
Returns the path within assets from which the specified tree stem type was loaded.
---
#### `String` root.treeFoliageDirectory(`String` foliageName)
Returns the path within assets from which the specified tree foliage type was loaded.
---
#### `Collection` root.collection(`String` collectionName)
Returns the metadata for the specified collection.
---
#### `List<Collectable>` root.collectables(`String` collectionName)
Returns a list of collectables for the specified collection.
---
#### `String` root.elementalResistance(`String` elementalType)
Returns the name of the stat used to calculate elemental resistance for the specified elemental type.
---
#### `Json` root.dungeonMetadata(`String` dungeonName)
Returns the metadata for the specified dungeon definition.
---
#### `BehaviorState` root.behavior(`LuaTable` context, `Json` config, `JsonObject` parameters)
Loads a behavior and returns the behavior state as userdata.
context is the current lua context called from, in almost all cases _ENV.
config can be either the `String` name of a behavior tree, or an entire behavior tree configuration to be built.
parameters is overrides for parameters for the behavior tree.
BehaviorState contains 2 methods:
behavior:init(_ENV) -- initializes the behavior, loads required scripts, and returns a new behavior state
behavior:run(state, dt) -- runs the behavior, takes a behavior state for the first argument
behavior:clear(state) -- resets the internal state of the behavior
Example:
```lua
function init()
self.behavior = root.behavior("monster", {})
self.behaviorState = self.behavior:init(_ENV)
end
function update(dt)
self.behavior:run(self.behaviorState, dt)
end
```

View File

@ -0,0 +1,23 @@
# animationConfig
The `animationConfig` table contains functions for getting configuration options from the base entity and its networked animator.
It is available only in client side rendering scripts.
---
#### `Json` animationConfig.animationParameter(`String` key)
Returns a networked value set by the parent entity's master script.
---
#### `Vec2F` animationConfig.partPoint(`String` partName, `String` propertyName)
Returns a `Vec2F` configured in a part's properties with all of the part's transformations applied to it.
---
#### `PolyF` animationConfig.partPoly(`String` partName, `String` propertyName)
Returns a `PolyF` configured in a part's properties with all the part's transformations applied to it.

49
doc/lua/scriptpane.md Normal file
View File

@ -0,0 +1,49 @@
These pane bindings are available to scripted interface panes and include functions not specifically related to widgets within the pane.
---
#### `EntityId` pane.sourceEntity()
Returns the entity id of the pane's source entity.
---
#### `void` pane.dismiss()
Closes the pane.
---
#### `void` pane.playSound(`String` sound, [`int` loops], [`float` volume])
Plays the specified sound asset, optionally looping the specified number of times or at the specified volume.
---
#### `bool` pane.stopAllSounds(`String` sound)
Stops all instances of the given sound asset, and returns `true` if any sounds were stopped and `false` otherwise.
---
#### `void` pane.setTitle(`String` title, `String` subtitle)
Sets the window title and subtitle.
---
#### `void` pane.setTitleIcon(`String` image)
Sets the window icon.
---
#### `void` pane.addWidget(`Json` widgetConfig, [`String` widgetName])
Creates a new widget with the specified config and adds it to the pane, optionally with the specified name.
---
#### `void` pane.removeWidget(`String` widgetName)
Removes the specified widget from the pane.

37
doc/lua/stagehand.md Normal file
View File

@ -0,0 +1,37 @@
The stagehand table contains bindings specific to stagehands which are available in addition to their common tables.
---
#### `EntityId` stagehand.id()
Returns the stagehand's entity id. Identical to entity.id(), so use that instead.
---
#### `Vec2F` stagehand.position()
Returns the stagehand's position. This is identical to entity.position(), so use that instead.
---
#### `void` stagehand.setPosition(`Vec2F` position)
Moves the stagehand to the specified position.
---
#### `void` stagehand.die()
Destroys the stagehand.
---
#### `String` stagehand.typeName()
Returns the stagehand's type name.
---
#### `void` stagehand.setUniqueId([`String` uniqueId])
Sets the stagehand's unique entity id, or clears it if unspecified.

263
doc/lua/statuscontroller.md Normal file
View File

@ -0,0 +1,263 @@
# status
The `status` table relates to the status controller attached to an entity. It is available in:
* monsters
* npcs
* status effects
* companion system scripts
* quest scripts
* tech
* primary status scripts for: player, monster, npc
---
#### `Json` status.statusProperty(`String` name, `Json` default)
Returns the value assigned to the specified status property. If there is no value set, returns default.
---
#### `void` status.setStatusProperty(`String` name, `Json` value)
Sets a status property to the specified value.
---
#### `float` status.stat(`String` statName)
Returns the value for the specified stat. Defaults to 0.0 if the stat does not exist.
---
#### `bool` status.statPositive(`String` statName)
Returns whether the stat value is greater than 0.
---
#### `List<String>` status.resourceNames()
Returns a list of the names of all the configured resources;
---
#### `bool` status.isResource(`String` resourceName)
Returns whether the specified resource exists in this status controller.
---
#### `float` status.resource(`String` resourceName)
Returns the value of the specified resource.
---
#### `bool` status.resourcePositive(`String` resourceName)
Returns whether the value of the specified resource is greater than 0.
---
#### `void` status.setResource(`String` resourceName, `float` value)
Sets a resource to the specified value.
---
#### `void` status.modifyResource(`String` resourceName, `float` value)
Adds the specified value to a resource.
---
#### `float` status.giveResource(`String` resourceName, `float` value)
Adds the specified value to a resource. Returns any overflow.
---
#### `bool` status.consumeResource(`String` resourceName, `float` amount)
Tries to consume the specified amount from a resource. Returns whether the full amount was able to be consumes. Does not modify the resource if unable to consume the full amount.
---
#### `bool` status.overConsumeResource(`String` resourceName, `float` amount)
Tries to consume the specified amount from a resource. If unable to consume the full amount, will consume all the remaining amount. Returns whether it was able to consume any at all of the resource.
---
#### `bool` status.resourceLocked(`String` resourceName)
Returns whether the resource is currently locked.
---
#### `void` status.setResourceLocked(`String` resourceName, `bool` locked)
Sets a resource to be locked/unlocked. A locked resource cannot be consumed.
---
#### `void` status.resetResource(`String` resourceName)
Resets a resource to its base value.
---
#### `void` status.resetAllResources()
Resets all resources to their base values.
---
#### `float` status.resourceMax(`String` resourceName)
Returns the max value for the specified resource.
---
#### `float` status.resourcePercentage(`String` resourceName)
Returns the percentage of max that the resource is currently at. From 0.0 to 1.0.
---
#### `void` status.setResourcePercentage(`String` resourceName, `float` value)
Sets a resource to a percentage of the max value for the resource. From 0.0 to 1.0.
---
#### `void` status.modifyResourcePercentage(`String` resourceName, `float` value)
Adds a percentage of the max resource value to the current value of the resource.
---
#### `JsonArray` status.getPersistentEffects(`String` effectCategory)
Returns a list of the currently active persistent effects in the specified effect category.
---
#### `void` status.addPersistentEffect(`String` effectCategory, `Json` effect)
Adds a status effect to the specified effect category.
---
#### `void` status.addPersistentEffects(`String` effectCategory, `JsonArray` effects)
Adds a list of effects to the specified effect category.
---
#### `void` status.setPersistentEffects(`String` effectCategory, `JsonArray` effects)
Sets the list of effects of the specified effect category. Replaces the current list active effects.
---
#### `void` status.clearPersistentEffects(`String` effectCategory)
Clears any status effects from the specified effect category.
---
#### `void` status.clearAllPersistentEffects()
Clears all persistent status effects from all effect categories.
---
#### `void` status.addEphemeralEffect(`String` effectName, [`float` duration], [`EntityId` sourceEntity])
Adds the specified unique status effect. Optionally with a custom duration, and optionally with a source entity id accessible in the status effect.
---
#### `void` status.addEphemeralEffects(`JsonArray` effects, [`EntityId` sourceEntity])
Adds a list of unique status effects. Optionally with a source entity id.
Unique status effects can be specified either as a string, "myuniqueeffect", or as a table, {effect = "myuniqueeffect", duration = 5}. Remember that this function takes a `list` of these effect descriptors. This is a valid list of effects: { "myuniqueeffect", {effect = "myothereffect", duration = 5} }
---
#### `void` status.removeEphemeralEffect(`String` effectName)
Removes the specified unique status effect.
---
#### `void` status.clearEphemeralEffects()
Clears all ephemeral status effects.
---
#### `List<pair<DamageNotification>>`, `unsigned` status.damageTakenSince([`unsigned` since = 0]])
Returns two values:
* A list of damage notifications for the entity's damage taken since the specified heartbeat.
* The most recent heartbeat to be passed into the function again to get the damage notifications taken since this function call.
Example:
```lua
_,lastStep = status.damageTakenSince() -- Returns the full buffer of damage notifications, throw this away, we only want the current step
-- stuff
notifications,lastStep = status.damageTakenSince(lastStep) -- Get the damage notifications since the last call, and update the heartbeat
```
---
#### `List<pair<EntityId,DamageRequest>>`, `unsigned` status.inflictedHitsSince([`unsigned` since = 0]])
Returns two values:
* A list {{entityId, damageRequest}} for the entity's inflicted hits since the specified heartbeat.
* The most recent heartbeat to be passed into the function again to get the inflicted hits since this function call.
---
#### `List<DamageNotification>`, `unsigned` status.inflictedDamageSince([`unsigned` since = 0])
Returns two values:
* A list of damage notifications for damage inflicted by the entity.
* The most recent heartbeat to be passed into the function again to get the list of damage notifications since the last call.
---
#### `JsonArray` status.activeUniqueStatusEffectSummary()
Returns a list of two element tables describing all unique status effects currently active on the status controller. Each entry consists of the `String` name of the effect and a `float` between 0 and 1 indicating the remaining portion of that effect's duration.
---
#### `bool` status.uniqueStatusEffectActive(`String` effectName)
Returns `true` if the specified unique status effect is currently active and `false` otherwise.
---
#### `String` status.primaryDirectives()
Returns the primary set of image processing directives applied to the animation of the entity using this status controller.
---
#### `void` status.setPrimaryDirectives([`String` directives])
Sets the primary set of image processing directives that should be applied to the animation of the entity using this status controller.
---
#### `void` status.applySelfDamageRequest(`DamageRequest` damageRequest)
Directly applies the specified damage request to the entity using this status controller.

69
doc/lua/statuseffect.md Normal file
View File

@ -0,0 +1,69 @@
# effect
The `effect` table relates to functions specifically for status effects.
---
#### `float` effect.duration()
Returns the remaining duration of the status effect.
---
#### `void` effect.modifyDuration(`float` duration)
Adds the specified duration to the current remaining duration.
---
#### `void` effect.expire()
Immediately expire the effect, setting the duration to 0.
---
#### `EntityId` effect.sourceEntity()
Returns the source entity id of the status effect, if any.
---
#### `void` effect.setParentDirectives(`String` directives)
Sets image processing directives for the entity the status effect is active on.
---
#### `Json` effect.getParameter(`String` name, `Json` def)
Returns the value associated with the parameter name in the effect configuration. If no value is set, returns the default specified.
---
#### `StatModifierGroupId` effect.addStatModifierGroup(`List<StatModifier>` modifiers)
Adds a new stat modifier group and returns the ID created for the group. Stat modifier groups will stay active until the effect expires.
Stat modifiers are of the format:
```lua
{
stat = "health",
amount = 50
--OR baseMultiplier = 1.5
--OR effectiveMultiplier = 1.5
}
```
---
#### `void` effect.setStatModifierGroup(`StatModifierGroupId`, groupId, `List<StatModifier>` modifiers)
Replaces the list of stat modifiers in a group with the specified modifiers.
---
#### `void` effect.removeStatModifierGroup(`StatModifierGroupId` groupId)
Removes the specified stat modifier group.

63
doc/lua/tech.md Normal file
View File

@ -0,0 +1,63 @@
# tech
The `tech` table contains functions exclusively available in tech scripts.
---
#### `Vec2F` tech.aimPosition()
Returns the current cursor aim position.
---
#### `void` tech.setVisible(`bool` visible)
Sets whether the tech should be visible.
---
#### `void` tech.setParentState(`String` state)
Set the animation state of the player.
Valid states:
* "Stand"
* "Fly"
* "Fall"
* "Sit"
* "Lay"
* "Duck"
* "Walk"
* "Run"
* "Swim"
---
#### `void` tech.setParentDirectives(`String` directives)
Sets the image processing directives for the player.
---
#### `void` tech.setParentHidden(`bool` hidden)
Sets whether to make the player invisible. Will still show the tech.
---
#### `void` tech.setParentOffset(`Vec2F` offset)
Sets the position of the player relative to the tech.
---
#### `bool` tech.parentLounging()
Returns whether the player is lounging.
---
#### `void` tech.setToolUsageSuppressed(`bool` suppressed)
Sets whether to suppress tool usage on the player. When tool usage is suppressed no items can be used.

View File

@ -0,0 +1,13 @@
Most entity script contexts include the *script* table, which provides bindings for getting and setting the script's update rate. Update deltas are specified in numbers of frames, so a script with an update delta of 1 would run every frame, or a script with an update delta of 60 would run once per second. An update delta of 0 means that the script's periodic update will never be called, but it can still perform actions through script calls, messaging, or event hooks.
---
#### `void` script.setUpdateDelta(`unsigned` dt)
Sets the script's update delta.
---
#### `float` script.updateDt()
Returns the duration in seconds between periodic updates to the script.

170
doc/lua/utility.md Normal file
View File

@ -0,0 +1,170 @@
The sb table contains miscellaneous utility functions that don't directly relate to any assets or content of the game.
---
#### `double` sb.nrand([`double` standardDeviation], [`double` mean])
Returns a randomized value with a normal distribution using the specified standard deviation (default is 1.0) and mean (default is 0).
---
#### `String` sb.makeUuid()
Returns a `String` representation of a new, randomly-created `Uuid`.
---
#### `void` sb.logInfo(`String` formatString, [`LuaValue` formatValues ...])
Logs the specified formatted string, optionally using the formatted replacement values, to the log file and console with the Info log level.
---
#### `void` sb.logWarn(`String` formatString, [`LuaValue` formatValues ...])
Logs the specified formatted string, optionally using the formatted replacement values, to the log file and console with the Warn log level.
---
#### `void` sb.logError(`String` formatString, [`LuaValue` formatValues ...])
Logs the specified formatted string, optionally using the formatted replacement values, to the log file and console with the Error log level.
---
#### `void` sb.setLogMap(`String` key, `String` formatString, [`LuaValue` formatValues ...])
Sets an entry in the debug log map (visible while in debug mode) using the specified format string and optional formatted replacement values.
---
#### `String` sb.printJson(`Json` value, [`bool` pretty])
Returns a human-readable string representation of the specified JSON value. If pretty is `true`, objects and arrays will have whitespace added for readability.
---
#### `String` sb.print(`LuaValue` value)
Returns a human-readable string representation of the specified `LuaValue`.
---
#### `Variant<Vec2F, double>` sb.interpolateSinEase(`double` offset, `Variant<Vec2F, double>` value1, `Variant<Vec2F, double>` value2)
Returns an interpolated `Vec2F` or `double` between the two specified values using a sin ease function.
---
#### `String` sb.replaceTags(`String` string, `Map<String, String>` tags)
Replaces all tags in the specified string with the specified tag replacement values.
---
#### `Json` sb.jsonMerge(`Json` a, `Json` b)
Returns the result of merging the contents of b on top of a.
---
#### `Json` sb.jsonQuery(`Json` content, `String` path, `Json` default)
Attempts to extract the value in the specified content at the specified path, and returns the found value or the specified default if no such value exists.
---
#### `int` sb.staticRandomI32([`LuaValue` hashValues ...])
Returns a statically randomized 32-bit signed integer based on the given list of seed values.
---
#### `int` sb.staticRandomI32Range(`int` min, `int` max, [`LuaValue` hashValues ...])
Returns a statically randomized 32-bit signed integer within the specified range based on the given list of seed values.
---
#### `double` sb.staticRandomDouble([`LuaValue` hashValues ...])
Returns a statically randomized `double` based on the given list of seed values.
---
#### `double` sb.staticRandomDoubleRange(`double` min, `double` max, [`LuaValue` hashValues ...])
Returns a statically randomized `double` within the specified range based on the given list of seed values.
---
#### `RandomSource` sb.makeRandomSource([`unsigned` seed])
Creates and returns a Lua UserData value which can be used as a random source, initialized with the specified seed. The `RandomSource` has the following methods:
##### `void` init([`unsigned` seed])
Reinitializes the random source, optionally using the specified seed.
##### `void` addEntropy([`unsigned` seed])
Adds entropy to the random source, optionally using the specified seed.
##### `unsigned` randu32()
Returns a random 32-bit unsigned integer value.
##### `unsigned` randu64()
Returns a random 64-bit unsigned integer value.
##### `int` randi32()
Returns a random 32-bit signed integer value.
##### `int` randi64()
Returns a random 64-bit signed integer value.
##### `float` randf([`float` min], [`float` max])
Returns a random `float` value within the specified range, or between 0 and 1 if no range is specified.
##### `double` randf([`double` min], [`double` max])
Returns a random `double` value within the specified range, or between 0 and 1 if no range is specified.
##### `unsigned` randf(`unsigned` minOrMax, [`unsigned` max])
Returns a random unsigned integer value between minOrMax and max, or between 0 and minOrMax if no max is specified.
##### `int` randf([`int` min], [`int` max])
Returns a random signed integer value between minOrMax and max, or between 0 and minOrMax if no max is specified.
##### `bool` randb()
Returns a random `bool` value.
---
#### `PerlinSource` sb.makePerlinSource(`Json` config)
Creates and returns a Lua UserData value which can be used as a Perlin noise source. The configuration for the `PerlinSource` should be a JSON object and can include the following keys:
* `unsigned` __seed__ - Seed value used to initialize the source.
* `String` __type__ - Type of noise to use. Valid types are "perlin", "billow" or "ridgedMulti".
* `int` __octaves__ - Number of octaves of noise to use. Defaults to 1.
* `double` __frequency__ - Defaults to 1.0.
* `double` __amplitude__ - Defaults to 1.0.
* `double` __bias__ - Defaults to 0.0.
* `double` __alpha__ - Defaults to 2.0.
* `double` __beta__ - Defaults to 2.0.
* `double` __offset__ - Defaults to 1.0.
* `double` __gain__ - Defaults to 2.0.
The `PerlinSource` has only one method:
##### `float` get(`float` x, [`float` y], [`float` z])
Returns a `float` value from the Perlin source using 1, 2, or 3 dimensions of input.

91
doc/lua/vehicle.md Normal file
View File

@ -0,0 +1,91 @@
The vehicle table contains bindings specific to vehicles which are available in addition to their common tables.
---
#### `bool` vehicle.controlHeld(`String` loungeName, `String` controlName)
Returns `true` if the specified control is currently being held by an occupant of the specified lounge position and `false` otherwise.
---
#### `Vec2F` vehicle.aimPosition(`String` loungeName)
Returns the world aim position for the specified lounge position.
---
#### `EntityId` vehicle.entityLoungingIn(`String` loungeName)
Returns the entity id of the entity currently occupying the specified lounge position, or `nil` if the lounge position is unoccupied.
---
#### `void` vehicle.setLoungeEnabled(`String` loungeName, `bool` enabled)
Enables or disables the specified lounge position.
---
#### `void` vehicle.setLoungeOrientation(`String` loungeName, `String` orientation)
Sets the lounge orientation for the specified lounge position. Valid orientations are "sit", "stand" or "lay".
---
#### `void` vehicle.setLoungeEmote(`String` loungeName, [`String` emote])
Sets the emote to be performed by entities occupying the specified lounge position, or clears it if no emote is specified.
---
#### `void` vehicle.setLoungeDance(`String` loungeName, [`String` dance])
Sets the dance to be performed by entities occupying the specified lounge position, or clears it if no dance is specified.
---
#### `void` vehicle.setLoungeStatusEffects(`String` loungeName, `JsonArray` statusEffects)
Sets the list of status effects to be applied to entities occupying the specified lounge position. To clear the effects, set an empty list.
---
#### `void` vehicle.setPersistent(`bool` persistent)
Sets whether the vehicle is persistent, i.e. whether it will be stored when the world is unloaded and reloaded.
---
#### `void` vehicle.setInteractive(`bool` interactive)
Sets whether the vehicle is currently interactive.
---
#### `void` vehicle.setDamageTeam(`DamageTeam` team)
Sets the vehicle's current damage team type and number.
---
#### `void` vehicle.setMovingCollisionEnabled(`String` collisionName, `bool` enabled)
Enables or disables the specified collision region.
---
#### `void` vehicle.setForceRegionEnabled(`String` regionName, `bool` enabled)
Enables or disables the specified force region.
---
#### `void` vehicle.setDamageSourceEnabled(`String` damageSourceName, `bool` enabled)
Enables or disables the specified damage source.
---
#### `void` vehicle.destroy()
Destroys the vehicle.

391
doc/lua/widget.md Normal file
View File

@ -0,0 +1,391 @@
# widget
The `widget` table contains functions to manipulate and get data about widgets in a scriptpane.
The widgetName passed into most of these functions can contain period separators for getting children.
Example:
```
widget.getPosition("itemScrollArea.itemList.1.name")
```
## General callbacks
These callbacks are available for all widgets.
---
#### `void` widget.playSound(`String` audio, [`int` loops = 0], [`float` volume = 1.0f])
Plays a sound.
---
#### `Vec2I` widget.getPosition(`String` widgetName)
Returns the position of a widget.
---
#### `void` widget.setPosition(`String` widgetName, `Vec2I` position)
Sets the position of a widget.
---
#### `Vec2I` widget.getSize(`String` widgetName)
Returns the size of a widget.
---
#### `void` widget.setSize(`String` widgetName, `Vec2I` size)
Sets the size of a widget.
---
#### `void` widget.setVisible(`String` widgetName, `bool` visible)
Sets the visibility of a widget.
---
#### `void` widget.active(`String` widgetName)
Returns whether the widget is visible.
---
#### `void` widget.focus(`String` widgetName)
Sets focus on the specified widget.
---
#### `void` widget.hasFocus(`String` widgetName)
Returns whether the specified widget is currently focused.
---
#### `void` widget.blur(`String` widgetName)
Unsets focus on the specified focused widget.
---
#### `Json` widget.getData(`String` widgetName)
Returns the arbitrary data value set for the widget.
---
#### `void` widget.setData(`String` widgetName, `Json` data)
Sets arbitrary data for the widget.
---
#### `String` widget.getChildAt(`Vec2I` screenPosition)
Returns the full name for any widget at screenPosition.
---
#### `bool` widget.inMember(`String` widgetName, `Vec2I` screenPosition)
Returns whether the widget contains the specified screenPosition.
---
#### `void` widget.addChild(`String` widgetName, `Json` childConfig, [`String` childName])
Creates a new child widget with the specified config and adds it to the specified widget, optionally with the specified name.
---
#### `void` widget.removeAllChildren(`String` widgetName)
Removes all child widgets of the specified widget.
---
#### `void` widget.removeChild(`String` widgetName, `String` childName)
Removes the specified child widget from the specified widget.
---
## Widget specific callbacks
These callbacks only work for some widget types.
---
#### `String` widget.getText(`String` widgetName)
Returns the text set in a TextBoxWidget.
---
#### `void` widget.setText(`String` widgetName, `String` text)
Sets the text of: LabelWidget, ButtonWidget, TextBoxWidget
---
#### `void` widget.setFontColor(`String` widgetName, `Color` color)
Sets the font color of: LabelWidget, ButtonWidget, TextBoxWidget
---
#### `void` widget.setImage(`String` widgetName, `String` imagePath)
Sets the image of an ImageWidget.
---
#### `void` widget.setImageScale(`String` widgetName, `float` imageScale)
Sets the scale of an ImageWidget.
---
#### `void` widget.setImageRotation(`String` widgetName, `float` imageRotation)
Sets the rotation of an ImageWidget.
---
#### `void` widget.setButtonEnabled(`String` widgetName, `bool` enabled)
Sets whether the ButtonWidget should be enabled.
---
#### `void` widget.setButtonImage(`String` widgetName, `String` baseImage)
Sets the baseImage of a ButtonWidget.
---
#### `void` widget.setButtonImages(`String` widgetName, `Json` imageSet)
Sets the full image set of a ButtonWidget.
```
{
base = "image.png",
hover = "image.png",
pressed = "image.png",
disabled = "image.png",
}
```
---
#### `void` widget.setButtonCheckedImages(`String` widgetName, `Json` imageSet)
Similar to widget.setButtonImages, but sets the images used for the checked state of a checkable ButtonWidget.
---
#### `void` widget.setButtonOverlayImage(`String` widgetName, `String` overlayImage)
Sets the overlay image of a ButtonWidget.
---
#### `bool` widget.getChecked(`String` widgetName)
Returns whether the ButtonWidget is checked.
---
#### `void` widget.setChecked(`String` widgetName, `bool` checked)
Sets whether a ButtonWidget is checked
---
#### `int` widget.getSelectedOption(`String` widgetName)
Returns the index of the selected option in a ButtonGroupWidget.
---
#### `int` widget.getSelectedData(`String` widgetName)
Returns the data of the selected option in a ButtonGroupWidget. Nil if no option is selected.
---
#### `void` widget.setSelectedOption(`String` widgetName, `int` index)
Sets the selected option index of a ButtonGroupWidget.
---
#### `void` widget.setOptionEnabled(`String` widgetName, `int` index, `bool` enabled)
Sets whether a ButtonGroupWidget option should be enabled.
---
#### `void` widget.setOptionVisible(`String` widgetName, `int` index, `bool`, visible)
Sets whether a ButtonGroupWidget option should be visible.
---
#### `void` widget.setProgress(`String` widgetName, `float` value)
Sets the progress of a ProgressWidget. Value should be between 0.0 and 1.0.
---
#### `void` widget.setSliderEnabled(`String` widgetName, `bool` enabled)
Sets whether the SliderBarWidget should be enabled.
---
#### `float` widget.getSliderValue(`String` widgetName)
Gets the current value of a SliderBarWidget.
---
#### `void` widget.setSliderValue(`String` widgetName, `int` newValue)
Sets the current value of a SliderBarWidget.
---
#### `void` widget.getSliderRange(`String` widgetName, `int` newMin, `int` newMax, [`int` newDelta])
Sets the minimum, maximum and (optionally) delta values of a SliderBarWidget.
---
#### `void` widget.clearListItems(`String` widgetName)
Clears all items in a ListWidget.
---
#### `String` widget.addListItem(`String` widgetName)
Adds a list item to a ListWidget using the configured template, and returns the name of the added list item.
---
#### `void` widget.removeListItem(`String` widgetName, `size_t` at)
Removes a list item from a ListWidget at a specific index.
---
#### `String` widget.getListSelected(`String` widgetName)
Returns the name of the currently selected widget in a ListWidget.
---
#### `void` widget.setListSelected(`String` widgetName, `String` selected)
Sets the selected widget of a ListWidget.
---
#### `void` widget.registerMemberCallback(`String` widgetName, `String` callbackName, `LuaFunction` callback)
Registers a member callback for a ListWidget's list items to use.
---
#### `ItemBag` widget.itemGridItems(`String` widgetName)
Returns the full item bag contents of an ItemGridWidget.
---
#### `ItemDescriptor` widget.itemSlotItem(`String` widgetName)
Returns the descriptor of the item in the specified item slot widget.
---
#### `void` widget.setItemSlotItem(`String` widgetName, `Json` itemDescriptor)
Sets the item in the specified item slot widget.
---
#### `void` widget.setItemSlotProgress(`String` widgetName, `float` progress)
Sets the progress overlay on the item slot to the specified value (between 0 and 1).
---
#### `CanvasWidget` widget.bindCanvas(`String` widgetName)
Binds the canvas widget with the specified name as userdata for easy access. The `CanvasWidget` has the following methods:
##### `Vec2I` size()
Returns the size of the canvas.
##### `void` clear()
Clears the canvas.
##### `Vec2I` mousePosition()
Returns the mouse position relative to the canvas.
##### `void` drawImage(`String` image, `Vec2F` position, [`float` scale], [`Color` color], [`bool` centered])
Draws an image to the canvas.
##### `void` drawImageDrawable(`String` image, `Vec2F` position, [`Variant<Vec2F, float>` scale], [`Color` color], [`float` rotation])
Draws an image to the canvas, centered on position, with slightly different options.
##### `void` drawImageRect(`String` texName, `RectF` texCoords, `RectF` screenCoords, [`Color` color])
Draws a rect section of a texture to a rect section of the canvas.
##### `void` drawTiledImage(`String` image, `Vec2F` offset, `RectF` screenCoords, [`float` scale], [`Color` color])
Draws an image tiled (and wrapping) within the specified screen area.
##### `void` drawLine(`Vec2F` start, `Vec2F` end, [`Color` color], [`float` lineWidth])
Draws a line on the canvas.
##### `void` drawRect(`RectF` rect, `Color` color)
Draws a filled rectangle on the canvas.
##### `void` drawPoly(`PolyF` poly, `Color` color, [`float` lineWidth])
Draws a polygon on the canvas.
##### `void` drawTriangles(`List<PolyF>` triangles, [`Color` color])
Draws a list of filled triangles to the canvas.
##### `void` drawText(`String` text, `Json` textPositioning, `unsigned` fontSize, [`Color` color])
Draws text on the canvas. textPositioning is in the format:
```lua
{
position = {0, 0}
horizontalAnchor = "left", -- left, mid, right
verticalAnchor = "top", -- top, mid, bottom
wrapWidth = nil -- wrap width in pixels or nil
}
```

1020
doc/lua/world.md Normal file

File diff suppressed because it is too large Load Diff

6
scripts/distclean.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
cd "`dirname \"$0\"`/.."
rm -rf build
rm -rf dist

View File

@ -0,0 +1,16 @@
#!/bin/bash
cd "`dirname \"$0\"`"
cd ../assets/packed/tiles/;
THISMAT=0;
for i in $(grep materialId */*.material | awk '{print $4}' | sort -n );
do
THISMAT=$(($THISMAT+1));
if [ ${i%?} -ne $THISMAT ];
then
echo "Skipped $THISMAT to $((${i%?}-1))";
THISMAT=${i%?};
fi;
done;

11
scripts/format-source.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
cd "`dirname \"$0\"`/../source"
: ${CLANG_FORMAT:=clang-format}
for file in *; do
if [ $file != "extern" -a -d $file ]; then
find $file \( -name '*.cpp' -or -name '*.hpp' \) -exec $CLANG_FORMAT -fallback-style=none -i {} \;
fi
done

View File

@ -0,0 +1,98 @@
#!/bin/sh -e
mkdir client_distribution
mkdir client_distribution/assets
mkdir client_distribution/tiled
./linux_binaries/asset_packer -c scripts/packing.config assets/packed client_distribution/assets/packed.pak
cp -r assets/user client_distribution/assets/
cp -r tiled/packed client_distribution/tiled/
cp -r doc client_distribution/doc
mkdir client_distribution/mods
touch client_distribution/mods/mods_go_here
mkdir client_distribution/win64
cp -r \
windows64_binaries/starbound.exe \
windows64_binaries/starbound.pdb \
windows64_binaries/starbound_server.exe \
windows64_binaries/mod_uploader.exe \
windows64_binaries/*.dll \
windows64_binaries/iconengines \
windows64_binaries/imageformats \
windows64_binaries/platforms \
windows64_binaries/translations \
scripts/gitlab-ci/windows64/sbinit.config \
client_distribution/win64/
mkdir client_distribution/win32
cp \
windows32_binaries/starbound.exe \
windows32_binaries/starbound.pdb \
windows32_binaries/starbound_server.exe \
windows32_binaries/asset_packer.exe \
windows32_binaries/asset_unpacker.exe \
windows32_binaries/dump_versioned_json.exe \
windows32_binaries/make_versioned_json.exe \
windows32_binaries/planet_mapgen.exe \
windows32_binaries/*.dll \
scripts/gitlab-ci/windows32/sbinit.config \
client_distribution/win32/
mkdir client_distribution/osx
cp -LR scripts/gitlab-ci/macos/Starbound.app client_distribution/osx/
mkdir client_distribution/osx/Starbound.app/Contents/MacOS
cp macos_binaries/starbound client_distribution/osx/Starbound.app/Contents/MacOS/
cp macos_binaries/*.dylib client_distribution/osx/Starbound.app/Contents/MacOS/
cp \
macos_binaries/starbound_server \
macos_binaries/asset_packer \
macos_binaries/asset_unpacker \
macos_binaries/dump_versioned_json \
macos_binaries/make_versioned_json \
macos_binaries/planet_mapgen \
scripts/gitlab-ci/macos/sbinit.config \
scripts/gitlab-ci/macos/run-server.sh \
client_distribution/osx/
mkdir client_distribution/linux
cp \
linux_binaries/starbound \
linux_binaries/starbound_server \
linux_binaries/asset_packer \
linux_binaries/asset_unpacker \
linux_binaries/dump_versioned_json \
linux_binaries/make_versioned_json \
linux_binaries/planet_mapgen \
linux_binaries/*.so \
scripts/gitlab-ci/linux/sbinit.config \
scripts/gitlab-ci/linux/run-client.sh \
scripts/gitlab-ci/linux/run-server.sh \
client_distribution/linux/
mkdir server_distribution
mkdir server_distribution/assets
mkdir server_distribution/mods
touch server_distribution/mods/mods_go_here
./linux_binaries/asset_packer -c scripts/packing.config -s assets/packed server_distribution/assets/packed.pak
mkdir server_distribution/win64
mkdir server_distribution/linux
cp \
linux_binaries/starbound_server \
linux_binaries/*.so \
scripts/gitlab-ci/linux/run-server.sh \
scripts/gitlab-ci/linux/sbinit.config \
server_distribution/linux/
cp \
windows64_binaries/starbound_server.exe \
windows64_binaries/*.dll \
scripts/gitlab-ci/windows64/sbinit.config \
server_distribution/win64/

View File

@ -0,0 +1,22 @@
#!/bin/sh -e
mkdir -p build
cd build
rm -f CMakeCache.txt
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DSTAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX=ON \
-DSTAR_USE_JEMALLOC=ON \
-DSTAR_ENABLE_STEAM_INTEGRATION=ON \
-DCMAKE_INCLUDE_PATH=../lib/linux/include \
-DCMAKE_LIBRARY_PATH=../lib/linux \
../source
make -j2
cd ..
mv dist linux_binaries
cp lib/linux/*.so linux_binaries/

View File

@ -0,0 +1,5 @@
#!/bin/sh
cd "`dirname \"$0\"`"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:./" ./starbound "$@"

View File

@ -0,0 +1,22 @@
#!/bin/sh
cd "`dirname \"$0\"`"
terms="
x-terminal-emulator
konsole
gnome-terminal.wrapper
xfce4-terminal.wrapper
koi8rxterm
lxterm
uxterm
xterm"
for term in $terms; do
$term -e ./starbound_server $@
if [ $? -eq 0 ]; then
exit 0;
fi
done
exit 1

View File

@ -0,0 +1,8 @@
{
"assetDirectories" : [
"../assets/",
"../mods/"
],
"storageDirectory" : "../storage/"
}

View File

@ -0,0 +1,8 @@
#!/bin/sh -e
cd linux_binaries
cp ../scripts/linux/sbinit.config .
./core_tests
./game_tests

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleGetInfoString</key>
<string>Starbound</string>
<key>CFBundleExecutable</key>
<string>starbound</string>
<key>CFBundleIdentifier</key>
<string>com.chucklefish</string>
<key>CFBundleName</key>
<string>starbound</string>
<key>CFBundleIconFile</key>
<string>starbound</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSEnvironment</key>
<dict>
<key>MinimumSystemVersion</key>
<string>10.9.0</string>
</dict>
<key>SDL_FILESYSTEM_BASE_DIR_TYPE</key>
<string>parent</string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
#!/bin/sh -e
mkdir -p build
cd build
rm -f CMakeCache.txt
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DSTAR_ENABLE_STATIC_LIBGCC_LIBSTDCXX=ON \
-DSTAR_USE_JEMALLOC=OFF \
-DSTAR_ENABLE_STEAM_INTEGRATION=ON \
-DSTAR_ENABLE_DISCORD_INTEGRATION=ON \
-DCMAKE_INCLUDE_PATH=../lib/osx/include \
-DCMAKE_LIBRARY_PATH=../lib/osx \
-DCMAKE_OSX_SYSROOT=/ \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
../source
make -j2
cd ..
mv dist macos_binaries
cp lib/osx/*.dylib macos_binaries/

View File

@ -0,0 +1,11 @@
#!/bin/sh -e
cd "`dirname \"$0\"`"
osascript <<END
tell application "Terminal"
do script "cd \"`pwd`\";./starbound_server $@;exit"
end tell
END

View File

@ -0,0 +1,8 @@
{
"assetDirectories" : [
"../assets/",
"../mods/"
],
"storageDirectory" : "../storage/"
}

View File

@ -0,0 +1,9 @@
#!/bin/sh -e
cd macos_binaries
cp ../scripts/osx/sbinit.config .
./core_tests
./game_tests

View File

@ -0,0 +1,43 @@
#!/bin/sh -e
mkdir client_win32_win64
cp -r \
client_distribution/assets \
client_distribution/doc \
client_distribution/mods \
client_distribution/tiled \
client_distribution/win32 \
client_distribution/win64 \
client_win32_win64
mkdir client_linux
cp -r \
client_distribution/assets \
client_distribution/doc \
client_distribution/mods \
client_distribution/tiled \
client_distribution/linux \
client_linux
mkdir client_macos
cp -r \
client_distribution/assets \
client_distribution/doc \
client_distribution/mods \
client_distribution/tiled \
client_distribution/osx \
client_macos
mkdir server_win64
cp -r \
server_distribution/assets \
server_distribution/mods \
server_distribution/win64 \
server_win64
mkdir server_linux
cp -r \
server_distribution/assets \
server_distribution/mods \
server_distribution/linux \
server_linux

View File

@ -0,0 +1,25 @@
set CMAKE_PREFIX_PATH="C:\Program Files\CMake"
set PATH=%PATH%;%CMAKE_PREFIX_PATH%\bin;%QT_PREFIX_PATH%\bin
mkdir build
cd build || exit /b 1
del /f CMakeCache.txt
cmake.exe ^
-G"Visual Studio 14" ^
-T"v140_xp" ^
-DSTAR_ENABLE_STATIC_MSVC_RUNTIME=ON ^
-DSTAR_ENABLE_STEAM_INTEGRATION=ON ^
-DSTAR_ENABLE_DISCORD_INTEGRATION=ON ^
-DCMAKE_INCLUDE_PATH="..\lib\windows32\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows32" ^
..\source || exit /b 1
cmake.exe --build . --config RelWithDebInfo || exit /b 1
cd ..
move dist windows32_binaries || exit /b 1
copy lib\windows32\*.dll windows32_binaries\ || exit /b 1

View File

@ -0,0 +1,14 @@
{
"assetDirectories" : [
"..\\assets\\",
"..\\mods\\"
],
"storageDirectory" : "..\\storage\\",
"defaultConfiguration" : {
"gameServerBind" : "*",
"queryServerBind" : "*",
"rconServerBind" : "*"
}
}

View File

@ -0,0 +1,8 @@
cd windows32_binaries
set PATH="%PATH%;..\lib\windows32"
copy ..\scripts\windows\sbinit.config .
.\core_tests || exit /b 1
.\game_tests || exit /b 1

View File

@ -0,0 +1,30 @@
set QT_PREFIX_PATH="C:\Qt\5.7\msvc2015_64"
set CMAKE_PREFIX_PATH="C:\Program Files\CMake"
set PATH=%PATH%;%CMAKE_PREFIX_PATH%\bin;%QT_PREFIX_PATH%\bin
mkdir build
cd build || exit /b 1
del /f CMakeCache.txt
cmake.exe ^
-G"Visual Studio 14 Win64" ^
-T"v140" ^
-DCMAKE_PREFIX_PATH=%QT_PREFIX_PATH% ^
-DSTAR_USE_JEMALLOC=OFF ^
-DSTAR_ENABLE_STEAM_INTEGRATION=ON ^
-DSTAR_ENABLE_DISCORD_INTEGRATION=ON ^
-DSTAR_BUILD_QT_TOOLS=ON ^
-DCMAKE_INCLUDE_PATH="..\lib\windows64\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows64" ^
..\source || exit /b 1
cmake.exe --build . --config RelWithDebInfo || exit /b 1
cd ..
move dist windows64_binaries || exit /b 1
windeployqt.exe windows64_binaries\mod_uploader.exe || exit /b 1
copy lib\windows64\*.dll windows64_binaries\ || exit /b 1

View File

@ -0,0 +1,14 @@
{
"assetDirectories" : [
"..\\assets\\",
"..\\mods\\"
],
"storageDirectory" : "..\\storage\\",
"defaultConfiguration" : {
"gameServerBind" : "*",
"queryServerBind" : "*",
"rconServerBind" : "*"
}
}

View File

@ -0,0 +1,8 @@
cd windows64_binaries
set PATH="%PATH%;..\lib\windows64"
copy ..\scripts\windows\sbinit.config .
.\core_tests || exit /b 1
.\game_tests || exit /b 1

View File

@ -0,0 +1,16 @@
{
"cmd": "make -Cbuild",
"name": "starbound",
"args": [],
"sh": true,
"env": {},
"errorMatch": "^(?<file>[^\\.]+.hs):(?<line>\\d+):(?<col>\\d+)",
"targets": {
"build": {
"cmd": "make -Cbuild build"
},
"clean": {
"cmd": "make -Cbuild clean"
}
}
}

View File

@ -0,0 +1,12 @@
-Isource/application/
-Isource/core/
-Isource/extern/
-Isource/frontend/
-Isource/game/
-Isource/game/interfaces/
-Isource/game/items/
-Isource/game/objects/
-Isource/game/scripting/
-Isource/game/terrain/
-Isource/graphics/
-Isource/windowing/

View File

@ -0,0 +1 @@
-Wall -Wextra -Wuninitialized -Wno-parentheses-equality -Qunused-arguments -Wno-deprecated-declarations -Woverloaded-virtual -Wnon-virtual-dtor -Winit-self

View File

@ -0,0 +1,12 @@
source/application/
source/core/
source/extern/
source/frontend/
source/game/
source/game/interfaces/
source/game/items/
source/game/objects/
source/game/scripting/
source/game/terrain/
source/graphics/
source/windowing/

View File

@ -0,0 +1,11 @@
#!/bin/sh
cd "`dirname \"$0\"`/../source"
for file in *; do
if [ $file != "extern" -a -d $file ]; then
# This is not bulletproof, this will break if the last character on a line
# is an *escaped* quote.
find $file \( -name '*.cpp' -or -name '*.hpp' \) -exec perl -0777 -i -pe 's/\"\s*\n\s*\"//igs' {} \;
fi
done

View File

@ -0,0 +1,21 @@
#!/bin/sh -e
cd "`dirname \"$0\"`/../.."
for OBJECT in $(find assets/ -name *.object); do
EXISTING_TAGS=$(./dist/json_tool --opt '/tags' "$OBJECT")
if test "x$EXISTING_TAGS" != "x"; then
echo "Skipping $OBJECT; it already has tags..."
continue
fi
echo "Automatically tagging $OBJECT"
RACE_TAGS=$(./dist/json_tool --opt '/race' "$OBJECT" --array)
CATEGORY_TAGS=$(./dist/json_tool --opt '/category' "$OBJECT" --array)
TYPE_TAGS=$(./dist/json_tool --opt '/objectType' "$OBJECT" --array)
TAGS=$(./dist/json_tool -j "$RACE_TAGS" -j "$CATEGORY_TAGS" -j "$TYPE_TAGS" --get '/*' --array-unique)
./dist/json_tool -i --set '/tags' "$TAGS" --after objectName "$OBJECT"
done

View File

@ -0,0 +1,6 @@
#!/bin/sh -e
cd "`dirname \"$0\"`/../../dist"
./map_grep "invalid=true" ../assets/packed/dungeons/
./map_grep "invalid=true" ../assets/devel/dungeons/

View File

@ -0,0 +1,5 @@
#!/bin/sh -e
cd "`dirname \"$0\"`/../.."
./dist/json_tool --find ./assets .object --edit '/tags' --input csv --after objectName --editor-image '/orientations/0/imageLayers/0/image' --editor-image '/orientations/0/dualImage' --editor-image '/orientations/0/image' --editor-image '/orientations/0/leftImage'

View File

@ -0,0 +1,20 @@
{
"assetDirectories" : [
"../assets/",
"./mods/"
],
"storageDirectory" : "./",
"assetsSettings" : {
"pathIgnore" : [],
"digestIgnore" : [
".*"
]
},
"defaultConfiguration" : {
"allowAdminCommandsFromAnyone" : true,
"anonymousConnectionsAreAdmin" : true
}
}

27
scripts/linux/setup.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/sh
cd "`dirname \"$0\"`/../.."
mkdir -p dist
cp scripts/linux/sbinit.config dist/
mkdir -p build
cd build
if [ -d /usr/lib/ccache ]; then
export PATH=/usr/lib/ccache/:$PATH
fi
LINUX_LIB_DIR=../lib/linux
cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_BUILD_TYPE=RelWithAsserts \
-DSTAR_USE_JEMALLOC=ON \
-DCMAKE_INCLUDE_PATH=$LINUX_LIB_DIR/include \
-DCMAKE_LIBRARY_PATH=$LINUX_LIB_DIR/ \
../source
if [ $# -ne 0 ]; then
make -j$*
fi

View File

@ -0,0 +1,149 @@
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-fexceptions',
'-DNDEBUG',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++11',
'-stdlib=libc++',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x', 'c++'
]
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = '/home/catherine/starbound/build'
if compilation_database_folder:
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}

View File

@ -0,0 +1,6 @@
#!/bin/sh
cd "$(dirname $0)/../.."
cd build
make -j3

View File

@ -0,0 +1,9 @@
#!/bin/sh -e
cd "`dirname \"$0\"`/../../dist"
STEAM_INSTALL_DIR="$HOME/Library/Application Support/Steam/steamapps/common/Starbound - Unstable"
./asset_packer -c ../scripts/packing.config ../assets/packed ./packed.pak
mv packed.pak "$STEAM_INSTALL_DIR/assets/packed.pak"
cp starbound "$STEAM_INSTALL_DIR/osx/Starbound.app/Contents/MacOS/"

View File

@ -0,0 +1,7 @@
#!/bin/sh -e
cd "`dirname \"$0\"`/../../dist"
cp ../scripts/steam_appid.txt .
DYLD_INSERT_LIBRARIES=~/Library/Application\ Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/gameoverlayrenderer.dylib DYLD_LIBRARY_PATH=../lib/osx/ $@

6
scripts/osx/run.command Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
cd "$(dirname $0)/../.."
cd dist
./starbound

23
scripts/osx/sbinit.config Normal file
View File

@ -0,0 +1,23 @@
{
"assetDirectories" : [
"../assets/",
"./mods/"
],
"storageDirectory" : "./",
"assetsSettings" : {
"pathIgnore" : [],
"digestIgnore" : [
".*"
]
},
"defaultConfiguration" : {
"allowAdminCommandsFromAnyone" : true,
"anonymousConnectionsAreAdmin" : true,
"bindings" : {
"KeybindingClear" : [ { "type" : "key", "value" : "Del", "mods" : [] } ]
}
}
}

17
scripts/osx/setup.command Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
cd "$(dirname $0)/../.."
mkdir -p dist
cp scripts/osx/sbinit.config dist/
mkdir -p build
cd build
CC=clang CXX=clang++ /Applications/CMake.app/Contents/bin/cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=true \
-DCMAKE_BUILD_TYPE=RelWithAsserts \
-DSTAR_USE_JEMALLOC=ON \
-DCMAKE_INCLUDE_PATH=../lib/osx/include \
-DCMAKE_LIBRARY_PATH=../lib/osx/ \
../source

29
scripts/osx/setup.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
cd "`dirname \"$0\"`/../.."
mkdir -p dist
cp scripts/osx/sbinit.config dist/
mkdir -p build
cd build
QT5_INSTALL_PATH=/usr/local/opt/qt5
if [ -d $QT5_INSTALL_PATH ]; then
export PATH=$QT5_INSTALL_PATH/bin:$PATH
export LDFLAGS=-L$QT5_INSTALL_PATH/lib
export CPPFLAGS=-I$QT5_INSTALL_PATH/include
export CMAKE_PREFIX_PATH=$QT5_INSTALL_PATH
BUILD_QT_TOOLS=ON
else
BUILD_QT_TOOLS=OFF
fi
CC=clang CXX=clang++ cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=true \
-DCMAKE_BUILD_TYPE=RelWithAsserts \
-DSTAR_BUILD_QT_TOOLS=$BUILD_QT_TOOLS \
-DSTAR_USE_JEMALLOC=ON \
-DCMAKE_INCLUDE_PATH=../lib/osx/include \
-DCMAKE_LIBRARY_PATH=../lib/osx/ \
../source

View File

@ -0,0 +1,160 @@
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
import os
import ycm_core
# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-fexceptions',
'-DNDEBUG',
# THIS IS IMPORTANT! Without a "-std=<something>" flag, clang won't know which
# language to use when compiling headers. So it will guess. Badly. So C++
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# For a C project, you would set this to something like 'c99' instead of
# 'c++11'.
'-std=c++14',
'-stdlib=libc++',
# ...and the same thing goes for the magic -x option which specifies the
# language that the files to be compiled are written in. This is mostly
# relevant for c++ headers.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x', 'c++'
]
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = '/Users/catherine/Documents/starbound/build'
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
# Workaround for clang bug regarding default paths in compiling from
# libclang.so vs the clang binary
final_flags.extend([
"-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/",
"-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.0.2/include"
])
return {
'flags': final_flags,
'do_cache': True
}

69
scripts/packing.config Normal file
View File

@ -0,0 +1,69 @@
{
"globalIgnore" : [
"/\\.",
"/~",
"thumbs\\.db$",
"\\.bak$",
"\\.tmp$",
"\\.zip$",
"\\.orig$",
"\\.fail$",
"\\.psd$",
"\\.tmx$"
],
"serverIgnore" : [
"\\.ogg$",
"\\.wav$"
],
"extensionOrdering" : [
"",
"config",
"bush",
"grass",
"modularfoliage",
"modularstem",
"projectile",
"monstertype",
"monsterpart",
"npctype",
"npctype",
"vehicle",
"particle",
"animation",
"object",
"liquid",
"material",
"object",
"coin",
"miningtool",
"flashlight",
"wiretool",
"beamminingtool",
"harvestingtool",
"tillingtool",
"paintingbeamtool",
"headarmor",
"chestarmor",
"legsarmor",
"backarmor",
"consumable",
"blueprint",
"codex",
"techitem",
"instrument",
"grapplinghook",
"thrownitem",
"unlockitem",
"activeitem",
"augmentitem",
"material",
"matmod",
"lua",
"frames",
"png",
"wav",
"ogg"
]
}

1
scripts/steam_appid.txt Normal file
View File

@ -0,0 +1 @@
367540

View File

@ -0,0 +1,7 @@
cd /d %~dp0
cd ..\..
cd build
IF %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
"C:\Program Files (x86)\CMake\bin\cmake.exe" --build . --config %1

View File

@ -0,0 +1,8 @@
cd /d %~dp0
cd ..\..\dist
set STEAM_STARBOUND_DIR=c:\Program Files (x86)\Steam\steamapps\common\Starbound - Unstable
.\asset_packer.exe -c ..\assets\packing.config "custom assets" ..\assets\packed .\packed.pak
move packed.pak "%STEAM_STARBOUND_DIR%\assets\packed.pak"
copy starbound.exe "%STEAM_STARBOUND_DIR%\win32\"

View File

@ -0,0 +1,8 @@
cd /d %~dp0
cd ..\..\dist
set STEAM_STARBOUND_DIR=c:\Program Files (x86)\Steam\steamapps\common\Starbound - Unstable
.\asset_packer.exe -c ..\assets\packing.config "custom assets" ..\assets\packed .\packed.pak
move packed.pak "%STEAM_STARBOUND_DIR%\assets\packed.pak"
copy starbound.exe "%STEAM_STARBOUND_DIR%\win64\"

View File

@ -0,0 +1,7 @@
pushd %~dp0
pushd ..\..\dist
map_grep "invalid=true" ..\assets\packed\dungeons\
map_grep "invalid=true" ..\assets\devel\dungeons\
pause
popd
popd

View File

@ -0,0 +1,24 @@
{
"assetDirectories" : [
"..\\assets\\",
".\\mods\\"
],
"storageDirectory" : ".\\",
"assetsSettings" : {
"pathIgnore" : [],
"digestIgnore" : [
".*"
]
},
"defaultConfiguration" : {
"allowAdminCommandsFromAnyone" : true,
"anonymousConnectionsAreAdmin" : true,
"gameServerBind" : "*",
"queryServerBind" : "*",
"rconServerBind" : "*"
}
}

View File

@ -0,0 +1,44 @@
cd /d %~dp0
cd ..\..
mkdir dist
del dist\*.dll
copy lib\windows32\*.dll dist\
copy scripts\windows\sbinit.config dist\
mkdir build
cd build
if exist "C:\Program Files (x86)\CMake\bin" (
set CMAKE_EXE_PATH="C:\Program Files (x86)\CMake\bin"
) else (
set CMAKE_EXE_PATH="C:\Program Files\CMake\bin"
)
set QT_PREFIX_PATH=C:\Qt\5.6\msvc2015
if exist %QT_PREFIX_PATH% (
%CMAKE_EXE_PATH%\cmake.exe ^
..\source ^
-G"Visual Studio 14" ^
-T"v140_xp" ^
-DSTAR_USE_JEMALLOC=OFF ^
-DCMAKE_PREFIX_PATH=%QT_PREFIX_PATH% ^
-DSTAR_BUILD_QT_TOOLS=ON ^
-DCMAKE_INCLUDE_PATH="..\lib\windows32\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows32"
) else (
%CMAKE_EXE_PATH%\cmake.exe ^
..\source ^
-G "Visual Studio 14" ^
-T"v140_xp" ^
-DSTAR_USE_JEMALLOC=OFF ^
-DCMAKE_INCLUDE_PATH="..\lib\windows32\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows32"
)
pause

View File

@ -0,0 +1,42 @@
cd /d %~dp0
cd ..\..
mkdir dist
del dist\*.dll
copy lib\windows64\*.dll dist\
copy scripts\windows\sbinit.config dist\
mkdir build
cd build
if exist "C:\Program Files (x86)\CMake\bin" (
set CMAKE_EXE_PATH="C:\Program Files (x86)\CMake\bin"
) else (
set CMAKE_EXE_PATH="C:\Program Files\CMake\bin"
)
set QT_PREFIX_PATH=C:\Qt\5.6\msvc2015_64
if exist %QT_PREFIX_PATH% (
%CMAKE_EXE_PATH%\cmake.exe ^
..\source ^
-G"Visual Studio 15 Win64" ^
-DSTAR_USE_JEMALLOC=ON ^
-DCMAKE_PREFIX_PATH=%QT_PREFIX_PATH% ^
-DSTAR_BUILD_QT_TOOLS=ON ^
-DCMAKE_INCLUDE_PATH="..\lib\windows64\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows64"
) else (
%CMAKE_EXE_PATH%\cmake.exe ^
..\source ^
-G "Visual Studio 15 Win64" ^
-DSTAR_USE_JEMALLOC=ON ^
-DCMAKE_INCLUDE_PATH="..\lib\windows64\include" ^
-DCMAKE_LIBRARY_PATH="..\lib\windows64"
)
pause

View File

@ -0,0 +1 @@
powershell.exe -command "Get-Content -Path '%cd%\..\..\dist\starbound.log' -Wait"

Some files were not shown because too many files have changed in this diff Show More