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

Important functions to add #9

Open
MNoya opened this issue Jul 17, 2015 · 3 comments
Open

Important functions to add #9

MNoya opened this issue Jul 17, 2015 · 3 comments

Comments

@MNoya
Copy link

MNoya commented Jul 17, 2015

BuildingHelper:PlaceBuilding(name, size, position)

  • Places a new building on full health and returns the handle. Places grid nav blockers for its size.
  • Skips the construction phase and doesn't require a builder, this is most important to place the "base" buildings for the players when the game starts.

BuildingHelper:UpgradeBuilding(building, name)

  • To use after an upgrade is acquired (new "tier" of a building).
  • Replaces the old building by a new one by name and keeps the same blockers and position.
@musshorn
Copy link
Owner

I added PlaceBuilding at some point today.

Made it a bit more configurable, documentation is here. https://github.com/snipplets/Dota-2-Building-Helper/wiki/BuildingHelper:PlaceBuilding

@MNoya
Copy link
Author

MNoya commented Jul 18, 2015

I went for a simple version (no callbacks or anything) that adds the option to not block the gridnav (this handles upgrades, as an upgrade is simply RemoveSelf() and calling PlaceBuilding w/o blocking the gridnav again, just reassigning the .blockers to the newly created building)

I also added a BuildingHelper:BlockGridNavSquare(size, location) function that is called on both ways of placing buildings (with a rudimentary fix for 5size grid blocking, which was blocking only a 4square)

https://github.com/MNoya/DotaCraft/blob/master/game/dota_addons/dotacraft/scripts/vscripts/buildinghelper.lua#L204-L280

@musshorn
Copy link
Owner

Oh that's a better way of doing it. Do you think its worth snapping PlaceBuilding to grid always as well? Otherwise you could end up with these weird offset buildings.

Could have it as an arg i suppose

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

No branches or pull requests

2 participants