From e94d004f486d1c6559f3aeee78015a5e11179311 Mon Sep 17 00:00:00 2001 From: Tracer <43095317+TracerDS@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:34:09 +0200 Subject: [PATCH] Added stats for peds Refactored the code so it will work with ped stats --- const_sh.lua | 625 +++++++++++++++++++++++++++++++++++++++++ core_c.lua | 72 +++-- core_s.lua | 109 +------ core_sh.lua | 26 +- meta.xml | 1 + models/peds/README.txt | 7 +- 6 files changed, 718 insertions(+), 122 deletions(-) create mode 100644 const_sh.lua diff --git a/const_sh.lua b/const_sh.lua new file mode 100644 index 0000000..44a45c4 --- /dev/null +++ b/const_sh.lua @@ -0,0 +1,625 @@ +ML.Const.WalkingStyles = { + MOVE_DEFAULT = 0, + MOVE_PLAYER = 54, + MOVE_PLAYER_FAT = 55, + MOVE_PLAYER_MUSCULAR = 56, + MOVE_ROCKET = 57, + MOVE_ROCKET_FAT = 58, + MOVE_ROCKET_MUSCULAR = 59, + MOVE_ARMED = 60, + MOVE_ARMED_FAT = 61, + MOVE_ARMED_MUSCULAR = 62, + MOVE_BASEBALLBAT = 63, + MOVE_BASEBALLBAT_FAT = 64, + MOVE_BASEBALLBAT_MUSCULAR = 65, + MOVE_CHAINSAW = 66, + MOVE_CHAINSAW_FAT = 67, + MOVE_CHAINSAW_MUSCULAR = 68, + MOVE_SNEAK = 69, + MOVE_JETPACK = 70, + MOVE_MAN = 118, + MOVE_SHUFFLE = 119, + MOVE_OLDMAN = 120, + MOVE_GANG1 = 121, + MOVE_GANG2 = 122, + MOVE_OLDFATMAN = 123, + MOVE_FATMAN = 124, + MOVE_JOGGER = 125, + MOVE_DRUNKMAN = 126, + MOVE_BLINDMAN = 127, + MOVE_SWAT = 128, + MOVE_WOMAN = 129, + MOVE_SHOPPING = 130, + MOVE_BUSYWOMAN = 131, + MOVE_SEXYWOMAN = 132, + MOVE_PRO = 133, + MOVE_OLDWOMAN = 134, + MOVE_FATWOMAN = 135, + MOVE_JOGWOMAN = 136, + MOVE_OLDFATWOMAN = 137, + MOVE_SKATE = 138, +} + +ML.Funcs.IsWalkingStyle = function(style) + if ML.Const.WalkingStyles[style] then + return true + end + for _,v in pairs(ML.Const.WalkingStyles) do + if v == style then return true end + end + return false +end + +ML.Const.PedStats = { + PROGRESS_MADE = 0, + TOTAL_PROGRESS = 1, + LONGEST_BASKETBALL = 2, + DIST_FOOT = 3, + DIST_CAR = 4, + DIST_BIKE = 5, + DIST_BOAT = 6, + DIST_GOLF_CART = 7, + DIST_HELICOPTER = 8, + DIST_PLANE = 9, + LONGEST_WHEELIE_DIST = 10, + LONGEST_STOPPIE_DIST = 11, + LONGEST_2WHEEL_DIST = 12, + WEAPON_BUDGET = 13, + FASHION_BUDGET = 14, + PROPERTY_BUDGET = 15, + SPRAYING_BUDGET = 16, + LONGEST_WHEELIE_TIME = 17, + LONGEST_STOPPIE_TIME = 18, + LONGEST_2WHEEL_TIME = 19, + FOOD_BUDGET = 20, + FAT = 21, + STAMINA = 22, + BODY_MUSCLE = 23, + MAX_HEALTH = 24, + SEX_APPEAL = 25, + DIST_SWIMMING = 26, + DIST_CYCLE = 27, + DIST_TREADMILL = 28, + DIST_EXCERSISE_BIKE = 29, + TATTOO_BUDGET = 30, + HAIRDRESSING_BUDGET = 31, + PROSTITUTE_BUDGET = 33, + MONEY_SPENT_GAMBLING = 35, + MONEY_MADE_PIMPING = 36, + MONEY_WON_GAMBLING = 37, + BIGGEST_GAMBLING_WIN = 38, + BIGGEST_GAMBLING_LOSS = 39, + LARGEST_BURGLARY_SWAG = 40, + MONEY_MADE_BURGLARY = 41, + LONGEST_TREADMILL_TIME = 44, + LONGEST_EXCERSISE_BIKE_TIME = 45, + HEAVIEST_WEIGHT_BENCH_PRESS = 46, + HEAVIEST_WEIGHT_DUMBELLS = 47, + BEST_TIME_HOTRING = 48, + BEST_TIME_BMX = 49, + LONGEST_CHASE_TIME = 51, + LAST_CHASE_TIME = 52, + WAGE_BILL = 53, + STRIP_CLUB_BUDGET = 54, + CAR_MOD_BUDGET = 55, + TIME_SPENT_SHOPPING = 56, + TOTAL_SHOPPING_BUDGET = 62, + TIME_SPENT_UNDERWATER = 63, + RESPECT_TOTAL = 64, + RESPECT_GIRLFRIEND = 65, + RESPECT_CLOTHES = 66, + RESPECT_FITNESS = 67, + RESPECT = 68, + Weapon skills: + WEAPONTYPE_PISTOL_SKILL = 69, + WEAPONTYPE_PISTOL_SILENCED_SKILL = 70, + WEAPONTYPE_DESERT_EAGLE_SKILL = 71, + WEAPONTYPE_SHOTGUN_SKILL = 72, + WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL = 73, + WEAPONTYPE_SPAS12_SHOTGUN_SKILL = 74, + WEAPONTYPE_MICRO_UZI_SKILL = 75, + WEAPONTYPE_MP5_SKILL = 76, + WEAPONTYPE_AK47_SKILL = 77, + WEAPONTYPE_M4_SKILL = 78, + WEAPONTYPE_SNIPERRIFLE_SKILL = 79, + SEX_APPEAL_CLOTHES = 80, + GAMBLING = 81, + Integer + PEOPLE_KILLED_BY_OTHERS = 120, + PEOPLE_KILLED_BY_PLAYER = 121, + CARS_DESTROYED = 122, + BOATS_DESTROYED = 123, + HELICOPTORS_DESTROYED = 124, + PROPERTY_DESTROYED = 125, + ROUNDS_FIRED = 126, + EXPLOSIVES_USED = 127, + BULLETS_HIT = 128, + TYRES_POPPED = 129, + HEADS_POPPED = 130, + WANTED_STARS_ATTAINED = 131, + WANTED_STARS_EVADED = 132, + TIMES_ARRESTED = 133, + DAYS_PASSED = 134, + TIMES_DIED = 135, + TIMES_SAVED = 136, + TIMES_CHEATED = 137, + SPRAYINGS = 138, + MAX_JUMP_DISTANCE = 139, + MAX_JUMP_HEIGHT = 140, + MAX_JUMP_FLIPS = 141, + MAX_JUMP_SPINS = 142, + BEST_STUNT = 143, + UNIQUE_JUMPS_FOUND = 144, + UNIQUE_JUMPS_DONE = 145, + MISSIONS_ATTEMPTED = 146, + MISSIONS_PASSED = 147, + TOTAL_MISSIONS = 148, + TAXI_MONEY_MADE = 149, + PASSENGERS_DELIVERED_IN_TAXI = 150, + LIVES_SAVED = 151, + CRIMINALS_CAUGHT = 152, + FIRES_EXTINGUISHED = 153, + PIZZAS_DELIVERED = 154, + ASSASSINATIONS = 155, + LATEST_DANCE_SCORE = 156, + VIGILANTE_LEVEL = 157, + AMBULANCE_LEVEL = 158, + FIREFIGHTER_LEVEL = 159, + DRIVING_SKILL = 160, + TRUCK_MISSIONS_PASSED = 161, + TRUCK_MONEY_MADE = 162, + RECRUITED_GANG_MEMBERS_KILLED = 163, + ARMOUR = 164, + ENERGY = 165, + PHOTOS_TAKEN = 166, + KILL_FRENZIES_ATTEMPTED = 167, + KILL_FRENZIES_PASSED = 168, + FLIGHT_TIME = 169, + TIMES_DROWNED = 170, + NUM_GIRLS_PIMPED = 171, + BEST_POSITION_HOTRING = 172, + FLIGHT_TIME_JETPACK = 173, + SHOOTING_RANGE_SCORE = 174, + VALET_CARS_PARKED = 175, + KILLS_SINCE_LAST_CHECKPOINT = 176, + TOTAL_LEGITIMATE_KILLS = 177, + BLOODRING_KILLS = 178, + BLOODRING_TIME = 179, + NO_MORE_HURRICANES = 180, + CITIES_PASSED = 181, + POLICE_BRIBES = 182, + CARS_STOLEN = 183, + CURRENT_GIRLFRIENDS = 184, + BAD_DATES = 185, + GIRLS_DATED = 186, + TIMES_SCORED_WITH_GIRL = 187, + DATES = 188, + GIRLS_DUMPED = 189, + TIMES_VISITED_PROSTITUTE = 190, + HOUSES_BURGLED = 191, + SAFES_CRACKED = 192, + STOLEN_ITEMS_SOLD = 194, + EIGHT_BALLS_IN_POOL = 195, + WINS_IN_POOL = 196, + LOSSES_IN_POOL = 197, + VISITS_TO_GYM = 198, + MEALS_EATEN = 200, + UNDERWATER_STAMINA = 225, + BIKE_SKILL = 229, + CYCLE_SKILL = 230, +} + +ML.Funcs.IsPedStat = function(stat) + if ML.Const.PedStats[stat] then + return true + end + for _,v in pairs(ML.Const.PedStats) do + if v == stat then return true end + end + return false +end + +ML.Const.PedVoices = { + PED_TYPE_GEN = { + VOICE_GEN_BBDYG1 = true, + VOICE_GEN_BBDYG2 = true, + VOICE_GEN_BFORI = true, + VOICE_GEN_BFOST = true, + VOICE_GEN_BFYBE = true, + VOICE_GEN_BFYBU = true, + VOICE_GEN_BFYCRP = true, + VOICE_GEN_BFYPRO = true, + VOICE_GEN_BFYRI = true, + VOICE_GEN_BFYST = true, + VOICE_GEN_BIKDRUG = true, + VOICE_GEN_BIKERA = true, + VOICE_GEN_BIKERB = true, + VOICE_GEN_BMOCD = true, + VOICE_GEN_BMORI = true, + VOICE_GEN_BMOSEC = true, + VOICE_GEN_BMOST = true, + VOICE_GEN_BMOTR1 = true, + VOICE_GEN_BMYAP = true, + VOICE_GEN_BMYBE = true, + VOICE_GEN_BMYBOUN = true, + VOICE_GEN_BMYBOX = true, + VOICE_GEN_BMYBU = true, + VOICE_GEN_BMYCG = true, + VOICE_GEN_BMYCON = true, + VOICE_GEN_BMYCR = true, + VOICE_GEN_BMYDJ = true, + VOICE_GEN_BMYDRUG = true, + VOICE_GEN_BMYMOUN = true, + VOICE_GEN_BMYPOL1 = true, + VOICE_GEN_BMYPOL2 = true, + VOICE_GEN_BMYRI = true, + VOICE_GEN_BMYST = true, + VOICE_GEN_BYMPI = true, + VOICE_GEN_CWFOFR = true, + VOICE_GEN_CWFOHB = true, + VOICE_GEN_CWFYFR1 = true, + VOICE_GEN_CWFYFR2 = true, + VOICE_GEN_CWFYHB1 = true, + VOICE_GEN_CWMOFR1 = true, + VOICE_GEN_CWMOHB1 = true, + VOICE_GEN_CWMOHB2 = true, + VOICE_GEN_CWMYFR = true, + VOICE_GEN_CWMYHB1 = true, + VOICE_GEN_CWMYHB2 = true, + VOICE_GEN_DNFOLC1 = true, + VOICE_GEN_DNFOLC2 = true, + VOICE_GEN_DNFYLC = true, + VOICE_GEN_DNMOLC1 = true, + VOICE_GEN_DNMOLC2 = true, + VOICE_GEN_DNMYLC = true, + VOICE_GEN_DWFOLC = true, + VOICE_GEN_DWFYLC1 = true, + VOICE_GEN_DWFYLC2 = true, + VOICE_GEN_DWMOLC1 = true, + VOICE_GEN_DWMOLC2 = true, + VOICE_GEN_DWMYLC1 = true, + VOICE_GEN_DWMYLC2 = true, + VOICE_GEN_HFORI = true, + VOICE_GEN_HFOST = true, + VOICE_GEN_HFYBE = true, + VOICE_GEN_HFYPRO = true, + VOICE_GEN_HFYRI = true, + VOICE_GEN_HFYST = true, + VOICE_GEN_HMORI = true, + VOICE_GEN_HMOST = true, + VOICE_GEN_HMYBE = true, + VOICE_GEN_HMYCM = true, + VOICE_GEN_HMYCR = true, + VOICE_GEN_HMYDRUG = true, + VOICE_GEN_HMYRI = true, + VOICE_GEN_HMYST = true, + VOICE_GEN_IMYST = true, + VOICE_GEN_IRFYST = true, + VOICE_GEN_IRMYST = true, + VOICE_GEN_MAFFA = true, + VOICE_GEN_MAFFB = true, + VOICE_GEN_MALE01 = true, + VOICE_GEN_NOVOICE = true, + VOICE_GEN_OFORI = true, + VOICE_GEN_OFOST = true, + VOICE_GEN_OFYRI = true, + VOICE_GEN_OFYST = true, + VOICE_GEN_OMOBOAT = true, + VOICE_GEN_OMOKUNG = true, + VOICE_GEN_OMORI = true, + VOICE_GEN_OMOST = true, + VOICE_GEN_OMYRI = true, + VOICE_GEN_OMYST = true, + VOICE_GEN_SBFORI = true, + VOICE_GEN_SBFOST = true, + VOICE_GEN_SBFYPRO = true, + VOICE_GEN_SBFYRI = true, + VOICE_GEN_SBFYST = true, + VOICE_GEN_SBFYSTR = true, + VOICE_GEN_SBMOCD = true, + VOICE_GEN_SBMORI = true, + VOICE_GEN_SBMOST = true, + VOICE_GEN_SBMOTR1 = true, + VOICE_GEN_SBMOTR2 = true, + VOICE_GEN_SBMYCR = true, + VOICE_GEN_SBMYRI = true, + VOICE_GEN_SBMYST = true, + VOICE_GEN_SBMYTR3 = true, + VOICE_GEN_SFYPRO = true, + VOICE_GEN_SHFYPRO = true, + VOICE_GEN_SHMYCR = true, + VOICE_GEN_SMYST = true, + VOICE_GEN_SMYST2 = true, + VOICE_GEN_SOFORI = true, + VOICE_GEN_SOFOST = true, + VOICE_GEN_SOFYBU = true, + VOICE_GEN_SOFYRI = true, + VOICE_GEN_SOFYST = true, + VOICE_GEN_SOMOBU = true, + VOICE_GEN_SOMORI = true, + VOICE_GEN_SOMOST = true, + VOICE_GEN_SOMYAP = true, + VOICE_GEN_SOMYBU = true, + VOICE_GEN_SOMYRI = true, + VOICE_GEN_SOMYST = true, + VOICE_GEN_SWFOPRO = true, + VOICE_GEN_SWFORI = true, + VOICE_GEN_SWFOST = true, + VOICE_GEN_SWFYRI = true, + VOICE_GEN_SWFYST = true, + VOICE_GEN_SWFYSTR = true, + VOICE_GEN_SWMOCD = true, + VOICE_GEN_SWMORI = true, + VOICE_GEN_SWMOST = true, + VOICE_GEN_SWMOTR1 = true, + VOICE_GEN_SWMOTR2 = true, + VOICE_GEN_SWMOTR3 = true, + VOICE_GEN_SWMOTR4 = true, + VOICE_GEN_SWMOTR5 = true, + VOICE_GEN_SWMYCR = true, + VOICE_GEN_SWMYHP1 = true, + VOICE_GEN_SWMYHP2 = true, + VOICE_GEN_SWMYRI = true, + VOICE_GEN_SWMYST = true, + VOICE_GEN_VBFYPRO = true, + VOICE_GEN_VBFYST2 = true, + VOICE_GEN_VBMOCD = true, + VOICE_GEN_VBMYCR = true, + VOICE_GEN_VBMYELV = true, + VOICE_GEN_VHFYPRO = true, + VOICE_GEN_VHFYST3 = true, + VOICE_GEN_VHMYCR = true, + VOICE_GEN_VHMYELV = true, + VOICE_GEN_VIMYELV = true, + VOICE_GEN_VWFYPRO = true, + VOICE_GEN_VWFYST1 = true, + VOICE_GEN_VWFYWAI = true, + VOICE_GEN_VWMOTR1 = true, + VOICE_GEN_VWMOTR2 = true, + VOICE_GEN_VWMYAP = true, + VOICE_GEN_VWMYBJD = true, + VOICE_GEN_VWMYCD = true, + VOICE_GEN_VWMYCR = true, + VOICE_GEN_WFOPJ = true, + VOICE_GEN_WFORI = true, + VOICE_GEN_WFOST = true, + VOICE_GEN_WFYBE = true, + VOICE_GEN_WFYBU = true, + VOICE_GEN_WFYCRK = true, + VOICE_GEN_WFYCRP = true, + VOICE_GEN_WFYJG = true, + VOICE_GEN_WFYLG = true, + VOICE_GEN_WFYPRO = true, + VOICE_GEN_WFYRI = true, + VOICE_GEN_WFYRO = true, + VOICE_GEN_WFYST = true, + VOICE_GEN_WFYSTEW = true, + VOICE_GEN_WMOMIB = true, + VOICE_GEN_WMOPJ = true, + VOICE_GEN_WMOPREA = true, + VOICE_GEN_WMORI = true, + VOICE_GEN_WMOSCI = true, + VOICE_GEN_WMOST = true, + VOICE_GEN_WMOTR1 = true, + VOICE_GEN_WMYBE = true, + VOICE_GEN_WMYBMX = true, + VOICE_GEN_WMYBOUN = true, + VOICE_GEN_WMYBOX = true, + VOICE_GEN_WMYBP = true, + VOICE_GEN_WMYBU = true, + VOICE_GEN_WMYCD1 = true, + VOICE_GEN_WMYCD2 = true, + VOICE_GEN_WMYCH = true, + VOICE_GEN_WMYCON = true, + VOICE_GEN_WMYCONB = true, + VOICE_GEN_WMYCR = true, + VOICE_GEN_WMYDRUG = true, + VOICE_GEN_WMYGAR = true, + VOICE_GEN_WMYGOL1 = true, + VOICE_GEN_WMYGOL2 = true, + VOICE_GEN_WMYJG = true, + VOICE_GEN_WMYLG = true, + VOICE_GEN_WMYMECH = true, + VOICE_GEN_WMYMOUN = true, + VOICE_GEN_WMYPLT = true, + VOICE_GEN_WMYRI = true, + VOICE_GEN_WMYRO = true, + VOICE_GEN_WMYSGRD = true, + VOICE_GEN_WMYSKAT = true, + VOICE_GEN_WMYST = true, + VOICE_GEN_WMYTX1 = true, + VOICE_GEN_WMYTX2 = true, + VOICE_GEN_WMYVA = true, + }, + PED_TYPE_EMG = { + VOICE_EMG_ARMY1 = true, + VOICE_EMG_ARMY2 = true, + VOICE_EMG_ARMY3 = true, + VOICE_EMG_EMT1 = true, + VOICE_EMG_EMT2 = true, + VOICE_EMG_EMT3 = true, + VOICE_EMG_EMT4 = true, + VOICE_EMG_EMT5 = true, + VOICE_EMG_FBI2 = true, + VOICE_EMG_FBI3 = true, + VOICE_EMG_FBI4 = true, + VOICE_EMG_FBI5 = true, + VOICE_EMG_FBI6 = true, + VOICE_EMG_LAPD1 = true, + VOICE_EMG_LAPD2 = true, + VOICE_EMG_LAPD3 = true, + VOICE_EMG_LAPD4 = true, + VOICE_EMG_LAPD5 = true, + VOICE_EMG_LAPD6 = true, + VOICE_EMG_LAPD7 = true, + VOICE_EMG_LAPD8 = true, + VOICE_EMG_LVPD1 = true, + VOICE_EMG_LVPD2 = true, + VOICE_EMG_LVPD3 = true, + VOICE_EMG_LVPD4 = true, + VOICE_EMG_LVPD5 = true, + VOICE_EMG_MCOP1 = true, + VOICE_EMG_MCOP2 = true, + VOICE_EMG_MCOP3 = true, + VOICE_EMG_MCOP4 = true, + VOICE_EMG_MCOP5 = true, + VOICE_EMG_MCOP6 = true, + VOICE_EMG_PULASKI = true, + VOICE_EMG_RCOP1 = true, + VOICE_EMG_RCOP2 = true, + VOICE_EMG_RCOP3 = true, + VOICE_EMG_RCOP4 = true, + VOICE_EMG_SFPD1 = true, + VOICE_EMG_SFPD2 = true, + VOICE_EMG_SFPD3 = true, + VOICE_EMG_SFPD4 = true, + VOICE_EMG_SFPD5 = true, + VOICE_EMG_SWAT1 = true, + VOICE_EMG_SWAT2 = true, + VOICE_EMG_SWAT4 = true, + VOICE_EMG_SWAT6 = true, + }, + PED_TYPE_PLAYER = { + VOICE_PLY_AG = true, + VOICE_PLY_AG2 = true, + VOICE_PLY_AR = true, + VOICE_PLY_AR2 = true, + VOICE_PLY_CD = true, + VOICE_PLY_CD2 = true, + VOICE_PLY_CF = true, + VOICE_PLY_CF2 = true, + VOICE_PLY_CG = true, + VOICE_PLY_CG2 = true, + VOICE_PLY_CR = true, + VOICE_PLY_CR2 = true, + VOICE_PLY_PG = true, + VOICE_PLY_PG2 = true, + VOICE_PLY_PR = true, + VOICE_PLY_PR2 = true, + VOICE_PLY_WG = true, + VOICE_PLY_WG2 = true, + VOICE_PLY_WR = true, + VOICE_PLY_WR2 = true, + }, + PED_TYPE_GANG = { + VOICE_GNG_BALLAS1 = true, + VOICE_GNG_BALLAS2 = true, + VOICE_GNG_BALLAS3 = true, + VOICE_GNG_BALLAS4 = true, + VOICE_GNG_BALLAS5 = true, + VOICE_GNG_BIG_BEAR = true, + VOICE_GNG_CESAR = true, + VOICE_GNG_DNB1 = true, + VOICE_GNG_DNB2 = true, + VOICE_GNG_DNB3 = true, + VOICE_GNG_DNB5 = true, + VOICE_GNG_DWAINE = true, + VOICE_GNG_FAM1 = true, + VOICE_GNG_FAM2 = true, + VOICE_GNG_FAM3 = true, + VOICE_GNG_FAM4 = true, + VOICE_GNG_FAM5 = true, + VOICE_GNG_JIZZY = true, + VOICE_GNG_LSV1 = true, + VOICE_GNG_LSV2 = true, + VOICE_GNG_LSV3 = true, + VOICE_GNG_LSV4 = true, + VOICE_GNG_LSV5 = true, + VOICE_GNG_MACCER = true, + VOICE_GNG_MAFBOSS = true, + VOICE_GNG_OGLOC = true, + VOICE_GNG_RYDER = true, + VOICE_GNG_SFR1 = true, + VOICE_GNG_SFR2 = true, + VOICE_GNG_SFR3 = true, + VOICE_GNG_SFR4 = true, + VOICE_GNG_SFR5 = true, + VOICE_GNG_SMOKE = true, + VOICE_GNG_STRI1 = true, + VOICE_GNG_STRI2 = true, + VOICE_GNG_STRI4 = true, + VOICE_GNG_STRI5 = true, + VOICE_GNG_SWEET = true, + VOICE_GNG_TBONE = true, + VOICE_GNG_TORENO = true, + VOICE_GNG_TRUTH = true, + VOICE_GNG_VLA1 = true, + VOICE_GNG_VLA2 = true, + VOICE_GNG_VLA3 = true, + VOICE_GNG_VLA4 = true, + VOICE_GNG_VLA5 = true, + VOICE_GNG_VMAFF1 = true, + VOICE_GNG_VMAFF2 = true, + VOICE_GNG_VMAFF3 = true, + VOICE_GNG_VMAFF4 = true, + VOICE_GNG_VMAFF5 = true, + VOICE_GNG_WOOZIE = true, + }, + PED_TYPE_GFD = { + VOICE_GFD_BARBARA = true, + VOICE_GFD_BMOBAR = true, + VOICE_GFD_BMYBARB = true, + VOICE_GFD_BMYTATT = true, + VOICE_GFD_CATALINA = true, + VOICE_GFD_DENISE = true, + VOICE_GFD_HELENA = true, + VOICE_GFD_KATIE = true, + VOICE_GFD_MICHELLE = true, + VOICE_GFD_MILLIE = true, + VOICE_GFD_POL_ANN = true, + VOICE_GFD_WFYBURG = true, + VOICE_GFD_WFYCLOT = true, + VOICE_GFD_WMYAMMO = true, + VOICE_GFD_WMYBARB = true, + VOICE_GFD_WMYBELL = true, + VOICE_GFD_WMYCLOT = true, + VOICE_GFD_WMYPIZZ = true, + }, +} + +ML.Funcs.IsPedVoice = function(block, value) + if not ML.Const.PedStats[block] then + return false + end + return not not ML.Const.PedStats[block][value] +end + +ML.Const.VehicleProperties = { + mass = true, + turnMass = true, + dragCoeff = true, + centerOfMass = true, + percentSubmerged = true, + tractionMultiplier = true, + tractionLoss = true, + tractionBias = true, + numberOfGears = true, + maxVelocity = true, + engineAcceleration = true, + engineInertia = true, + driveType = true, + engineType = true, + brakeDeceleration = true, + brakeBias = true, + ABS = true, + steeringLock = true, + suspensionForceLevel = true, + suspensionDamping = true, + suspensionHighSpeedDamping = true, + suspensionUpperLimit = true, + suspensionLowerLimit = true, + suspensionFrontRearBias = true, + suspensionAntiDiveMultiplier = true, + seatOffsetDistance = true, + collisionDamageMultiplier = true, + monetary = true, + modelFlags = true, + handlingFlags = true, + headLight = true, + tailLight = true, + animGroup = true, +} + +ML.Funcs.IsVehicleProperty = function(property) + return not not ML.Const.VehicleProperties[property] +end \ No newline at end of file diff --git a/core_c.lua b/core_c.lua index 2d11ba3..19c9d4e 100644 --- a/core_c.lua +++ b/core_c.lua @@ -1,12 +1,18 @@ -ML.ReplacedModels = {} -ML.ReplacedModelsID = {} +ML.ReplacedModels = { + ped = {}, + vehicle = {}, +} +ML.ReplacedModelsID = { + ped = {}, + vehicle = {}, +} -- Function for request ID for a model ML.Funcs.RequestModel = function(modelType, modelName, modelData) local id = engineRequestModel(modelType) if not id then return end - ML.ReplacedModels[modelName] = {} + local modelTable = {} local col local txd @@ -31,14 +37,18 @@ ML.Funcs.RequestModel = function(modelType, modelName, modelData) end end - ML.ReplacedModels[modelName].id = id - ML.ReplacedModels[modelName].modelName = modelName - ML.ReplacedModels[modelName].col = col - ML.ReplacedModels[modelName].txd = txd - ML.ReplacedModels[modelName].dff = dff - ML.ReplacedModels[modelName].config = modelData.config + modelTable.id = id + modelTable.modelName = modelName + modelTable.col = col + modelTable.txd = txd + modelTable.dff = dff + modelTable.config = modelData.config - ML.ReplacedModelsID[id] = modelName + -- replaced model + ML.ReplacedModels[modelType][modelName] = modelTable + + -- helper table used for getting the model by id + ML.ReplacedModelsID[modelType][id] = modelName return id end @@ -47,16 +57,44 @@ end ML.Funcs.ReplaceModel = function(model, id) if not model or not isElement(model) then return end - if getElementType(model) == 'vehicle' then - local modelName = ML.ReplacedModelsID[id] - if not modelName then return end + local modelType = getElementType(model) + local modelTypeIDTable = ML.ReplacedModelsID[modelType] + if not modelTypeIDTable then return end + + local modelName = modelTypeIDTable[id] + if not modelName then return end - local modelEntry = ML.ReplacedModels[modelName] - if not modelEntry then return end + local modelTypeTable = ML.ReplacedModels[modelType] + if not modelTypeTable then return end + local modelEntry = modelTypeTable[modelName] + if not modelEntry then return end + + if modelType == 'vehicle' then for name, value in pairs(modelEntry.config) do - if not setVehicleHandling(model, name, value) then - break + if ML.Funcs.IsVehicleProperty(name) then + if not setVehicleHandling(model, name, value) then + break + end + end + end + end + if modelTypeTable == 'ped' then + for name, value in pairs(modelEntry.config) then + if ML.Funcs.IsWalkingStyle(name) then + if not setPedWalkingStyle(model, value) then + break + end + end + if ML.Funcs.IsPedStat(name) then + if not setPedStat(model, name, value) then + break + end + end + if ML.Funcs.IsPedVoice(name, value) then + if not setPedVoice(model, name, value) then + break + end end end end diff --git a/core_s.lua b/core_s.lua index 52a7d35..e95f6a0 100644 --- a/core_s.lua +++ b/core_s.lua @@ -41,114 +41,17 @@ local function ReadDir(path) tbl[modelName].col = col end - -- special: For vehicles only + -- special: For vehicles and peds only if entry:endswith('.conf') then - local config = {} + local config local xml = xmlLoadFile(path..'/'..entry) if xml then for _,node in ipairs(xmlNodeGetChildren(xml) or {}) do - local propertyName = xmlNodeGetAttribute(node, 'name') - local propertyValue = xmlNodeGetAttribute(node, 'value') - - if propertyName == 'mass' then - config.mass = propertyValue - end - if propertyName == 'turnMass' then - config.turnMass = propertyValue - end - if propertyName == 'dragCoeff' then - config.dragCoeff = propertyValue - end - if propertyName == 'centerOfMass' then - config.centerOfMass = propertyValue - end - if propertyName == 'percentSubmerged' then - config.percentSubmerged = propertyValue - end - if propertyName == 'tractionMultiplier' then - config.tractionMultiplier = propertyValue - end - if propertyName == 'tractionLoss' then - config.tractionLoss = propertyValue - end - if propertyName == 'tractionBias' then - config.tractionBias = propertyValue - end - if propertyName == 'numberOfGears' then - config.numberOfGears = propertyValue - end - if propertyName == 'maxVelocity' then - config.maxVelocity = propertyValue - end - if propertyName == 'engineAcceleration' then - config.engineAcceleration = propertyValue - end - if propertyName == 'engineInertia' then - config.engineInertia = propertyValue - end - if propertyName == 'driveType' then - config.driveType = propertyValue - end - if propertyName == 'engineType' then - config.engineType = propertyValue - end - if propertyName == 'brakeDeceleration' then - config.brakeDeceleration = propertyValue - end - if propertyName == 'brakeBias' then - config.brakeBias = propertyValue - end - if propertyName == 'ABS' then - config.ABS = propertyValue - end - if propertyName == 'steeringLock' then - config.steeringLock = propertyValue - end - if propertyName == 'suspensionForceLevel' then - config.suspensionForceLevel = propertyValue - end - if propertyName == 'suspensionDamping' then - config.suspensionDamping = propertyValue - end - if propertyName == 'suspensionHighSpeedDamping' then - config.suspensionHighSpeedDamping = propertyValue - end - if propertyName == 'suspensionUpperLimit' then - config.suspensionUpperLimit = propertyValue - end - if propertyName == 'suspensionLowerLimit' then - config.suspensionLowerLimit = propertyValue - end - if propertyName == 'suspensionFrontRearBias' then - config.suspensionFrontRearBias = propertyValue - end - if propertyName == 'suspensionAntiDiveMultiplier' then - config.suspensionAntiDiveMultiplier = propertyValue - end - if propertyName == 'seatOffsetDistance' then - config.seatOffsetDistance = propertyValue - end - if propertyName == 'collisionDamageMultiplier' then - config.collisionDamageMultiplier = propertyValue - end - if propertyName == 'monetary' then - config.monetary = propertyValue - end - if propertyName == 'modelFlags' then - config.modelFlags = propertyValue - end - if propertyName == 'handlingFlags' then - config.handlingFlags = propertyValue - end - if propertyName == 'headLight' then - config.headLight = propertyValue - end - if propertyName == 'tailLight' then - config.tailLight = propertyValue - end - if propertyName == 'animGroup' then - config.animGroup = propertyValue + -- load data for model + local propName, propValue = ML.Funcs.XML.LoadData(node) + if propName and propValue then + config[propName] = propValue end end diff --git a/core_sh.lua b/core_sh.lua index 7410376..3ee55fd 100644 --- a/core_sh.lua +++ b/core_sh.lua @@ -39,4 +39,28 @@ ML.Funcs.CreateModel = function(modelType, ...) end end -CreateModel = ML.Funcs.CreateModel \ No newline at end of file +CreateModel = ML.Funcs.CreateModel + +ML.Funcs.XML = {} +ML.Funcs.XML.LoadData = function(node) + local propertyName = xmlNodeGetAttribute(node, 'name') + local propertyValue = xmlNodeGetAttribute(node, 'value') + + -- vehicle data + if ML.Const.VehicleProperties[propertyName] then + return propertyName, propertyValue + end + + -- ped data + if ML.Const.PedStats[propertyName] ~= nil then + return propertyName, propertyValue + end + if ML.Const.WalkingStyles[propertyName] ~= nil then + return propertyName, propertyValue + end + if ML.Const.PedVoices[propertyName] then + if ML.Const.PedVoices[propertyName][propertyValue] then + return propertyName, propertyValue + end + end +end \ No newline at end of file diff --git a/meta.xml b/meta.xml index a0c358e..6b0830d 100644 --- a/meta.xml +++ b/meta.xml @@ -2,6 +2,7 @@