MinetestForFun / server-minetestforfun

Repository of the subgame and mods of "MinetestForFun" server
https://www.xorhub.com
The Unlicense
27 stars 10 forks source link

Change creeper's way to work to a more classic way #509

Closed ObaniGemini closed 7 years ago

ObaniGemini commented 8 years ago

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.

BetterToAutomateTheWorld commented 8 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

ghost commented 8 years ago

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)

ObaniGemini commented 8 years ago

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

BetterToAutomateTheWorld commented 8 years ago

@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"

ObaniGemini commented 8 years ago

:+1: for the fixed value.

Lymkwi commented 8 years ago

@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.

ghost commented 8 years ago

@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

Lymkwi commented 8 years ago

@crabman77 Et là? https://github.com/MinetestForFun/server-minetestforfun/commit/7ddebddee284d1089653fdc03d8fc65f349a876c

ghost commented 8 years ago

Oui je pense que c'est bon.

ghost commented 7 years ago

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.

ghost commented 7 years ago

Fixed https://github.com/MinetestForFun/server-minetestforfun/commit/6fd2c789a6a1c7b081811520fc56fb7e9c600da4

BetterToAutomateTheWorld commented 7 years ago

Thank you @crabman77