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

Decouple Golems from Players and use SpawnMonster for Golem #7665

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

obligaron
Copy link
Contributor

Contributes to #543 and supports #7663

In master and vanilla golems are tied to a specific monster id. This monster id corresponds 1:1 to the player id. This is how the relation player<->golem relationship is maintained and that's also why the game reserves the first 4 monster slots for golems (max player count in multiplayer).

This PR changes that by

  • using goalVar3 to maintain the golem<->player relationship (should be 0 in singleplayer saves)
  • introducing a helper to find golems for a player
  • using SpawnMonster logic to spawn golems (similar to how monsters are spawned dynamically, see Support dynamically spawned monsters in multiplayer #6890)
  • to maintain vanilla compatibility, the first 4 slots are still reserved for golems. In singleplayer, the first monster slot is always used.

Additional notes

  • Allows multiple golems to be spawned by removing the KillGolem call in AddGolem for existing golems (allows better mods).
  • This PR supports up to 55 players because we still store the enemy id in a uint8_t (could be changed later).
  • This PR can be tested with the current player count by changing ReservedMonsterSlotsForGolems to a lower number (I tested with 2 players and set it to 0 and 1).

Source/msg.cpp Outdated Show resolved Hide resolved
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.

2 participants