Compare commits

..
Author SHA1 Message Date
Vladislav Khorev e9f71a7959 Fixing stuff 2026-09-30 00:15:34 +06:00
Vladislav Khorev c288c81e7e First version 2026-09-30 00:07:49 +06:00
23 changed files with 525 additions and 433 deletions

No files matched your search

+228 -245
View File
@@ -2,25 +2,36 @@
"chatHistory": [ "chatHistory": [
[], [],
[], [],
[] [
{
"incoming": true,
"text": "Bishkek residents are increasingly complaining of depression and apathy. Watch the latest video about this on our channel!"
}
]
], ],
"chatPreviewMsg": [ "chatPreviewMsg": [
"Бекзат, ты где? Я жду....",
"", "",
"", "Bishkek residents are ..."
""
], ],
"chatUnread": [ "chatUnread": [
true, true,
true, true,
true false
], ],
"currentLocationName": "", "currentLocationName": "uni_interior",
"globalFloats": { "globalFloats": {
"player_hp": 200.0 "player_hp": 200.0
}, },
"globalInts": {}, "globalInts": {
"lection_is_over": 1,
"news_chat_opened": 1
},
"inventory": { "inventory": {
"items": [] "items": [
"phone",
"journal"
]
}, },
"isDarklands": false, "isDarklands": false,
"isDawn": false, "isDawn": false,
@@ -28,9 +39,7 @@
"locations": { "locations": {
"location_dorm": { "location_dorm": {
"dialogueState": { "dialogueState": {
"active": true, "active": false
"currentNodeId": "line_1",
"dialogueId": "dialog_start001"
}, },
"interactiveObjectStates": [ "interactiveObjectStates": [
{ {
@@ -265,57 +274,27 @@
}, },
{ {
"alpha": 1.0, "alpha": 1.0,
"animTask": {
"durationMs": 10.0,
"elapsedMs": 0.0,
"startPosX": 1.100000023841858,
"startPosY": 0.9695000052452087,
"startPosZ": -19.950000762939453,
"startRotY": 0.0,
"startScale": 1.0,
"targetPosX": 1.100000023841858,
"targetPosY": 0.9695000052452087,
"targetPosZ": -19.950000762939453,
"targetRotY": 1.5707963705062866,
"targetScale": 1.0,
"type": 1
},
"isActive": true, "isActive": true,
"isAnimating": true, "isAnimating": false,
"positionX": 1.100000023841858, "positionX": 1.100000023841858,
"positionY": 0.9695000052452087, "positionY": 0.9695000052452087,
"positionZ": -19.950000762939453, "positionZ": -19.950000762939453,
"rotationY": 0.0, "rotationY": 1.5707963705062866,
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 1.0,
"animTask": {
"durationMs": 10.0,
"elapsedMs": 0.0,
"startPosX": -1.100000023841858,
"startPosY": 0.9695000052452087,
"startPosZ": -19.950000762939453,
"startRotY": 0.0,
"startScale": 1.0,
"targetPosX": -1.100000023841858,
"targetPosY": 0.9695000052452087,
"targetPosZ": -19.950000762939453,
"targetRotY": -1.5707963705062866,
"targetScale": 1.0,
"type": 1
},
"isActive": true, "isActive": true,
"isAnimating": true, "isAnimating": false,
"positionX": -1.100000023841858, "positionX": -1.100000023841858,
"positionY": 0.9695000052452087, "positionY": 0.9695000052452087,
"positionZ": -19.950000762939453, "positionZ": -19.950000762939453,
"rotationY": 0.0, "rotationY": -1.5707963705062866,
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 1.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": 6.664400577545166, "positionX": 6.664400577545166,
"positionY": 0.8999999761581421, "positionY": 0.8999999761581421,
@@ -325,7 +304,7 @@
}, },
{ {
"alpha": 1.0, "alpha": 1.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": 5.842959880828857, "positionX": 5.842959880828857,
"positionY": 0.9284919500350952, "positionY": 0.9284919500350952,
@@ -380,7 +359,7 @@
"positionX": 1.100000023841858, "positionX": 1.100000023841858,
"positionY": 0.9695000052452087, "positionY": 0.9695000052452087,
"positionZ": -15.699999809265137, "positionZ": -15.699999809265137,
"rotationY": 0.0, "rotationY": 1.5707963705062866,
"scale": 1.0 "scale": 1.0
}, },
{ {
@@ -424,8 +403,8 @@
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 0.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": 0.0, "positionX": 0.0,
"positionY": 2.8500001430511475, "positionY": 2.8500001430511475,
@@ -444,8 +423,8 @@
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 0.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": 4.949999809265137, "positionX": 4.949999809265137,
"positionY": 2.8500001430511475, "positionY": 2.8500001430511475,
@@ -454,8 +433,8 @@
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 0.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": -4.949999809265137, "positionX": -4.949999809265137,
"positionY": 2.8500001430511475, "positionY": 2.8500001430511475,
@@ -475,9 +454,9 @@
} }
], ],
"locationState": { "locationState": {
"activeNavigationIndex": 0, "activeNavigationIndex": 2,
"cameraAzimuth": -2.3499999046325684, "cameraAzimuth": -2.805004358291626,
"cameraInclination": 1.103600025177002, "cameraInclination": 0.5385987758636475,
"isDarklands": false, "isDarklands": false,
"isDawn": false, "isDawn": false,
"isNight": false, "isNight": false,
@@ -485,18 +464,34 @@
"targetInteractiveObjectIndex": -1, "targetInteractiveObjectIndex": -1,
"targetTeleportZoneIndex": -1, "targetTeleportZoneIndex": -1,
"taxi": { "taxi": {
"taxiArrivedCallbackCalled": false, "taxiArrivedCallbackCalled": true,
"taxiCar": { "taxiCar": {
"currentWaypoint": 0, "currentWaypoint": 3,
"mode": 1, "mode": 1,
"positionX": -20.850000381469727, "positionX": -18.432445526123047,
"positionY": 0.0, "positionY": 0.0,
"positionZ": 64.0, "positionZ": -0.437654584646225,
"rotation": 0.0, "rotation": -0.05602673813700676,
"steeringAngle": 0.0, "steeringAngle": 3.249874258592911e-10,
"velocity": 0.0, "velocity": 3.600008487701416,
"waypointReachRadius": 5.0, "waypointReachRadius": 5.0,
"waypoints": [] "waypoints": [
{
"x": -20.850000381469727,
"y": 0.0,
"z": 30.0
},
{
"x": -19.350000381469727,
"y": 0.0,
"z": 24.0
},
{
"x": -19.350000381469727,
"y": 0.0,
"z": 14.0
}
]
}, },
"taxiCarInitialState": { "taxiCarInitialState": {
"currentWaypoint": 0, "currentWaypoint": 0,
@@ -531,7 +526,7 @@
} }
] ]
}, },
"tutorialInteractiveObjectsLocked": true "tutorialInteractiveObjectsLocked": false
}, },
"npcStates": [ "npcStates": [
{ {
@@ -550,13 +545,7 @@
-15.038200378417969 -15.038200378417969
], ],
"hp": 100.0, "hp": 100.0,
"pathWaypoints": [ "pathWaypoints": [],
[
-6.296899795532227,
0.0,
-15.041899681091309
]
],
"position": [ "position": [
-6.334780216217041, -6.334780216217041,
0.0, 0.0,
@@ -571,9 +560,9 @@
"targetFacingAngle": 0.0, "targetFacingAngle": 0.0,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
-6.296899795532227, -6.334780216217041,
0.0, 0.0,
-15.041899681091309 -15.038200378417969
] ]
} }
], ],
@@ -581,11 +570,11 @@
"attackTargetIndex": -1, "attackTargetIndex": -1,
"attack_cooldown": 0.0, "attack_cooldown": 0.0,
"battle_state": 0, "battle_state": 0,
"currentState": 0, "currentState": 1,
"currentWaypointIndex": 0, "currentWaypointIndex": 0,
"enabled": true, "enabled": true,
"faceTargetIndex": -1, "faceTargetIndex": -1,
"facingAngle": 0.0, "facingAngle": -1.6831790208816528,
"homeDriftCheckTimer": 5.0, "homeDriftCheckTimer": 5.0,
"homePosition": [ "homePosition": [
0.0, 0.0,
@@ -595,40 +584,40 @@
"hp": 200.0, "hp": 200.0,
"pathWaypoints": [ "pathWaypoints": [
[ [
6.8031005859375, -11.399999618530273,
0.0, 0.0,
-14.641900062561035 0.0
] ]
], ],
"position": [ "position": [
6.7634501457214355, -10.641555786132813,
0.0, 0.0,
-14.60219955444336 0.3920173943042755
], ],
"requestedWalkTarget": [ "requestedWalkTarget": [
6.7634501457214355, -11.399999618530273,
0.0, 0.0,
-14.60219955444336 0.0
], ],
"showWeapon": true, "showWeapon": false,
"targetFacingAngle": 0.0, "targetFacingAngle": -1.0937435626983643,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
6.8031005859375, -11.399999618530273,
0.0, 0.0,
-14.641900062561035 0.0
] ]
}, },
"scriptGlobals": { "scriptGlobals": {
"alik_door_opened": false, "alik_door_opened": false,
"bathroom_door_opened": false, "bathroom_door_opened": false,
"journal_picked_up": false, "journal_picked_up": true,
"phone_picked_up": false, "phone_picked_up": true,
"player_door_opened": false "player_door_opened": true
}, },
"teleportZoneState": { "teleportZoneState": {
"tp_dorm_to_2floor": false, "tp_dorm_to_2floor": false,
"tp_dorm_to_loc2": false "tp_dorm_to_loc2": true
}, },
"triggerZoneState": { "triggerZoneState": {
"ladder_zone001": { "ladder_zone001": {
@@ -640,7 +629,7 @@
"playerInside": false "playerInside": false
}, },
"taxi_zone001": { "taxi_zone001": {
"enabled": true, "enabled": false,
"playerInside": false "playerInside": false
} }
} }
@@ -683,8 +672,8 @@
], ],
"locationState": { "locationState": {
"activeNavigationIndex": 0, "activeNavigationIndex": 0,
"cameraAzimuth": -2.3499999046325684, "cameraAzimuth": -0.06499999761581421,
"cameraInclination": 1.103600025177002, "cameraInclination": 1.1135984659194946,
"isDarklands": false, "isDarklands": false,
"isDawn": false, "isDawn": false,
"isNight": false, "isNight": false,
@@ -745,11 +734,11 @@
"attackTargetIndex": -1, "attackTargetIndex": -1,
"attack_cooldown": 0.0, "attack_cooldown": 0.0,
"battle_state": 0, "battle_state": 0,
"currentState": 0, "currentState": 1,
"currentWaypointIndex": 0, "currentWaypointIndex": 0,
"enabled": true, "enabled": true,
"faceTargetIndex": -1, "faceTargetIndex": -1,
"facingAngle": 0.0, "facingAngle": -1.5379809141159058,
"homeDriftCheckTimer": 5.0, "homeDriftCheckTimer": 5.0,
"homePosition": [ "homePosition": [
0.0, 0.0,
@@ -757,24 +746,30 @@
0.0 0.0
], ],
"hp": 200.0, "hp": 200.0,
"pathWaypoints": [], "pathWaypoints": [
[
6.633500099182129,
0.0,
-9.649999618530273
]
],
"position": [ "position": [
5.0, 8.072282791137695,
0.0, 0.0,
-18.399999618530273 -9.602767944335938
], ],
"requestedWalkTarget": [ "requestedWalkTarget": [
5.0, 6.633500099182129,
0.0, 0.0,
-18.399999618530273 -9.649999618530273
], ],
"showWeapon": true, "showWeapon": false,
"targetFacingAngle": 0.0, "targetFacingAngle": -1.5379809141159058,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
5.0, 6.633500099182129,
0.0, 0.0,
-18.399999618530273 -9.649999618530273
] ]
}, },
"scriptGlobals": null, "scriptGlobals": null,
@@ -947,32 +942,17 @@
"positionX": 1.5, "positionX": 1.5,
"positionY": 0.9750000238418579, "positionY": 0.9750000238418579,
"positionZ": 6.400000095367432, "positionZ": 6.400000095367432,
"rotationY": 0.0, "rotationY": -1.5707963705062866,
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 1.0,
"animTask": {
"durationMs": 10.0,
"elapsedMs": 0.0,
"startPosX": 1.5,
"startPosY": 0.9750000238418579,
"startPosZ": -1.5999999046325684,
"startRotY": 0.0,
"startScale": 1.0,
"targetPosX": 1.5,
"targetPosY": 0.9750000238418579,
"targetPosZ": -1.5999999046325684,
"targetRotY": -1.5707963705062866,
"targetScale": 1.0,
"type": 1
},
"isActive": true, "isActive": true,
"isAnimating": true, "isAnimating": false,
"positionX": 1.5, "positionX": 1.5,
"positionY": 0.9750000238418579, "positionY": 0.9750000238418579,
"positionZ": -1.5999999046325684, "positionZ": -1.5999999046325684,
"rotationY": 0.0, "rotationY": -1.5707963705062866,
"scale": 1.0 "scale": 1.0
}, },
{ {
@@ -1002,7 +982,7 @@
"positionX": 0.0, "positionX": 0.0,
"positionY": 0.9750000238418579, "positionY": 0.9750000238418579,
"positionZ": 8.000000953674316, "positionZ": 8.000000953674316,
"rotationY": 0.0, "rotationY": 1.5707963705062866,
"scale": 1.0 "scale": 1.0
}, },
{ {
@@ -1026,8 +1006,8 @@
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 0.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": 0.0, "positionX": 0.0,
"positionY": 2.4499998092651367, "positionY": 2.4499998092651367,
@@ -1066,8 +1046,8 @@
"scale": 1.0 "scale": 1.0
}, },
{ {
"alpha": 1.0, "alpha": 0.0,
"isActive": true, "isActive": false,
"isAnimating": false, "isAnimating": false,
"positionX": 3.75, "positionX": 3.75,
"positionY": 2.4499998092651367, "positionY": 2.4499998092651367,
@@ -1087,9 +1067,9 @@
} }
], ],
"locationState": { "locationState": {
"activeNavigationIndex": 0, "activeNavigationIndex": 2,
"cameraAzimuth": -2.3499999046325684, "cameraAzimuth": 0.7391971945762634,
"cameraInclination": 1.103600025177002, "cameraInclination": 0.9035983681678772,
"isDarklands": false, "isDarklands": false,
"isDawn": false, "isDawn": false,
"isNight": false, "isNight": false,
@@ -1136,40 +1116,34 @@
"battle_state": 0, "battle_state": 0,
"currentState": 0, "currentState": 0,
"currentWaypointIndex": 0, "currentWaypointIndex": 0,
"enabled": false, "enabled": true,
"faceTargetIndex": -1, "faceTargetIndex": -1,
"facingAngle": 0.0, "facingAngle": 3.1415927410125732,
"homeDriftCheckTimer": 5.0, "homeDriftCheckTimer": 4.749999046325684,
"homePosition": [ "homePosition": [
-0.2859399914741516, 4.941939830780029,
0.0, 0.0,
13.964099884033203 6.641109943389893
], ],
"hp": 100.0, "hp": 100.0,
"pathWaypoints": [ "pathWaypoints": [],
[
-0.31001949310302734,
0.0,
13.974998474121094
]
],
"position": [ "position": [
-0.2859399914741516, 4.911655902862549,
0.0, 0.0,
13.964099884033203 6.640154838562012
], ],
"requestedWalkTarget": [ "requestedWalkTarget": [
-0.2859399914741516, 4.941939830780029,
0.0, 0.0,
13.964099884033203 6.641109943389893
], ],
"showWeapon": true, "showWeapon": false,
"targetFacingAngle": 0.0, "targetFacingAngle": 3.1415927410125732,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
-0.31001949310302734, 4.941939830780029,
0.0, 0.0,
13.974998474121094 6.641109943389893
] ]
}, },
{ {
@@ -1178,23 +1152,17 @@
"battle_state": 0, "battle_state": 0,
"currentState": 0, "currentState": 0,
"currentWaypointIndex": 0, "currentWaypointIndex": 0,
"enabled": false, "enabled": true,
"faceTargetIndex": -1, "faceTargetIndex": -1,
"facingAngle": 3.1415927410125732, "facingAngle": 3.1415927410125732,
"homeDriftCheckTimer": 5.0, "homeDriftCheckTimer": 2.8999974727630615,
"homePosition": [ "homePosition": [
0.7996190190315247, 0.7996190190315247,
0.0, 0.0,
-9.556790351867676 -9.556790351867676
], ],
"hp": 100.0, "hp": 100.0,
"pathWaypoints": [ "pathWaypoints": [],
[
0.7899808883666992,
0.0,
-9.52500057220459
]
],
"position": [ "position": [
0.7996190190315247, 0.7996190190315247,
0.0, 0.0,
@@ -1205,8 +1173,8 @@
0.0, 0.0,
-9.556790351867676 -9.556790351867676
], ],
"showWeapon": true, "showWeapon": false,
"targetFacingAngle": 0.0, "targetFacingAngle": 3.1415927410125732,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
0.7899808883666992, 0.7899808883666992,
@@ -1230,13 +1198,7 @@
13.964099884033203 13.964099884033203
], ],
"hp": 35.0, "hp": 35.0,
"pathWaypoints": [ "pathWaypoints": [],
[
-0.010019302368164063,
0.0,
13.974998474121094
]
],
"position": [ "position": [
0.0, 0.0,
0.0, 0.0,
@@ -1251,9 +1213,9 @@
"targetFacingAngle": 0.0, "targetFacingAngle": 0.0,
"visibleRange": 5.5, "visibleRange": 5.5,
"walkTarget": [ "walkTarget": [
-0.010019302368164063,
0.0, 0.0,
13.974998474121094 0.0,
13.964099884033203
] ]
}, },
{ {
@@ -1272,13 +1234,7 @@
-6.400000095367432 -6.400000095367432
], ],
"hp": 35.0, "hp": 35.0,
"pathWaypoints": [ "pathWaypoints": [],
[
-0.010019302368164063,
0.0,
-6.425000190734863
]
],
"position": [ "position": [
0.0, 0.0,
0.0, 0.0,
@@ -1293,9 +1249,9 @@
"targetFacingAngle": 0.0, "targetFacingAngle": 0.0,
"visibleRange": 6.5, "visibleRange": 6.5,
"walkTarget": [ "walkTarget": [
-0.010019302368164063,
0.0, 0.0,
-6.425000190734863 0.0,
-6.400000095367432
] ]
}, },
{ {
@@ -1314,13 +1270,7 @@
12.0 12.0
], ],
"hp": 35.0, "hp": 35.0,
"pathWaypoints": [ "pathWaypoints": [],
[
-5.010019302368164,
0.0,
11.974998474121094
]
],
"position": [ "position": [
-5.0, -5.0,
0.0, 0.0,
@@ -1335,9 +1285,9 @@
"targetFacingAngle": 0.0, "targetFacingAngle": 0.0,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
-5.010019302368164, -5.0,
0.0, 0.0,
11.974998474121094 12.0
] ]
}, },
{ {
@@ -1356,13 +1306,7 @@
12.0 12.0
], ],
"hp": 35.0, "hp": 35.0,
"pathWaypoints": [ "pathWaypoints": [],
[
4.889980316162109,
0.0,
11.875
]
],
"position": [ "position": [
5.0, 5.0,
0.0, 0.0,
@@ -1377,51 +1321,96 @@
"targetFacingAngle": 0.0, "targetFacingAngle": 0.0,
"visibleRange": 4.800000190734863, "visibleRange": 4.800000190734863,
"walkTarget": [ "walkTarget": [
4.889980316162109, 5.0,
0.0, 0.0,
11.875 12.0
] ]
}, },
{ {
"attackTargetIndex": -1, "attackTargetIndex": -1,
"attack_cooldown": 0.0, "attack_cooldown": 0.0,
"battle_state": 0, "battle_state": 0,
"currentState": 0, "currentState": 1,
"currentWaypointIndex": 0, "currentWaypointIndex": 4,
"enabled": false, "enabled": true,
"faceTargetIndex": -1, "faceTargetIndex": -1,
"facingAngle": 3.1415927410125732, "facingAngle": -0.2980719804763794,
"homeDriftCheckTimer": 5.0, "homeDriftCheckTimer": 4.749999046325684,
"homePosition": [ "homePosition": [
3.9899799823760986, 5.289979934692383,
0.0, 0.0,
10.375 -5.525000095367432
], ],
"hp": 100.0, "hp": 100.0,
"pathWaypoints": [ "pathWaypoints": [
[ [
3.989980697631836, 3.489980697631836,
0.0, 0.0,
10.375 13.674999237060547
],
[
2.789980888366699,
0.0,
13.775001525878906
],
[
1.489980697631836,
0.0,
13.674999237060547
],
[
1.2899808883666992,
0.0,
13.275001525878906
],
[
-0.21001911163330078,
0.0,
8.375
],
[
0.0899801254272461,
0.0,
7.274999618530273
],
[
0.9899806976318359,
0.0,
-1.625
],
[
1.989980697631836,
0.0,
-1.8250007629394531
],
[
4.489980697631836,
0.0,
-5.325000762939453
],
[
5.289979934692383,
0.0,
-5.525000095367432
] ]
], ],
"position": [ "position": [
3.9899799823760986, 0.7987902164459229,
0.0, 0.0,
10.375 11.658617973327637
], ],
"requestedWalkTarget": [ "requestedWalkTarget": [
3.9899799823760986, 5.289979934692383,
0.0, 0.0,
10.375 -5.525000095367432
], ],
"showWeapon": true, "showWeapon": false,
"targetFacingAngle": 0.0, "targetFacingAngle": -0.2980719804763794,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
3.989980697631836, 5.289979934692383,
0.0, 0.0,
10.375 -5.525000095367432
] ]
} }
], ],
@@ -1433,38 +1422,32 @@
"currentWaypointIndex": 0, "currentWaypointIndex": 0,
"enabled": true, "enabled": true,
"faceTargetIndex": -1, "faceTargetIndex": -1,
"facingAngle": 0.0, "facingAngle": 1.3097667694091797,
"homeDriftCheckTimer": 5.0, "homeDriftCheckTimer": 5.0,
"homePosition": [ "homePosition": [
-4.909999847412109,
0.0, 0.0,
0.0, 10.375
0.0
], ],
"hp": 200.0, "hp": 200.0,
"pathWaypoints": [ "pathWaypoints": [],
[
0.9899806976318359,
0.0,
-9.625000953674316
]
],
"position": [ "position": [
0.9426940083503723, 3.073923349380493,
0.0, 0.0,
-9.6310396194458 6.071750164031982
], ],
"requestedWalkTarget": [ "requestedWalkTarget": [
0.9426940083503723, 3.1117358207702637,
0.0, 0.0,
-9.6310396194458 6.061649322509766
], ],
"showWeapon": true, "showWeapon": false,
"targetFacingAngle": 0.0, "targetFacingAngle": 1.3097667694091797,
"visibleRange": 6.0, "visibleRange": 6.0,
"walkTarget": [ "walkTarget": [
0.9899806976318359, 3.1117358207702637,
0.0, 0.0,
-9.625000953674316 6.061649322509766
] ]
}, },
"scriptGlobals": { "scriptGlobals": {
@@ -1472,11 +1455,11 @@
"CONST_MSG_WHERE": "Бекзат, ты где? Я жду...", "CONST_MSG_WHERE": "Бекзат, ты где? Я жду...",
"first_time_darklands": true, "first_time_darklands": true,
"ghost_gone": false, "ghost_gone": false,
"hall_door_opened": false, "hall_door_opened": true,
"morning_can_open_door_index": 0, "morning_can_open_door_index": 0,
"morning_did_open_door_index": 0, "morning_did_open_door_index": 0,
"player_hold_book": false, "player_hold_book": false,
"teacher_arrived_to_library": false, "teacher_arrived_to_library": true,
"teacher_door_opened": false, "teacher_door_opened": false,
"teacher_told_about_book": false, "teacher_told_about_book": false,
"was_day_when_player_left": 0, "was_day_when_player_left": 0,
@@ -1505,7 +1488,7 @@
} }
} }
}, },
"money": 5500, "money": 5000,
"playerHp": 200.0, "playerHp": 200.0,
"playerMaxHp": 200.0, "playerMaxHp": 200.0,
"questJournal": { "questJournal": {
@@ -1515,17 +1498,17 @@
"id": "tutorial_take_items", "id": "tutorial_take_items",
"objectives": [ "objectives": [
{ {
"completed": false, "completed": true,
"id": "take_phone", "id": "take_phone",
"visible": true "visible": true
}, },
{ {
"completed": false, "completed": true,
"id": "take_journal", "id": "take_journal",
"visible": true "visible": true
} }
], ],
"status": 1 "status": 2
}, },
{ {
"activeObjectiveIndex": 0, "activeObjectiveIndex": 0,
@@ -1593,7 +1576,7 @@
"id": "study_beginning", "id": "study_beginning",
"objectives": [ "objectives": [
{ {
"completed": false, "completed": true,
"id": "study_beginning_lecture", "id": "study_beginning_lecture",
"visible": true "visible": true
}, },
@@ -1651,13 +1634,13 @@
} }
] ]
}, },
"savedAt": "2026-07-24 23:40", "savedAt": "2026-09-29 23:22",
"taxiIsCalled": false, "taxiIsCalled": false,
"tutorialJournalPickedUp": false, "tutorialJournalPickedUp": true,
"tutorialJournalScreenOpened": false, "tutorialJournalScreenOpened": true,
"tutorialNeedOpenTaxiScreen": false, "tutorialNeedOpenTaxiScreen": false,
"tutorialPhoneChatScreenOpened": false, "tutorialPhoneChatScreenOpened": true,
"tutorialPhonePickedUp": false, "tutorialPhonePickedUp": true,
"tutorialStep": 0, "tutorialStep": 5,
"uniIntTutorialState": 0 "uniIntTutorialState": 0
} }
+2 -28
View File
@@ -56,7 +56,7 @@
"pressed": "resources/w/ui/img/Journal001_State=Tap.png" "pressed": "resources/w/ui/img/Journal001_State=Tap.png"
} }
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
"name": "location", "name": "location",
"width": 380, "width": 380,
@@ -65,32 +65,6 @@
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_gravity": "bottom", "vertical_gravity": "bottom",
"texture": "resources/w/ui/img/Location_uni_int.png" "texture": "resources/w/ui/img/Location_uni_int.png"
},
{
"type": "StaticImage",
"name": "hint_darklands003_arrow",
"width": 24,
"height": 118,
"x": 210,
"y": 110,
"texture": "resources/w/ui/img/hint_arrow_up.png"
},
{
"type": "StaticImage",
"name": "hint_darklands003",
"width": 470,
"height": 202,
"x": 130,
"y": 200,
"texture": "resources/w/ui/img/Hint_darklands003_hp.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
@@ -264,4 +238,4 @@
} }
] ]
} }
} }
-19
View File
@@ -65,25 +65,6 @@
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_gravity": "bottom", "vertical_gravity": "bottom",
"texture": "resources/w/ui/img/Location_uni_int.png" "texture": "resources/w/ui/img/Location_uni_int.png"
},
{
"type": "StaticImage",
"name": "hint_darklands002",
"horizontal_gravity": "center",
"vertical_gravity": "top",
"width": 470,
"height": 178,
"x": 0,
"y": 80,
"texture": "resources/w/ui/img/Hint_darklands002_attack.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
@@ -65,25 +65,6 @@
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_gravity": "bottom", "vertical_gravity": "bottom",
"texture": "resources/w/ui/img/Location_uni_int.png" "texture": "resources/w/ui/img/Location_uni_int.png"
},
{
"type": "StaticImage",
"name": "hint_darklands002",
"horizontal_gravity": "center",
"vertical_gravity": "top",
"width": 470,
"height": 178,
"x": 0,
"y": 80,
"texture": "resources/w/ui/img/Hint_darklands002_attack.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -28
View File
@@ -56,7 +56,7 @@
"pressed": "resources/w/ui/img/Journal001_State=Tap.png" "pressed": "resources/w/ui/img/Journal001_State=Tap.png"
} }
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
"name": "location", "name": "location",
"width": 380, "width": 380,
@@ -65,32 +65,6 @@
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_gravity": "bottom", "vertical_gravity": "bottom",
"texture": "resources/w/ui_en/img/Location_uni_int.png" "texture": "resources/w/ui_en/img/Location_uni_int.png"
},
{
"type": "StaticImage",
"name": "hint_darklands003_arrow",
"width": 24,
"height": 118,
"x": 210,
"y": 110,
"texture": "resources/w/ui/img/hint_arrow_up.png"
},
{
"type": "StaticImage",
"name": "hint_darklands003",
"width": 442,
"height": 188,
"x": 130,
"y": 200,
"texture": "resources/w/ui_en/img/Hint_darklands003_hp.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
@@ -264,4 +238,4 @@
} }
] ]
} }
} }
-19
View File
@@ -65,25 +65,6 @@
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_gravity": "bottom", "vertical_gravity": "bottom",
"texture": "resources/w/ui_en/img/Location_uni_int.png" "texture": "resources/w/ui_en/img/Location_uni_int.png"
},
{
"type": "StaticImage",
"name": "hint_darklands002",
"horizontal_gravity": "center",
"vertical_gravity": "top",
"width": 446,
"height": 158,
"x": 0,
"y": 80,
"texture": "resources/w/ui_en/img/Hint_darklands002_attack.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
@@ -65,25 +65,6 @@
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_gravity": "bottom", "vertical_gravity": "bottom",
"texture": "resources/w/ui_en/img/Location_uni_int.png" "texture": "resources/w/ui_en/img/Location_uni_int.png"
},
{
"type": "StaticImage",
"name": "hint_darklands002",
"horizontal_gravity": "center",
"vertical_gravity": "top",
"width": 446,
"height": 158,
"x": 0,
"y": 80,
"texture": "resources/w/ui_en/img/Hint_darklands002_attackandroid.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}, },
{ {
"type": "StaticImage", "type": "StaticImage",
+4 -3
View File
@@ -173,8 +173,8 @@ void Character::resetPlayerAfterDeath() {
state.attack = 0; state.attack = 0;
} }
void Character::forceReplan() { bool Character::forceReplan() {
if (!pathPlanner) return; if (!pathPlanner) return false;
const Eigen::Vector3f normalizedTarget(state.requestedWalkTarget.x(), 0.f, state.requestedWalkTarget.z()); const Eigen::Vector3f normalizedTarget(state.requestedWalkTarget.x(), 0.f, state.requestedWalkTarget.z());
state.pathWaypoints = pathPlanner(state.position, normalizedTarget); state.pathWaypoints = pathPlanner(state.position, normalizedTarget);
@@ -185,12 +185,13 @@ void Character::forceReplan() {
waypoint.y() = 0.f; waypoint.y() = 0.f;
} }
state.walkTarget = state.pathWaypoints.back(); state.walkTarget = state.pathWaypoints.back();
return; return true;
} }
state.walkTarget = Eigen::Vector3f(state.position.x(), 0.f, state.position.z()); state.walkTarget = Eigen::Vector3f(state.position.x(), 0.f, state.position.z());
state.onArrivedCallback = nullptr; state.onArrivedCallback = nullptr;
state.onArrivedCallbackName.clear(); state.onArrivedCallbackName.clear();
return false;
} }
void Character::setTexture(std::shared_ptr<FRG::Texture> texture) { void Character::setTexture(std::shared_ptr<FRG::Texture> texture) {
+1 -1
View File
@@ -59,7 +59,7 @@ public:
void setTarget(const Eigen::Vector3f& target, std::function<void()> onArrived = nullptr, std::string callbackName = ""); void setTarget(const Eigen::Vector3f& target, std::function<void()> onArrived = nullptr, std::string callbackName = "");
void stopAndRotateToTarget(int npcId); void stopAndRotateToTarget(int npcId);
void forceReplan(); bool forceReplan();
void stopInPlace() { state.stopInPlace(); } void stopInPlace() { state.stopInPlace(); }
// ---- Reset ---- // ---- Reset ----
+2 -1
View File
@@ -103,7 +103,8 @@ public:
float modelScale = 0.12f; float modelScale = 0.12f;
Eigen::Quaternionf modelCorrectionRotation = Eigen::Quaternionf::Identity(); Eigen::Quaternionf modelCorrectionRotation = Eigen::Quaternionf::Identity();
bool useGpuSkinning = true; bool useGpuSkinning = true;
float collisionRadius = 0.45f; //float collisionRadius = 0.45f;
float collisionRadius = 0.65f;
float interactionRadius = 0.0f; float interactionRadius = 0.0f;
// --- Pathfinding data (serializable parts) --- // --- Pathfinding data (serializable parts) ---
+2 -2
View File
@@ -22,8 +22,8 @@ int Environment::width = CONST_DEFAULT_WIDTH;
int Environment::height = CONST_DEFAULT_HEIGHT; int Environment::height = CONST_DEFAULT_HEIGHT;
float Environment::zoom = DEFAULT_ZOOM; float Environment::zoom = DEFAULT_ZOOM;
bool Environment::enableLogging = false; //bool Environment::enableLogging = false;
//bool Environment::enableLogging = true; bool Environment::enableLogging = true;
SDL_Window* Environment::window = nullptr; SDL_Window* Environment::window = nullptr;
+6 -4
View File
@@ -394,7 +394,8 @@ namespace FRG
menuManager.startGameFunc = [this]() { menuManager.startGameFunc = [this]() {
mainThreadHandler.EnqueueMainThreadTask([this]() { mainThreadHandler.EnqueueMainThreadTask([this]() {
performResetToInitialState(); performResetToInitialState();
gameState.currentLocationName = "location_dorm"; //gameState.currentLocationName = "location_dorm";
gameState.currentLocationName = "uni_interior";
currentLocation()->scriptEngine.callLocationEnterCallback(); currentLocation()->scriptEngine.callLocationEnterCallback();
this->audioPlayer->crossFadeMusicAsync("music/obshaga.ogg"); this->audioPlayer->crossFadeMusicAsync("music/obshaga.ogg");
menuManager.lastMusicTrack = "music/obshaga.ogg"; menuManager.lastMusicTrack = "music/obshaga.ogg";
@@ -1458,7 +1459,7 @@ namespace FRG
} }
if (event.key.keysym.sym == SDLK_2) if (event.key.keysym.sym == SDLK_2)
{ {
startDarklandsTransition(); startDarklandsTransition(true);
} }
if (event.key.keysym.sym == SDLK_3) if (event.key.keysym.sym == SDLK_3)
{ {
@@ -1510,6 +1511,7 @@ namespace FRG
return n; return n;
} }
void Game::activateSlowMoEffect() { void Game::activateSlowMoEffect() {
if (!currentLocation()) return; if (!currentLocation()) return;
@@ -1753,9 +1755,9 @@ namespace FRG
} }
} }
bool Game::startDarklandsTransition() bool Game::startDarklandsTransition(bool force)
{ {
if (!gameState.isNight) if (!force && !gameState.isNight)
{ {
currentLocation()->dialogueSystem.startDialogue("darklands_day_dialog001"); currentLocation()->dialogueSystem.startDialogue("darklands_day_dialog001");
return false; return false;
+1 -1
View File
@@ -74,7 +74,7 @@ namespace FRG {
EditorMode editorMode = EditorMode::None; EditorMode editorMode = EditorMode::None;
// Returns false if a transition is already in progress. // Returns false if a transition is already in progress.
bool startDarklandsTransition(); bool startDarklandsTransition(bool force = false);
bool startNightTransition(); bool startNightTransition();
std::unique_ptr<AudioPlayerAsync> audioPlayer; std::unique_ptr<AudioPlayerAsync> audioPlayer;
+78 -37
View File
@@ -450,7 +450,16 @@ namespace FRG
const auto addCharacter = [&](const Character* other) { const auto addCharacter = [&](const Character* other) {
if (!other || other == self) return; if (!other || other == self) return;
if (other->getHp() <= 0.f || !other->state.enabled) return; if (other->getHp() <= 0.f || !other->state.enabled) return;
if (other->isMoving()) return;
// Проверяем, находятся ли персонажи в состоянии фактического столкновения
const float dist = (other->state.position - self->state.position).norm();
const float collisionDist = self->state.collisionRadius + other->state.collisionRadius;
// Добавляем epsilon (0.1f) для учета погрешностей при входе в зону коллизии
const bool isColliding = dist <= (collisionDist + 0.1f);
// Игнорируем движущегося персонажа, только если мы с ним НЕ сталкиваемся в данный момент
if (other->isMoving() && !isColliding) return;
if (distancePointToSegmentXZ(other->state.position, start, end) > kDynamicObstacleInfluenceDist) { if (distancePointToSegmentXZ(other->state.position, start, end) > kDynamicObstacleInfluenceDist) {
return; return;
@@ -460,7 +469,7 @@ namespace FRG
obs.position = Eigen::Vector3f(other->state.position.x(), navigation->getFloorY(), other->state.position.z()); obs.position = Eigen::Vector3f(other->state.position.x(), navigation->getFloorY(), other->state.position.z());
obs.radius = (std::max)(0.0f, other->state.collisionRadius * 0.6f); obs.radius = (std::max)(0.0f, other->state.collisionRadius * 0.6f);
dynamicObstacles.push_back(obs); dynamicObstacles.push_back(obs);
}; };
addCharacter(player.get()); addCharacter(player.get());
for (const auto& npc : npcs) { for (const auto& npc : npcs) {
@@ -468,8 +477,8 @@ namespace FRG
} }
return navigation->findPathToNearest(start, end, dynamicObstacles); return navigation->findPathToNearest(start, end, dynamicObstacles);
};
}; };
};
if (player) { if (player) {
player->setPathPlanner(makePlanner(player.get())); player->setPathPlanner(makePlanner(player.get()));
@@ -591,6 +600,9 @@ namespace FRG
} }
Character* Location::raycastNpcs(const Eigen::Vector3f& rayOrigin, const Eigen::Vector3f& rayDir, float maxDistance) { Character* Location::raycastNpcs(const Eigen::Vector3f& rayOrigin, const Eigen::Vector3f& rayDir, float maxDistance) {
//return nullptr;
// Every NPC is treated as a vertical cylinder: radius 1.0m, height 1.85m, // Every NPC is treated as a vertical cylinder: radius 1.0m, height 1.85m,
// base at npc->position (the model's foot). Intersection = circle hit in the // base at npc->position (the model's foot). Intersection = circle hit in the
// XZ plane, then clip the entry/exit t against the [yFoot, yFoot+height] slab. // XZ plane, then clip the entry/exit t against the [yFoot, yFoot+height] slab.
@@ -654,7 +666,6 @@ namespace FRG
else { else {
//logger() << "[RAYCAST_NPC] No NPC hit" << std::endl; //logger() << "[RAYCAST_NPC] No NPC hit" << std::endl;
} }
return closestNpc; return closestNpc;
} }
@@ -1401,7 +1412,7 @@ namespace FRG
if (!a || !b) continue; if (!a || !b) continue;
if (a->getHp() <= 0.f || b->getHp() <= 0.f || !a->state.enabled || !b->state.enabled) continue; if (a->getHp() <= 0.f || b->getHp() <= 0.f || !a->state.enabled || !b->state.enabled) continue;
const float minDist = a->state.collisionRadius + b->state.collisionRadius; const float minDist = (a->state.collisionRadius + b->state.collisionRadius) * 0.3;
if (minDist <= 0.f) continue; if (minDist <= 0.f) continue;
const Eigen::Vector2f pa(a->state.position.x(), a->state.position.z()); const Eigen::Vector2f pa(a->state.position.x(), a->state.position.z());
@@ -1413,53 +1424,83 @@ namespace FRG
continue; continue;
} }
Eigen::Vector2f normal(1.f, 0.f); // 1. ПЕРЕСТРОЕНИЕ ПУТИ (выполняется при пересечении обычного радиуса коллизии)
if (dist > kMinSeparationEps) {
normal = delta / dist;
}
const float penetration = (minDist - dist);
const float push = penetration * 0.5f;
Eigen::Vector3f newA = a->state.position;
Eigen::Vector3f newB = b->state.position;
newA.x() -= normal.x() * push;
newA.z() -= normal.y() * push;
newA.y() = 0.f;
newB.x() += normal.x() * push;
newB.z() += normal.y() * push;
newB.y() = 0.f;
const bool aWasMoving = a->isMoving(); const bool aWasMoving = a->isMoving();
const bool bWasMoving = b->isMoving(); const bool bWasMoving = b->isMoving();
if (navigation && navigation->isReady()) { auto tryReplan = [&](Character* c) {
const bool aOk = navigation->isWalkable(newA); if (replanCooldownRemainingMs.find(c) != replanCooldownRemainingMs.end()) {
const bool bOk = navigation->isWalkable(newB); return; // Уже находится в откате
}
if (c->forceReplan()) {
replanCooldownRemainingMs[c] = 500; // таймаут на спам
}
};
if (aOk && bOk) { if (aWasMoving || bWasMoving) {
if (aWasMoving && bWasMoving) {
tryReplan(a);
tryReplan(b);
}
else if (aWasMoving) {
tryReplan(a);
}
else if (bWasMoving) {
tryReplan(b);
}
}
// 2. ФИЗИЧЕСКОЕ ВЫТАЛКИВАНИЕ (только если дистанция меньше 0.5 * minDist)
const float hardMinDist = minDist * 0.5f;
if (dist < hardMinDist) {
Eigen::Vector2f normal(1.f, 0.f);
if (dist > kMinSeparationEps) {
normal = delta / dist;
}
// Вычисляем выталкивание относительно hardMinDist, а не minDist
const float penetration = (hardMinDist - dist);
const float push = penetration * 0.5f;
Eigen::Vector3f newA = a->state.position;
Eigen::Vector3f newB = b->state.position;
newA.x() -= normal.x() * push;
newA.z() -= normal.y() * push;
newA.y() = 0.f;
newB.x() += normal.x() * push;
newB.z() += normal.y() * push;
newB.y() = 0.f;
if (navigation && navigation->isReady()) {
const bool aOk = navigation->isWalkable(newA);
const bool bOk = navigation->isWalkable(newB);
if (aOk && bOk) {
a->state.position = newA;
b->state.position = newB;
}
else if (aOk && !bOk) {
a->state.position = newA;
}
else if (!aOk && bOk) {
b->state.position = newB;
}
}
else {
a->state.position = newA; a->state.position = newA;
b->state.position = newB; b->state.position = newB;
} }
else if (aOk && !bOk) {
a->state.position = newA;
}
else if (!aOk && bOk) {
b->state.position = newB;
}
}
else {
a->state.position = newA;
b->state.position = newB;
} }
// 3. ОСТАНОВКА И КОЛЛБЭКИ
if (a->state.isPlayer && !aWasMoving) a->stopInPlace(); if (a->state.isPlayer && !aWasMoving) a->stopInPlace();
if (b->state.isPlayer && !bWasMoving) b->stopInPlace(); if (b->state.isPlayer && !bWasMoving) b->stopInPlace();
if (aWasMoving && !bWasMoving) { if (aWasMoving && !bWasMoving) {
nudgeCharacterAside(b, a->state.position); nudgeCharacterAside(b, a->state.position);
fireBumpCallbacks(a, b); fireBumpCallbacks(a, b);
} else if (bWasMoving && !aWasMoving) { }
else if (bWasMoving && !aWasMoving) {
nudgeCharacterAside(a, b->state.position); nudgeCharacterAside(a, b->state.position);
fireBumpCallbacks(b, a); fireBumpCallbacks(b, a);
} }
+9 -5
View File
@@ -419,12 +419,13 @@ namespace FRG {
void MenuManager::enterGameplay(bool isFromLoad) { void MenuManager::enterGameplay(bool isFromLoad) {
if (!isFromLoad && uiState_ == GameUiState::MainMenu && startGameFunc) startGameFunc(); if (!isFromLoad && uiState_ == GameUiState::MainMenu && startGameFunc) startGameFunc();
uiState_ = GameUiState::Gameplay; uiState_ = GameUiState::Gameplay;
uiManager.replaceRoot(hudRoot); //uiManager.replaceRoot(hudRoot);
topUiManager.replaceRoot(hudTopHintRoot_); //uiManager.replaceRoot(hudStep5abRoot);
if (isFromLoad) { //topUiManager.replaceRoot(hudTopHintRoot_);
//if (isFromLoad) {
uiManager.clearMenuStack(); uiManager.clearMenuStack();
topUiManager.clearMenuStack(); topUiManager.clearMenuStack();
} //}
applyCurrentHealthBar(); applyCurrentHealthBar();
@@ -437,8 +438,12 @@ namespace FRG {
}); });
} }
//onLocationChanged(gameState_.currentLocationName);
if (isFromLoad) if (isFromLoad)
applyHudForCurrentState(); applyHudForCurrentState();
//applyHudForCurrentState();
applyUniIntHud();
} }
void MenuManager::applyHudForCurrentState() { void MenuManager::applyHudForCurrentState() {
@@ -556,7 +561,6 @@ namespace FRG {
uiManager.setTextButtonCallback("menuStartButton", [this](const std::string&) { uiManager.setTextButtonCallback("menuStartButton", [this](const std::string&) {
audioPlayer_.playSoundAsync("resources/audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); audioPlayer_.playSoundAsync("resources/audio/751089__smallconfusion__mechanical-plastic-click-11.ogg");
enterGameplay(); enterGameplay();
}); });
uiManager.setTextButtonCallback("menuAboutButton", [this](const std::string&) { uiManager.setTextButtonCallback("menuAboutButton", [this](const std::string&) {
showAboutScreen(); showAboutScreen();
+184 -1
View File
@@ -124,6 +124,68 @@ void PathFinder::build(const std::string& configPath,
<< ", cell=" << cellSize << ", areas=" << areas.size() << "\n"; << ", cell=" << cellSize << ", areas=" << areas.size() << "\n";
} }
std::vector<Eigen::Vector3f> PathFinder::findPath(const Eigen::Vector3f& start,
const Eigen::Vector3f& end) const
{
return runAStar(start, end, walkable, false);
}
std::vector<Eigen::Vector3f> PathFinder::findPath(const Eigen::Vector3f& start,
const Eigen::Vector3f& end,
const std::vector<DynamicObstacle>& dynamicObstacles) const
{
if (!ready || walkable.empty()) {
return {};
}
std::vector<unsigned char> walkableGrid = walkable;
// --- Логика внесения dynamicObstacles остается здесь ---
if (!dynamicObstacles.empty()) {
for (const DynamicObstacle& obstacle : dynamicObstacles) {
const float radius = obstacle.radius + agentRadius;
if (radius <= 0.0f) continue;
const float minWorldX = obstacle.position.x() - radius;
const float maxWorldX = obstacle.position.x() + radius;
const float minWorldZ = obstacle.position.z() - radius;
const float maxWorldZ = obstacle.position.z() + radius;
const int minCellX = (std::max)(0, static_cast<int>(std::floor((minWorldX - minX) / cellSize)));
const int maxCellX = (std::min)(gridWidth - 1, static_cast<int>(std::floor((maxWorldX - minX) / cellSize)));
const int minCellZ = (std::max)(0, static_cast<int>(std::floor((minWorldZ - minZ) / cellSize)));
const int maxCellZ = (std::min)(gridDepth - 1, static_cast<int>(std::floor((maxWorldZ - minZ) / cellSize)));
const float radiusSq = radius * radius;
for (int z = minCellZ; z <= maxCellZ; ++z) {
for (int x = minCellX; x <= maxCellX; ++x) {
const Cell cell{ x, z };
const Eigen::Vector3f center = cellCenter(cell);
const float dx = center.x() - obstacle.position.x();
const float dz = center.z() - obstacle.position.z();
if (dx * dx + dz * dz <= radiusSq) {
const int idx = indexOf(cell);
if (idx >= 0 && idx < static_cast<int>(walkableGrid.size())) {
walkableGrid[static_cast<size_t>(idx)] = 0;
}
}
}
}
}
}
return runAStar(start, end, walkableGrid, false);
}
std::vector<Eigen::Vector3f> PathFinder::findNearestReachableImpl(
const Eigen::Vector3f& start,
const Eigen::Vector3f& end,
const std::vector<unsigned char>& walkableGrid) const
{
return runAStar(start, end, walkableGrid, true);
}
/*
std::vector<Eigen::Vector3f> PathFinder::findPath(const Eigen::Vector3f& start, std::vector<Eigen::Vector3f> PathFinder::findPath(const Eigen::Vector3f& start,
const Eigen::Vector3f& end) const const Eigen::Vector3f& end) const
{ {
@@ -494,7 +556,7 @@ std::vector<Eigen::Vector3f> PathFinder::findNearestReachableImpl(
path.erase(path.begin()); path.erase(path.begin());
return path; return path;
} }*/
std::vector<Eigen::Vector3f> PathFinder::findPathToNearest( std::vector<Eigen::Vector3f> PathFinder::findPathToNearest(
const Eigen::Vector3f& start, const Eigen::Vector3f& end) const const Eigen::Vector3f& start, const Eigen::Vector3f& end) const
@@ -1075,4 +1137,125 @@ bool PathFinder::pointInPolygon(float x, float z, const std::vector<Eigen::Vecto
return inside; return inside;
} }
std::vector<Eigen::Vector3f> PathFinder::runAStar(
const Eigen::Vector3f& start,
const Eigen::Vector3f& end,
const std::vector<unsigned char>& grid,
bool returnNearestOnFail) const
{
if (!ready || grid.empty()) return {};
Cell startCell, endCell;
if (!findNearestWalkableCell(start, startCell, grid) ||
!findNearestWalkableCell(end, endCell, grid)) {
return {};
}
if (startCell.x == endCell.x && startCell.z == endCell.z) {
return { cellCenter(endCell) };
}
struct QueueNode {
int index = 0;
float priority = 0.0f;
bool operator<(const QueueNode& other) const { return priority > other.priority; }
};
const int cellCount = gridWidth * gridDepth;
std::vector<float> cost(static_cast<size_t>(cellCount), (std::numeric_limits<float>::max)());
std::vector<int> cameFrom(static_cast<size_t>(cellCount), -1);
std::priority_queue<QueueNode> open;
const int startIndex = indexOf(startCell);
const int endIndex = indexOf(endCell);
cost[static_cast<size_t>(startIndex)] = 0.0f;
open.push({ startIndex, 0.0f });
int bestIndex = startIndex;
float bestDist = distanceCells(startCell, endCell);
static const int offsets[8][2] = {
{ 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 },
{ 1, 1 }, { 1, -1 }, { -1, 1 }, { -1, -1 }
};
bool reached = false;
while (!open.empty()) {
const QueueNode current = open.top();
open.pop();
if (current.index == endIndex) {
bestIndex = endIndex;
reached = true;
break;
}
const Cell currentCell{ current.index % gridWidth, current.index / gridWidth };
if (cost[static_cast<size_t>(current.index)] < current.priority - distanceCells(currentCell, endCell)) {
continue;
}
if (returnNearestOnFail) {
const float d = distanceCells(currentCell, endCell);
if (d < bestDist) {
bestDist = d;
bestIndex = current.index;
}
}
for (const auto& offset : offsets) {
Cell next{ currentCell.x + offset[0], currentCell.z + offset[1] };
if (!isCellWalkable(next, grid)) continue;
const bool diagonal = offset[0] != 0 && offset[1] != 0;
if (diagonal) {
Cell h{ currentCell.x + offset[0], currentCell.z };
Cell v{ currentCell.x, currentCell.z + offset[1] };
if (!isCellWalkable(h, grid) || !isCellWalkable(v, grid)) continue;
}
const int nextIndex = indexOf(next);
const float stepCost = diagonal ? 1.41421356f : 1.0f;
const float newCost = cost[static_cast<size_t>(current.index)] + stepCost;
if (newCost >= cost[static_cast<size_t>(nextIndex)]) continue;
cost[static_cast<size_t>(nextIndex)] = newCost;
cameFrom[static_cast<size_t>(nextIndex)] = current.index;
open.push({ nextIndex, newCost + distanceCells(next, endCell) });
}
}
if (!reached && !returnNearestOnFail) return {};
if (bestIndex == startIndex) return {};
std::vector<Cell> cells;
for (int cur = bestIndex; cur != -1; cur = cameFrom[static_cast<size_t>(cur)]) {
cells.push_back({ cur % gridWidth, cur / gridWidth });
if (cur == startIndex) break;
}
std::reverse(cells.begin(), cells.end());
cells = smoothCells(cells, grid);
std::vector<Eigen::Vector3f> path;
path.reserve(cells.size());
for (const Cell& cell : cells) path.push_back(cellCenter(cell));
if (!path.empty() && (path.front() - Eigen::Vector3f(start.x(), floorY, start.z())).norm() < cellSize * 0.75f) {
path.erase(path.begin());
}
if (reached && !path.empty()) {
Cell requestedEndCell;
if (worldToCell(end, requestedEndCell) && requestedEndCell.x == endCell.x && requestedEndCell.z == endCell.z) {
path.back() = Eigen::Vector3f(end.x(), floorY, end.z());
}
}
return path;
}
} // namespace FRG } // namespace FRG
+6 -1
View File
@@ -63,7 +63,7 @@ public:
private: private:
float cellSize = 0.4f; float cellSize = 0.4f;
float agentRadius = 0.45f; float agentRadius = 0.15f;
float floorY = 0.0f; float floorY = 0.0f;
float objectPadding = 0.25f; float objectPadding = 0.25f;
float boundaryPadding = 0.0f; float boundaryPadding = 0.0f;
@@ -109,6 +109,11 @@ private:
std::vector<Eigen::Vector3f> findNearestReachableImpl(const Eigen::Vector3f& start, std::vector<Eigen::Vector3f> findNearestReachableImpl(const Eigen::Vector3f& start,
const Eigen::Vector3f& end, const Eigen::Vector3f& end,
const std::vector<unsigned char>& walkableGrid) const; const std::vector<unsigned char>& walkableGrid) const;
std::vector<Eigen::Vector3f> runAStar(const Eigen::Vector3f& start,
const Eigen::Vector3f& end,
const std::vector<unsigned char>& grid,
bool returnNearestOnFail) const;
}; };
} // namespace FRG } // namespace FRG