[Mod] Static Spawnpoint [spawnpoint]

[Mod] Static Spawnpoint [spawnpoint]

Postby octacian » Wed Mar 08, 2017 10:50 pm

Image

Static Spawnpoint [spawnpoint]

This is a rather simple mod introducing two commands to set a static spawnpoint and to teleport to it. Yes, I know you can set this in minetest.conf, however, doing so causes the spawnpoint to be the same across all of your worlds (very inconvenient). Instead of using minetest.conf, this mod stores the spawnpoint (and other settings) within the world directory itself. This allows each and every world to have a different spawnpoint and configuration.

The most unique thing about this spawn mod is that it includes a feature allowing you to set the time between executing the command until the player is actually teleported. You can also enable a setting which causes the teleportation to be interrupted if the player moves within the original time.

Commands

/spawnpoint: Display spawnpoint position if set
/spawn <player>: Teleports you or the player specified to the spawnpoint (requires spawn privilege, and bring privilege to teleport another player)
/setspawn <position>: Sets the spawn to the position specified (in format x, y, z) or to your current location (requires server privilege)

Note: If no spawnpoint is specified and a player attempts to execute /spawn, he/she will be told "No spawnpoint set!"

Configuration

The different "variables" of SpawnPoint can be configured per-world using the /spawnpoint command (requires server privilege). This command displays the spawnpoint if no parameters are provided, but when a setting name is provided, the value of the setting is returned (assuming such a setting exists). If a setting name and value is provided, the setting is changed. Valid setting names are listed below.

time: Time before teleportation is completed (if 0 teleportation is immediate)
do_not_move: Whether a player should be required to not move to allow teleportation to be successful
pos: Position in the format (<x>,<y>,<z>) - can only be set via /setspawn or manually in configuration files

This per-world configuration (including the spawn position itself) is stored in the world directory. If Minetest 0.4.16's new modstorage is available, SpawnPoint will use that to store configuration. Otherwise, configuration will be handled by the Minetest Settings API and placed in a spawnpoint.conf file. If you would like to configure SpawnPoint manually, create a spawnpoint.conf file in the world directory and assign values to the applicable settings as documented above, each setting on a new line in the format setting_name = setting_value.

Initially, SpawnPoint stored all settings in a multi-line spawnpoint.conf file, however, this made very little sense as setting weren't named. With the new configuration scheme as documented above, compatibility code has been implemented causing all the old settings to be imported into the newest format possible. When the formatted settings method is used with spawnpoint.conf, all configuration is automatically imported to Minetest modstorage as well when it becomes available. After importing takes place from spawnpoint.conf, the file is removed.

Screenshot was taken at spawn on the awesome HOMETOWN server!
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 10:18 pm
GitHub: octacian
In-game: octacian

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby azekill_DIABLO » Thu Mar 09, 2017 5:18 pm

Just perfect
azekill_DIABLO
Member
 
Posts: 7469
Joined: Wed Oct 29, 2014 8:05 pm
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby octacian » Fri Mar 24, 2017 12:29 am

Update!

SpawnPoint has now undergone heavy testing and is stable for use anywhere. You can now configure the mod per-world using the /spawnpoint chatcommand if you have the server privilege (see OP). The do not move function has been improved so that the position is not just checked every second but instead using a global step to update immediately.

Note: The ability to configure SpawnPoint in minetest.conf has been removed for simplicity of code. However, if enough people find this feature important, I will consider adding it back.
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 10:18 pm
GitHub: octacian
In-game: octacian

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby muhdnurhidayat » Tue Jun 06, 2017 1:00 pm

That header image... seems familiar... :3
muhdnurhidayat
Member
 
Posts: 296
Joined: Wed Nov 16, 2016 10:55 pm
GitHub: MuhdNurHidayat
In-game: muhdnurhidayat

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby harmony » Thu Jun 22, 2017 5:58 pm

muhdnurhidayat wrote:That header image... seems familiar... :3

It's for Hometown :D
harmony
Member
 
Posts: 410
Joined: Tue Jun 20, 2017 10:16 pm
In-game: ynomrah

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby octacian » Sun Jul 02, 2017 7:18 pm

Update!


octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 10:18 pm
GitHub: octacian
In-game: octacian

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby octacian » Sun Jul 02, 2017 7:20 pm

Update!

  • New save formats now supported (Key-value settings and Minetest 0.4.16's modstorage)
  • Compatibility to import old settings formats to new formats as they become available
  • General cleanup of code style
  • Use built-in vector functions to process positions

See the original post for in-depth information.
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 10:18 pm
GitHub: octacian
In-game: octacian

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby Wuzzy » Sun Jul 02, 2017 8:41 pm

Why not fixing this right in the engine? This seems like an engine bug to me.
I think many more settings need to become mapgen settings and saved with the map. static_spawn_point is one of them.
Wuzzy
Member
 
Posts: 3440
Joined: Mon Sep 24, 2012 3:01 pm
GitHub: Wuzzy2
In-game: Wuzzy

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby octacian » Sun Jul 02, 2017 8:57 pm

Wuzzy wrote:Why not fixing this right in the engine? This seems like an engine bug to me.
I think many more settings need to become mapgen settings and saved with the map. static_spawn_point is one of them.


I hadn't considered that. Definitely not a bug, could be a good feature request though. I'll open an issue or PR soon. Maybe a static_spawn_point setting in world.mt. Could even expand to allow easily setting a per-player spawnpoint with something like "player:set_spawn". This would eliminate the need to check for mods such as beds on_respawnplayer, etc...

Whatever happens, some features of this mod like time and do_not_move would have to stay in a mod most likely. I expect that /spawn and /setspawn would be implemented in the engine at the same time if static spawnpoints were improves.
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 10:18 pm
GitHub: octacian
In-game: octacian

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby Lone_Wolf » Mon Jul 24, 2017 3:54 pm

Great mod!
Lone_Wolf
Member
 
Posts: 2145
Joined: Sun Apr 09, 2017 5:50 am
GitHub: LoneWolfHT
In-game: Lone_Wolf

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby Stix » Sun Aug 06, 2017 3:03 pm

Lone_Wolf wrote:Great mod!

agreed, +1
Stix
Member
 
Posts: 1365
Joined: Fri Aug 04, 2017 2:19 pm
In-game: Stix [+alts]

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby R-One » Thu Jul 05, 2018 10:33 am

hi, the setspawn command makes an error under minetest 0.4.17.1

+ Log of error here


- EDIT :

ok i managed to run the mod under 0.4.17.1, for that i created the spawnpoint.conf file in the world folder.

I restarted the game, and obviously the mod has created the mod_storage folder and deleted the spawnpoint.conf file since everything works.

A possible issue to investigate for new installations.
R-One
Member
 
Posts: 105
Joined: Wed Dec 20, 2017 11:06 pm

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby octacian » Thu Jul 05, 2018 3:03 pm

Thanks for bringing my attention to this!

I won't be able to take a look for a few weeks - I'm really busy with some things. As soon as I have time though, I'll try to take a look. In the meantime, it's good to hear you were able to get it working.

Just FYI, the fix should actually be quite simple. A few lines at most. I may even be able to do it right away, with that in mind.
octacian
Member
 
Posts: 593
Joined: Mon Dec 21, 2015 10:18 pm
GitHub: octacian
In-game: octacian

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby Lone_Wolf » Thu Jul 05, 2018 3:31 pm

I also had this error
Lone_Wolf
Member
 
Posts: 2145
Joined: Sun Apr 09, 2017 5:50 am
GitHub: LoneWolfHT
In-game: Lone_Wolf

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby Miniontoby » Thu Mar 21, 2019 1:42 pm

I have the solution.

Change in "unit.lua" all the words "storage" to "mod_storage" and the mod should work
Miniontoby
New member
 
Posts: 8
Joined: Fri Mar 01, 2019 7:25 pm
In-game: Miniontoby

Re: [Mod] Static Spawnpoint [spawnpoint]

Postby Lone_Wolf » Fri Mar 22, 2019 2:27 am

Miniontoby wrote:I have the solution.

Change in "unit.lua" all the words "storage" to "mod_storage" and the mod should work

Pretty sure that prevents it from saving the pawnpoint when the world restarts too
I created a PR that fixes it https://github.com/octacian/spawnpoint/pull/3
Lone_Wolf
Member
 
Posts: 2145
Joined: Sun Apr 09, 2017 5:50 am
GitHub: LoneWolfHT
In-game: Lone_Wolf



Return to WIP Mods



Who is online

Users browsing this forum: Bing Bot [Bot] and 0 guests