Lemmings Forums

NeoLemmix => Bugs & Suggestions => Closed => Topic started by: Armani on August 06, 2023, 08:32:07 PM

Title: [BUG][PLAYER]Lemmings can pass thorugh a steel wall in certain circumstances
Post by: Armani on August 06, 2023, 08:32:07 PM
(https://i.imgur.com/Wb6OQE6.gif)
When a lemming is completely trapped inside the terrain as well as a force field, you can make him move a pixel forward by assigning him a walker no matter what.

(https://i.imgur.com/xRxTP1Z.gif)
With this bug, with enough skills and lemmings, you can get through any arbitrary thick steel wall.

level files and replays are attached.
Title: Re: [BUG][PLAYER]Lemmings can pass thorugh a steel wall in certain circumstances
Post by: ericderkovits on August 13, 2023, 05:55:09 AM
definitely bugs. should be fixed.

Tried these 2 levels and replays in Superlemmix, but the replays fail.
Title: Re: [BUG][PLAYER]Lemmings can pass thorugh a steel wall in certain circumstances
Post by: namida on August 31, 2023, 02:55:28 AM
Code: [Select]
  if (NewSkill = baToWalking) and (L.LemAction = baWalking) then
  begin
    TurnAround(L);

    // Special treatment if in one-way-field facing the wrong direction
    // see http://www.lemmingsforums.net/index.php?topic=2640.0
    if    (HasTriggerAt(L.LemX, L.LemY, trForceRight, L) and (L.LemDx = -1))
       or (HasTriggerAt(L.LemX, L.LemY, trForceLeft, L) and (L.LemDx = 1)) then
    begin
      // Go one back to cancel the Inc(L.LemX, L.LemDx) in HandleWalking
      // unless the Lem will fall down (which is handles already in Transition)
      if HasPixelAt(L.LemX, L.LemY) then Dec(L.LemX, L.LemDx);
    end;
  end;

This code, starting at line 1930 in LemGame.pas, is the relevant code. Ironically, the fix for similar behavior in one-way fields (https://www.lemmingsforums.net/index.php?topic=2640.0) has instead enabled it on terrain - commenting out that fix, fixes this. I need to look closer at exactly what's happening here to figure out how to fix it without breaking that fix.
Title: Re: [BUG][PLAYER]Lemmings can pass thorugh a steel wall in certain circumstances
Post by: namida on August 31, 2023, 03:35:58 AM
Should be fixed in commit e25c4bb.

Basically, it arose because Nepster's correction for lemmings passing through one-way fields in a manner like this, worked by cancelling out a movement that happens unconditionally for a walker. However, if the walker turns around specifically due to terrain, then this movement already gets cancelled out in the walker's update code. The double-cancel thus allowed for the result seen here.

Also - nothing is special about steel here; this bug occurred with non-steel terrain too.