buldthensnip/pkg/base/common.lua
2012-11-27 11:19:38 +13:00

184 lines
4.0 KiB
Lua

--[[
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 <http://www.gnu.org/licenses/>.
]]
-- base dir stuff
DIR_PKG_ROOT = DIR_PKG_ROOT or "pkg/base"
DIR_PKG_LIB = DIR_PKG_LIB or DIR_PKG_ROOT
DIR_PKG_PMF = DIR_PKG_PMF or DIR_PKG_ROOT.."/pmf"
DIR_PKG_GFX = DIR_PKG_GFX or DIR_PKG_ROOT.."/gfx"
DIR_PKG_WAV = DIR_PKG_WAV or DIR_PKG_ROOT.."/wav"
DIR_PKG_MAP = DIR_PKG_MAP or "pkg/maps"
MAP_DEFAULT = MAP_DEFAULT or DIR_PKG_MAP.."/mesa.vxl"
LIB_LIST = LIB_LIST or {
DIR_PKG_LIB.."/lib_collect.lua",
DIR_PKG_LIB.."/lib_gui.lua",
DIR_PKG_LIB.."/lib_map.lua",
DIR_PKG_LIB.."/lib_namegen.lua",
DIR_PKG_LIB.."/lib_pmf.lua",
DIR_PKG_LIB.."/lib_sdlkey.lua",
DIR_PKG_LIB.."/lib_vector.lua",
DIR_PKG_LIB.."/obj_player.lua",
DIR_PKG_LIB.."/obj_intent.lua",
}
-- load libs
local i
for i=1,#LIB_LIST do
local asdf_qwerty = i
i = nil
dofile(LIB_LIST[asdf_qwerty])
i = asdf_qwerty
end
i = nil
-- mode stuff
MODE_DEBUG_SHOWBOXES = false
MODE_CHEAT_FLY = false
MODE_AUTOCLIMB = true
MODE_AIRJUMP = false
MODE_SOFTCROUCH = true
MODE_TILT_SLOWDOWN = false -- TODO!
MODE_TILT_DOWN_NOCLIMB = false -- TODO!
MODE_DELAY_SPADE_DIG = 1.0
MODE_DELAY_SPADE_HIT = 0.25
MODE_DELAY_BLOCK_BUILD = 0.5
MODE_DELAY_TOOL_CHANGE = 0.4
-- tools
TOOL_SPADE = 0
TOOL_BLOCK = 1
TOOL_GUN = 2
TOOL_NADE = 3
-- weapons
WPN_RIFLE = 1
WPN_SHOTTY = 2
weapons = {
[WPN_RIFLE] = {
-- version: 0.60 with spread removed completely
dmg_head = 100,
dmg_body = 49,
dmg_limb = 33,
ammo_clip = 10,
ammo_reserve = 50,
ammo_pallets = 1,
time_fire = 1/2,
time_reload = 2.5,
is_reload_perclip = false,
spread = 0.0, -- THAT'S RIGHT, THE 0.75 RIFLE SUCKS
recoil_x = 0.0001,
recoil_y = -0.05,
basename = "rifle",
fn_tick = function(sec_current, sec_delta, plr, wpn, wpnstatic)
if wpn.firing and sec_current < wpn.t_fire then
-- TODO: actually fire gun
wpn.t_fire = wpn.t_fire + wpnstatic.time_fire
if wpn.t_fire < sec_current then
wpn.t_fire = sec_current
end
-- TODO: poll: do we want to require a new click per shot?
end
end,
enabled = true,
},
[WPN_SHOTTY] = {
-- version: something quite different.
-- TODO: get the balance right!
dmg_head = 26,
dmg_body = 23,
dmg_limb = 19,
ammo_clip = 10,
ammo_reserve = 50,
ammo_pallets = 16,
time_fire = 1/15,
time_reload = 2.5,
is_reload_perclip = false,
spread = 0.015, -- No, this should not be good at range.
recoil_x = 0.003,
recoil_y = -0.12,
basename = "shotty",
enabled = false,
},
}
-- teams
teams = {
[0] = {
name = "Blue Master Race",
color_mdl = {16,128,32},
color_chat = {0,192,0},
},
[1] = {
name = "Green Master Race",
color_mdl = {16,32,128},
color_chat = {0,0,255},
},
}
cpalette_base = {
0x7F,0x7F,0x7F,
0xFF,0x00,0x00,
0xFF,0x7F,0x00,
0xFF,0xFF,0x00,
0x00,0xFF,0x00,
0x00,0xFF,0xFF,
0x00,0x00,0xFF,
0xFF,0x00,0xFF,
}
cpalette = {}
do
local i,j
for i=0,7 do
local r,g,b
r = cpalette_base[i*3+1]
g = cpalette_base[i*3+2]
b = cpalette_base[i*3+3]
for j=0,3 do
local cr = math.floor((r*j)/3)
local cg = math.floor((g*j)/3)
local cb = math.floor((b*j)/3)
cpalette[#cpalette+1] = {cr,cg,cb}
end
for j=1,4 do
local cr = r + math.floor(((255-r)*j)/4)
local cg = g + math.floor(((255-g)*j)/4)
local cb = b + math.floor(((255-b)*j)/4)
cpalette[#cpalette+1] = {cr,cg,cb}
end
end
end