Перенос кода с Cleo на Lua

  • Автор темы deleted-user-515827
  • Дата начала
D

deleted-user-515827

Гость
Автор темы
Версия MoonLoader
.026-beta
Всем привет. Есть такой скрипт для тепловых ловушек, как у Гидры для других вертолётов/самолётов. Я его декомпилирован через Sanny Builder и вышло вот такое:

Декомпил:
// This file was decompiled using SASCM.ini published on 2022-03-20
{$CLEO .cs}

script_name 'FLARE'
get_this_script_struct 8@
8@ += 16
read_memory 8@ = read_memory 8@ size 4 virtual_protect 0
8@ -= -3749
8@ -= 10787168
8@ /= 4

:FLARE_62
wait 0
if
  not Actor.DrivingPlane($PLAYER_ACTOR)
jf @FLARE_105
if
84A9:   not actor $PLAYER_ACTOR driving_heli
jf @FLARE_1926
jump @FLARE_62

:FLARE_105
0@ = Actor.CurrentCar($PLAYER_ACTOR)
Model.Load(#RCCAM)
Model.Load(#FLARE)
038B: load_requested_models

:FLARE_125
wait 0
if
  Model.Available(#RCCAM)
  Model.Available(#FLARE)
jf @FLARE_157
jump @FLARE_164

:FLARE_157
jump @FLARE_125

:FLARE_164
1@ = 0
TIMERA = 375
TIMERB = 75

:FLARE_186
wait 0
if and
00E1:   player 0 pressed_key 17
  TIMERA > 375
jf @FLARE_1511
0085: 9@ = 1@ // (int)
9@ *= 2
005A: 9@ += 8@ // (int)
if
056E:   car &0(9@,1i) defined
jf @FLARE_290
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
9@ += -1

:FLARE_290
3@ = Car.Model(0@)
07E4: get_model 3@ dimensions_cornerA_to 3@ 3@ 4@ dimensions_cornerB_to 3@ 3@ 3@
4@ += -1.5
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.5 -5.0 4@
Car.Create(&0(9@,1i), #RCCAM, 5@, 6@, 7@)
06A2: get_car 0@ velocity_in_direction_XYZ 5@ 6@ 7@
5@ *= 0.02
6@ *= 0.02
7@ *= 0.02
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 5@ 6@ 7@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0407: store_coords_to 2@ 3@ 4@ from_car 0@ with_offset 0.3 -0.5 0.0
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 0.0 0.0
0063: 2@ -= 5@ // (float)
0063: 3@ -= 6@ // (float)
0063: 4@ -= 7@ // (float)
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 2@ 3@ 4@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0338: set_car &0(9@,1i) visibility 0
3@ = 589332
get_vehicle_pointer 4@ = vehicle 0@
get_vehicle_pointer 5@ = vehicle &0(9@,1i)
7@ = 589334
2@ = 0

:FLARE_629
0209: 6@ = random_int_in_ranges 0 5
if and
  &0(7@,1i) == 1
003C:   &0(3@,1i) == 4@ // (int)
  6@ == 0
jf @FLARE_691
008A: &0(3@,1i) = 5@ // (int)

:FLARE_691
3@ += 9
7@ += 9
2@ += 1
  2@ > 31
jf @FLARE_629
0085: 2@ = 9@ // (int)
9@ += 1
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 -5.0 -5.0
Object.Create(&0(9@,1i), #FLARE, 5@, 6@, 7@)
0681: attach_object &0(9@,1i) to_car &0(2@,1i) with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0
Object.CollisionDetection(&0(9@,1i), False)
1@ += 1
9@ += 1
if
056E:   car &0(9@,1i) defined
jf @FLARE_914
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
9@ += -1

:FLARE_914
3@ = Car.Model(0@)
07E4: get_model 3@ dimensions_cornerA_to 3@ 3@ 4@ dimensions_cornerB_to 3@ 3@ 3@
4@ += -1.5
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset -0.5 -5.0 4@
Car.Create(&0(9@,1i), #RCCAM, 5@, 6@, 7@)
06A2: get_car 0@ velocity_in_direction_XYZ 5@ 6@ 7@
5@ *= 0.02
6@ *= 0.02
7@ *= 0.02
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 5@ 6@ 7@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0407: store_coords_to 2@ 3@ 4@ from_car 0@ with_offset -0.3 -0.5 0.0
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 0.0 0.0
0063: 2@ -= 5@ // (float)
0063: 3@ -= 6@ // (float)
0063: 4@ -= 7@ // (float)
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 2@ 3@ 4@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0338: set_car &0(9@,1i) visibility 0
3@ = 589332
get_vehicle_pointer 4@ = vehicle 0@
get_vehicle_pointer 5@ = vehicle &0(9@,1i)
7@ = 589334
2@ = 0

:FLARE_1253
0209: 6@ = random_int_in_ranges 0 5
if and
  &0(7@,1i) == 1
003C:   &0(3@,1i) == 4@ // (int)
  6@ == 0
jf @FLARE_1315
008A: &0(3@,1i) = 5@ // (int)

:FLARE_1315
3@ += 9
7@ += 9
2@ += 1
  2@ > 31
jf @FLARE_1253
0085: 2@ = 9@ // (int)
9@ += 1
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 -5.0 -5.0
Object.Create(&0(9@,1i), #FLARE, 5@, 6@, 7@)
0681: attach_object &0(9@,1i) to_car &0(2@,1i) with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0
Object.CollisionDetection(&0(9@,1i), False)
1@ += 1
if
  1@ == 32
jf @FLARE_1504
1@ = 0

:FLARE_1504
TIMERA = 0

:FLARE_1511
0085: 9@ = 8@ // (int)
2@ = 0

:FLARE_1526
if
056E:   car &0(9@,1i) defined
jf @FLARE_1722
if
  TIMERB > 75
jf @FLARE_1638
Car.StorePos(&0(9@,1i), 5@, 6@, 7@)
095C: create_smoke_at 5@ 6@ 7@ velocity 0.0 0.0 0.0 RGBA 1.0 1.0 1.0 1.0 size 5.0 last_factor 0.25

:FLARE_1638
if or
  Car.Wrecked(&0(9@,1i))
81F3:   not car &0(9@,1i) in_air
02BF:   car &0(9@,1i) sunk
jf @FLARE_1708
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
jump @FLARE_1715

:FLARE_1708
9@ += 1

:FLARE_1715
jump @FLARE_1729

:FLARE_1722
9@ += 1

:FLARE_1729
9@ += 1
2@ += 1
  2@ > 31
jf @FLARE_1526
if
  TIMERB > 75
jf @FLARE_1782
TIMERB = 0

:FLARE_1782
if
  not Actor.DrivingPlane($PLAYER_ACTOR)
jf @FLARE_186
Car.RemoveReferences(0@)
0085: 9@ = 8@ // (int)
2@ = 0

:FLARE_1818
if
056E:   car &0(9@,1i) defined
jf @FLARE_1870
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
jump @FLARE_1877

:FLARE_1870
9@ += 1

:FLARE_1877
9@ += 1
2@ += 1
  2@ > 31
jf @FLARE_1818
Model.Destroy(#RCCAM)
Model.Destroy(#FLARE)
wait 0
jump @FLARE_62

:FLARE_1926
0@ = Actor.CurrentCar($PLAYER_ACTOR)
Model.Load(#RCCAM)
Model.Load(#FLARE)
038B: load_requested_models

:FLARE_1946
wait 0
if
  Model.Available(#RCCAM)
  Model.Available(#FLARE)
jf @FLARE_1978
jump @FLARE_1985

:FLARE_1978
jump @FLARE_1946

:FLARE_1985
1@ = 0
TIMERA = 375
TIMERB = 75

:FLARE_2007
wait 0
if and
00E1:   player 0 pressed_key 6
  TIMERA > 375
jf @FLARE_3332
0085: 9@ = 1@ // (int)
9@ *= 2
005A: 9@ += 8@ // (int)
if
056E:   car &0(9@,1i) defined
jf @FLARE_2111
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
9@ += -1

:FLARE_2111
3@ = Car.Model(0@)
07E4: get_model 3@ dimensions_cornerA_to 3@ 3@ 4@ dimensions_cornerB_to 3@ 3@ 3@
4@ += -1.5
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.5 -5.0 4@
Car.Create(&0(9@,1i), #RCCAM, 5@, 6@, 7@)
06A2: get_car 0@ velocity_in_direction_XYZ 5@ 6@ 7@
5@ *= 0.02
6@ *= 0.02
7@ *= 0.02
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 5@ 6@ 7@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0407: store_coords_to 2@ 3@ 4@ from_car 0@ with_offset 0.1 -0.2 0.0
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 0.0 0.0
0063: 2@ -= 5@ // (float)
0063: 3@ -= 6@ // (float)
0063: 4@ -= 7@ // (float)
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 2@ 3@ 4@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0338: set_car &0(9@,1i) visibility 0
3@ = 589332
get_vehicle_pointer 4@ = vehicle 0@
get_vehicle_pointer 5@ = vehicle &0(9@,1i)
7@ = 589334
2@ = 0

:FLARE_2450
0209: 6@ = random_int_in_ranges 0 5
if and
  &0(7@,1i) == 1
003C:   &0(3@,1i) == 4@ // (int)
  6@ == 0
jf @FLARE_2512
008A: &0(3@,1i) = 5@ // (int)

:FLARE_2512
3@ += 9
7@ += 9
2@ += 1
  2@ > 31
jf @FLARE_2450
0085: 2@ = 9@ // (int)
9@ += 1
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 -5.0 -5.0
Object.Create(&0(9@,1i), #FLARE, 5@, 6@, 7@)
0681: attach_object &0(9@,1i) to_car &0(2@,1i) with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0
Object.CollisionDetection(&0(9@,1i), False)
1@ += 1
9@ += 1
if
056E:   car &0(9@,1i) defined
jf @FLARE_2735
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
9@ += -1

:FLARE_2735
3@ = Car.Model(0@)
07E4: get_model 3@ dimensions_cornerA_to 3@ 3@ 4@ dimensions_cornerB_to 3@ 3@ 3@
4@ += -1.5
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset -0.5 -5.0 4@
Car.Create(&0(9@,1i), #RCCAM, 5@, 6@, 7@)
06A2: get_car 0@ velocity_in_direction_XYZ 5@ 6@ 7@
5@ *= 0.02
6@ *= 0.02
7@ *= 0.02
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 5@ 6@ 7@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0407: store_coords_to 2@ 3@ 4@ from_car 0@ with_offset -0.1 -0.2 0.0
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 0.0 0.0
0063: 2@ -= 5@ // (float)
0063: 3@ -= 6@ // (float)
0063: 4@ -= 7@ // (float)
07D5: set_car &0(9@,1i) velocity_in_direction_XYZ 2@ 3@ 4@ rotation_velocitiesXY 0.0 0.0 unk 0.0
0338: set_car &0(9@,1i) visibility 0
3@ = 589332
get_vehicle_pointer 4@ = vehicle 0@
get_vehicle_pointer 5@ = vehicle &0(9@,1i)
7@ = 589334
2@ = 0

:FLARE_3074
0209: 6@ = random_int_in_ranges 0 5
if and
  &0(7@,1i) == 1
003C:   &0(3@,1i) == 4@ // (int)
  6@ == 0
jf @FLARE_3136
008A: &0(3@,1i) = 5@ // (int)

:FLARE_3136
3@ += 9
7@ += 9
2@ += 1
  2@ > 31
jf @FLARE_3074
0085: 2@ = 9@ // (int)
9@ += 1
0407: store_coords_to 5@ 6@ 7@ from_car 0@ with_offset 0.0 -5.0 -5.0
Object.Create(&0(9@,1i), #FLARE, 5@, 6@, 7@)
0681: attach_object &0(9@,1i) to_car &0(2@,1i) with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0
Object.CollisionDetection(&0(9@,1i), False)
1@ += 1
if
  1@ == 32
jf @FLARE_3325
1@ = 0

:FLARE_3325
TIMERA = 0

:FLARE_3332
0085: 9@ = 8@ // (int)
2@ = 0

:FLARE_3347
if
056E:   car &0(9@,1i) defined
jf @FLARE_3543
if
  TIMERB > 75
jf @FLARE_3459
Car.StorePos(&0(9@,1i), 5@, 6@, 7@)
095C: create_smoke_at 5@ 6@ 7@ velocity 0.0 0.0 0.0 RGBA 1.0 1.0 1.0 1.0 size 5.0 last_factor 0.25

:FLARE_3459
if or
  Car.Wrecked(&0(9@,1i))
81F3:   not car &0(9@,1i) in_air
02BF:   car &0(9@,1i) sunk
jf @FLARE_3529
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
jump @FLARE_3536

:FLARE_3529
9@ += 1

:FLARE_3536
jump @FLARE_3550

:FLARE_3543
9@ += 1

:FLARE_3550
9@ += 1
2@ += 1
  2@ > 31
jf @FLARE_3347
if
  TIMERB > 75
jf @FLARE_3603
TIMERB = 0

:FLARE_3603
if
84A9:   not actor $PLAYER_ACTOR driving_heli
jf @FLARE_2007
Car.RemoveReferences(0@)
0085: 9@ = 8@ // (int)
2@ = 0

:FLARE_3639
if
056E:   car &0(9@,1i) defined
jf @FLARE_3691
Car.Destroy(&0(9@,1i))
9@ += 1
Object.Destroy(&0(9@,1i))
jump @FLARE_3698

:FLARE_3691
9@ += 1

:FLARE_3698
9@ += 1
2@ += 1
  2@ > 31
jf @FLARE_3639
Model.Destroy(#RCCAM)
Model.Destroy(#FLARE)
wait 0
jump @FLARE_62
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
0000: NOP
hex
 00
end

Он работает максимально просто, спавнится невидимое ТС "Горшок", отключается его видимость и к нему цепляется тепловая ловушка, которая благодаря физике т.с. красиво спускается.
И всё бы ничего, но ракеты направленные на игрока не автоматически переводятся на эту ловушку, для этого нужно сделать, как я понял, вот это:

Момент из кода, который я не понял:
3@ = 589332 - Глобальная переменная???
get_vehicle_pointer 4@ = vehicle 0@ - Т.С. игрока
get_vehicle_pointer 5@ = vehicle &0(9@,1i) - 9@ Т.С-горшок-обманка, но я не понимаю, что это за обёртка
7@ = 589334 - Глобальная переменная???

:FLARE_3074
0209: 6@ = random_int_in_ranges 0 5
if and
  &0(7@,1i) == 1
003C:   &0(3@,1i) == 4@ // (int)
  6@ == 0
jf @FLARE_3136
008A: &0(3@,1i) = 5@ // (int)

Вопрос - что за ебанина &0(XXX, XXX) и как её перенести на Lua?
Заранее спасибо

Исходник клео - прикрепил.
 

Вложения

  • flare.cs
    3.9 KB · Просмотры: 4