portalgun: Change colors on fire (#267)

* portalgun: Change colors on fire

Also fix an (accidental?) global.

* portalgun: Generate colored models once.
This commit is contained in:
10se1ucgo 2016-09-30 02:23:39 -04:00 committed by Adrian Siekierka
parent 8153b68d46
commit f6b6dbe1f8
2 changed files with 22 additions and 4 deletions

View File

@ -17,14 +17,28 @@
local thisid = ...
local function set_color(new_r, new_g, new_b)
return function(r,g,b)
if r == 0 and g == 0 and b == 0 then
return new_r, new_g, new_b
else
return r, g, b
end
end
end
if client then
weapon_models[thisid] = model_load({
local base_model = model_load({
kv6 = {
bdir = DIR_PORTALGUN,
name = "portalgun.kv6",
scale = 1.0/128.0,
},
}, {"kv6"})
weapon_models[thisid] = {
base_model({filt = set_color(0, 92, 172)}),
base_model({filt = set_color(240, 92, 28)})
}
end
weapon_names[thisid] = "Portal Gun"
@ -46,7 +60,7 @@ return function (plr)
recoil_x = 0.0001,
recoil_y = -0.05,
model = client and (weapon_models[thisid] {}),
model = client and weapon_models[thisid][1],
name = "Portal Gun",
})
@ -70,8 +84,7 @@ return function (plr)
end
function this.textgen()
local cols
col = 0xFFC0C0C0
local col = 0xFFC0C0C0
return col, ((plr.portal_list[1] and "0") or "-")..
" "..((plr.portal_list[2] and "0") or "-")
end
@ -79,6 +92,11 @@ return function (plr)
function this.click(button, state)
if button == 1 or button == 3 then
-- LMB
if button == 1 then
this.cfg.model = client and weapon_models[thisid][1]
else
this.cfg.model = client and weapon_models[thisid][2]
end
if this.ammo_clip > 0 then
if state then
this.portal_select = (button==1 and 1) or 2

Binary file not shown.