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

Mobs repellant for spawn #38

Open
Klaranth opened this issue Feb 9, 2022 · 4 comments
Open

Mobs repellant for spawn #38

Klaranth opened this issue Feb 9, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Klaranth
Copy link
Collaborator

Klaranth commented Feb 9, 2022

We need to find a way to make mobs not spawn in the spawn area (-100, 0, -100) to (100, 40, 100)

@Klaranth Klaranth added enhancement New feature or request good first issue Good for newcomers labels Feb 9, 2022
@Klaranth
Copy link
Collaborator Author

Klaranth commented Feb 9, 2022

IF Eden uses mobs redo mod :

mobs_spawn_protected
Spawn in protected areas.

If set to 1, mobs will not spawn in protected areas.

Type: int
Default: 0

Source: https://antummt.github.io/mod-mobs_redo/api.html#mobs_spawn_protected

@dennisjenkins75
Copy link
Contributor

yes, I just found that. However, this would prevent mobs from spawning in many places; we just want to stop them from spawning at our player spawn point.

@Bituvo
Copy link

Bituvo commented Feb 15, 2022

I found out that mob spawning is handled in the spawn_action function of the API. We could put a check at line 4,023 to see if the selected position is inside the spawn area Klaranth defined, and return if it isn't. Instead of being hardcoded, the spawn region could be configurable but the spawn area probably won't change anytime soon.

-- don't spawn mobs inside the player spawn region
if not (pos.x > -100 and pos.x < 100)
and not (pos.y > 0 and pos.y < 40)
and not (pos.z > -100 and pos.z < 100) then
	return
end

The server could have another custom mod for this, so this isn't removed with the next update of mobs_redo.
Hopefully the server does use mobs_redo, otherwise I wasted 5 minutes of my life

@dennisjenkins75
Copy link
Contributor

Nice research. I propose that we actually author a change for the spawn_action code, and have it use minetest:settings_get_pos("protected_spawn.pos1") (and pos2), and use those limits. If not set, then use the existing values. Then anyone could override the protected area by adding two lines to their minetest.conf file.

I can code this up in a few days, unless someone beats me to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants