Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poisonous grenade #1091

Merged
merged 28 commits into from
Mar 2, 2023
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4e4ee2c
adding poison grenade
farooqkz Feb 2, 2023
780802a
finally working \o/
farooqkz Feb 3, 2023
0700b81
making the linter happy
farooqkz Feb 3, 2023
c3581ef
not my job but okay...
farooqkz Feb 3, 2023
e4e335a
unwanted file
farooqkz Feb 3, 2023
03c3c20
revert
farooqkz Feb 3, 2023
2ebaf92
update maps submodule
farooqkz Feb 3, 2023
f9653c2
trying to do it with minetest.after
farooqkz Feb 4, 2023
4500179
self -> damage_fn
farooqkz Feb 7, 2023
67adb09
working \o/
farooqkz Feb 7, 2023
6c9456c
making the CI happy
farooqkz Feb 7, 2023
8de1317
fix bug when all objects(including non-players) are dmg'ed
farooqkz Feb 7, 2023
944b6c0
unnecessary line
farooqkz Feb 7, 2023
6f3675f
Merge branch 'MT-CTF:master' into poison
farooqkz Feb 9, 2023
ec58d9d
per suggestion
farooqkz Feb 9, 2023
48831fc
per request
farooqkz Feb 12, 2023
27a1ce6
fix
farooqkz Feb 12, 2023
838dde4
remove leftover code
farooqkz Feb 13, 2023
5c28401
improvement
farooqkz Feb 13, 2023
5d10bf9
betterway of getting team color
farooqkz Feb 13, 2023
623cfee
fix poison grenade get replaced by smoke grenade when thrown to flag
farooqkz Feb 27, 2023
80b7614
Merge branch 'poison' of github.com:farooqkz/capturetheflag into poison
farooqkz Feb 27, 2023
2178f42
no poison or smoke grenade too close to flags + reduced time for smok…
farooqkz Feb 27, 2023
ecf9d9f
make poison grenade more green
farooqkz Feb 27, 2023
abbda58
add poison grenade to treasure chests
farooqkz Feb 28, 2023
161d71f
fix bug when throwing near flags
farooqkz Feb 28, 2023
5e9900e
Update mods/pvp/grenades/grenades.lua per LW suggestion
farooqkz Mar 1, 2023
802b649
Update mods/pvp/grenades/grenades.lua per LV suggestion(better partic…
farooqkz Mar 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
no poison or smoke grenade too close to flags + reduced time for smok…
…e grenades near flags
farooqkz committed Feb 27, 2023

Unverified

This user has not yet uploaded their public signing key.
commit 2178f42dbf5cc7040aab16f990b8706c5d50d6f1
18 changes: 13 additions & 5 deletions mods/pvp/grenades/grenades.lua
Original file line number Diff line number Diff line change
@@ -137,16 +137,24 @@ local register_smoke_grenade = function(name, description, image, damage)
if not player or not pos then return end

local pteam = ctf_teams.get(pname)
local duration_multiplier = 1
-- it gets multiplied with the default duration

if pteam then
local fpos = ctf_map.current_map.teams[pteam].flag_pos

if not fpos then return end
for _, team in pairs(ctf_map.current_map) do
local distance_from_flag = vector.distance(pos, team.flag_pos)
if distance_from_flag <= 15 then
minetest.chat_send_player(pname, "You can't explode smoke grenades so close to a flag!")
player:get_inventory():add_item("main", "grenades:"..name)
return
end

if vector.distance(pos, fpos) <= 15 then
minetest.chat_send_player(pname, "You can't explode smoke grenades so close to your flag!")
player:get_inventory():add_item("main", "grenades:"..name)
return
if distance_from_flag <= 25 then
duration_multiplier = 10 / distance_from_flag
end
end
end

@@ -188,7 +196,7 @@ local register_smoke_grenade = function(name, description, image, damage)
damage_fn()
end

minetest.after(SMOKE_GRENADE_TIME, function()
minetest.after(SMOKE_GRENADE_TIME * duration_multiplier, function()
sounds[hiss] = nil
minetest.sound_stop(hiss)
stop = true