Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setVehicleRespawnRotation function and tweaked OOP variants #338

Merged
merged 4 commits into from Sep 4, 2018

Conversation

Projects
None yet
4 participants
@l0nger
Copy link
Contributor

l0nger commented Aug 23, 2018

function setVehicleRespawnPosition has been changed to:

  • setVehicleRespawnPosition( vehicle theVehicle, x, y, z [, rx, ry, rz ] )
  • setVehicleRespawnRotation( vehicle theVehicle, rx, ry, rz )
  • getVehicleRespawnPosition( vehicle theVehicle )
  • getVehicleRespawnRotation( vehicle theVehicle )

adapted under OOP:

  • vehicle:setRespawnPosition( x, y, z )
  • vehicle:setRespawnRotation( x, y, z )
  • vehicle:getRespawnPosition( )
  • vehicle:getRespawnRotation( )

lua class variables inherit to vehicle element

  • vehicle.respawnPosition
  • vehicle.respawnRotation

CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pElement);
argStream.ReadVector3D(vecPosition);
argStream.ReadVector3D(vecRotation, CVector());

This comment has been minimized.

@qaisjp

qaisjp Aug 23, 2018

Member

SetVehicleRespawnPosition should still support rotation due to backwards compat (don't change the functionality of this function)


CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pElement);
argStream.ReadVector3D(vecPosition);
argStream.ReadVector3D(vecRotation, CVector());

This comment has been minimized.

@Addlibs

Addlibs Aug 23, 2018

Contributor

What about existing code? setVehicleRespawnPosition should retain the ability to set respawn rotations, as existing code could rely on this behaviour.

The most you could do is deprecate this for now, meaning add a warning like this or something, but retain the functionality (not tested nor attempted to compile):

if (argStream.NextIsVector3D())
{
    CVector vecRotation;
    argStream.ReadVector3D(vecRotation);

    // Set deprecation warning
    argStream.SetCustomWarning("Setting respawn rotation in setVehicleRespawnPosition is deprecated and may not work in future versions. Please consider using setVehicleRespawnRotation.");
    if (!argStream.HasErrors()) // Deprecation warning is printed out at this call
    {
        // Update position and rotation
    }
}
else if (!argStream.HasErrors())
{
    // Update position only
}

@qaisjp qaisjp added the enhancement label Aug 23, 2018

@l0nger

This comment has been minimized.

Copy link
Contributor Author

l0nger commented Aug 24, 2018

Fixed, thanks for tip @Addlibs

@patrikjuvonen patrikjuvonen added this to In progress in release/v1.5.6 via automation Aug 24, 2018

@patrikjuvonen patrikjuvonen added this to the 1.5.6 milestone Aug 24, 2018

@qaisjp qaisjp removed this from In progress in release/v1.5.6 Aug 29, 2018

@qaisjp qaisjp removed this from the 1.5.6 milestone Aug 29, 2018

@patrikjuvonen patrikjuvonen changed the title added new function setVehicleRespawnPosition/Rotation Add setVehicleRespawnRotation function and tweaked OOP variants Sep 4, 2018

@qaisjp qaisjp added this to the 1.5.7 milestone Sep 4, 2018

@qaisjp qaisjp modified the milestones: 1.5.7, 1.5.6 Sep 4, 2018

@qaisjp qaisjp merged commit dc27d47 into multitheftauto:master Sep 4, 2018

1 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
WIP ready for review
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.