Skip to content

Commit

Permalink
portalgun: Change colors on fire (#267)
Browse files Browse the repository at this point in the history
* portalgun: Change colors on fire

Also fix an (accidental?) global.

* portalgun: Generate colored models once.
  • Loading branch information
10se1ucgo authored and asiekierka committed Sep 30, 2016
1 parent 8153b68 commit f6b6dbe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions pkg/gm/portalgun/gun_portal.lua
Expand Up @@ -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"
Expand All @@ -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",
})
Expand All @@ -70,15 +84,19 @@ 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

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
Expand Down
Binary file modified pkg/gm/portalgun/portalgun.kv6
Binary file not shown.

0 comments on commit f6b6dbe

Please sign in to comment.