Skip to content

Commit

Permalink
Fix CameraSetInstruction missing fields (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Refaltor77 authored Oct 14, 2023
1 parent 38a5162 commit 8793eba
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/types/camera/CameraSetInstruction.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@
final class CameraSetInstruction{

public function __construct(
private int $preset,
private ?CameraSetInstructionEase $ease,
private ?Vector3 $cameraPosition,
private ?CameraSetInstructionRotation $rotation,
private ?Vector3 $facingPosition
private ?Vector3 $facingPosition,
private ?bool $default
){}

public function getPreset() : int{ return $this->preset; }

public function getEase() : ?CameraSetInstructionEase{ return $this->ease; }

public function getCameraPosition() : ?Vector3{ return $this->cameraPosition; }
Expand All @@ -34,24 +38,32 @@ public function getRotation() : ?CameraSetInstructionRotation{ return $this->rot

public function getFacingPosition() : ?Vector3{ return $this->facingPosition; }

public function getDefault() : ?bool{ return $this->default; }

public static function read(PacketSerializer $in) : self{
$preset = $in->getLInt();
$ease = $in->readOptional(fn() => CameraSetInstructionEase::read($in));
$cameraPosition = $in->readOptional(fn() => $in->getVector3());
$rotation = $in->readOptional(fn() => CameraSetInstructionRotation::read($in));
$facingPosition = $in->readOptional(fn() => $in->getVector3());
$default = $in->readOptional(fn() => $in->getBool());

return new self(
$preset,
$ease,
$cameraPosition,
$rotation,
$facingPosition
$facingPosition,
$default
);
}

public function write(PacketSerializer $out) : void{
$out->putLInt($this->preset);
$out->writeOptional($this->ease, fn(CameraSetInstructionEase $v) => $v->write($out));
$out->writeOptional($this->cameraPosition, fn(Vector3 $v) => $out->putVector3($v));
$out->writeOptional($this->rotation, fn(CameraSetInstructionRotation $v) => $v->write($out));
$out->writeOptional($this->facingPosition, fn(Vector3 $v) => $out->putVector3($v));
$out->writeOptional($this->default, fn(bool $v) => $out->putBool($v));
}
}

0 comments on commit 8793eba

Please sign in to comment.