Charakterbewegungen hinzugefügt, Deko hinzugefügt, Kochrezepte angepasst
This commit is contained in:
parent
95945c0306
commit
a0c893ca0b
1124 changed files with 64294 additions and 763 deletions
2
mods/3d_armor_flyswim/.gitattributes
vendored
Normal file
2
mods/3d_armor_flyswim/.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
9
mods/3d_armor_flyswim/LICENSE.txt
Normal file
9
mods/3d_armor_flyswim/LICENSE.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
[mod] 3d_armor_flyswim
|
||||
=======================
|
||||
Licence code LGPL v2.1
|
||||
"Headanim" code by LoneWolfHT MIT Licence
|
||||
Cape Textures - CC0
|
||||
Blender Model/B3Ds as per base MTG - CC BY-SA 3.0
|
||||
"3d_armor_trans.png" CC-BY-SA 3.0
|
||||
|
||||
|
147
mods/3d_armor_flyswim/README.MD
Normal file
147
mods/3d_armor_flyswim/README.MD
Normal file
|
@ -0,0 +1,147 @@
|
|||
_, __, _, __, _, _ _, __,
|
||||
~_) | \ / \ |_) |\/| / \ |_)
|
||||
_) |_/ |~| | \ | | \ / | \
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
__, _, , _ _ _, _ _, _, _ _ _ _, _ _, _ _ _, _ _,
|
||||
|_ | \ | | |\ | / _ (_ | | | |\/| |\/| | |\ | / _
|
||||
| |_, \| | | \| \ / , ) |/\| | | | | | | | \| \ /
|
||||
~ ~ ~ ) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
~'
|
||||
|
||||
---------------------------
|
||||
## Information
|
||||
---------------------------
|
||||
This is a small utility mod which adds some new animations to the default animations found in player_api animations, the new animations are:
|
||||
|
||||
|Animation| Start | End | FPS |
|
||||
|---------|-------|-----|-----|
|
||||
|Swim | 246 | 279 | 30 |
|
||||
|Swim Atk | 285 | 318 | 30 |
|
||||
|Fly | 325 | 334 | 30 |
|
||||
|Fly Atk | 340 | 349 | 30 |
|
||||
|Fall | 355 | 364 | 30 |
|
||||
|Fall Atk | 365 | 374 | 30 |
|
||||
|Duck Std | 380 | 380 | 30 |
|
||||
|Duck | 381 | 399 | 30 |
|
||||
|Climb | 410 | 429 | 30 |
|
||||
|
||||
|
||||
|
||||
I have done my best to trigger the animations in the correct circumstances when viewing the player model in 3rd person.
|
||||
|
||||
I have only tested this against minetest versions 5.0 to 5.6
|
||||
|
||||
Mod now works with just player_api, 3d_armor is an optional depends.
|
||||
|
||||
Works with simple_skins - https://forum.minetest.net/viewtopic.php?f=11&t=9100
|
||||
|
||||
Works with skinsdb - https://forum.minetest.net/viewtopic.php?t=17899
|
||||
|
||||
Works with clothing 2 - https://forum.minetest.net/viewtopic.php?p=395157
|
||||
|
||||
When using skinsdb capes must be supplied by clothing 2.
|
||||
|
||||

|
||||
|
||||
---------------------------
|
||||
## Mod explanations and interactions
|
||||
---------------------------
|
||||
**player_api**
|
||||
fly,swim,crouch,climb animations work, enabling capes will do nothing as you cant wear them
|
||||
|
||||
Below here assumed you stil have player_api enabled/installed:
|
||||
|
||||
**simple skins**
|
||||
fly,swim,crouch,climb animations work, enabling capes will do nothing as you cant wear them
|
||||
|
||||
**3d_armor**
|
||||
You have the option to have capes on or off upto you, capes are considered armor
|
||||
|
||||
**3d_armor and simple_skins**
|
||||
You have the option to have capes on or off upto you, capes are considered armor
|
||||
|
||||
**skinsdb**
|
||||
Fly,swim,crouch,climb animations work, enabling capes will do nothing as you cant wear them
|
||||
|
||||
**3d_armor and skinsdb**
|
||||
Fly,swim,crouch,climb animations work you can enable capes but they wont be visible on your character but will still provide any bonuses
|
||||
|
||||
**3d_armor, skinsdb and clothing 2**
|
||||
Fly,swim,crouch,climb animations work, visual cape provided by clothing_2 however can also enable capes but they wont be visible and it's a bit strange wearing two capes. So recommened left disabled.
|
||||
|
||||
|
||||
---------------------------
|
||||
## Animation rules/triggers
|
||||
---------------------------
|
||||
Swimming - You must be in at least 2 nodes depth of liquid/flowing liquid and moving otherwise your character will simply wade through the liquid or float (stand). If you sink close to the bottom while submerged in the liquid your character will automatically stand on the bottom.
|
||||
|
||||
Swim through - Hold shift down while swimming, you will sink but will also now be able to swim through 1x1 tunnels.
|
||||
|
||||
Flying - Character/player must have fly_privs you must have at least 2 nodes of airlike nodes between you and the ground otherwise your character will simply/stand or walk ready to land. You also need some type of movement horizontally to trigger the animation otherwise your character will simply stand in the air to emulate hovering.
|
||||
|
||||
Falling - Character/player must have 4 nodes of airlike nodes between them and the ground. Easiest to trigger if fly_privs have been removed but you can fall with fly_privs. Max falling speed is set by terminal velocity, however holding shift down will let you exceed terminal velocity.
|
||||
|
||||
Crouching - Press shift while standing in the open and then walk forward.
|
||||
|
||||
Crouching under - Simply walk through a gap 1.5 nodes tall. Player/character must be facing the space and walking forwards.
|
||||
|
||||
|
||||
---------------------------
|
||||
## Turn off Animation or Crouch Rule
|
||||
---------------------------
|
||||
From MT Main Menu go to "Settings" then "All Settings" then "Mods" then "3d_armor_flyswim"
|
||||
|
||||
**capes_add_to_3darmor** - Default is enabled - Makes capes an armor item avaliable via 3d_armor (1 test cape included)
|
||||
|
||||
**example_cape** - Default is enabled - The example cape "Someones Cape" is avaliable which grants fly_privs when worn and a 100% speed increase
|
||||
|
||||
**fly_anim** - Default is enabled - Will show the flying animation
|
||||
|
||||
**fall_anim** - Default is enabled - Will show the falling animation
|
||||
|
||||
**fall_tv** - Default is 100 - This is terminal velocity, 100 represents approximatly 100kp/h however player/character speed will oscilate around this speed. Without this limit when falling characters simply accelerate endlessly (until they hit chunk load edge).
|
||||
|
||||
**swim_anim** - Default is enabled - Will show swim animation
|
||||
|
||||
**swim_sneak** - Default is enabled - Will allow character/player to swim through a hole 1x1 in size when underwater.
|
||||
|
||||
**climb_anim** - Default is enabled - Will show climb animation
|
||||
|
||||
**crouch_anim** - Default is enabled - Will show crouch/duck animation
|
||||
|
||||
**crouch_sneak** - Default is enabled - Will allow character/player to walk through a gap 1.5 nodes high when on land.
|
||||
|
||||
---------------------------
|
||||
## Why are Capes Included?
|
||||
---------------------------
|
||||
I found it best to keep capes included in this mod with the option to enable or disable. This is because capes needs the new b3d player model so they
|
||||
are displayed as part of armor instead of part of the player. However as I didn't want to force anyone into using capes as armor items I created a second
|
||||
optional player model which keeps capes with the player textures.
|
||||
|
||||
The above would create a circular dependancy if capes was it's own mod. Capes would have a dependency on Fly/Swim but Fly/Swim needs to know if Capes mod
|
||||
is present so as to load the correct b3d player model.
|
||||
|
||||
Given the above I have kept capes inside this mod with an option to enable/disable it under Settings>>All Settings>>Mods>>3d_armor_flyswim by default capes are set to Enabled/true
|
||||
|
||||
Capes provide minimal additional armor, about half as much as wooden boots by default.
|
||||
|
||||
--------------------------------------------
|
||||
## What nodes are set as Flyable/Swimmable?
|
||||
--------------------------------------------
|
||||
Any node which has the drawtype set as "airlike", "liquid" and "flowingliquid" will automatically be flyable or swimmable.
|
||||
|
||||
Big thanks to Gundul for pointing out a better way to do this.
|
||||
|
||||
--------------------------------------------
|
||||
## Headanimation is incorporated
|
||||
--------------------------------------------
|
||||
I have incorporated "headanim" mod content by LoneWolfHT as it was easier to include and then customise for this mod than try to interface
|
||||
with "headanim". Full credit to LoneWolfHT for the functionality. I did modify the functionality a little so visually when in 3rd person view
|
||||
Sams head will:
|
||||
|
||||
~ Regular animations when looking down Sams chin now rests on his chest (about a 60 degree angle).
|
||||
~ Regular animations when looking up Sam only bends head back to the same 60 degrees.
|
||||
~ Swimming and flying you can look down full 90 degrees, straight ahead 0 degrees, however head motion is restricted to 30 degrees back.
|
||||
|
||||
Make sure you disable "headanim" if you have it installed, although I found no serious issues with both enabled the mods
|
||||
could fight one another for control of head position.
|
1
mods/3d_armor_flyswim/description.txt
Normal file
1
mods/3d_armor_flyswim/description.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Addition of Fly and Swimming animations to 3d_armour base character model, used when swimming and flyinf or falling avaliable for other mods to make use of.
|
28
mods/3d_armor_flyswim/i_example_cape.lua
Normal file
28
mods/3d_armor_flyswim/i_example_cape.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
------------------------------------------------------------
|
||||
-- ___ _ __ ___ _ --
|
||||
-- | __| |_ _ / _|___ / __|_ __ _(_)_ __ --
|
||||
-- | _|| | || | > _|_ _| \__ \ V V / | ' \ --
|
||||
-- |_| |_|\_, | \_____| |___/\_/\_/|_|_|_|_| --
|
||||
-- |__/ --
|
||||
-- Crouch and Climb --
|
||||
------------------------------------------------------------
|
||||
-- Example Cape --
|
||||
------------------------------------------------------------
|
||||
armor:register_armor("3d_armor_flyswim:demo_cape", {
|
||||
description = "Someones Cape",
|
||||
inventory_image = "3d_armor_flyswim_demo_cape_inv.png",
|
||||
groups = {armor_capes=1, physics_speed=1, armor_use=1000},
|
||||
armor_groups = {fleshy=5},
|
||||
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||
on_equip = function(player)
|
||||
local privs = minetest.get_player_privs(player:get_player_name())
|
||||
privs.fly = true
|
||||
minetest.set_player_privs(player:get_player_name(), privs)
|
||||
end,
|
||||
|
||||
on_unequip = function(player)
|
||||
local privs = minetest.get_player_privs(player:get_player_name())
|
||||
privs.fly = nil
|
||||
minetest.set_player_privs(player:get_player_name(), privs)
|
||||
end,
|
||||
})
|
186
mods/3d_armor_flyswim/i_functions.lua
Normal file
186
mods/3d_armor_flyswim/i_functions.lua
Normal file
|
@ -0,0 +1,186 @@
|
|||
------------------------------------------------------------
|
||||
-- ___ _ __ ___ _ --
|
||||
-- | __| |_ _ / _|___ / __|_ __ _(_)_ __ --
|
||||
-- | _|| | || | > _|_ _| \__ \ V V / | ' \ --
|
||||
-- |_| |_|\_, | \_____| |___/\_/\_/|_|_|_|_| --
|
||||
-- |__/ --
|
||||
-- Crouch and Climb --
|
||||
------------------------------------------------------------
|
||||
-- Functions --
|
||||
------------------------------------------------------------
|
||||
|
||||
----------------------------------------
|
||||
-- Get Player model and textures
|
||||
|
||||
function armor_fly_swim.get_player_model()
|
||||
|
||||
-- player_api only (simple_skins uses)
|
||||
local player_mod = "character_sf.b3d"
|
||||
local texture = {"character.png",
|
||||
"3d_armor_trans.png"}
|
||||
|
||||
-- 3d_armor only nil capes (simple_skins uses)
|
||||
if armor_fly_swim.is_3d_armor and
|
||||
not armor_fly_swim.add_capes and
|
||||
not armor_fly_swim.is_skinsdb then
|
||||
|
||||
player_mod = "3d_armor_character_sf.b3d"
|
||||
texture = {armor.default_skin..".png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png"}
|
||||
end
|
||||
|
||||
-- 3d_armor only with capes (simple_skins uses)
|
||||
if armor_fly_swim.is_3d_armor and
|
||||
armor_fly_swim.add_capes and
|
||||
not armor_fly_swim.is_skinsdb then
|
||||
|
||||
player_mod = "3d_armor_character_sfc.b3d"
|
||||
texture = {armor.default_skin..".png",
|
||||
"3d_armor_trans.png",
|
||||
"3d_armor_trans.png"}
|
||||
end
|
||||
|
||||
-- skins_db with 3d_armor or without
|
||||
if armor_fly_swim.is_skinsdb then
|
||||
player_mod = "skinsdb_3d_armor_character_5.b3d"
|
||||
texture = {"blank.png",
|
||||
"blank.png",
|
||||
"blank.png",
|
||||
"blank.png"}
|
||||
end
|
||||
|
||||
return player_mod,texture
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
-- Get WASD, pressed = true
|
||||
|
||||
function armor_fly_swim.get_wasd_state(controls)
|
||||
|
||||
local rtn = false
|
||||
|
||||
if controls.up == true or
|
||||
controls.down == true or
|
||||
controls.left == true or
|
||||
controls.right == true then
|
||||
|
||||
rtn = true
|
||||
end
|
||||
|
||||
return rtn
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
-- Check specific node fly/swim
|
||||
-- 1=player feet, 2=one below feet,
|
||||
-- Thanks Gundul
|
||||
|
||||
function node_fsable(pos,num,type)
|
||||
|
||||
local draw_ta = {"airlike"}
|
||||
local draw_tl = {"liquid","flowingliquid"}
|
||||
local compare = draw_ta
|
||||
local node = minetest.get_node({x=pos.x,y=pos.y-(num-1),z=pos.z})
|
||||
local n_draw
|
||||
|
||||
if minetest.registered_nodes[node.name] then
|
||||
n_draw = minetest.registered_nodes[node.name].drawtype
|
||||
else
|
||||
n_draw = "normal"
|
||||
end
|
||||
|
||||
if type == "s" then
|
||||
compare = draw_tl
|
||||
end
|
||||
|
||||
for k,v in ipairs(compare) do
|
||||
if n_draw == v then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-----------------------------------------------
|
||||
-- Check X number nodes down fly/Swimmable
|
||||
|
||||
function node_down_fsable(pos,num,type)
|
||||
|
||||
local draw_ta = {"airlike"}
|
||||
local draw_tl = {"liquid","flowingliquid"}
|
||||
local i = 0
|
||||
local nodes = {}
|
||||
local result ={}
|
||||
local compare = draw_ta
|
||||
while (i < num ) do
|
||||
table.insert(nodes, minetest.get_node({x=pos.x,y=pos.y-i,z=pos.z}))
|
||||
i=i+1
|
||||
end
|
||||
|
||||
if type == "s" then
|
||||
compare = draw_tl
|
||||
end
|
||||
|
||||
local n_draw
|
||||
for k,v in pairs(nodes) do
|
||||
local n_draw
|
||||
|
||||
if minetest.registered_nodes[v.name] then
|
||||
n_draw = minetest.registered_nodes[v.name].drawtype
|
||||
else
|
||||
n_draw = "normal"
|
||||
end
|
||||
|
||||
for k2,v2 in ipairs(compare) do
|
||||
if n_draw == v2 then
|
||||
table.insert(result,"t")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if #result == num then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------
|
||||
-- Workaround for slab edge crouch
|
||||
|
||||
function crouch_wa(player,pos)
|
||||
local is_slab = 0
|
||||
local pos_w = {}
|
||||
local angle = (player:get_look_horizontal())*180/math.pi -- Convert Look direction to angles
|
||||
|
||||
-- +Z North
|
||||
if angle <= 45 or angle >= 315 then
|
||||
pos_w={x=pos.x,y=pos.y+1,z=pos.z+1}
|
||||
|
||||
-- -X West
|
||||
elseif angle > 45 and angle < 135 then
|
||||
pos_w={x=pos.x-1,y=pos.y+1,z=pos.z}
|
||||
|
||||
-- -Z South
|
||||
elseif angle >= 135 and angle <= 225 then
|
||||
pos_w={x=pos.x,y=pos.y+1,z=pos.z-1}
|
||||
|
||||
-- +X East
|
||||
elseif angle > 225 and angle < 315 then
|
||||
pos_w={x=pos.x+1,y=pos.y+1,z=pos.z}
|
||||
end
|
||||
|
||||
local check = minetest.get_node(pos_w)
|
||||
|
||||
if minetest.registered_nodes[check.name] then
|
||||
local check_g = minetest.get_item_group(check.name, "slab")
|
||||
|
||||
if check_g ~= 0 then
|
||||
is_slab = 1
|
||||
end
|
||||
end
|
||||
|
||||
-- return 1 or 0, need to update to bool
|
||||
return is_slab
|
||||
end
|
386
mods/3d_armor_flyswim/init.lua
Normal file
386
mods/3d_armor_flyswim/init.lua
Normal file
|
@ -0,0 +1,386 @@
|
|||
------------------------------------------------------------
|
||||
-- ___ _ __ ___ _ --
|
||||
-- | __| |_ _ / _|___ / __|_ __ _(_)_ __ --
|
||||
-- | _|| | || | > _|_ _| \__ \ V V / | ' \ --
|
||||
-- |_| |_|\_, | \_____| |___/\_/\_/|_|_|_|_| --
|
||||
-- |__/ --
|
||||
-- Crouch and Climb --
|
||||
------------------------------------------------------------
|
||||
-- Sirrobzeroone --
|
||||
-- Licence code LGPL v2.1 --
|
||||
-- Cape Textures - CC0 --
|
||||
-- Blender Model/B3Ds as per base MTG - CC BY-SA 3.0 --
|
||||
-- except "3d_armor_trans.png" CC-BY-SA 3.0 --
|
||||
------------------------------------------------------------
|
||||
|
||||
----------------------------
|
||||
-- Settings
|
||||
|
||||
armor_fly_swim = {}
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
armor_fly_swim.add_capes = minetest.settings:get_bool("capes_add_to_3darmor" ,false)
|
||||
armor_fly_swim.example_cape = minetest.settings:get_bool("example_cape" ,false)
|
||||
|
||||
local fly_anim = minetest.settings:get_bool("fly_anim" ,true)
|
||||
local fall_anim = minetest.settings:get_bool("fall_anim" ,true)
|
||||
local fall_tv = tonumber(minetest.settings:get("fall_tv" ,true)) or 100
|
||||
-- Convert kp/h back to number of -y blocks per 0.05 of a second.
|
||||
fall_tv = -1*(fall_tv/3.7)
|
||||
local swim_anim = minetest.settings:get_bool("swim_anim" ,true)
|
||||
local swim_sneak = minetest.settings:get_bool("swim_sneak" ,true)
|
||||
local climb_anim = minetest.settings:get_bool("climb_anim" ,true)
|
||||
local crouch_anim = minetest.settings:get_bool("crouch_anim" ,true)
|
||||
local crouch_sneak = minetest.settings:get_bool("crouch_sneak" ,true)
|
||||
|
||||
-----------------------
|
||||
-- Conditional mods
|
||||
|
||||
armor_fly_swim.is_3d_armor = minetest.get_modpath("3d_armor")
|
||||
armor_fly_swim.is_skinsdb = minetest.get_modpath("skinsdb")
|
||||
|
||||
-------------------------------------
|
||||
-- Adding new armor item for Capes
|
||||
|
||||
if armor_fly_swim.add_capes == true then
|
||||
if minetest.global_exists("armor") and armor.elements then
|
||||
table.insert(armor.elements, "capes")
|
||||
end
|
||||
end
|
||||
|
||||
----------------------------
|
||||
-- Initiate files
|
||||
|
||||
dofile(modpath .. "/i_functions.lua")
|
||||
|
||||
if armor_fly_swim.example_cape and
|
||||
armor_fly_swim.add_capes and
|
||||
armor_fly_swim.is_3d_armor then
|
||||
|
||||
dofile(modpath .. "/i_example_cape.lua")
|
||||
end
|
||||
-------------------------------------
|
||||
-- Get Player model to use
|
||||
|
||||
local player_mod, texture = armor_fly_swim.get_player_model()
|
||||
|
||||
--------------------------------------
|
||||
-- Player model with Swim/Fly/Capes
|
||||
|
||||
player_api.register_model(player_mod, {
|
||||
animation_speed = 30,
|
||||
textures = texture,
|
||||
animations = {
|
||||
stand = {x=0, y=79},
|
||||
lay = {x=162, y=166},
|
||||
walk = {x=168, y=187},
|
||||
mine = {x=189, y=198},
|
||||
walk_mine = {x=200, y=219},
|
||||
sit = {x=81, y=160},
|
||||
swim = {x=246, y=279},
|
||||
swim_atk = {x=285, y=318},
|
||||
fly = {x=325, y=334},
|
||||
fly_atk = {x=340, y=349},
|
||||
fall = {x=355, y=364},
|
||||
fall_atk = {x=365, y=374},
|
||||
duck_std = {x=380, y=380},
|
||||
duck = {x=381, y=399},
|
||||
climb = {x=410, y=429},
|
||||
},
|
||||
})
|
||||
----------------------------------------
|
||||
-- Setting model on join and clearing
|
||||
-- local_animations
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
player_api.set_model(player,player_mod)
|
||||
player_api.player_attached[player:get_player_name()] = false
|
||||
player:set_local_animation({},{},{},{},30)
|
||||
|
||||
end)
|
||||
|
||||
------------------------------------------------
|
||||
-- Global step to check if player meets --
|
||||
-- Conditions for Swimming, Flying(falling) --
|
||||
-- Crouching or Climbing --
|
||||
------------------------------------------------
|
||||
minetest.register_globalstep(function()
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local controls = player:get_player_control()
|
||||
local controls_wasd = armor_fly_swim.get_wasd_state(controls)
|
||||
local attached_to = player:get_attach()
|
||||
local privs = minetest.get_player_privs(player:get_player_name())
|
||||
local pos = player:get_pos()
|
||||
local pmeta = player:get_meta()
|
||||
local cur_anim = player_api.get_animation(player)
|
||||
local ladder = {}
|
||||
ladder.n = {is = false, pos = pos}
|
||||
ladder.n_a = {is = false, pos = {x=pos.x,y=pos.y +1,z=pos.z}}
|
||||
ladder.n_b = {is = false, pos = {x=pos.x,y=pos.y -1,z=pos.z}}
|
||||
local is_slab = crouch_wa(player,pos)
|
||||
local attack = ""
|
||||
local ani_spd = 30
|
||||
local offset = 0
|
||||
local tdebug = false
|
||||
|
||||
-- reset player collisionbox, eye height, speed override
|
||||
player:set_properties({collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}})
|
||||
player:set_properties({eye_height = 1.47})
|
||||
|
||||
-- used to store and reset the players physics.speed settings
|
||||
-- back to what they were before fly_swim adjusted them
|
||||
if pmeta:get_int("flyswim_std_under_slab") == 1 then
|
||||
player:set_physics_override({speed = pmeta:get_float("flyswim_org_phy_or")})
|
||||
pmeta:set_int("flyswim_std_under_slab", 0)
|
||||
end
|
||||
|
||||
local vel = player:get_velocity()
|
||||
|
||||
-- basically 3D Pythagorean Theorem km/h
|
||||
local play_s = (math.sqrt(math.pow(math.abs(vel.x),2) +
|
||||
math.pow(math.abs(vel.y),2) +
|
||||
math.pow(math.abs(vel.z),2) ))*3.6
|
||||
|
||||
-- Sets terminal velocity to about 100Km/hr beyond
|
||||
-- this speed chunk load issues become more noticable
|
||||
--(-1*(vel.y+1)) - catch those holding shift and over
|
||||
-- acceleratering when falling so dynamic end point
|
||||
-- so player dosent bounce back up
|
||||
if vel.y < fall_tv and controls.sneak ~= true then
|
||||
local tv_offset_y = -1*((-1*(vel.y+1)) + vel.y)
|
||||
player:add_player_velocity({x=0, y=tv_offset_y, z=0})
|
||||
end
|
||||
|
||||
-- Check for Swinging/attacking and set string
|
||||
if controls.LMB or controls.RMB then
|
||||
attack = "_atk"
|
||||
end
|
||||
|
||||
-- get ladder pos node
|
||||
local t_node = minetest.registered_nodes[minetest.get_node(ladder.n.pos).name]
|
||||
if t_node and t_node.climbable then
|
||||
ladder.n.is = true
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Start of Animation Cases --
|
||||
---------------------------------------------------------
|
||||
-------------------------------------
|
||||
-- Crouch Slab/Node Exception Case
|
||||
|
||||
-- If player still udner slab/swimming in tunnel
|
||||
-- and they let go of shift this stops them
|
||||
-- standing up
|
||||
local node_check = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
local nc_draw = "normal"
|
||||
local nc_slab = 0
|
||||
local nc_node = 0
|
||||
|
||||
if minetest.registered_nodes[node_check.name] then
|
||||
|
||||
nc_slab = minetest.get_item_group(node_check.name, "slab")
|
||||
nc_draw = minetest.registered_nodes[node_check.name].drawtype
|
||||
|
||||
if nc_draw ~= "liquid" and
|
||||
nc_draw ~= "flowingliquid" and
|
||||
nc_draw ~= "airlike" then
|
||||
|
||||
nc_node = 1
|
||||
end
|
||||
end
|
||||
|
||||
if crouch_sneak and
|
||||
nc_slab == 1 and
|
||||
not attached_to and
|
||||
not controls.sneak and
|
||||
not node_fsable(pos,2,"a") then
|
||||
|
||||
local animiation = "duck_std"
|
||||
|
||||
-- when player moving
|
||||
if controls_wasd then
|
||||
local play_or_2 =player:get_physics_override()
|
||||
pmeta:set_int("flyswim_std_under_slab", 1)
|
||||
pmeta:set_float("flyswim_org_phy_or", play_or_2.speed)
|
||||
player:set_physics_override({speed = play_or_2.speed*0.2})
|
||||
|
||||
animation = "duck"
|
||||
end
|
||||
|
||||
if crouch_anim == true then
|
||||
player_api.set_animation(player, animation ,ani_spd/2)
|
||||
end
|
||||
|
||||
player:set_properties({collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.45, 0.3}})
|
||||
player:set_properties({eye_height = 1.27})
|
||||
if tdebug then minetest.debug("crouch catch") end
|
||||
|
||||
elseif swim_sneak and
|
||||
nc_node == 1 and
|
||||
node_down_fsable(pos,1,"s") and
|
||||
not attached_to and
|
||||
not controls.sneak then
|
||||
|
||||
player_api.set_animation(player, "swim",ani_spd)
|
||||
player:set_properties({collisionbox = {-0.4, 0, -0.4, 0.4, 0.5, 0.4}})
|
||||
player:set_properties({eye_height = 0.7})
|
||||
offset = 90
|
||||
if tdebug then minetest.debug("swim through catch") end
|
||||
|
||||
-----------------------------
|
||||
-- Climb
|
||||
elseif climb_anim and
|
||||
ladder.n.is and
|
||||
(controls.jump or controls.sneak) then
|
||||
|
||||
-- Moved inside climb to save unessecary node checking
|
||||
for k,def in pairs(ladder) do
|
||||
if k ~= "n" then
|
||||
local node = minetest.registered_nodes[minetest.get_node(def.pos).name]
|
||||
if node and node.climbable then
|
||||
def.is = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (controls.sneak and ladder.n_b.is) or
|
||||
(controls.jump and ladder.n_a.is) then
|
||||
|
||||
player_api.set_animation(player, "climb",ani_spd)
|
||||
if tdebug then minetest.debug("climb") end
|
||||
end
|
||||
|
||||
-----------------------------
|
||||
-- Swim
|
||||
|
||||
elseif swim_anim == true and
|
||||
controls_wasd and
|
||||
node_down_fsable(pos,2,"s") and
|
||||
not attached_to then
|
||||
|
||||
player_api.set_animation(player,"swim"..attack ,ani_spd)
|
||||
offset = 90
|
||||
if tdebug then minetest.debug("swim") end
|
||||
|
||||
elseif swim_sneak == true and
|
||||
swim_anim == true and
|
||||
controls.sneak and
|
||||
node_down_fsable(pos,1,"s") and
|
||||
not attached_to then
|
||||
|
||||
player_api.set_animation(player, "swim",ani_spd)
|
||||
player:set_properties({collisionbox = {-0.4, 0, -0.4, 0.4, 0.5, 0.4}})
|
||||
player:set_properties({eye_height = 0.7})
|
||||
offset = 90
|
||||
if tdebug then minetest.debug("swim through") end
|
||||
-----------------------------
|
||||
-- Sneak
|
||||
|
||||
-- first elseif Crouch-walk workaround.
|
||||
-- First slab player enters counts as a true slab
|
||||
-- and has an edge. As such the shift edge detection
|
||||
-- kicks in and player can't move forwards. This
|
||||
-- case sets the player collision box to 1 high for that first slab
|
||||
|
||||
elseif crouch_anim and
|
||||
controls.sneak and
|
||||
controls.up and
|
||||
not node_fsable(pos,2,"a") and
|
||||
not attached_to and
|
||||
play_s <= 1 and is_slab == 1 then
|
||||
|
||||
if crouch_anim == true then
|
||||
player_api.set_animation(player, "duck",ani_spd/2)
|
||||
player:set_properties({eye_height = 1.27})
|
||||
end
|
||||
|
||||
if crouch_sneak == true then
|
||||
-- Workaround set collision box to 1 high
|
||||
player:set_properties({collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.0, 0.3}})
|
||||
end
|
||||
if tdebug then minetest.debug("crouch_1") end
|
||||
|
||||
elseif crouch_anim and
|
||||
controls.sneak and
|
||||
not node_fsable(pos,2,"a") and
|
||||
not attached_to then
|
||||
|
||||
local animation = "duck_std"
|
||||
if controls_wasd then animation = "duck" end
|
||||
|
||||
player_api.set_animation(player, animation, ani_spd/2)
|
||||
player:set_properties({eye_height = 1.27})
|
||||
|
||||
if crouch_sneak == true then
|
||||
player:set_properties({collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.45, 0.3}})
|
||||
end
|
||||
if tdebug then minetest.debug("crouch_2") end
|
||||
|
||||
-----------------------------
|
||||
-- Flying
|
||||
|
||||
elseif fly_anim == true and
|
||||
privs.fly == true and
|
||||
node_down_fsable(pos,3,"a") and
|
||||
not attached_to then
|
||||
|
||||
-- Vel.y value is a compromise for code simplicity,
|
||||
-- Flyers wont get fall animation until below -18m/s
|
||||
if controls_wasd then
|
||||
player_api.set_animation(player, "fly"..attack, ani_spd)
|
||||
offset = 90
|
||||
if tdebug then minetest.debug("fly") end
|
||||
|
||||
elseif fall_anim == true and
|
||||
vel.y < -18.0 then
|
||||
player_api.set_animation(player, "fall"..attack, ani_spd)
|
||||
offset = 90
|
||||
if tdebug then minetest.debug("fly_fall") end
|
||||
end
|
||||
|
||||
-----------------------------
|
||||
-- Falling
|
||||
|
||||
elseif fall_anim == true and
|
||||
node_down_fsable(pos,5,"a") and
|
||||
vel.y < -0.5 and
|
||||
not attached_to then
|
||||
|
||||
player_api.set_animation(player, "fall"..attack, ani_spd)
|
||||
offset = 90
|
||||
if tdebug then minetest.debug("fall") end
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
-- Post MT 5.3 Head Animation --
|
||||
---------------------------------------------------------
|
||||
-- this function was added in 5.3 which has the bone position
|
||||
-- change break animations fix - i think (MT #9807)
|
||||
-- I'm not too sure how to directly test for the bone fix/ MT version
|
||||
-- so I simply check for this function.
|
||||
local check_v = minetest.is_creative_enabled
|
||||
|
||||
if check_v ~= nil then
|
||||
|
||||
local look_degree = -math.deg(player:get_look_vertical())
|
||||
|
||||
if look_degree > 29 and offset ~= 0 then
|
||||
offset = offset - (look_degree-30)
|
||||
|
||||
elseif look_degree > 60 and offset == 0 then
|
||||
offset = offset - (look_degree-60)
|
||||
|
||||
elseif look_degree < -60 and offset == 0 then
|
||||
offset = offset - (look_degree+60)
|
||||
end
|
||||
|
||||
-- Code by LoneWolfHT - Headanim mod MIT Licence --
|
||||
player:set_bone_position("Head", vector.new(0, 6.35, 0),vector.new(look_degree + offset, 0, 0))
|
||||
-- Code by LoneWolfHT - Headanim mod MIT Licence --
|
||||
end
|
||||
--minetest.chat_send_all(play_s.." km/h") -- for diagnosing chunk emerge issues when falling currently unsolved
|
||||
|
||||
end
|
||||
end)
|
8
mods/3d_armor_flyswim/mod.conf
Normal file
8
mods/3d_armor_flyswim/mod.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
name = 3d_armor_flyswim
|
||||
description = Adds Flying, Swimming, Crouching and Climbing animations to base character model for 3d_armor
|
||||
depends = player_api
|
||||
optional_depends = 3d_armor, simple_skins, skinsdb, clothing
|
||||
author = sirrobzeroone
|
||||
title = Add Fly, Swim, Crouch and Climb animations
|
||||
|
||||
release = 13392
|
BIN
mods/3d_armor_flyswim/models/3d_armor_character.b3d
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character.b3d
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sf.b3d
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sf.b3d
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sf.blend
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sf.blend
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sf.blend1
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sf.blend1
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sfc.b3d
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sfc.b3d
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sfc.blend
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sfc.blend
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sfc.blend1
Normal file
BIN
mods/3d_armor_flyswim/models/3d_armor_character_sfc.blend1
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/character_sf.b3d
Normal file
BIN
mods/3d_armor_flyswim/models/character_sf.b3d
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/character_sf.blend
Normal file
BIN
mods/3d_armor_flyswim/models/character_sf.blend
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/character_sf.blend1
Normal file
BIN
mods/3d_armor_flyswim/models/character_sf.blend1
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/skinsdb_3d_armor_character_5.b3d
Normal file
BIN
mods/3d_armor_flyswim/models/skinsdb_3d_armor_character_5.b3d
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/models/skinsdb_3d_armor_character_5.blend
Normal file
BIN
mods/3d_armor_flyswim/models/skinsdb_3d_armor_character_5.blend
Normal file
Binary file not shown.
BIN
mods/3d_armor_flyswim/screenshot.png
Normal file
BIN
mods/3d_armor_flyswim/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
32
mods/3d_armor_flyswim/settingtypes.txt
Normal file
32
mods/3d_armor_flyswim/settingtypes.txt
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Make capes part of 3d Armor when enabled
|
||||
capes_add_to_3darmor (Add Capes to 3d Armor) bool true
|
||||
|
||||
# Disable the Example Cape "Someones Cape"
|
||||
example_cape (The Example Cape "Someones Cape" which grants fly_privs when worn and a 100% speed increase) bool true
|
||||
|
||||
# Enable Fly Animation
|
||||
fly_anim (Enable fly animation) bool true
|
||||
|
||||
# Enable Fall Animation
|
||||
fall_anim (Enable fall animation) bool true
|
||||
|
||||
# Terminal Velocity Speed kp/h
|
||||
fall_tv (Set terminal velocity speed - recommend not exceeding 100 kp/h) int 100
|
||||
|
||||
# Enable Swim Animation
|
||||
swim_anim (Enable swim animation) bool true
|
||||
|
||||
# Enable Swim Sneak - swim through 1x1 hole
|
||||
swim_sneak (Enable swim sneak) bool true
|
||||
|
||||
# Enable Climb Animation
|
||||
climb_anim (Enable climb animation) bool true
|
||||
|
||||
# Enable Crouch/Duck Animation
|
||||
crouch_anim (Enable crouch/duck animation) bool true
|
||||
|
||||
# Enable Crouch/Duck - through through 1.5 hole
|
||||
crouch_sneak (Enable crouch/duck animation) bool true
|
||||
|
||||
|
||||
|
BIN
mods/3d_armor_flyswim/swimming_animated.gif
Normal file
BIN
mods/3d_armor_flyswim/swimming_animated.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 533 KiB |
BIN
mods/3d_armor_flyswim/textures/3d_armor_flyswim_demo_cape.png
Normal file
BIN
mods/3d_armor_flyswim/textures/3d_armor_flyswim_demo_cape.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 7 KiB |
BIN
mods/3d_armor_flyswim/textures/3d_armor_trans.png
Normal file
BIN
mods/3d_armor_flyswim/textures/3d_armor_trans.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 274 B |
BIN
mods/3d_armor_flyswim/textures/screenshot.xcf
Normal file
BIN
mods/3d_armor_flyswim/textures/screenshot.xcf
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue