Compare commits
12 Commits
BadToad200
...
master
Author | SHA1 | Date | |
---|---|---|---|
c86e2f3fbc | |||
59e42c450e | |||
f1ff77133a | |||
fceb855f2a | |||
95f3980694 | |||
8bdf40b849 | |||
b2feac105a | |||
c55a8f8dcd | |||
5ba7c54408 | |||
0af5f94e21 | |||
6f081ff323 | |||
|
6d236fe10d |
92
NOTES.md
Normal file
92
NOTES.md
Normal 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
116
README.md
Normal 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
|
||||
|
||||

|
||||
|
||||
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
|
||||
|
42
README.txt
42
README.txt
@ -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
|
||||
|
||||

|
||||
|
||||
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
|
||||
------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -5,6 +5,8 @@ enable_node_highlighting = true
|
||||
|
||||
debug_log_level = action
|
||||
|
||||
enable_blood = true
|
||||
|
||||
torches_enable_ceiling = false
|
||||
torches_style = minetest
|
||||
|
||||
|
@ -22,22 +22,17 @@ 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
|
||||
|
||||
function adventuretest.register_pl_hook(f,t)
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
||||
|
@ -5,7 +5,9 @@ minetest.register_chatcommand("affect",{
|
||||
privs = {affects=true},
|
||||
func = function (name, param)
|
||||
local aname, affectid = string.match(param, "([^ ]+) (.+)")
|
||||
if ( affects.affectPlayer(aname,affectid) ) then
|
||||
if ( aname == nil or aname == "" or affectid == nil or affectid == '' ) then
|
||||
minetest.chat_send_player(name, "Syntax: affect <name> <affectid>")
|
||||
elseif ( affects.affectPlayer(aname,affectid) ) then
|
||||
minetest.chat_send_player(name,aname.." has been affected by "..affects._affects[affectid].name)
|
||||
else
|
||||
minetest.chat_send_player(name,"Unable to affect "..aname.." with "..affectid)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
})
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
BIN
mods/mobs/textures/mobs_blood_blue.png
Normal file
BIN
mods/mobs/textures/mobs_blood_blue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
@ -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()
|
||||
|
@ -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))
|
||||
|
@ -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
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 503 KiB |
Loading…
x
Reference in New Issue
Block a user