Compare commits

..

12 Commits

Author SHA1 Message Date
c86e2f3fbc add forward compatibility with MT 5 for the ancient nodeupdate(pos)
* replace if the new minetest api is detected the `nodeupdate(pos)`
  with the new `check_for_falling(pos)` api since 5.0 but mantains
  backguard compatibility with 4.0.13 to 4.0.16
* use the new expose version check flags from `adventuretest` mod
  so the fire n doors mods must depends on default or adventuretest
* add to respective notes such change
2023-01-13 10:04:17 -04:00
59e42c450e manage a minetest engine backguard compatibility check and expose to api
* provide flags for minetest release as adventuretest.<flag> for
  example to check 5.0 just `if adventuiretest.is_50 then` but
  such mod must depends on default or adventuretest mods
* thos also add a pseudo check to 4.0.17 that is 0.4.17.2 and go
  the 0.4.18 version from sfan is not take into consideration cos
  provides so many things about 5.0 that must not be in such release.
2023-01-13 09:20:28 -04:00
f1ff77133a place_node crashes the game because of nil player, so add nil checks
* Fix for runtime error in callback `item_OnPlace()` due nill player/placer
* This is for forward preparation on minetest 5.X with backguard compatibility
* related to #39
* related to https://codeberg.org/minenux/minetest-game-adventuretest/issues/39
* related to https://github.com/Bremaweb/adventuretest/issues/39
* update NOTES.md with related fixed about MT 5.X migration
2023-01-13 08:32:39 -04:00
fceb855f2a migration to 5.0 notes add 2023-01-12 18:17:30 -04:00
95f3980694 Fix crashes with mobs below or above due division by zero
* removes a division by zero issue which returns nan for yaw
  in some places
2023-01-12 18:06:07 -04:00
8bdf40b849 allow both flours from farming plus and food to be accepted for bowl
* this happened in the bowl and flour quest/task
2023-01-12 17:43:05 -04:00
b2feac105a Fix crash when using chat commands affect/removeaffects
* related to pull request https://github.com/Bremaweb/adventuretest/pull/38
* related to pull request https://codeberg.org/minenux/minetest-game-adventuretest/pulls/38
* related to pull request https://git.minetest.io/minenux/minetest-game-adventuretest/pulls/38
2023-01-12 17:38:59 -04:00
c55a8f8dcd posibility to configure blood or cry when attack or being under attack 2023-01-12 16:18:07 -04:00
5ba7c54408 Allow tool repairs on workbench mod coexits with game mechanish
* adapt the fix from the upstream by mt-sane
* becouse there is is also the anvil,
* This also fixes the problem with the vanishing of the tools
  when using the repair craft.
* closed https://github.com/Bremaweb/adventuretest/pull/26
* close #26
* close https://codeber.org/minenux/minetest-game-adventuretest/pulls/26
2023-01-12 13:49:29 -04:00
0af5f94e21 information setup property, configuration and minimal engine version 2023-01-11 18:02:18 -04:00
6f081ff323 Keep leveling up as long as there is enough exp
* this maybe must be adapted to a more limited but makes sense,
  players will stay trying to get more and more levels..
* from e221221a34
  adapted to this minenux fork
* TODO: pending to fine tune to not infinite levels #40 at
  https://codeberg.org/minenux/minetest-game-adventuretest/issues/40
  and
  https://git.minetest.io/minenux/minetest-game-adventuretest/issues/40
2023-01-11 15:48:39 -04:00
Brandon
6d236fe10d Fix pl_hook player loop and timing bug 2016-09-25 21:40:13 -05:00
28 changed files with 430 additions and 166 deletions

92
NOTES.md Normal file
View File

@ -0,0 +1,92 @@
### migration to mt 5.0/5.2
There are the issues Tignasse Verte mentionned: Adding `placer` in `register_functions.lua`
(related commit for minenux are commit a996d5ac709446322d6c6261c21e5f0752a6aeeb )
and replacing the two occourances of `nodeupdate` with `minetest.check_for_falling`.
(relatd commit for minenux are commit 8c53cabfce2d079df76e57b27b020e016837e8fc )
Other changes are necessary because I changed (and had to change) quite a lot
in `mg_villages` internally recently. If you want to get further with running
the game under newer versions of MT, replace the versions of `cottages`, `handle_schematics`
and `mg_villages` AdventureTest comes with with the newest versions.
Then, remove the line `mg_villages.on_generated(minp,maxp,seed)` in
`adventuretest/register_functions.lua`. This may have an impact on quests the
old explorer is handling out, but if you ignore these for now, the world ought to be usable.
Comment out the file/content of `mg/fill_chests.lua` for now as that requires
a few adjustments for filling the chests with the right content, and that's a bit
too much to write here in an inconvenient forum post.
You won't see any villagers spawning because their spawn blocks are not placed.
My first attempts there ended in a severe overcrowding of villagers. Needs
finetuning/understanding what BrandonReese did to keep it balanced. But then,
this seems to be an open issue on Github as well...
Mobs will likely not work very well. A lot changed regarding them.
They certainly could use an update as well - as could the goblins. I'm sure the witches
from the same modder would feel welcome in the AdventureTest universe, too.
### Fiel of view for monsters vs characters
From https://forum.minetest.net/viewtopic.php?p=182737#p182737
If it helps any, here is the in_fov code from mobs redo mod that works (self is mob, pos is player position and self.fov is set to 90, self.rotate is usually 0 for front facing mobs):
CODE: SELECT ALL
```
in_fov = function(self,pos)
-- checks if POS is in self's FOV
local yaw = self.object:getyaw() + self.rotate
local vx = math.sin(yaw)
local vz = math.cos(yaw)
local ds = math.sqrt(vx^2 + vz^2)
local ps = math.sqrt(pos.x^2 + pos.z^2)
local d = { x = vx / ds, z = vz / ds }
local p = { x = pos.x / ps, z = pos.z / ps }
local an = ( d.x * p.x ) + ( d.z * p.z )
a = math.deg( math.acos( an ) )
```
Thank you everyone, especially TeTpaAka and Nore. All problems were at last solved, and the code now reports the angle difference between entities like it should! You get 0* when standing right in front of the mob, 90* when standing parallel to either side, 180* when standing behind... whereas flying up or down now accounts pitch correctly on top of that.
Here is the final and fully functional version. I hope it will be helpful to more people than just me, if anyone ever needs a simple and efficient FOV scanner for Minetest.
```
local function in_fov (pos1, pos2, yaw, pitch, fov)
local function yaw2vec (yaw, pitch)
-- we must invert the yaw for x to keep the result from inverting when facing opposite directions (0* becoming 180*)
return {x = math.sin(-yaw) * math.cos(pitch), y = math.sin(pitch), z = math.cos(yaw) * math.cos(pitch)}
end
local function dotproduct (v1, v2)
return ((v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z))
end
local function angle (v1, v2)
return math.deg(math.acos(dotproduct(v1, v2) / (vector.length(v1) * vector.length(v2))))
end
local v = vector.subtract(pos2, pos1)
print(angle(yaw2vec(yaw, pitch), v))
end
```
here is the final version of the function which I'll be including in my mod, simplified to only 5 lines of code but with the same result:
CODE: SELECT ALL
```
-- returns the angle difference between pos1 and pos2, as seen from pos1 at the specified yaw and pitch
function pos_to_angle (pos1, pos2, yaw, pitch)
-- note: we must invert the yaw for x in yaw_vec, to keep the result from inverting when facing opposite directions (0* becoming 180*)
local yaw_vec = {x = -math.sin(yaw) * math.cos(pitch), y = math.sin(pitch), z = math.cos(yaw) * math.cos(pitch)}
local pos_subtract = vector.subtract(pos2, pos1)
local pos_dotproduct = (yaw_vec.x * pos_subtract.x) + (yaw_vec.y * pos_subtract.y) + (yaw_vec.z * pos_subtract.z)
local angle = math.deg(math.acos(pos_dotproduct / (vector.length(yaw_vec) * vector.length(pos_subtract))))
return angle
end
```

116
README.md Normal file
View File

@ -0,0 +1,116 @@
Adventuretest game for the Minetest game engine
==========================================================
To play this game in Minetest, insert this repository as
/games/adventuretest
in the Minetest Engine.
The Minetest Engine that can play this game can be found at
https://minetest.io/ or just build your version using the minenux branch
at https://codeberg.org/minenux/minetest-engine-minetest/src/branch/stable-4.0
![screenshot.png](screenshot.png)
INFORMATION
-----------
The game has a RPG spirit, but not limit to, its focused in
singleplayer, but also works for multiplayer too, creative and
damage are mutually exclusive settings.
#### Quests
The game have "quests" that any player can do, some have rewards
others just provide rare things,
A common rquest is Right click on any of the ladies in the village
with black hair to receive your quest.
#### Crafting guides
Build in in the lifesaver button, There is a crafting guide,
of the inventory. also once in the game type `/m` and press
enter and you will get a crafting guide, equipping armor form
and changing skin form.
### Configuration
By default each interaction of attack causes blood, but you
can configure to make the enemy just cry with `enable_blood` to `false`
### Know issues
If yu got crash, somethigns you game get slow for movement, in singleplayer,
the character suddently stop and if you tryto move, keep moving until
a block just stop it.
To solve, go into your world directory and delete the affects.txt
and physics file. This happens sometimes when there is a crash.
Adventuretest License
------------------------------------------
Copyright (C) 2013-2014 Brandon Bohannon <brandon@bremaweb.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
License of default mods source code
-----------------------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
License of media (models, textures and sounds)
--------------------------------------
Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com>
See README.txt in each mod directory for information about other authors.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
http://creativecommons.org/licenses/by-sa/3.0/
License of menu/header.png
Copyright (C) 2013 BlockMen CC BY-3.0
License of Spider model
Copyright (C) 2013 AspireMint CC BY-SA
goblins_goblin.b3d and goblins_goblin.blend
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) by FreeLikeGNU
http://creativecommons.org/licenses/by-sa/3.0/
above meshes based on character from minetest_game
MirceaKitsune (WTFPL)
https://github.com/minetest/minetest_game/blob/master/mods/default/README.txt#L71
goblins_goblins*.png files and goblins_goblin.xcf file by FreeLikeGNU
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) FreeLikeGNU
http://creativecommons.org/licenses/by-sa/3.0/
Thanks to Napiophelios for the goblin king skin
https://forum.minetest.net/viewtopic.php?f=9&t=13004#p186921
goblins_goblin_king.png
License: Creative Commons CC-BY-SA-3.0 SummerFeilds TP

View File

@ -5,8 +5,46 @@ To play this game in Minetest, insert this repository as
/games/adventuretest
in the Minetest Engine.
The Minetest Engine can be found in:
https://github.com/minetest/minetest/
The Minetest Engine that can play this game can be found at
https://minetest.io/ or just build your version using the minenux branch
at https://codeberg.org/minenux/minetest-engine-minetest/src/branch/stable-4.0
![screenshot.png](screenshot.png)
INFORMATION
-----------
The game has a RPG spirit, but not limit to, its focused in
singleplayer, but also works for multiplayer too, creative and
damage are mutually exclusive settings.
#### Quests
The game have "quests" that any player can do, some have rewards
others just provide rare things,
A common rquest is Right click on any of the ladies in the village
with black hair to receive your quest.
#### Crafting guides
Build in in the lifesaver button, There is a crafting guide,
of the inventory. also once in the game type `/m` and press
enter and you will get a crafting guide, equipping armor form
and changing skin form.
### Configuration
By default each interaction of attack causes blood, but you
can configure to make the enemy just cry with `enable_blood` to `false`
### Know issues
If yu got crash, somethigns you game get slow for movement, in singleplayer,
the character suddently stop and if you tryto move, keep moving until
a block just stop it.
To solve, go into your world directory and delete the affects.txt
and physics file. This happens sometimes when there is a crash.
Adventuretest License
------------------------------------------

View File

@ -1 +1,8 @@
name = Adventuretest
title = adventuretest
name = adventuretest
author = bremaweb
description = Adventure RPG-hard game for the Minetest game engine
release = 20181212
min_minetest_version = 0.4.14
max_minetest_version = 4.99
disabled_settings = creative_mode, !enable_damage

View File

@ -5,6 +5,8 @@ enable_node_highlighting = true
debug_log_level = action
enable_blood = true
torches_enable_ceiling = false
torches_style = minetest

View File

@ -22,21 +22,16 @@ end
adventuretest.pl_hooks = {}
function adventuretest.player_loop(dtime)
local p = minetest.get_connected_players()
local reset_hooks = { }
for _, player in pairs(p) do
local name = player:get_player_name()
for k,hook in pairs(adventuretest.pl_hooks) do
adventuretest.pl_hooks[k].timer = adventuretest.pl_hooks[k].timer + dtime
if adventuretest.pl_hooks[k].timer >= adventuretest.pl_hooks[k].timeout then
reset_hooks[#reset_hooks+1] = k
local reset_hooks = {}
for k,hook in pairs(adventuretest.pl_hooks) do
adventuretest.pl_hooks[k].timer = adventuretest.pl_hooks[k].timer + dtime
if adventuretest.pl_hooks[k].timer >= adventuretest.pl_hooks[k].timeout then
for _, player in pairs(p) do
local name = player:get_player_name()
adventuretest.pl_hooks[k].timer = 0
adventuretest.pl_hooks[k].func(player,name,dtime)
end
end
end
if #reset_hooks > 0 then
for _,hid in pairs(reset_hooks) do
adventuretest.pl_hooks[hid].timer = 0
end
end
end
end
end

View File

@ -3,6 +3,11 @@ adventuretest = {}
adventuretest.seed = os.time()
local enable_blood
if minetest.setting_get("enable_blood") ~= nil then
enable_blood = minetest.setting_getbool("enable_blood") or true
end
game_origin = nil
if minetest.setting_get("game_origin") ~= nil then
game_origin = minetest.string_to_pos(minetest.setting_get("game_origin"))
@ -10,6 +15,31 @@ else
game_origin = {x=0,y=3,z=0}
end
adventuretest.blood = enable_blood
-- check for minetest 5.x compatibility and mantains backguard 4.X/0.4
local is_57 = minetest.has_feature("get_light_data_buffer")
local is_56 = minetest.has_feature("particlespawner_tweenable")
local is_55 = minetest.has_feature("dynamic_add_media_table")
local is_54 = minetest.has_feature("direct_velocity_on_players")
local is_53 = minetest.has_feature("object_step_has_moveresult")
local is_52 = minetest.has_feature("pathfinder_works")
local is_51 = minetest.has_feature("httpfetch_binary_data")
local is_50 = minetest.has_feature("object_use_texture_alpha")
local is_04 = minetest.has_feature("area_store_custom_ids")
local is_40 = minetest.has_feature("add_entity_with_staticdata")
-- expose api check of minetest version compatibility, 40 is 4.0.17+ and 0.4 is 0.4.14 to 0.4.17.1
adventuretest.is_57 = is_57
adventuretest.is_56 = is_56
adventuretest.is_55 = is_55
adventuretest.is_54 = is_54
adventuretest.is_53 = is_53
adventuretest.is_52 = is_52
adventuretest.is_51 = is_51
adventuretest.is_50 = is_50
adventuretest.is_04 = is_04
adventuretest.is_40 = is_40
dofile(minetest.get_modpath("adventuretest").."/functions.lua");
dofile(minetest.get_modpath("adventuretest").."/register_functions.lua");
dofile(minetest.get_modpath("adventuretest").."/privs.lua")

View File

@ -98,7 +98,7 @@ minetest.register_on_dignode(adventuretest_dignode)
local function adventuretest_placenode(pos, node, placer)
hunger.handle_node_actions(pos,node,placer)
if placer:is_player() then
if placer and placer:is_player() then
local name = placer:get_player_name()
pd.increment(name,STAT_PLACED,1)

View File

@ -17,16 +17,14 @@ minetest.register_chatcommand("affect",{
minetest.register_chatcommand("removeaffect",{
params = "<name> [affectid]",
description = "Remove an affect or all affects from a player",
description = "Removes and affect or all affects from a player",
privs = {affects=true},
func = function (name, param)
local aname, affectid = string.match(param, "([^ ]+) (.+)")
if ( aname == nil or aname == "" ) then
minetest.chat_send_player(name, "Syntax: removeaffect <name> [affectid]")
elseif ( affects.removeAffect(aname,affectid) ) then
if ( affects.removeAffect(aname,affectid) ) then
minetest.chat_send_player(name,"Affect removed from "..aname)
else
minetest.chat_send_player(name,"Unable to remove affects")
end
end
})
})

View File

@ -46,8 +46,8 @@ local cottages_anvil_formspec =
"label[0,3.0;"..S("Punch anvil with hammer to").."]"..
"label[0,3.3;"..S("repair tool in workpiece-slot.").."]"..
"list[current_player;main;0,4;8,4;]"
.."listring[current_player;main]".."listring[current_name;input]"
.."listring[current_player;main]".."listring[current_name;hammer]"
.."listring[current_player;main]".."listring[current_name;input]"
minetest.register_node("cottages:anvil", {
@ -303,18 +303,3 @@ minetest.register_craft({
{'', cottages.craftitem_stick, '' } }
})
--------------------------------------------------------------------------------
-- Update existing nodes to use SHIFT-CLICK
--------------------------------------------------------------------------------
minetest.register_lbm({
name = "cottages:anvil_lbm",
nodenames = {"cottages:anvil"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
cottages_anvil_formspec..
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]");
end,
})

View File

@ -25,25 +25,25 @@ local S = cottages.S
barrel = {};
local barrel_formspec = "size[8,9]"..
"image[2.6,2;2,3;default_sandstone.png^[lowpart:"..
-- (100-percent)..":default_desert_stone.png]".. -- TODO: better images
"50:default_desert_stone.png]".. -- TODO: better images
"label[2.2,0;"..S("Pour:").."]"..
"list[current_name;input;3,0.5;1,1;]"..
"label[5,3.3;"..S("Fill:").."]"..
"list[current_name;output;5,3.8;1,1;]"..
"list[current_player;main;0,5;8,4;]"
.."listring[current_name;output]".."listring[current_player;main]"
.."listring[current_name;input]".."listring[current_player;main]"
-- prepare formspec
barrel.on_construct = function( pos )
local meta = minetest.get_meta(pos);
local percent = math.random( 1, 100 ); -- TODO: show real filling
meta:set_string( 'formspec', barrel_formspec)
meta:set_string( 'formspec',
"size[8,9]"..
"image[2.6,2;2,3;default_sandstone.png^[lowpart:"..
(100-percent)..":default_desert_stone.png]".. -- TODO: better images
"label[2.2,0;"..S("Pour:").."]"..
"list[current_name;input;3,0.5;1,1;]"..
"label[5,3.3;"..S("Fill:").."]"..
"list[current_name;output;5,3.8;1,1;]"..
"list[current_player;main;0,5;8,4;]"
.."listring[current_name;output]".."listring[current_player;main]"
.."listring[current_name;input]".."listring[current_player;main]"
)
meta:set_string( 'liquid_type', '' ); -- which liquid is in the barrel?
meta:set_int( 'liquid_level', 0 ); -- how much of the liquid is in there?
@ -223,17 +223,3 @@ minetest.register_craft({
{"cottages:tub"},
},
})
--------------------------------------------------------------------------------
-- Update existing nodes to use SHIFT-CLICK
--------------------------------------------------------------------------------
minetest.register_lbm({
name = "cottages:barrel_lbm",
nodenames = {"cottages:barrel"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", barrel_formspec)
end,
})

View File

@ -59,16 +59,3 @@ minetest.register_node("cottages:chest_storage", {
is_ground_content = false,
})
--------------------------------------------------------------------------------
-- Update existing nodes to use SHIFT-CLICK
--------------------------------------------------------------------------------
minetest.register_lbm({
name = "cottages:chests_lbm",
nodenames = {"cottages:chest_private", "cottages:chest_work", "cottages:chest_storage"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", default.chest_formspec)
end,
})

View File

@ -189,12 +189,6 @@ end
minetest.register_node("cottages:table", cottages_table_def );
local cottage_shelf_formspec =
"size[8,8]"..
"list[current_name;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]"..
"listring[]"
-- looks better than two slabs impersonating a shelf; also more 3d than a bookshelf
-- the infotext shows if it's empty or not
minetest.register_node("cottages:shelf", {
@ -227,7 +221,11 @@ minetest.register_node("cottages:shelf", {
local meta = minetest.get_meta(pos);
meta:set_string("formspec", cottage_shelf_formspec)
meta:set_string("formspec",
"size[8,8]"..
"list[current_name;main;0,0;8,3;]"..
"list[current_player;main;0,4;8,4;]"..
"listring[current_name;main]".."listring[current_player;main]")
meta:set_string("infotext", S("open storage shelf"))
local inv = meta:get_inventory();
inv:set_size("main", 24);
@ -392,16 +390,3 @@ minetest.register_craft({
}
})
--------------------------------------------------------------------------------
-- Update existing nodes to use SHIFT-CLICK
--------------------------------------------------------------------------------
minetest.register_lbm({
name = "cottages:shelf_lbm",
nodenames = {"cottages:shelf"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", cottage_shelf_formspec)
end,
})

View File

@ -99,8 +99,8 @@ local cottages_formspec_treshing_floor =
"label[0,3.0;"..S("to get straw and seeds from wheat.").."]"..
"list[current_player;main;0,4;8,4;]"
.."listring[current_name;straw]".."listring[current_player;main]"
.."listring[current_name;harvest]".."listring[current_player;main]"
.."listring[current_name;seeds]".."listring[current_player;main]"
.."listring[current_name;harvest]".."listring[current_player;main]"
minetest.register_node("cottages:threshing_floor", {
drawtype = "nodebox",
@ -576,31 +576,3 @@ minetest.register_craft({
{"cottages:straw","cottages:straw","cottages:straw"},
},
})
--------------------------------------------------------------------------------
-- Update existing nodes to use SHIFT-CLICK
--------------------------------------------------------------------------------
minetest.register_lbm({
name = "cottages:threshing_floor_lbm",
nodenames = {"cottages:threshing_floor"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
cottages_formspec_treshing_floor..
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]" );
end,
})
minetest.register_lbm({
name = "cottages:handmill_lbm",
nodenames = {"cottages:handmill"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
cottages_handmill_formspec..
"label[2.5,-0.5;"..S("Owner: %s"):format(meta:get_string('owner') or "").."]" );
end,
})

View File

@ -144,6 +144,7 @@ if minetest.setting_getbool("creative_mode") then
})
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
minetest.log("warning","[creative] maybe missing check for player here?")
return true
end)

View File

@ -382,7 +382,11 @@ minetest.register_abm({
end
-- Remove node
minetest.remove_node(p0)
nodeupdate(p0)
if adventuretest.is_50 then
minetest.check_for_falling(p0)
else
nodeupdate(p0)
end
end
end
})

View File

@ -925,19 +925,6 @@ minetest.register_abm({
end,
})
--------------------------------------------------------------------------------
-- Update existing nodes to use SHIFT-CLICK
--------------------------------------------------------------------------------
minetest.register_lbm({
name = "default:chest_lbm",
nodenames = {"default:chest", "default:npc_chest"},
run_at_every_load = false,
action = function(pos, node)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",default.chest_formspec)
end,
})
local function has_locked_chest_privilege(meta, player)
if meta ~= nil then

View File

@ -216,10 +216,13 @@ end
adventuretest.register_pl_hook(default.player_globalstep,0)
if minetest.register_on_punchplayer ~= nil then
local enable_blood = adventuretest.blood
local texture_blood_cry = "mobs_blood_blue.png"
if enable_blood then texture_blood_cry = "mobs_blood.png" end
minetest.register_on_punchplayer( function(player, hitter, time_from_last_punch, tool_capabilities, dir)
local name = player:get_player_name()
process_weapon(hitter,time_from_last_punch,tool_capabilities)
blood_particles(player:getpos(),0.5,27,"mobs_blood.png")
blood_particles(player:getpos(),0.5,27,texture_blood_cry)
if player_anim[name] == "lay" or player_anim[name] == "sit" then
player:set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})
local sleep_hud = pd.get(name,"sleep_hud")

View File

@ -371,7 +371,11 @@ function doors.register(name, def)
end
def.after_dig_node = function(pos, node, meta, digger)
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
nodeupdate({x = pos.x, y = pos.y + 1, z = pos.z})
if adventuretest.is_50 then
minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z})
else
nodeupdate({x = pos.x, y = pos.y + 1, z = pos.z})
end
end
def.can_dig = function(pos, player)
return can_dig(pos, player)

View File

@ -239,7 +239,11 @@ else
local p = minetest.find_node_near(p0, 1, {"group:flammable"})
if p then
minetest.remove_node(p)
nodeupdate(p)
if adventuretest.is_50 then
minetest.check_for_falling(p)
else
nodeupdate(p)
end
end
end
end,

View File

@ -2,8 +2,9 @@ local hb = {}
local scale = tonumber(core.setting_get("hud_scaling")) or 1
local function update_wheel(player)
local name = player:get_player_name()
if not player or not name then
if not player or not name or not player:is_player() then
return
end
@ -169,6 +170,9 @@ minetest.register_on_joinplayer(function(player)
end)
local function update_wrapper(a, b, player)
if not player or not player:is_player() then
return
end
local name = player:get_player_name()
if not name then
return

View File

@ -1,5 +1,9 @@
mobs = {}
local enable_blood = adventuretest.blood
local texture_blood_cry = "mobs_blood_blue.png"
if enable_blood then texture_blood_dry = "mobs_blood.png" end
dofile(minetest.get_modpath("mobs").."/step.lua")
mobs.mob_list = { npc={}, barbarian={}, monster={}, animal={}, npc_special={}}
@ -58,7 +62,7 @@ function mobs:register_mob(name, def)
knock_back = def.knock_back or 3,
blood_offset = def.blood_offset or 0,
blood_amount = def.blood_amount or 15,
blood_texture = def.blood_texture or "mobs_blood.png",
blood_texture = texture_blood_cry,
rewards = def.rewards or nil,
stationary = def.stationary or false,
activity_level = def.activity_level or 10,
@ -634,7 +638,14 @@ end
function mobs:face_pos(self,pos)
local s = self.object:getpos()
local vec = {x=pos.x-s.x, y=pos.y-s.y, z=pos.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
local yaw = 0
if vec.x ~= 0 then
yaw=math.atan(vec.z/vec.x)+math.pi/2
else
if vec.z>0 then
yaw=math.pi
end
end
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end

View File

@ -144,7 +144,14 @@ function mobs.on_step(self,dtime)
end
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
local yaw = 0
if vec.x ~= 0 then
yaw=math.atan(vec.z/vec.x)+math.pi/2
else
if vec.z>0 then
yaw=math.pi
end
end
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
@ -223,7 +230,13 @@ function mobs.on_step(self,dtime)
end
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
if vec.x ~= 0 then
yaw=math.atan(vec.z/vec.x)+math.pi/2
else
if vec.z>0 then
yaw=math.pi
end
end
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end
@ -345,7 +358,13 @@ function mobs.on_step(self,dtime)
self.v_start = false
else
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
local yaw = math.atan(vec.z/vec.x)+math.pi/2
if vec.x ~= 0 then
yaw=math.atan(vec.z/vec.x)+math.pi/2
else
if vec.z>0 then
yaw=math.pi
end
end
if self.drawtype == "side" then
yaw = yaw+(math.pi/2)
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -3,8 +3,12 @@ quests.chest = {}
quests.chest.go = function(npc,player)
local inv = player:get_inventory()
local pos = npc.object:getpos()
if inv:contains_item("main","farming_plus:flour") and inv:contains_item("main","food:bowl") then
inv:remove_item("main","farming_plus:flour")
if (inv:contains_item("main","farming_plus:flour") or inv:contains_item("main","food:flour")) and inv:contains_item("main","food:bowl") then
if inv:contains_item("main","farming_plus:flour") then
inv:remove_item("main","farming_plus:flour")
else
inv:remove_item("main","food:flour")
end
inv:remove_item("main","food:bowl")
chat.local_chat(pos,"'Thank you very much, take this as a token of my appreciation!'",6)
local lp = player:getpos()

View File

@ -63,7 +63,7 @@ function skills.add_exp(name, exp)
l.exp = l.exp + exp
local next_level = ((l.level^2) * 50)
if l.exp >= next_level then
while l.exp >= next_level do
l.level = l.level + 1
l.exp = l.exp - next_level
minetest.chat_send_player(name,"You have gained a level! You are now level "..tostring(l.level))

View File

@ -89,21 +89,51 @@ local function inventory_set(player, size)
end
local function on_craft(itemstack,player,old_craftgrid,craft_inv)
if itemstack:get_definition().skill ~= nil then
local name = player:get_player_name()
local probability = skills.get_probability(name,SKILL_CRAFTING,itemstack:get_definition().skill)
local rangeLow = ( probability - 10 ) / 100
probability = probability / 100
local wear = math.floor(50000 - ( 50000 * math.random(rangeLow,probability) ))
itemstack:add_wear(wear)
local i = skills.add_skill_exp(name,SKILL_CRAFTING,1)
local ii = skills.add_skill_exp(name,itemstack:get_definition().skill,1)
if i or ii then
local name = player:get_player_name()
if not name then return nil end
local craftItemDef = itemstack:get_definition()
if not craftItemDef then return nil end
local craftItemSkill = craftItemDef.skill
if not craftItemSkill then return nil end
if craftItemDef.type == "tool" then
local isSameItem = true
local itemCount = 0
local craftedItemName = craftItemDef.name
for _,recipeStack in ipairs(old_craftgrid) do
local recipeItemName = recipeStack:get_name()
if recipeItemName ~= "" then
itemCount = itemCount + 1
if itemCount > 2 then break end
if recipeItemName ~= craftedItemName then
isSameItem = false
break
end
end
end
if isSameItem and itemCount == 2 then
-- Yes we can ... repair
return nil
end
end
local probability = skills.get_probability(name, SKILL_CRAFTING, craftItemSkill)
local rangeLow = math.max(( probability - 10 ) / 100, 0.0)
probability = probability / 100
local wear = math.floor(50000 - ( 50000 * math.random(rangeLow,probability) ))
itemstack:add_wear(wear)
local craftItemDefw = itemstack:get_definition()
local craftItemSkillw = craftItemDefw.skill
-- local i = skills.add_skill_exp(name,SKILL_CRAFTING,1)
local ii = skills.add_skill_exp(name,craftItemSkillw,1)
if ii then
minetest.chat_send_player(name,"Your skills are increasing!")
end
return itemstack
end
return nil
end
minetest.register_on_craft(on_craft)

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 KiB