MT-CTF / capturetheflag

Capture the Flag game using the Minetest Voxel Engine
https://ctf.rubenwardy.com
81 stars 88 forks source link

Spikes don't have perks for the placer(s) #1087

Open farooqkz opened 1 year ago

farooqkz commented 1 year ago

Currently we have spikes in game which deal damage to the enemies and could even possibly kill them. In maps like The Tunnel spikes can improve base's defense so much. But no point is given to the player placing spikes as kill assists or kills.

Spikes do node damage:

https://github.com/MT-CTF/capturetheflag/blob/master/mods/ctf/ctf_map/ctf_traps.lua#L39

However this damage has no effect for the teammates:

https://github.com/MT-CTF/capturetheflag/blob/master/mods/ctf/ctf_map/ctf_traps.lua#L96

One way to implement this feature is saving placer's name in node's metadata and retrieving the metadata upon damage and via code, the placer could damage the enemy so that the mechanism of the game could later count kills or kill assists.

To get a node metadata one needs to get node's position and I haven't found a way to get node position through hp change callback. Maybe one could get this using players current position but I don't think that is much reliable.

LoneWolfHT commented 1 year ago

Maybe one could get this using players current position but I don't think that is much reliable

Probably the safest option, worst case scenario you don't get the kill points

farooqkz commented 1 year ago

I think the best is requesting position of damager node from the core team.

LoneWolfHT commented 1 year ago

I think the best is requesting position of damager node from the core team.

You have to make sure you can reliably track node removal/placement though

farooqkz commented 1 year ago

I think the best is requesting position of damager node from the core team.

You have to make sure you can reliably track node removal/placement though

We could add metadata to each spike on place

LoneWolfHT commented 1 year ago

We could add metadata to each spike on place

That has nothing to do with storing the positions in a per-match table. I think I misunderstood what you meant by I think the best is requesting position of damager node from the core team.

farooqkz commented 1 year ago

I was thinking to storing placer name and team in the spike's node metadata and retrieve it using reason.node_pos(once we have it) to punch the damagee on the behalf of placer.

LoneWolfHT commented 1 year ago

Added the engine change needed label in that case. Although there are less pretty workarounds that don't require an engine change

farooqkz commented 1 year ago

Requested: https://github.com/minetest/minetest/issues/13195

LoneWolfHT commented 1 year ago

This is now possible in 5.8-dev, but the implementation should disable itself if the server version is too old

farooqkz commented 1 year ago

Please assign this to me.