Closed ObaniGemini closed 7 years ago
To do something simple (easier to maintain), @LeMagnesium & @crabman77 can you give me you opinion about this little tweak :
-- stop attacking if player or out of range
-- MFF 08/09/2016 (tweaked to explode even if the player is out of range after the counter start )
if not self.attack
or not self.attack:getpos()
or self.attack:get_hp() <= 0 then
Instead of :
-- stop attacking if player or out of range
if dist > self.view_range
or not self.attack
or not self.attack:getpos()
or self.attack:get_hp() <= 0 then
The creeper explode attack is from here https://github.com/MinetestForFun/server-minetestforfun/blob/master/mods/mobs/api.lua#L1483 to here https://github.com/MinetestForFun/server-minetestforfun/blob/master/mods/mobs/api.lua#L1658
No it's for all mobs.
if dist > self.view_range (si ne le voit plus)
creepers attack start there -> https://github.com/MinetestForFun/server-minetestforfun/blob/master/mods/mobs/api.lua#L1509
He stop attack there -> https://github.com/MinetestForFun/server-minetestforfun/blob/master/mods/mobs/api.lua#L1529
if dist > self.reach then (si n'est plus à portée)
This part of the API will affect not affect any other monsters from what I see (excepted to pumpbooms maybe, which is not a problem). Another tweak then would be to start the timer to closer to the player, for it doesn't become a non-dangerous mob
@crabman77 If im not wrong, it's only for all monsters with the attack type 'explode', if i understand well the API So i think it's only for Creepers and PumpBooms.
@ObaniGemini For the distance, maybe divide by 2 the maxview before activate the counter ? if "player" in "total_range_view" divided per 2 then "start_counter_auto_explode"
PS : We can also set a fixed value which will be used tu activate the "start_counter_auto_explode"
:+1: for the fixed value.
@Darcidride The range factor won't be hardcoded, there is one variable for that already. Also, why would you divide the range?
@crabman77 I did the modification, I hope I didn't butcher the code.
@LeMagnesium j'ai un doute sur la 1ere condition, c'est pour tous les mobs, peut être la remettre et ajouter
and not self.attack_type == "explode"
sinon les autre mobs risquent de ne pas s’arrêter, si un 2ème joueur passe à coté et que le 1er s’éloigne, le mobs ne changera pas de cible. https://github.com/MinetestForFun/server-minetestforfun/commit/327694b4ea53865be389afcba4d6ff1ebac51575#diff-1a9bf31b6ac84ce577d3d5bd5a8c2adbR1483
Oui je pense que c'est bon.
Je crois que le changement a apporté un bug, les pumboom se mettent à exploser a plusieurs nodes(10) de distance maintenant, dès qu'ils nous voient ils explosent au lieu de venir vers nous et exploser au plus près.
Thank you @crabman77
Actually, creeper's exploding timer is disabled if player moves away from him.
The idea would be to start the timer, and to let the creeper explode even if the player is away, as the classic creeper does, which lets the player dodge him.