Skip to content

Pressure plate collision hook doesn't work #104

@MineBartekSA

Description

@MineBartekSA

Hello!
I've been trying to update my TShock plugin that utilizes the OTAPI.Hooks.Collision.PressurePlate hook and it doesn't seem to work.

To test this out, I've written a simple OTAPI Server that utilizes this hook.
Even on this server, the hook wouldn't trigger.

I've attached my code in the spoiler below.
Other hooks work as one would expect.

Simple OTAPI Server code

Target framework: .net6.0
Built on the latest version of OTAPI (3.1.20) got from NuGet

using OTAPI;
using Terraria;

namespace OTest;

internal abstract class Program
{
    private static void Main(string[] args)
    {
        Console.WriteLine("Starting....");
        On.Terraria.Main.DedServ += OnDedicatedServer;
        Hooks.Collision.PressurePlate += OnPressurePlate;
        Hooks.NetMessage.PlayerAnnounce += OnPlayerAnnounce;
        WindowsLaunch.Main(args);
    }

    private static void OnDedicatedServer(On.Terraria.Main.orig_DedServ orig, Main self)
    {
        Console.WriteLine("Dedicated server start!");
        orig(self);
    }

    private static void OnPressurePlate(object? sender, Hooks.Collision.PressurePlateEventArgs args)
    {
        Console.WriteLine($"Entity {args.Entity.entityId} triggered pressure plate");
    }

    private static void OnPlayerAnnounce(object? sender, Hooks.NetMessage.PlayerAnnounceEventArgs args)
    {
        Console.WriteLine($"Announcing player: {args.Text}");
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions