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

Center beacon blip #4168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Center beacon blip #4168

wants to merge 1 commit into from

Conversation

aco4
Copy link
Contributor

@aco4 aco4 commented Jan 7, 2025

wzapi function addBeacon(x, y, playerFilter[, message]) spawns a beacon, but it's not in the middle of a tile. It's placed on the North-West (top left) corner.

Why it happens

wzapi.cpp:

bool wzapi::addBeacon(WZAPI_PARAMS(int _x, int _y, int playerFilter, optional<std::string> _message))
{
	SCRIPT_ASSERT(false, context, _x >= 0, "Beacon x value %d is less than zero", _x);
	SCRIPT_ASSERT(false, context, _y >= 0, "Beacon y value %d is less than zero", _y);
	SCRIPT_ASSERT(false, context, _x <= mapWidth, "Beacon x value %d is greater than mapWidth %d", _x, (int)mapWidth);
	SCRIPT_ASSERT(false, context, _y <= mapHeight, "Beacon y value %d is greater than mapHeight %d", _y, (int)mapHeight);

	int x = world_coord(_x);
	int y = world_coord(_y);
        ...

Needs to be

	int x = world_coord(_x) + 64;
	int y = world_coord(_y) + 64;

Each tile = 128 "world units".


I'm not sure this works; I didn't test it. Additionally, I'm not sure if there's an appropriate constant I should be using instead. Review would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant