Skip to content

[DOCS] PlayerMouseEvent information #275

@bencres

Description

@bencres

Documentation Issue Type

  • Typo or grammatical error
  • Incorrect or outdated information
  • Unclear explanation or confusing content
  • Missing documentation for a topic
  • Broken links or images
  • Code example not working
  • Other (please describe)

from Zoon20X on Discord:

public class CameraDemo {
  public static final CameraDemo INSTANCE = new CameraDemo();
  
  private final EventRegistry eventRegistry = new EventRegistry(new CopyOnWriteArrayList(), () -> this.isActive, "CameraDemo is not active!", (IEventRegistry)HytaleServer.get().getEventBus());
  
  private final ServerCameraSettings cameraSettings = createServerCameraSettings();
  
  private boolean isActive;
  
  public void activate() {
    if (this.isActive)
      return; 
    this.eventRegistry.enable();
    this.isActive = true;
    this.eventRegistry.register(PlayerConnectEvent.class, event -> onAddNewPlayer(event.getPlayerRef()));
    this.eventRegistry.register(PlayerMouseButtonEvent.class, this::onPlayerMouseButton);
    this.eventRegistry.registerGlobal(PlayerInteractEvent.class, event -> event.setCancelled(true));
    Universe.get().getPlayers().forEach(this::onAddNewPlayer);
  }

so the PlayerMouseButtonEvent is directly tied and registered using the CameraDemo class, this is not registered or fired in any other class, i believe this is due to how the camera works when enabling it

typing the command /player camera demo activate puts you in a top down view in game and your mouse can freely move around and click,

private final Vector2f screenPoint; this explains what this will refer to, as it wouldn't work in a locked mouse state

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions