yamp-project / v-issues

0 stars 0 forks source link

Ped API, but most of it can also be used for the player #1

Open devpanda0 opened 5 months ago

devpanda0 commented 5 months ago

What is the scope of the api ?

Propose an api design A clear and concise description of what you want to happen.


Those were my thoughts for now. If I think of anything else, I'll add it Code Examples are in TypeScript :)

General Part

ped.clone(includesMetaDatas: boolean)
ped.disableAI()
/* maybe resetPed when model will be change? */
ped.setModel(model: string | number, resetPed?: boolean)

ped.giveWeapon(weaponHash: number, ammoCount: number, isHidden: boolean, forceInHand: boolean)
ped.removeWeapon(weaponHash: number)

/* maybe a getter & setter for clothes as base64, but it must be decryptable and it must not break after an update - it is smarter to manage these things */
ped.getApperanceBase64()
ped.setApperanceBase64()

Clothing Part

The idea behind this is to ensure that, whether you create your own clothing DLCs or GTA releases an update, the Drawable IDs do not get misaligned. The API automatically calculates the offset when setting a piece of clothing and selects the correct item from the given DLC.

/* the zero is for basegame dlc */
ped.setClothes(dlc: string | number = 0, component: number, drawable: number, texture: number, palette?: number)
ped.setProps(dlc: string | number = 0, component: number, drawable: number, texture: number)

ped.setFaceFeature(index: number, scale: number)
ped.setHeadBlendData(data: {
    shapeFirstId: number,
    shapeSecondId: number,
    shapeThirdId: number,
    skinFirstId: number,
    skinSecondId: number,
    skinThirdId: number,
    shapeMix: number,
    skinMix: number,
    thirdMix: number,
})
ped.setEyeColor(index: number)
ped.setHeadOverlay(overlayId: number, index: number, opacity: number, primaryColor: number = 0, secondaryColor: number = 0)
ped.addDecoration(collection: string | number, overlay: number)
ped.setHairColor(color?: number, highlightColor?: number)
ped.playAnimation(dict: string, clip: string, flags: number)

ped.getClothe(component: number)
ped.getClothes()
ped.getFaceFeature(index: number)
ped.getFaceFeatures()
ped.getHeadBlendData()
ped.getEyeColor()
ped.getHeadOverlay(overlayId: number)
ped.getHeadOverlays()
ped.getHairColor()
ped.getCurrentAnimation()
ped.getDecorations()

ped.resetClothe(component: number)
ped.resetClothes()
ped.resetProp(component: number)
ped.resetProps()
ped.resetFaceFeature(index: number)
ped.resetFaceFeatures()
ped.resetDecorations()
ped.resetDecoration(collection: string | number, overlay: number)
ByAlexius commented 5 months ago

I think it might be a good idea to also add a ped.freeze() and a ped.unfreeze() or ped.freeze(state: boolean) function. @devpanda0

devpanda0 commented 5 months ago

I think it might be a good idea to also add a ped.freeze() and a ped.unfreeze() or ped.freeze(state: boolean) function. @devpanda0

when then ped.frozen = true/false its then getter and setter in one

PatchByte commented 5 months ago

What would ped.dumb in this case? The other suggestions seem really good :+1:

LeonMrBonnie commented 5 months ago

.dumb() is not a good method name, add a verb to make it clearer, but even then the name "dumb" is not a good name for an API. Something like ped.disableAI() would be better

PatchByte commented 5 months ago

.dumb() is not a good method name, add a verb to make it clearer, but even then the name "dumb" is not a good name for an API. Something like ped.disableAI() would be better

Thank you a lot for clarification! :+1:

devpanda0 commented 5 months ago

i have renamed it :)