Add kill assists (#755)

* Update teams.lua

* Update teams.lua and init.lua

* Update teams.lua and init.lua

* Update teams.lua and init.lua

* Update teams.lua and init.lua Kill assist implemented

* Update init.lua Remove unused variables

* Added ctf.clearAssists function
Only awards those who did more that 50% of damage
Clears attackers stats after suicide

* Remove unused variable

* Minor modifications

renamed ctf.clearAssists to ctf.clear_assists
changed playerName to player

* Cap assist points

* Reaching full health while in combat clears assist data

* split points between assisting players by damage done

* Reworked assist data storage to work with a table rather than player metadata

* Fix lua check

* Removed duplicate scoring

* Change kill assist color

* Health regen subtracts from assist.
Suicide gives assist points

* Fixed accessing nil value for max_hp

* Corrected max_hp

* hardcode hp list for max hp
This commit is contained in:
Anthony-De 2021-02-01 11:24:29 -05:00 committed by GitHub
parent 6515f1e189
commit 49f4e6fd47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 23 deletions

View file

@ -24,7 +24,9 @@ minetest.register_craftitem("ctf_bandages:bandage", {
local limit = ctf_bandages.heal_percent *
object:get_properties().hp_max
if hp > 0 and hp < limit then
hp = hp + math.random(3,4)
local hp_add = math.random(3,4)
ctf.add_heal_assist(pname, hp_add)
hp = hp + hp_add
if hp > limit then
hp = limit
end