Release 1.0.1

Created configuration file, and increased default deathtime to 10 seconds. See changelog in the readme for further info.
master
Majozoe 2022-08-12 17:33:29 -04:00 committed by GitHub
parent 08b7a4c602
commit f526cf78c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 23 deletions

View File

@ -1,19 +1,28 @@
The Grue - A mod for Minetest
https://github.com/Majozoe/Minetest-Gruemod/issues
The Grue - A mod for Minetest
< - - - >
Version: 1.0.0a
Version: 1.0.1
License: CC0 (https://creativecommons.org/publicdomain/zero/1.0/)
< - - - >
Changelog
Changelog
Version 1.0.1 (August 12th, 2022
Added configuration options to the main menu. This is accessible by going to the settings tab, then clicking on "All Settings", then "Content: Mods", and searching for Grue.
There are currently 4 options available, controlling when the grue can attack and how loud the audio cues are.
Note: I had to resort to using what I felt was a strange method for increasing the volume for values greater than 1. I found no issues major during my short time testing it, but if you encounter any issues, please let me know.
Increased the default death time from 5 seconds to 10 seconds.
Version 1.0.0a (August 8th, 2022)
- Adjusted position checking to reduce the likelihood that the mod checks the block underneath the player. This would cause the mod to return a light level of 0, and may end up with the player getting killed by the Grue in broad daylight.
Adjusted position checking to reduce the likelihood that the mod checks the block underneath the player. This would cause the mod to return a light level of 0, and may end up with the player getting killed by the Grue in broad daylight.
< - - - >
< - What is this mod? - >
@ -24,7 +33,7 @@ The 'Grue' mod is a mod for Minetest that implements a nefarious creature lurkin
< - That's cool and all, but how does it work? - >
As of right now, the game is constantly checking your light level. If it falls below a light level of 2 (0 is the lowest), then a timer starts ticking down. This timer is reset if you retreat back to a brighter area.
As of right now, the game is constantly checking your light level. If it falls below a light level of 2 (0 is the lowest), then a timer startsticking down. This timer is reset if you retreat back to a brighter area.
After 5 seconds, you'll get a warning, and after an additional 5 seconds, you will die.
@ -64,16 +73,10 @@ If you are downloading this from Github, extract the zip file, then make sure th
< - Does this work with other versions of Minetest? - >
No clue! This mod was created on Minetest 5.6.0. If it breaks on newer versions, I'll do my best to fix it, but I cannot make the same claims for older versions.
< - Heeeelp! I have an issue! - >
Don't worry! In the event of something crazy happening, just refer to the forum post located [here](https://forum.minetest.net/viewtopic.php?f=9&t=28523) or create an issue on [Github](https://github.com/Majozoe/Minetest-Gruemod/issues).
Don't worry! In the event of something crazy happening, just refer to the forum post located here (link TBD) or create an issue on the Github.
Be sure to include a description of what is going on, what you were doing, whether or not you were on singleplayer, what other mods or even what game you were using, as well as any other info you might think is necessary such as a crash log or a screenshot, etc.
If you do not include enough information, then I'm afraid I am incapable of helping you unless I ask for more info.
If you do not include enough information, then I'm afraid I am incapable of helping you unless I ask for more info.

View File

@ -1,9 +1,5 @@
-- Declaring variables
local warntime = 5 -- tname.timer before you are warned about getting eaten by a Grue
local deathtime = 5 -- tname.timer after getting warned before you are eaten by a Grue
local health = 0
local position = {x=0, y=0, z=0}
local lightlevel = 0
@ -23,7 +19,21 @@ minetest.register_on_leaveplayer(function(player) -- Removes disconnected player
local name = player:get_player_name()
grue.players[name] = nil
end)
-- Function for retrieving settings
local function get_setting_value(name, default)
local value = minetest.settings:get("grue_" .. name)
if type(value) == "nil" then value = default end -- Checks if the retrieved value is "nil". If so, returns the default value supplied to the function.
return tonumber(value)
end
-- Configurable variables.
local maxlight = get_setting_value("maxlight", 1) -- Max light level that the Grue can attack in
local soundvolume = get_setting_value("soundvolume", 1) -- Multiplier for how loud the audio clips are.
local warntime = get_setting_value("warntime", 5)-- Time before you are warned about getting eaten by a Grue
local deathtime = get_setting_value("deathtime", 10) -- Time after getting warned before you are eaten by a Grue
-- Main function, checking every tick.
@ -44,26 +54,35 @@ minetest.register_globalstep(function(dtime)
if health > 0 then -- Making sure the player isn't dead. The Grue is only interested in live prey.
local lightlevel = minetest.get_node_light(position,nil)
if lightlevel == nil then break end
if lightlevel <= 1 then -- Checking to see if the local light level is low enough
if lightlevel <= maxlight then -- Checking to see if the local light level is low enough
tname.timer = tname.timer + dtime
if tname.warned == false then -- Checking to see if the player has already been warned.
if (tname.warned == false) and (warntime ~= 0) then -- Checking to see if the player has already been warned. Skips if player set warntime to 0
if tname.timer >= warntime then
minetest.chat_send_player(name, "You are likely to be eaten by a Grue.")
minetest.sound_play("grue_warning", {pos = position, gain = 1.0, max_hear_distance = 8,})
while soundvolume > 0 do -- Hacky way of supporting values greater than 1, since increasing the gain doesn't seem to do anything.
minetest.sound_play("grue_warning", {pos = position, gain = soundvolume, max_hear_distance = 8,})
soundvolume = soundvolume - 1
end
tname.warned = true
tname.timer = 0
soundvolume = get_setting_value("soundvolume", 1) -- Reset sound value
end
else
if tname.timer >= deathtime then --This is the part where you die
player:set_hp(0, set_hp)
minetest.chat_send_player(name, "You have been eaten by a Grue.")
minetest.sound_play("grue_attack", {pos = position, gain = 1.0, max_hear_distance = 8,})
while soundvolume > 0 do
minetest.sound_play("grue_attack", {pos = position, gain = soundvolume, max_hear_distance = 8,})
soundvolume = soundvolume - 1
end
tname.warned = false
tname.timer = 0
soundvolume = get_setting_value("soundvolume", 1) -- Reset sound value
end
end

18
settingtypes.txt Normal file
View File

@ -0,0 +1,18 @@
# This setting controls the highest light level that the grue can attack in.
# Range between 0-15, with 0 being the darkest, and 15 being the brightest
# Note: Values above 10 may render torches ineffective, while 15 will cause the Grue to attack at any time.
grue_maxlight (How much light is needed to keep the Grue away.) int 1 0 15
# This setting controls how loud the audio clips in the mod are.
# Higher values result in louder audio clips.
grue_soundvolume (Multiplier for mod volume) float 1 0 10
# This setting controls how long you can stay in the dark before you get warned by the Grue.
# Counted in seconds.
# If set to 0, you will get no warning.
grue_warntime (How much time in seconds you have before being warned) float 5 0
# This setting controls how long you can stay in the dark before you are killed by the Grue.
# Counted in seconds, and takes effect after you are warned.
# If set to 0, you will die instantly.
grue_deathtime (How much time in seconds you have before dying) float 10 0