Make grenade work, make grenades less rare

This commit is contained in:
rubenwardy 2016-04-05 23:21:50 +01:00
parent 384af5d073
commit 2321195c7a
9 changed files with 33 additions and 32 deletions

View file

@ -23,7 +23,11 @@ function ctf_events.post(action, one, two)
end
ctf.register_on_killedplayer(function(victim, killer, type)
ctf_events.post("kill_" .. type, killer, victim)
if killer == victim then
ctf_events.post("kill_grenade", nil, victim)
else
ctf_events.post("kill_" .. type, killer, victim)
end
ctf_events.update_all()
end)
@ -47,21 +51,25 @@ function ctf_events.update_row(i, player, name, tplayer, evt)
local y_pos = i * 20
-- One
local tone_text, tone_hex = ctf_colors.get_color(evt.one, ctf.player(evt.one))
if hud:exists(player, idx) then
hud:change(player, idx, "text", evt.one)
hud:change(player, idx, "number", tone_hex)
if evt.one then
local tone_text, tone_hex = ctf_colors.get_color(evt.one, ctf.player(evt.one))
if hud:exists(player, idx) then
hud:change(player, idx, "text", evt.one)
hud:change(player, idx, "number", tone_hex)
else
local tmp = {
hud_elem_type = "text",
position = {x = 0, y = 0.8},
scale = {x = 200, y = 100},
text = evt.one,
number = tone_hex,
offset = {x = 145, y = -y_pos},
alignment = {x = -1, y = 0}
}
hud:add(player, idx, tmp)
end
else
local tmp = {
hud_elem_type = "text",
position = {x = 0, y = 0.8},
scale = {x = 200, y = 100},
text = evt.one,
number = tone_hex,
offset = {x = 145, y = -y_pos},
alignment = {x = -1, y = 0}
}
hud:add(player, idx, tmp)
hud:remove(player, idx)
end
-- Two

@ -1 +1 @@
Subproject commit f3d2dc934a0f7a06c430bcb35d7275d5bd6d5525
Subproject commit f3379d0dfde59a09c4065b0f424ce8a61e2593f9

View file

@ -12,7 +12,7 @@ treasurer.register_treasure("shooter:crossbow",0.5,2,{1,5})
treasurer.register_treasure("shooter:pistol",0.4,2,{1,5})
treasurer.register_treasure("shooter:rifle",0.1,2,{1,2})
treasurer.register_treasure("shooter:shotgun",0.05,2,1)
treasurer.register_treasure("shooter:grenade",0.01,2,{1,5})
treasurer.register_treasure("shooter:grenade",0.05,2,1)
treasurer.register_treasure("shooter:machine_gun",0.01,2,1)
treasurer.register_treasure("shooter:ammo",0.3,2,{1,10})
treasurer.register_treasure("shooter:arrow_white",0.5,2,{1,10})

View file

@ -0,0 +1,2 @@
First person shooter mod.
Adds firearms plus a few other fun items.

1
mods/shooter/mod.conf Normal file
View file

@ -0,0 +1 @@
name = shooter

BIN
mods/shooter/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

View file

@ -393,7 +393,7 @@ function shooter:blast(pos, radius, fleshy, distance, user)
obj_pos.y = obj_pos.y + 1.7
blast_pos = {x=pos.x, y=pos.y + 4, z=pos.z}
if minetest.line_of_sight(obj_pos, blast_pos, 1) then
obj:punch(obj, 1.0, {
obj:punch(obj, 2.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy=damage},
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

View file

@ -80,22 +80,12 @@ minetest.register_entity("shooter:turret_entity", {
get_turret_entity(self.pos)
end,
on_rightclick = function(self, clicker)
if self.player == nil then
if self.player then
self.player:set_detach()
self.player = nil
else
clicker:set_attach(self.object, "", {x=0,y=5,z=-8}, {x=0,y=0,z=0})
self.player = clicker
else
self.player:set_detach()
local yaw = self.yaw + math.pi / 2
local dir = vector.normalize({
x = math.cos(yaw),
y = 0,
z = math.sin(yaw),
})
local pos = vector.subtract(self.player:getpos(), dir)
minetest.after(0.2, function(player)
player:setpos(pos)
end, self.player)
self.player = nil
end
end,
on_step = function(self, dtime)