diff --git a/CREDITS.txt b/CREDITS.txt index aae96c4..1cccc80 100644 --- a/CREDITS.txt +++ b/CREDITS.txt @@ -1,40 +1,29 @@ -DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS. +This was out of date. I'm going to try and collate all the names. +If your name is missing, please prod us (even if we don't use your contribution anymore) +and we'll chuck it in. -GreaseMonkey [Lead Developer]: - Everything other people didn't. +Lead Developer + the guy who started the project out of frustration: + GreaseMonkey +And the rest in alphabetical order, without whom this project would not have been possible to run without a degree and a supercomputer: + 10se1ucgo + Articsledder + BR + Bully + Dany0 + learn_more + melchips + rakiru + Sonarpulse + topo + Triplefox + ulyssecarion + UnrealIncident +Special thanks to: + BR, for your countless contributions to the code and whatnot. + melchips, for your seriously awesome work on the OpenGL renderer. + rakiru, for hosting the server from day 42 (as well as some other cool things too). + Triplefox, for your GUI system I *still* have yet to learn how to use, + and the many other contributions you did earlier on. -And the rest in alphabetical order: - -Arctic77: - Rifle model added January 2013 - -BR: - Player name list - Team switching - "Are you sure?" on quit - Improved key binding system - -Dany0: - Czech translation - -Ericson2314: - Rearranged the build tree - Added an SSE-optimised matrix-vector multiply - -rakiru: - Scroll wheel to switch tools - Lent his VPS to host an Iceball server - -topo: - FPS counter - Basic key binding system - -Triplefox: - Widget system (in progress) - Miscellaneous utility functions - Kindly let me use his map, mesa.vxl - -UnrealIncident: - Debug info (which is the reason I use string.format at all) \ No newline at end of file diff --git a/README.txt b/README.txt index 77eefc7..a00ad92 100644 --- a/README.txt +++ b/README.txt @@ -8,6 +8,9 @@ If you've built this for not-Windows, running ./iceball should do the same. The tutorial files are located in pkg/iceball/halp/. +If you can't run the tutorial, or you can't read the text on it, +read docs/troubleshooting.txt. + ------------------------------------------------------------------------------ LICENSING NOTES: @@ -27,7 +30,10 @@ It is marked accordingly. The manual is in the public domain, except where otherwise specified. -REQUIREMENTS: +MINIMUM SYSTEM REQUIREMENTS: +A computer. + +BUILDING REQUIREMENTS: - a C compiler that isn't crap (read: not MSVC++) - specifically, GCC - MinGW is a port of GCC for Windows: http://mingw.org/ @@ -38,15 +44,12 @@ REQUIREMENTS: - zlib - http://zlib.net/ - sackit - https://github.com/iamgreaser/sackit/ - you should copy libsackit.a and sackit.h to xlibinc. -- enet 1.3 - http://enet.bespin.org/ +- ENet 1.3 - http://enet.bespin.org/ - GNU make - if someone has BSD make, please tell us :) -STUFF TO DO BEFORE 0.1 CAN BE RELEASED: -- DOCS!!! (ones which aren't crap) -- make net_pack more solid -- JSON writer -- make kicking not suck +On Windows, read Makefile.mingw for some instructions. +On other OSes, some files for sackit and ENet need to be in xlibinc. MSVC readme (wip): - create a folder 'winlibs' in the iceball dir diff --git a/bigzipdist.sh b/bigzipdist.sh new file mode 100755 index 0000000..6746984 --- /dev/null +++ b/bigzipdist.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +export ZIPNAME=nubdist/iceball-0.1.zip + +#zip -r $ZIPNAME *.dll *.exe *.txt *.bat docs/ \ +# pkg/base/*.lua \ +# pkg/base/icegui/*.lua \ +# pkg/maps/mesa.vxl \ +# pkg/base/gfx/ pkg/base/pmf/ \ +# pkg/iceball/snowtest/ \ +# pkg/iceball/pmfedit/ \ +# pkg/iceball/mapedit/ \ +# dlcache/info.txt clsave/info.txt svsave/info.txt \ +# clsave/config.json clsave/pub/user.json + +zip -r $ZIPNAME *.dll *.exe *.txt opencmd.bat connect-*.bat docs/ \ + pmfedit.bat mapedit.bat \ + dlcache/info.txt clsave/info.txt \ + clsave/config.json clsave/pub/user.json \ + clsave/pub/skin/info.txt \ + clsave/vol/dummy clsave/base/vol/dummy \ + pkg/iceball/halp/ \ + pkg/base/ pkg/maps/mesa.vxl pkg/maps/mesa.vxl.tga \ + pkg/iceball/snowtest/ pkg/iceball/hack_console/ \ + pkg/iceball/pmfedit/ pkg/iceball/mapedit/ \ + svsave/info.txt \ + svsave/pub/server.json svsave/pub/mods.json svsave/base/vol/dummy svsave/vol/dummy \ + src/ include/ Makefile* CMakeLists.txt main.make \ + clsave/pub/controls.json \ + xlibinc/dummy winlibs/dummy \ + -x pkg/base/srcwav16/ pkg/base/kv6/ pkg/base/glsl/ + diff --git a/clsave/config.json b/clsave/config.json index 64efc84..b6932f2 100644 --- a/clsave/config.json +++ b/clsave/config.json @@ -3,6 +3,17 @@ This file contains configuration for the engine itself. It cannot be read by any mods. + + If you have a graphics card that's reasonably fast + and has at least 128MB of VRAM (64MB *might* cut it), + set gl_vbo to true. + (Yes, this DOES help on an Intel 3000 HD.) + If your game crashes when the map starts appearing, set it to false. + + If you have an OpenGL-2.0-capable card (or one with non-power-of-two support), + and you wish to conserve a little bit of VRAM, + set gl_expand_textures to false. + If you get white boxes, it obviously wasn't capable - set it to true. ", @@ -15,7 +26,7 @@ "antialiasinglevel": 0, "smoothlighting": true, - "gl_expand_textures": false, + "gl_expand_textures": true, "gl_chunk_size": 16, "gl_chunks_tesselated_per_frame": 4, "gl_shaders": true, diff --git a/docs/00README.txt b/docs/00README.txt index bc7b437..c9f8469 100644 --- a/docs/00README.txt +++ b/docs/00README.txt @@ -1,8 +1,3 @@ -Ignore what this said about being obsolete. -We need to move to a better system. The weird python shit is not it. -READ_THIS_FIRST.txt is a bit old. Check the forums at - http://iceballga.me -for some more useful info. - -modding_lua.txt is almost always up to date. - +This used to say these docs were obsolete. +However, we eventually got stuff sorted and now they're somewhat up to date. +So just... ignore this file. diff --git a/docs/modding_lua.txt b/docs/modding_lua.txt index 40f46db..274c4fb 100644 --- a/docs/modding_lua.txt +++ b/docs/modding_lua.txt @@ -86,12 +86,13 @@ server.hook_file = fn(neth, ftype, fname)->object can return nil to cancel the request can return true to perform the default request + can return a string to load a different file instead otherwise, return an object to be serialised currently supported values for ftype: - "icemap" - the rest must be either nil or true. + the rest must be either nil, true, or a string. client.hook_render = fn() @ sets a hook called every frame diff --git a/docs/modding_scripts.txt b/docs/modding_scripts.txt new file mode 100644 index 0000000..17e35b0 --- /dev/null +++ b/docs/modding_scripts.txt @@ -0,0 +1,38 @@ +Each mod must be in its own directory in the form of: + pkg/author/mod/ + +You can nest further so you can, for example, do: + pkg/author/mod/submod/subsubmod/thisisgettingridiculous/ + +To load mods, set up a file named svsave/pub/mods.json with a "mods" list, e.g. +{ + "mods" : [ + "pkg/iceball/hack_console/", + "pkg/iceball/snowtest/" + ] +} + +hack_console is very useful but also opens a huge gaping hole in the game that allows people to run really, really weird hacks. Don't use it on a really public server. +snowtest makes the map snow. It is not a good example of how you should code your mods - it's the oldest mod in Iceball's existance and predates iceballfornoobs-004... and the ability for the player to place blocks, for that matter. + +Each mod has a mod.json file in its root, of the form (all fields are optional): +{ + "depends": ["pkg/author/some_mod_you_depend_on", "pkg/other_author/another_mod"], + "preload": ["pre.lua"], + "preload_client": ["pre_client.lua"], + "preload_server": ["pre_server.lua"], + "load": ["load.lua"], + "load_client": ["load_client.lua"], + "load_server": ["load_server.lua"], +} + +"depends" will autoload required mods if necessary. + +"preload" executes code just after pkg/base/preconf.lua is loaded. +"load" executes code at the very end of main_server.lua / client_start.lua. +The client/server-specific versions execute after their generic counterparts. + +Currently there is no documentation on the engine itself as it may change at any time. Beware! +Have a nosey through the code to see what you can override. +pkg/iceball/hack_console/ shows you how to do a rather complex override in a *cough* "class" *cough*. + diff --git a/docs/troubleshooting.txt b/docs/troubleshooting.txt index f88020a..59985ab 100644 --- a/docs/troubleshooting.txt +++ b/docs/troubleshooting.txt @@ -43,7 +43,7 @@ In my case I tend to prepend the commandline with "gdb --args ". Someone else can elaborate here if necessary. *** How do I change my name? *** -Did you read the built-in tutorial? +Did you read the built-in tutorial? It mentioned a file. What was it called? *** Anything else? *** Join us on IRC: #iceball @ irc.quacknet.org (NOT quaKEnet!). diff --git a/include/common.h b/include/common.h index 7ca5ff8..a725982 100644 --- a/include/common.h +++ b/include/common.h @@ -16,10 +16,10 @@ */ #define VERSION_W 0 -#define VERSION_X 0 +#define VERSION_X 1 #define VERSION_Y 0 #define VERSION_A 0 -#define VERSION_Z 53 +#define VERSION_Z 0 // Remember to bump "Z" basically every time you change the engine! // Remember to bump the version in Lua too! // Remember to document API changes in a new version! diff --git a/mapedit.bat b/mapedit.bat index fb20778..c8e1593 100644 --- a/mapedit.bat +++ b/mapedit.bat @@ -1,2 +1,2 @@ -@echo off -iceball -s 0 pkg/iceball/mapedit +@echo off +iceball-gl -s 0 pkg/iceball/mapedit diff --git a/multiclient.bat b/multiclient.bat index 22c6bec..036cfbb 100644 --- a/multiclient.bat +++ b/multiclient.bat @@ -1 +1,4 @@ -iceball -c localhost 1337 \ No newline at end of file +@echo off +iceball-gl -c localhost 20737 +pause + diff --git a/multiclient_server.bat b/multiclient_server.bat index bf83b64..181dc4b 100644 --- a/multiclient_server.bat +++ b/multiclient_server.bat @@ -1 +1,4 @@ -iceball.exe -s 1337 pkg/base \ No newline at end of file +@echo off +iceball-gl.exe -d 20737 pkg/base +pause + diff --git a/pkg/base/client_start.lua b/pkg/base/client_start.lua index e10f56b..f55dff0 100644 --- a/pkg/base/client_start.lua +++ b/pkg/base/client_start.lua @@ -516,13 +516,6 @@ function h_tick_init(sec_current, sec_delta) intent[#intent+1] = new_intel({team = 1, iid = #intent+1}) intent[#intent+1] = new_tent({team = 1, iid = #intent+1}) - --[[ - chat_add(chat_text, sec_current, "Just testing the chat...", 0xFFFFFFFF) - chat_add(chat_text, sec_current, "BLUE MASTER RACE", 0xFF0000FF) - chat_add(chat_text, sec_current, "GREEN MASTER RACE", 0xFF00C000) - chat_add(chat_text, sec_current, "SALLY MASTER RACE", 0xFFAA00FF) - chat_add(chat_text, sec_current, "YOU ALL SUCK", 0xFFC00000) - ]] chat_add(chat_text, sec_current, "Welcome to Iceball!", 0xFFFF00AA) chat_add(chat_killfeed, sec_current, "If it's broken, fix it yourself.", 0xFFFF00AA) @@ -879,7 +872,7 @@ function client.hook_kick(reason) client.hook_render = new_render end +print("pkg/base/client_start.lua: Loading mods...") +load_mod_list(getfenv(), nil, {"load", "load_client"}, client_config) print("pkg/base/client_start.lua loaded.") ---dofile("pkg/base/plug_snow.lua") ---dofile("pkg/base/plug_pmfedit.lua") diff --git a/pkg/base/lib_mods.lua b/pkg/base/lib_mods.lua new file mode 100644 index 0000000..173d4e3 --- /dev/null +++ b/pkg/base/lib_mods.lua @@ -0,0 +1,109 @@ +--[[ + This file is part of Ice Lua Components. + + Ice Lua Components is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Ice Lua Components is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Ice Lua Components. If not, see . +]] + +local loaded = {} +local failed = {} +local prevmod = {} + +function get_mod_name(path) + if path ~= path:lower() then + error("Someone didn't follow the convention of all-lowercase names! This is more important than you futile Windows users think.") + end + while path:sub(path:len()) == "/" do + path = path:sub(1,path:len()-1) + end + path = path:lower() + return path +end + +function load_mod(env, path, stages, ...) + print("Loading "..path) + if failed[path] then + error("Already failed earlier") + end + failed[path] = true -- pre-fail to avoid infinite loop + local mdata = loaded[path] or common.json_load(path.."/mod.json") -- use cached version if necessary + loaded[path] = nil -- remove from loaded list just in case we fail + + -- check for any dependencies + local deps = mdata.depends + if deps then + local i + + -- pre-scan dependencies + for i=1,#deps do + if failed[deps[i]] then + error("Mod failed a dependency before we got to it: "..deps[i]) + return false + end + end + + -- load dependencies + for i=1,#deps do + load_mod(env, get_mod_name(deps[i]), stages, ...) + if not loaded[deps[i]] then + error("Dependency failed: "..deps[i]) + return false + end + end + end + + -- load our scripts + local i + local farr = {} + for i=1,#stages do + local arr = mdata[stages[i]] + if arr then + local j + + -- load files + for j=1,#arr do + local fname = path.."/"..arr[j] + print("- Loading file "..fname) + local f = loadfile(fname) + if not f then + error("Script failed to load: "..f) + return false + end + farr[#farr+1] = {fname, f} + end + end + end + + -- execute our scripts + for i=1,#farr do + -- if they throw an error... good. it can crash. + local f = farr[i][2] + setfenv(f, env) + f(...) + end + + -- add ourselves to the loaded list and unfail ourselves + loaded[path] = mdata + failed[path] = nil +end + +function load_mod_list(env, arr, stages, ...) + local i + arr = arr or prevmod + prevmod = arr + print(#arr) + for i=1,#arr do + load_mod(env, get_mod_name(arr[i]), stages, ...) + end +end + diff --git a/pkg/base/main_client.lua b/pkg/base/main_client.lua index 3b356ca..ac6066f 100644 --- a/pkg/base/main_client.lua +++ b/pkg/base/main_client.lua @@ -15,6 +15,10 @@ along with Ice Lua Components. If not, see . ]] +if common.version.num < 4194304 then + error("You need Iceball version 0.1 or later to connect to this server.") +end + function client.hook_kick(reason) print("Kicked - "..reason) function client.hook_tick() @@ -27,6 +31,11 @@ end dofile("pkg/base/preconf.lua") +-- load mod JSON files +mod_data = common.json_load("*MODCFG") +dofile("pkg/base/lib_mods.lua") +load_mod_list(getfenv(), mod_data.mods, {"preload", "preload_client"}, client_config, mod_data) + -- if you don't want music, set FILE_MUSIC to "true". FILE_MUSIC = FILE_MUSIC or "music.it" @@ -112,14 +121,6 @@ You should have at least ]]..VERSION_ENGINE.str..[[. ]]..bug_str..[[]] end --- BACKWARD COMPAT HACKS -client.camera_point_sky = client.camera_point_sky or function(dx,dy,dz,zoom,sx,sy,sz) - return client.camera_point(dx,dy,dz,zoom,0.0) -end -common.camera_point_sky = common.camera_point_sky or function(dx,dy,dz,zoom,sx,sy,sz) - return common.camera_point(dx,dy,dz,zoom,0.0) -end - -- please excuse this hack. argarr = {...} function argspew_gen(arr, idx) @@ -311,6 +312,5 @@ function client.hook_tick() return 0.005 end ---dofile("pkg/base/client_start.lua") print("pkg/base/main_client.lua loaded.") diff --git a/pkg/base/main_server.lua b/pkg/base/main_server.lua index 284494f..a01fb2c 100644 --- a/pkg/base/main_server.lua +++ b/pkg/base/main_server.lua @@ -15,22 +15,42 @@ along with Ice Lua Components. If not, see . ]] +if common.version.num < 4194304 then + error("You need Iceball version 0.1 or later to run this code.") +end + dofile("pkg/base/preconf.lua") +dofile("pkg/base/lib_util.lua") print("pkg/base/main_server.lua starting") print(...) -if common.version == nil then - error("You must have at least version 0.0-1 to run this server!" - .." iceballfornoobs-004 is FAR TOO OLD!" - .." If you are using an old git version, PLEASE UPDATE!") +-- parse arguments +local loose, server_toggles, server_settings = parse_commandline_options({...}) +local server_config_filename = server_settings['server'] or "svsave/pub/server.json" +server_config = common.json_load(server_config_filename) +-- TODO: Check that server_config ~= nil +if server_settings.svseed then + math.randomseed(0+server_settings.svseed) +elseif common.time ~= nil then + math.randomseed(common.time()) end +-- load mod config +mod_conf_file = server_config.mod_config or "svsave/pub/mods.json" +mod_data = common.json_load(mod_conf_file) + +-- load mod JSON files +dofile("pkg/base/lib_mods.lua") +load_mod_list(getfenv(), mod_data.mods, {"preload", "preload_server"}, server_config, mod_data) + dofile("pkg/base/common.lua") dofile("pkg/base/commands.lua") client_list = {fdlist={}} -server_tick_accum = 0. +server_tick_accum = 0 + +map_fname = loose[1] function slot_add(neth, tidx, wpn, name) local i @@ -68,7 +88,6 @@ function slot_add(neth, tidx, wpn, name) return nil end - function server.hook_file(neth, ftype, fname) print("hook_file:", neth, ftype, fname) local cli = client_list[neth] @@ -80,6 +99,8 @@ function server.hook_file(neth, ftype, fname) if (ftype == "icemap" or ftype == "map") and (fname == "*MAP") then return map_loaded + elseif (ftype == "json") and (fname == "*MODCFG") then + return mod_conf_file elseif (ftype == "tga") and (fname == "*MAPIMG") then if map_fname then return map_fname..".tga" @@ -236,18 +257,6 @@ function server.hook_tick(sec_current, sec_delta) return 0.005 end --- parse arguments - -local loose, server_toggles, server_settings = parse_commandline_options({...}) -local server_config_filename = server_settings['server'] or "svsave/pub/server.json" -server_config = common.json_load(server_config_filename) --- TODO: Check that server_config ~= nil -if server_settings.svseed then - math.randomseed(0+server_settings.svseed) -elseif common.time ~= nil then - math.randomseed(common.time()) -end - permissions = {} if server_config.permissions ~= nil then @@ -333,12 +342,8 @@ if server_config.permissions ~= nil then end -- load map -map_fname = loose[1] ---[[map_fname = map_fname or MAP_DEFAULT -map_loaded = common.map_load(map_fname, "auto") -]] -if map_fname == "flat" then - map_loaded = loadfile("pkg/base/gen_flat.lua")(loose, server_toggles, server_settings) +if server_settings.gen then + map_loaded = loadfile(server_settings.gen)(loose, server_toggles, server_settings) elseif map_fname then map_loaded = common.map_load(map_fname, "auto") else @@ -358,4 +363,7 @@ do end end +print("pkg/base/main_server.lua: Loading mods...") +load_mod_list(getfenv(), mod_data.mods, {"load", "load_server"}, server_config, mod_data) print("pkg/base/main_server.lua loaded.") + diff --git a/pkg/base/obj_player.lua b/pkg/base/obj_player.lua index 8596230..5f9fea7 100644 --- a/pkg/base/obj_player.lua +++ b/pkg/base/obj_player.lua @@ -1854,22 +1854,13 @@ function new_player(settings) end function this.typing_text.on_return(options) - if this.typing_text.text ~= "" then - if string.sub(this.typing_text.text,1,1) == "~" then - local a,b - a,b = pcall(function () loadstring(string.sub(this.typing_text.text,2))() end) --nasty, but handy - if not a then - print("quickcall err:", b) - end - else - if this.typing_type.text == "Chat: " then - net_send(nil, common.net_pack("Bz", PKT_CHAT_SEND, this.typing_text.text)) - elseif this.typing_type.text == "Team: " then - net_send(nil, common.net_pack("Bz", PKT_CHAT_SEND_TEAM, this.typing_text.text)) - elseif this.typing_type.text == "Squad: " then - net_send(nil, common.net_pack("Bz", PKT_CHAT_SEND_SQUAD, this.typing_text.text)) - end + if this.typing_type.text == "Chat: " then + net_send(nil, common.net_pack("Bz", PKT_CHAT_SEND, this.typing_text.text)) + elseif this.typing_type.text == "Team: " then + net_send(nil, common.net_pack("Bz", PKT_CHAT_SEND_TEAM, this.typing_text.text)) + elseif this.typing_type.text == "Squad: " then + net_send(nil, common.net_pack("Bz", PKT_CHAT_SEND_SQUAD, this.typing_text.text)) end end @@ -1946,7 +1937,8 @@ function new_player(settings) "#", "Score", "K", - "D"}) + "D", + "?"}) for row=1, #v do local squad = "" local plr = v[row] @@ -1972,7 +1964,9 @@ function new_player(settings) for row_idx,row in pairs(strtable) do if row[7] ~= nil then local concat = {msg="", color=0xAAAAAAFF} - if row[7] == this then -- highlight the client's name + if row_idx == 1 then -- this is the header + concat.color = 0xFF888888 + elseif row[7] == this then -- highlight the client's name concat.color = 0xFFFFFFFF elseif this.squad == row[7].squad and this.team == row[7].team and this.squad ~= "" and this.squad ~= nil then if row[7].alive then diff --git a/pkg/base/preconf.lua b/pkg/base/preconf.lua index 79a2c35..98d8a8f 100644 --- a/pkg/base/preconf.lua +++ b/pkg/base/preconf.lua @@ -29,8 +29,8 @@ do end -- network throttling -NET_FLUSH_C2S = 0.05 -NET_FLUSH_S2C = 0.1 +NET_FLUSH_C2S = 0.02 +NET_FLUSH_S2C = 0.02 NET_MAX_LAG = 15.0 -- base dir stuff diff --git a/pkg/base/version.lua b/pkg/base/version.lua index 437ae67..1fa4c37 100644 --- a/pkg/base/version.lua +++ b/pkg/base/version.lua @@ -16,9 +16,9 @@ ]] VERSION_ENGINE = { - cmp={0,0,0,0,53}, - num=53, - str="0.0-53", + cmp={0,1,0,0,0}, + num=4194304, + str="0.1", } VERSION_BUGS = { @@ -82,5 +82,8 @@ VERSION_BUGS = { {intro=51, fix=53, msg="Local mode (-s) broken and causes a crash"}, {intro=nil, fix=53, msg="Timing accuracy somewhat bad (uses a float instead of a double, mostly an issue for sec_current)"}, {intro=nil, fix=53, msg="There are some weird network stability issues"}, +{intro=nil, fix=4194304+0, msg="Binary files don't have a type name"}, +{intro=nil, fix=4194304+0, msg="JSON files cannot be remotely sent to clients"}, +{intro=nil, fix=nil, msg="Occasional crash in sackit_module_free on common.mus_free - this is probably a sackit bug."}, } diff --git a/pkg/iceball/hack_console/main.lua b/pkg/iceball/hack_console/main.lua new file mode 100644 index 0000000..7115dfa --- /dev/null +++ b/pkg/iceball/hack_console/main.lua @@ -0,0 +1,57 @@ +--[[ + This file is part of Ice Lua Components. + + Ice Lua Components is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Ice Lua Components is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Ice Lua Components. If not, see . +]] + +-- don't run this on a normal server. +-- it's useful for testing stuff, but it's a very serious loophole. + +local super = new_player +function new_player(...) + local this = super(...) + + local s_create_hud = this.create_hud + local function f_create_hud(...) + local ret = s_create_hud(...) + + local s_chat_on_return = this.typing_text.on_return + function this.typing_text.on_return(...) + if this.typing_text.text ~= "" and string.sub(this.typing_text.text,1,1) == "~" then + local a,b + a,b = pcall(function () loadstring(string.sub(this.typing_text.text,2))() end) --nasty, but handy + if not a then + print("quickcall err:", b) + end + this.typing_text.text = "" + end + + return s_chat_on_return(...) + end + end + + function this.create_hud(...) + local ret = s_create_hud(...) + f_create_hud(...) + return ret + end + + if this.scene then + f_create_hud(...) + end + + return this +end + + diff --git a/pkg/iceball/hack_console/mod.json b/pkg/iceball/hack_console/mod.json new file mode 100644 index 0000000..2e33578 --- /dev/null +++ b/pkg/iceball/hack_console/mod.json @@ -0,0 +1,4 @@ +{ + "load_client": ["main.lua"] +} + diff --git a/pkg/iceball/halp/texts.lua b/pkg/iceball/halp/texts.lua index 815f18e..138114e 100644 --- a/pkg/iceball/halp/texts.lua +++ b/pkg/iceball/halp/texts.lua @@ -8,6 +8,14 @@ tutorial to here. Use your up/down arrow keys to scroll through the text. + +Please read this whole document +carefully, as it contains +important information, and we +don't want to have to tell people +the same things all over again +which could be avoided if they +had read this tutorial. $- $cFFFFFF55What is Iceball? @@ -42,6 +50,12 @@ download the source code from: $cFF55FF55https:// $cFF55FF55 github.com/iamgreaser/iceball/ +$cFFFF5555If you are running a serious +$cFFFF5555server, you SHOULD be getting +$cFFFF5555your code from the github +$cFFFF5555repository, as it contains fixes +$cFFFF5555and whatnot. + $- $cFFFFFF55How do I run Iceball? @@ -80,6 +94,9 @@ $cFFFF0000COMMUNICATE $cFFFF0000COMMUNICATE This cannot be stressed enough. This is a team game. +If you cannot speak the language +of the server, find another +server. Controls: $pWASD = movement @@ -105,6 +122,9 @@ $pSpade = dig 3 high $pBlock = pick block colour $pGun = scope +TIP: you move slightly faster +with a spade in your hand. + $- $cFFFFFF55Further documentation @@ -123,6 +143,9 @@ This is also useful, though not everything is available: $cFF55FF55 http://lua.org/manual/5.1/ +Modding API core reference: +$cFFFF5555 docs/modding_scripts.txt + File format specifications: $cFFFF5555 docs/format_icemap.txt $cFFFF5555 docs/format_pmf.txt diff --git a/pkg/iceball/snowtest/client_start.lua b/pkg/iceball/snowtest/client_start.lua deleted file mode 100644 index 3888e60..0000000 --- a/pkg/iceball/snowtest/client_start.lua +++ /dev/null @@ -1,21 +0,0 @@ ---[[ - This file is part of Ice Lua Components. - - Ice Lua Components is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Ice Lua Components is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with Ice Lua Components. If not, see . -]] - --- Example mod. NOT RELIABLE. - -loadfile("pkg/base/client_start.lua")(...) -dofile("pkg/base/plug_snow.lua") diff --git a/pkg/iceball/snowtest/main_client.lua b/pkg/iceball/snowtest/main_client.lua deleted file mode 100644 index 0d35a9a..0000000 --- a/pkg/iceball/snowtest/main_client.lua +++ /dev/null @@ -1,20 +0,0 @@ ---[[ - This file is part of Ice Lua Components. - - Ice Lua Components is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Ice Lua Components is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with Ice Lua Components. If not, see . -]] - --- Example mod. NOT RELIABLE. - -loadfile("pkg/base/main_client.lua")(...) diff --git a/pkg/iceball/snowtest/main_server.lua b/pkg/iceball/snowtest/main_server.lua deleted file mode 100644 index 32927ba..0000000 --- a/pkg/iceball/snowtest/main_server.lua +++ /dev/null @@ -1,22 +0,0 @@ ---[[ - This file is part of Ice Lua Components. - - Ice Lua Components is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Ice Lua Components is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with Ice Lua Components. If not, see . -]] - --- Example mod. NOT RELIABLE. - -print("[server] Testing the snow plugin!") -loadfile("pkg/base/main_server.lua")(...) -dofile("pkg/base/plug_snow.lua") diff --git a/pkg/iceball/snowtest/mod.json b/pkg/iceball/snowtest/mod.json new file mode 100644 index 0000000..86403ab --- /dev/null +++ b/pkg/iceball/snowtest/mod.json @@ -0,0 +1,4 @@ +{ + "load": ["plug_snow.lua"] +} + diff --git a/pkg/base/plug_snow.lua b/pkg/iceball/snowtest/plug_snow.lua similarity index 99% rename from pkg/base/plug_snow.lua rename to pkg/iceball/snowtest/plug_snow.lua index 15f5c28..f7ec52f 100644 --- a/pkg/base/plug_snow.lua +++ b/pkg/iceball/snowtest/plug_snow.lua @@ -288,3 +288,5 @@ if client then client.hook_tick = snow_tick end +print("Snow plugin loaded.") + diff --git a/pmfedit.bat b/pmfedit.bat index 8e4c58c..2d0eb3f 100644 --- a/pmfedit.bat +++ b/pmfedit.bat @@ -1,12 +1,2 @@ -@echo off -echo I am a noob at computers who does not know how to use the command line. -echo. -echo However, because I am an absolute pro at making models, GreaseMonkey has -echo been kind to me and given me this .bat file, so I can make models. -echo. -echo I will copy and paste to and from clsave/editor.pmf, because I am not THAT -echo much of a noob. -echo. -echo I WILL ALSO READ DOCS/READ_THIS_FIRST.TXT IN FUTURE. -echo. -iceball -s 0 pkg/iceball/pmfedit +@echo off +iceball-gl -s 0 pkg/iceball/pmfedit diff --git a/radthing.bat b/radthing.bat deleted file mode 100644 index 2b4912e..0000000 --- a/radthing.bat +++ /dev/null @@ -1 +0,0 @@ -iceball -s 0 pkg/iceball/radtest \ No newline at end of file diff --git a/run-gl.bat b/run-gl.bat index 3415cb8..d58a238 100644 --- a/run-gl.bat +++ b/run-gl.bat @@ -1,74 +1,74 @@ -@ECHO OFF - -:Menu -ECHO ============== Iceball ============== -ECHO ------------------------------------- -ECHO 1. Single-player -ECHO 2. Dev server -ECHO 3. Lighting test -ECHO 4. Snow weather test -ECHO 5. Map editor -ECHO 6. PMF editor -ECHO ------------------------------------- -ECHO 0. Exit -ECHO ------------------------------------- -ECHO. - -SET INPUT= -SET /P INPUT=Please select a number: - -cls -IF /I '%INPUT%'=='1' GOTO SinglePlayer -IF /I '%INPUT%'=='2' GOTO DevServer -IF /I '%INPUT%'=='3' GOTO LightingTest -IF /I '%INPUT%'=='4' GOTO SnowTest -IF /I '%INPUT%'=='5' GOTO MapEditor -IF /I '%INPUT%'=='6' GOTO PMFEditor -IF /I '%INPUT%'=='0' EXIT - -ECHO Invalid option -pause -cls -GOTO Menu - -:SinglePlayer -ECHO Starting local server... -iceball-gl.exe -s 0 pkg/base pkg/maps/mesa.vxl -ECHO. -cls -GOTO Menu - -:DevServer -ECHO Connecting to dev server... -iceball-gl.exe -c iceballga.me 20737 -ECHO. -cls -GOTO Menu - -:LightingTest -ECHO Starting lighting test... -iceball-gl.exe -s 0 pkg/iceball/radtest -ECHO. -cls -GOTO Menu - -:SnowTest -ECHO Starting snow weather test... -iceball-gl.exe -s 0 pkg/iceball/snowtest -ECHO. -cls -GOTO Menu - -:MapEditor -ECHO Starting map editor... -iceball-gl.exe -s 0 pkg/iceball/mapedit -ECHO. -cls -GOTO Menu - -:PMFEditor -ECHO Starting PMF editor... -iceball-gl.exe -s 0 pkg/iceball/pmfedit -ECHO. -cls -GOTO Menu +@ECHO OFF + +:Menu +ECHO ============== Iceball ============== +ECHO ------------------------------------- +ECHO 1. Single-player +ECHO 2. Dev server +ECHO 3. Lighting test +ECHO 4. Snow weather test +ECHO 5. Map editor +ECHO 6. PMF editor +ECHO ------------------------------------- +ECHO 0. Exit +ECHO ------------------------------------- +ECHO. + +SET INPUT= +SET /P INPUT=Please select a number: + +cls +IF /I '%INPUT%'=='1' GOTO SinglePlayer +IF /I '%INPUT%'=='2' GOTO DevServer +IF /I '%INPUT%'=='3' GOTO LightingTest +IF /I '%INPUT%'=='4' GOTO SnowTest +IF /I '%INPUT%'=='5' GOTO MapEditor +IF /I '%INPUT%'=='6' GOTO PMFEditor +IF /I '%INPUT%'=='0' EXIT + +ECHO Invalid option +pause +cls +GOTO Menu + +:SinglePlayer +ECHO Starting local server... +iceball-gl.exe -s 0 pkg/base pkg/maps/mesa.vxl +ECHO. +cls +GOTO Menu + +:DevServer +ECHO Connecting to dev server... +iceball-gl.exe -c iceballga.me 20737 +ECHO. +cls +GOTO Menu + +:LightingTest +ECHO Starting lighting test... +iceball-gl.exe -s 0 pkg/iceball/radtest +ECHO. +cls +GOTO Menu + +:SnowTest +ECHO Starting snow weather test... +iceball-gl.exe -s 0 pkg/iceball/snowtest +ECHO. +cls +GOTO Menu + +:MapEditor +ECHO Starting map editor... +iceball-gl.exe -s 0 pkg/iceball/mapedit +ECHO. +cls +GOTO Menu + +:PMFEditor +ECHO Starting PMF editor... +iceball-gl.exe -s 0 pkg/iceball/pmfedit +ECHO. +cls +GOTO Menu diff --git a/run.bat b/run.bat index d65e7c2..6191373 100644 --- a/run.bat +++ b/run.bat @@ -1,74 +1,74 @@ -@ECHO OFF - -:Menu -ECHO ============== Iceball ============== -ECHO ------------------------------------- -ECHO 1. Single-player -ECHO 2. Dev server -ECHO 3. Lighting test -ECHO 4. Snow weather test -ECHO 5. Map editor -ECHO 6. PMF editor -ECHO ------------------------------------- -ECHO 0. Exit -ECHO ------------------------------------- -ECHO. - -SET INPUT= -SET /P INPUT=Please select a number: - -cls -IF /I '%INPUT%'=='1' GOTO SinglePlayer -IF /I '%INPUT%'=='2' GOTO DevServer -IF /I '%INPUT%'=='3' GOTO LightingTest -IF /I '%INPUT%'=='4' GOTO SnowTest -IF /I '%INPUT%'=='5' GOTO MapEditor -IF /I '%INPUT%'=='6' GOTO PMFEditor -IF /I '%INPUT%'=='0' EXIT - -ECHO Invalid option -pause -cls -GOTO Menu - -:SinglePlayer -ECHO Starting local server... -iceball.exe -s 0 pkg/base pkg/maps/mesa.vxl -ECHO. -cls -GOTO Menu - -:DevServer -ECHO Connecting to dev server... -iceball.exe -c play.iceballga.me 20737 -ECHO. -cls -GOTO Menu - -:LightingTest -ECHO Starting lighting test... -iceball.exe -s 0 pkg/iceball/radtest -ECHO. -cls -GOTO Menu - -:SnowTest -ECHO Starting snow weather test... -iceball.exe -s 0 pkg/iceball/snowtest -ECHO. -cls -GOTO Menu - -:MapEditor -ECHO Starting map editor... -iceball.exe -s 0 pkg/iceball/mapedit -ECHO. -cls -GOTO Menu - -:PMFEditor -ECHO Starting PMF editor... -iceball.exe -s 0 pkg/iceball/pmfedit -ECHO. -cls -GOTO Menu +@ECHO OFF + +:Menu +ECHO ============== Iceball ============== +ECHO ------------------------------------- +ECHO 1. Single-player +ECHO 2. Dev server +ECHO 3. Lighting test +ECHO 4. Snow weather test +ECHO 5. Map editor +ECHO 6. PMF editor +ECHO ------------------------------------- +ECHO 0. Exit +ECHO ------------------------------------- +ECHO. + +SET INPUT= +SET /P INPUT=Please select a number: + +cls +IF /I '%INPUT%'=='1' GOTO SinglePlayer +IF /I '%INPUT%'=='2' GOTO DevServer +IF /I '%INPUT%'=='3' GOTO LightingTest +IF /I '%INPUT%'=='4' GOTO SnowTest +IF /I '%INPUT%'=='5' GOTO MapEditor +IF /I '%INPUT%'=='6' GOTO PMFEditor +IF /I '%INPUT%'=='0' EXIT + +ECHO Invalid option +pause +cls +GOTO Menu + +:SinglePlayer +ECHO Starting local server... +iceball.exe -s 0 pkg/base pkg/maps/mesa.vxl +ECHO. +cls +GOTO Menu + +:DevServer +ECHO Connecting to dev server... +iceball.exe -c play.iceballga.me 20737 +ECHO. +cls +GOTO Menu + +:LightingTest +ECHO Starting lighting test... +iceball.exe -s 0 pkg/iceball/radtest +ECHO. +cls +GOTO Menu + +:SnowTest +ECHO Starting snow weather test... +iceball.exe -s 0 pkg/iceball/snowtest +ECHO. +cls +GOTO Menu + +:MapEditor +ECHO Starting map editor... +iceball.exe -s 0 pkg/iceball/mapedit +ECHO. +cls +GOTO Menu + +:PMFEditor +ECHO Starting PMF editor... +iceball.exe -s 0 pkg/iceball/pmfedit +ECHO. +cls +GOTO Menu diff --git a/snowthing.bat b/snowthing.bat deleted file mode 100644 index 99db16a..0000000 --- a/snowthing.bat +++ /dev/null @@ -1 +0,0 @@ -iceball -s 0 pkg/iceball/snowtest \ No newline at end of file diff --git a/src/lua_fetch.h b/src/lua_fetch.h index c08b9ed..78cee48 100644 --- a/src/lua_fetch.h +++ b/src/lua_fetch.h @@ -196,6 +196,11 @@ int icelua_fn_common_fetch_poll(lua_State *L) switch(to_client_local.cfetch_udtype) { case UD_JSON: + to_client_local.cfetch_ubuf[to_client_local.cfetch_ulen] = 0; + ret = (json_parse(L, to_client_local.cfetch_ubuf) + ? 0 + : 1); + break; case UD_LUA: ret = (luaL_loadbuffer (L, to_client_local.cfetch_ubuf, diff --git a/src/network.c b/src/network.c index ceb4548..be6dbe1 100644 --- a/src/network.c +++ b/src/network.c @@ -498,6 +498,8 @@ const char *net_aux_gettype_str(int ftype) return "it"; case UD_JSON: return "json"; + case UD_BIN: + return "bin"; } return NULL; @@ -816,7 +818,7 @@ int net_eat_s2c_packet(client_t *cli, client_t *other, int neth, int len, const //printf("clen=%i ulen=%i\n", clen, ulen); cli->cfetch_clen = clen; cli->cfetch_ulen = ulen; - cli->cfetch_cbuf = (char*)malloc(clen); + cli->cfetch_cbuf = (char*)malloc(clen+1); cli->cfetch_ubuf = NULL; cli->cfetch_cpos = 0; // TODO: check if NULL @@ -827,7 +829,7 @@ int net_eat_s2c_packet(client_t *cli, client_t *other, int neth, int len, const // 0x32: // file transfer end //printf("transfer END\n"); - cli->cfetch_ubuf = (char*)malloc(cli->cfetch_ulen); + cli->cfetch_ubuf = (char*)malloc(cli->cfetch_ulen+1); // TODO: check if NULL uLongf dlen = cli->cfetch_ulen; diff --git a/svsave/pub/mods.json b/svsave/pub/mods.json new file mode 100644 index 0000000..564929d --- /dev/null +++ b/svsave/pub/mods.json @@ -0,0 +1,6 @@ +{ + "mods" : [ + "pkg/iceball/hack_console/" + ] +} + diff --git a/svsave/pub/server.json b/svsave/pub/server.json index 0159a67..ed0fa87 100644 --- a/svsave/pub/server.json +++ b/svsave/pub/server.json @@ -1,13 +1,14 @@ { "name": "Iceball Server", "motd": "Welcome to Iceball", + "mod_config": "svsave/pub/mods.json", "permissions": { "default" : { "permissions" : [ "me", "kill", "squad", - "logout" + "logout" ] }, "griefer" : {