From 3d8d01d8a4923e7e4e24cd8744318b17b9c0cc0e Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 6 Mar 2021 14:41:18 -0600 Subject: Add initial content --- COPYING | 24 ++++++++++++++++++++ init.lua | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mod.conf | 4 ++++ 3 files changed, 106 insertions(+) create mode 100644 COPYING create mode 100644 init.lua create mode 100644 mod.conf diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/COPYING @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..bd2f006 --- /dev/null +++ b/init.lua @@ -0,0 +1,78 @@ +local function set(name,old,new) + local player = minetest.get_player_by_name(name) + local speed = playersettings.get(name,"creativesettings:speed") + local jump = playersettings.get(name,"creativesettings:jump") + local gravity = playersettings.get(name,"creativesettings:gravity") + local x = playersettings.get(name,"creativesettings:visualx") + local y = playersettings.get(name,"creativesettings:visualy") + local z = playersettings.get(name,"creativesettings:visualz") + player:set_physics_override({ + speed = speed, + jump = jump, + gravity = gravity, + }) + player:set_properties({ + visual_size = vector.new(x,y,z), + }) +end + +playersettings.register("creativesettings:speed",{ + shortdesc = "Physics Override: Speed", + longdesc = "A multiplier affecting speed of movement.\n'1' is normal speed.", + type = "number", + min = 0.5, + max = 5, + default = 1, + afterchange = set, + onjoin = set, +}) + +playersettings.register("creativesettings:jump",{ + shortdesc = "Physics Override: Jump Height", + longdesc = "A multiplier affecting jump height.\n'1' is normal height.", + type = "number", + min = 0.5, + max = 3, + default = 1, + afterchange = set, +}) + +playersettings.register("creativesettings:gravity",{ + shortdesc = "Physics Override: Gravity", + longdesc = "A multiplier affecting gravity strength.\n'1' is normal strength.", + type = "number", + min = 0.15, + max = 5, + default = 1, + afterchange = set, +}) + +playersettings.register("creativesettings:visualx",{ + shortdesc = "Visual Size: X (Width)", + longdesc = "How wide (left to right) you appear to be.\n'1' is normal width.", + type = "number", + min = 0.75, + max = 1.25, + default = 1, + afterchange = set, +}) + +playersettings.register("creativesettings:visualy",{ + shortdesc = "Visual Size: Y (Height)", + longdesc = "How tall (top to bottom) you appear to be.\n'1' is normal height.", + type = "number", + min = 0.75, + max = 1.25, + default = 1, + afterchange = set, +}) + +playersettings.register("creativesettings:visualz",{ + shortdesc = "Visual Size: Z (Depth)", + longdesc = "How deep (front to back) you appear to be.\n'1' is normal depth.", + type = "number", + min = 0.75, + max = 1.25, + default = 1, + afterchange = set, +}) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..67df465 --- /dev/null +++ b/mod.conf @@ -0,0 +1,4 @@ +name = creativesettings +description = Some settings for the Minetest playersettings mod, mostly intended for creative servers +author = cheapie +depends = playersettings -- cgit v1.2.3