EvoSC icon indicating copy to clipboard operation
EvoSC copied to clipboard

TM2020: CP-Diff widget change to work with Multilap-Maps (solution inside)

Open renefreund opened this issue 5 years ago • 0 comments

Actual cp-diff widget do not support multilaps-maps

i fixed it, but don't know if it maybe break rounds- or laps-mode. (i know. laps are not supported right now).

Also i don't know if in maniascript player.LapWaypointTimes is available in other versions than tm2020.

i replaced player.RaceWaypointTimes.count with player.LapWaypointTimes.count in core/Modules/CpDiffs/Templates/widget.latte.xml because RaceWaypointTimes do not count the next checkpoint in second+ lap not as CP1. Instead it just keeps iterating and fillBox() checks if there is any record-time for this CP and returns if there isn't. LapWaypointTimes always start at 1 in each lap.

if you like, i will validate if my change break the widget rounds-mode. But need to setup a server... etc.

You can check the patch on "Easy Nascar" server. (tm2020)

old:

            if(player != Null){
                declare wayPointTimesCount = player.RaceWaypointTimes.count;

                if(!targetLabel.Visible && player.Speed * 3.6 < 10.0 && wayPointTimesCount == 0){
                    targetLabel.Visible = True;
                    AnimMgr.Add(targetLabel, "<label opacity='1.0' />", 300, CAnimManager::EAnimManagerEasing::QuintOut);
                    continue;
                }

                if(LastCpCount != wayPointTimesCount){
                    if(wayPointTimesCount == 0){
                        respawn();
                    }else{
                        if (player.StartTime >= 0) {
                            declare timeAtCp = player.RaceWaypointTimes[wayPointTimesCount - 1];
                            declare isEndLap = False;
                            sleep(25);
                            if (UI.UISequence == CUIConfig::EUISequence::Finish) {
                                isEndLap = True;
                            }
                            fillBox(wayPointTimesCount - 1, timeAtCp, isEndLap);
                        }
                    }

                    LastCpCount = wayPointTimesCount;
                }
            }

new:

          if(player != Null){
                declare wayPointTimesCount = player.RaceWaypointTimes.count;
                declare lapWayPountTimesCount = player.LapWaypointTimes.count;

                if(!targetLabel.Visible && player.Speed * 3.6 < 10.0 && lapWayPountTimesCount == 0){
                    targetLabel.Visible = True;
                    AnimMgr.Add(targetLabel, "<label opacity='1.0' />", 300, CAnimManager::EAnimManagerEasing::QuintOut);
                    continue;
                }

                if(LastCpCount != lapWayPountTimesCount){
                    if(lapWayPountTimesCount == 0){
                        respawn();
                    }else{
                        if (player.StartTime >= 0) {
                            declare timeAtCp = player.LapWaypointTimes[lapWayPountTimesCount - 1];
                            declare isEndLap = False;
                            sleep(25);
                            if (UI.UISequence == CUIConfig::EUISequence::Finish) {
                                isEndLap = True;
                            }
                            fillBox(lapWayPountTimesCount - 1, timeAtCp, isEndLap);
                        }
                    }

                    LastCpCount = lapWayPountTimesCount;
                }
            }

Greetings

renefreund avatar Feb 24 '21 22:02 renefreund