start of a rugby mod - set mode to r1ctf to test the model
This commit is contained in:
parent
f48bd4c6d3
commit
bb7878a7b8
@ -264,6 +264,17 @@ function model_loaders.pmf(isfile, pkt, extra)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function model_loaders.lua(isfile, pkt, extra)
|
||||||
|
extra = extra or {}
|
||||||
|
--print(pkt)
|
||||||
|
if isfile then pkt = loadfile(pkt) end
|
||||||
|
if not pkt then return nil end
|
||||||
|
|
||||||
|
print(pkt)
|
||||||
|
|
||||||
|
return pkt
|
||||||
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
function loadkv6(fname, name, ptsize, ptspacing)
|
function loadkv6(fname, name, ptsize, ptspacing)
|
||||||
return parsekv6(common.bin_load(fname), name, ptsize, ptspacing)
|
return parsekv6(common.bin_load(fname), name, ptsize, ptspacing)
|
||||||
|
@ -70,7 +70,7 @@ function model_load(mdict, prio, sdir)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#prio do
|
for i=1,#prio do
|
||||||
local mdl = SKIN_ENABLE[prio[i]] and model_loaders[prio[i]](
|
local mdl = model_loaders[prio[i]](
|
||||||
true, mdict[prio[i]].bdir.."/"..mdict[prio[i]].name, mdict[prio[i]])
|
true, mdict[prio[i]].bdir.."/"..mdict[prio[i]].name, mdict[prio[i]])
|
||||||
if mdl then return mdl end
|
if mdl then return mdl end
|
||||||
end
|
end
|
||||||
|
18
pkg/iceball/rugby/main.lua
Normal file
18
pkg/iceball/rugby/main.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
do
|
||||||
|
local s_model_load = model_load
|
||||||
|
function model_load(mdict, ...)
|
||||||
|
print(mdict)
|
||||||
|
if mdict.kv6 and mdict.kv6.name == "bomb.kv6" then
|
||||||
|
return s_model_load ({
|
||||||
|
lua = {
|
||||||
|
bdir = "pkg/iceball/rugby",
|
||||||
|
name = "mdl_ball.lua",
|
||||||
|
},
|
||||||
|
}, {"lua"})
|
||||||
|
else
|
||||||
|
return s_model_load(mdict, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
67
pkg/iceball/rugby/mdl_ball.lua
Normal file
67
pkg/iceball/rugby/mdl_ball.lua
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
do
|
||||||
|
local settings = ...
|
||||||
|
|
||||||
|
local this = {}
|
||||||
|
|
||||||
|
this.tex = skin_load("png", "mdl_ball.png", "pkg/iceball/rugby")
|
||||||
|
|
||||||
|
do
|
||||||
|
local ucount = 16
|
||||||
|
local vcount = 10
|
||||||
|
local scale = 0.4
|
||||||
|
function uvmap(u, v)
|
||||||
|
local amp = math.sin(v)
|
||||||
|
amp = amp*0.4*scale
|
||||||
|
local rs = math.sin(u)
|
||||||
|
local rc = math.cos(u)
|
||||||
|
|
||||||
|
return rs*amp, (math.cos(v)-1)*0.7*scale, rc*amp
|
||||||
|
end
|
||||||
|
|
||||||
|
local l = {}
|
||||||
|
local iu, iv
|
||||||
|
local u0 = 0
|
||||||
|
local v0 = 0
|
||||||
|
local u1 = 2/ucount
|
||||||
|
local v1 = 1/vcount
|
||||||
|
local au0 = 0
|
||||||
|
local av0 = 0
|
||||||
|
local au1 = 2*math.pi/ucount
|
||||||
|
local av1 = math.pi/vcount
|
||||||
|
for iu=0,ucount-1 do
|
||||||
|
for iv=0,vcount-1 do
|
||||||
|
local u = 2*iu*math.pi/ucount
|
||||||
|
local v = iv*math.pi/vcount
|
||||||
|
local x00, y00, z00 = uvmap(u+au0, v+av0)
|
||||||
|
local x01, y01, z01 = uvmap(u+au0, v+av1)
|
||||||
|
local x10, y10, z10 = uvmap(u+au1, v+av0)
|
||||||
|
local x11, y11, z11 = uvmap(u+au1, v+av1)
|
||||||
|
|
||||||
|
u = (iu*2/ucount)%1
|
||||||
|
v = (iv/vcount)%1
|
||||||
|
|
||||||
|
l[1+#l] = {x00, y00, z00, v+v0, u+u0}
|
||||||
|
l[1+#l] = {x10, y10, z10, v+v0, u+u1}
|
||||||
|
l[1+#l] = {x01, y01, z01, v+v1, u+u0}
|
||||||
|
l[1+#l] = {x01, y01, z01, v+v1, u+u0}
|
||||||
|
l[1+#l] = {x10, y10, z10, v+v0, u+u1}
|
||||||
|
l[1+#l] = {x11, y11, z11, v+v1, u+u1}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
this.va = common.va_make(l, nil, "3v,2t")
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.render_global(x, y, z, r1, r2, r3, s)
|
||||||
|
client.va_render_global(this.va, x, y, z, r1, r2, r3, s, this.tex)
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.render_local(x, y, z, r1, r2, r3, s)
|
||||||
|
client.va_render_local(this.va, x, y, z, r1, r2, r3, s, this.tex)
|
||||||
|
end
|
||||||
|
|
||||||
|
return this
|
||||||
|
|
||||||
|
end
|
||||||
|
|
BIN
pkg/iceball/rugby/mdl_ball.png
Normal file
BIN
pkg/iceball/rugby/mdl_ball.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
3
pkg/iceball/rugby/mod.json
Normal file
3
pkg/iceball/rugby/mod.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"preload": ["main.lua"]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user