@@ -387,12 +387,19 @@ Local<Value> PlayerClass::simulateLookAt(const Arguments& args) {
387387 auto sp = asSimulatedPlayer ();
388388 if (!sp) return Local<Value>();
389389 Vec3 target;
390- int dimid = sp->getDimensionId ();
390+ int dimid = sp->getDimensionId ();
391+ int lookDuration = 2 ; // 0 = Instant, 1 = Continuous, 2 = UntilMove
392+ if (args.size () > 1 ) {
393+ if (!args[1 ].isNumber ()) {
394+ LOG_WRONG_ARG_TYPE ();
395+ }
396+ lookDuration = args[1 ].asNumber ().toInt32 ();
397+ }
391398 if (IsInstanceOf<IntPos>(args[0 ])) {
392399 auto pos = IntPos::extractPos (args[0 ]);
393400 auto did = pos->getDimensionId ();
394401 if (dimid == did || did < 0 || did > 2 ) {
395- sp->simulateLookAt (pos->getBlockPos (), (sim::LookDuration)0 );
402+ sp->simulateLookAt (pos->getBlockPos (), (sim::LookDuration)lookDuration );
396403 return Boolean::newBoolean (true );
397404 }
398405 lse::getSelfPluginInstance ().getLogger ().debug (" Can't simulate look at other dimension!" );
@@ -401,7 +408,7 @@ Local<Value> PlayerClass::simulateLookAt(const Arguments& args) {
401408 auto pos = FloatPos::extractPos (args[0 ]);
402409 auto did = pos->getDimensionId ();
403410 if (dimid == did || did < 0 || did > 2 ) {
404- sp->simulateLookAt (pos->getVec3 (), (sim::LookDuration)0 );
411+ sp->simulateLookAt (pos->getVec3 (), (sim::LookDuration)lookDuration );
405412 return Boolean::newBoolean (true );
406413 }
407414 lse::getSelfPluginInstance ().getLogger ().debug (" Can't simulate look at other dimension!" );
@@ -411,14 +418,14 @@ Local<Value> PlayerClass::simulateLookAt(const Arguments& args) {
411418 auto pos = IntPos::extractPos (block->getPos ());
412419 auto did = pos->getDimensionId ();
413420 if (dimid == did || did < 0 || did > 2 ) {
414- sp->simulateLookAt (pos->getBlockPos (), (sim::LookDuration)0 );
421+ sp->simulateLookAt (pos->getBlockPos (), (sim::LookDuration)lookDuration );
415422 return Boolean::newBoolean (true );
416423 }
417424 lse::getSelfPluginInstance ().getLogger ().debug (" Can't simulate look at other dimension!" );
418425 return Boolean::newBoolean (false );
419426 } else if (auto actor = EntityClass::tryExtractActor (args[0 ])) {
420427 if (!*actor) return Local<Value>();
421- sp->simulateLookAt (**actor, (sim::LookDuration)0 );
428+ sp->simulateLookAt (**actor, (sim::LookDuration)lookDuration );
422429 return Boolean::newBoolean (true );
423430 }
424431 LOG_WRONG_ARG_TYPE ();
0 commit comments