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

ModTile CanPlace not running #3509

Closed
Sinchu9 opened this issue May 31, 2023 · 1 comment
Closed

ModTile CanPlace not running #3509

Sinchu9 opened this issue May 31, 2023 · 1 comment
Assignees
Labels
Bug Bugs that affect users Requestor-Modders Issues or PRs adding or fixing TML modder API

Comments

@Sinchu9
Copy link

Sinchu9 commented May 31, 2023

Version

Latest 1.4.4-preview

OS

Windows

Platform

Steam

This bug affects

Mod capability as a Modder

Description

When placing a ModTile, tile's CanPlace override is not ran

Log File

No response

Steps to reproduce

  1. Create a ModTile and a ModItem that crates that tile with Item.createTile
  2. In ModTile, make a CanPlace override that uses Main.NewText() to display "Placed?" in the chat then checks if the tile below is dirt. Return true if it is dirt, return false if it is not
  3. Attempt to place the tile

Expected Behavior

"Placed?" should appear in teh chat and teh tiel should only get placed if the tile under it is dirt

Actual Behavior

The tile is always placed and "Placed?" does not appear in the chat

Reproduction frequency

Consistantly

Additional Information

Followed ExampleHerb.cs when initially finding the issue
The ModTile still respects required Anchors

@Sinchu9 Sinchu9 added the NEW ISSUE Flags an Issue as new. To be removed once issue is assessed. label May 31, 2023
@github-actions github-actions bot added the Requestor-Modders Issues or PRs adding or fixing TML modder API label May 31, 2023
@JavidPack JavidPack removed the NEW ISSUE Flags an Issue as new. To be removed once issue is assessed. label Aug 29, 2023
@JavidPack JavidPack self-assigned this Aug 29, 2023
@JavidPack JavidPack added the Bug Bugs that affect users label Aug 29, 2023
@staceyschnee
Copy link

GlobalTile.CanPlace is also not called when the tile to be placed is a Modded Tile.
GlobalTile.CanPlace is called for vanilla tiles.

Create a class that inherits from GlobalTile.
In NewGlobalTile, override CanPlace that logs the tile type: Mod.Logger.InfoFormat("CanPlace {0},{1} type {2}", i, j, type);
Try to place a ModTile
See that CanPlace is never called and the entry is never logged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bugs that affect users Requestor-Modders Issues or PRs adding or fixing TML modder API
Projects
None yet
Development

No branches or pull requests

3 participants