Merge remote-tracking branch 'original/master'
commit
f6d66578b3
|
@ -117,7 +117,7 @@ minetest.register_entity("__builtin:item", {
|
|||
local playerfound = false
|
||||
for k, obj in pairs(objs2) do
|
||||
local objpos=obj:getpos()
|
||||
self.object:setacceleration({x=0, y=-10, z=0})
|
||||
--self.object:setacceleration({x=0, y=-10, z=0})
|
||||
if obj:get_player_name() ~= nil and objpos.y >= pos.y-1.25 and objpos.y <= pos.y+.25 then
|
||||
playerfound = true
|
||||
if self.dontbugme == false then
|
||||
|
|
|
@ -29,7 +29,7 @@ minetest.register_item(":", {
|
|||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
fleshy = {times={[2]=2.00, [3]=1.00}, uses=0, maxlevel=1},
|
||||
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
|
||||
crumbly = {times={[2]=3.00, [3]=1.40}, uses=0, maxlevel=1},
|
||||
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
|
||||
oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3},
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ minetest.register_tool("default:shovel_wood", {
|
|||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=3.00, [2]=0.80, [3]=0.50}, uses=10, maxlevel=1}
|
||||
crumbly={times={[1]=3.00, [2]=0.80, [3]=1.00}, uses=10, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -106,7 +106,7 @@ minetest.register_tool("default:shovel_stone", {
|
|||
tool_capabilities = {
|
||||
max_drop_level=0,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=1.50, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1}
|
||||
crumbly={times={[1]=1.50, [2]=0.50, [3]=0.50}, uses=20, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -116,7 +116,7 @@ minetest.register_tool("default:shovel_steel", {
|
|||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=10, maxlevel=2}
|
||||
crumbly={times={[1]=1.50, [2]=0.70, [3]=0.30}, uses=10, maxlevel=2}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -804,6 +804,15 @@ minetest.register_node("default:stone_with_iron", {
|
|||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:azurite_ore", {
|
||||
description = "Azurite Ore",
|
||||
tile_images = {"azurite.png"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
drop = 'default:azurite_ore',
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("default:dirt_with_grass", {
|
||||
description = "Dirt with grass",
|
||||
tile_images = {"default_grass.png", "default_dirt.png", "default_grass_side.png"},
|
||||
|
@ -1369,6 +1378,7 @@ minetest.register_node("default:apple", {
|
|||
description = "Apple",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 1.0,
|
||||
eatable = true,
|
||||
tile_images = {"default_apple.png"},
|
||||
inventory_image = "default_apple.png",
|
||||
paramtype = "light",
|
||||
|
|
|
@ -806,7 +806,7 @@ minetest.register_node("default:stone_with_iron", {
|
|||
|
||||
minetest.register_node("default:dirt_with_grass", {
|
||||
description = "Dirt with grass",
|
||||
tile_images = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
|
||||
tile_images = {"default_grass.png", "default_dirt.png", "default_grass_side.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
drop = 'default:dirt',
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 711 B |
|
@ -103,8 +103,8 @@ dofile(minetest.get_modpath("mesecons").."/internal_api.lua");
|
|||
minetest.register_node("mesecons:mesecon_off", {
|
||||
drawtype = "meseconlike",
|
||||
tile_images = {"jeija_mesecon_off.png", "jeija_mesecon_curved_off.png", "jeija_mesecon_t_junction_off.png", "jeija_mesecon_crossing_off.png"},
|
||||
inventory_image = "jeija_mesecon_off.png",
|
||||
wield_image = "jeija_mesecon_off.png",
|
||||
inventory_image = "mesecons_dust.png",
|
||||
wield_image = "mesecons_dust.png",
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
walkable = false,
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 318 B |
|
@ -91,3 +91,8 @@ stairs.register_stair_and_slab("sandstone", "default:sandstone",
|
|||
{"default_sandstone.png"},
|
||||
"Sandstone stair",
|
||||
"Sandstone slab")
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
if node.name == ("stairs:slab_wood") then
|
||||
minetest.env:add_node(pos, {name="default:wood"})
|
||||
end
|
||||
end)
|
||||
|
|
|
@ -78,7 +78,13 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control,
|
|||
m_sprinting_fov_states(5),
|
||||
|
||||
m_digging_anim(0),
|
||||
m_digging_button(-1)
|
||||
m_eating_anim(0),
|
||||
m_digging_button(-1),
|
||||
m_eating_state(false),
|
||||
|
||||
m_eatable(false),
|
||||
m_is_digging(false),
|
||||
m_is_eating(false)
|
||||
{
|
||||
//dstream<<__FUNCTION_NAME<<std::endl;
|
||||
|
||||
|
@ -210,7 +216,7 @@ void Camera::step(f32 dtime)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_digging_button != -1)
|
||||
if(m_digging_button != -1)
|
||||
{
|
||||
f32 offset = dtime * 3.5;
|
||||
float m_digging_anim_was = m_digging_anim;
|
||||
|
@ -232,6 +238,25 @@ void Camera::step(f32 dtime)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(m_is_eating)
|
||||
{
|
||||
if(m_eating_anim <= -5)
|
||||
{
|
||||
m_eating_state = false;
|
||||
}
|
||||
else if(m_eating_anim >= 5)
|
||||
{
|
||||
m_eating_state = true;
|
||||
}
|
||||
if(m_eating_state == false)
|
||||
{
|
||||
m_eating_anim += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_eating_anim -= 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
|
||||
|
@ -270,7 +295,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
|
|||
{
|
||||
m_sprinting_fov_state += incr;
|
||||
}*/
|
||||
if(player->sprinting_timer != -10 && player->sprinting_timer != -20)
|
||||
if(player->sprinting_timer != -10 && player->sprinting_timer != -20 && player->sprinting_timer != -30)
|
||||
{
|
||||
m_sprinting_fov_state = 0.3-player->sprinting_timer;
|
||||
}
|
||||
|
@ -370,7 +395,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
|
|||
v3f wield_position = v3f(55, -35, 65);
|
||||
//v3f wield_rotation = v3f(-100, 120, -100);
|
||||
v3f wield_rotation = v3f(-100, 120, -100);
|
||||
if(m_digging_anim < 0.05 || m_digging_anim > 0.5){
|
||||
if(m_digging_anim < 0.05 || m_digging_anim > 0.5)
|
||||
{
|
||||
f32 frac = 1.0;
|
||||
if(m_digging_anim > 0.5)
|
||||
frac = 2.0 * (m_digging_anim - 0.5);
|
||||
|
@ -385,22 +411,37 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
|
|||
//wield_rotation.X -= frac * 15.0 * pow(ratiothing2, 1.4f);
|
||||
//wield_rotation.Z += frac * 15.0 * pow(ratiothing2, 1.0f);
|
||||
}
|
||||
if (m_digging_button != -1)
|
||||
if(m_digging_button != -1)
|
||||
{
|
||||
f32 digfrac = m_digging_anim;
|
||||
wield_position.X -= 50 * sin(pow(digfrac, 0.7f) * PI);
|
||||
wield_position.Y += 24 * sin(digfrac * 1.8 * PI);
|
||||
wield_position.Z += 25 * 0.5;
|
||||
if(m_digging_button == 0 && m_eatable)
|
||||
{
|
||||
m_is_eating = true;
|
||||
wield_position.X = 0;
|
||||
wield_position.Y = -20 + m_eating_anim;
|
||||
wield_position.Z = 65;
|
||||
wield_rotation.X = 0;
|
||||
wield_rotation.Y = 0;
|
||||
wield_rotation.Z = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_is_eating = false;
|
||||
f32 digfrac = m_digging_anim;
|
||||
wield_position.X -= 50 * sin(pow(digfrac, 0.7f) * PI);
|
||||
wield_position.Y += 24 * sin(digfrac * 1.8 * PI);
|
||||
wield_position.Z += 25 * 0.5;
|
||||
|
||||
// Euler angles are PURE EVIL, so why not use quaternions?
|
||||
core::quaternion quat_begin(wield_rotation * core::DEGTORAD);
|
||||
core::quaternion quat_end(v3f(80, 30, 100) * core::DEGTORAD);
|
||||
core::quaternion quat_slerp;
|
||||
quat_slerp.slerp(quat_begin, quat_end, sin(digfrac * PI));
|
||||
quat_slerp.toEuler(wield_rotation);
|
||||
wield_rotation *= core::RADTODEG;
|
||||
// Euler angles are PURE EVIL, so why not use quaternions?
|
||||
core::quaternion quat_begin(wield_rotation * core::DEGTORAD);
|
||||
core::quaternion quat_end(v3f(80, 30, 100) * core::DEGTORAD);
|
||||
core::quaternion quat_slerp;
|
||||
quat_slerp.slerp(quat_begin, quat_end, sin(digfrac * PI));
|
||||
quat_slerp.toEuler(wield_rotation);
|
||||
wield_rotation *= core::RADTODEG;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
f32 bobfrac = my_modf(m_view_bobbing_anim);
|
||||
wield_position.X -= sin(bobfrac*PI*2.0) * 3.0;
|
||||
wield_position.Y += sin(my_modf(bobfrac*2.0)*PI) * 3.0;
|
||||
|
@ -573,15 +614,19 @@ void Camera::updateViewingRange(f32 frametime_in)
|
|||
m_frametime_old = frametime;
|
||||
}
|
||||
|
||||
void Camera::setDigging(s32 button)
|
||||
void Camera::setDigging(s32 button, bool digging)
|
||||
{
|
||||
if (m_digging_button == -1)
|
||||
if(m_digging_button == -1)
|
||||
{
|
||||
m_digging_button = button;
|
||||
}
|
||||
m_is_digging = digging;
|
||||
}
|
||||
|
||||
void Camera::wield(const ItemStack &item)
|
||||
{
|
||||
IItemDefManager *idef = m_gamedef->idef();
|
||||
m_eatable = item.getDefinition(idef).eatable;
|
||||
scene::IMesh *wield_mesh = item.getDefinition(idef).wield_mesh;
|
||||
if(wield_mesh)
|
||||
{
|
||||
|
|
|
@ -114,7 +114,8 @@ public:
|
|||
|
||||
// Start digging animation
|
||||
// Pass 0 for left click, 1 for right click
|
||||
void setDigging(s32 button);
|
||||
// Digging is for, well...
|
||||
void setDigging(s32 button, bool digging);
|
||||
|
||||
// Replace the wielded item mesh
|
||||
void wield(const ItemStack &item);
|
||||
|
@ -172,10 +173,16 @@ private:
|
|||
|
||||
// Digging animation frame (0 <= m_digging_anim < 1)
|
||||
f32 m_digging_anim;
|
||||
// Eating animation
|
||||
f32 m_eating_anim;
|
||||
// If -1, no digging animation
|
||||
// If 0, left-click digging animation
|
||||
// If 1, right-click digging animation
|
||||
s32 m_digging_button;
|
||||
bool m_eating_state;
|
||||
bool m_eatable;
|
||||
bool m_is_digging;
|
||||
bool m_is_eating;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
17
src/game.cpp
17
src/game.cpp
|
@ -2325,8 +2325,7 @@ void the_game(
|
|||
}
|
||||
|
||||
dig_time += dtime;
|
||||
if (digging)
|
||||
camera.setDigging(0); // left click animation
|
||||
camera.setDigging(0, digging); // left click animation
|
||||
}
|
||||
|
||||
if(input->getRightClicked())
|
||||
|
@ -2379,7 +2378,7 @@ void the_game(
|
|||
else
|
||||
{
|
||||
client.interact(3, pointed);
|
||||
camera.setDigging(1); // right click animation
|
||||
camera.setDigging(1, digging); // right click animation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2434,9 +2433,9 @@ void the_game(
|
|||
|
||||
pointed_old = pointed;
|
||||
|
||||
if((left_punch || input->getLeftClicked()) && digging)
|
||||
if(left_punch || input->getLeftClicked())
|
||||
{
|
||||
camera.setDigging(0); // left click animation
|
||||
camera.setDigging(0, digging); // left click animation
|
||||
}
|
||||
|
||||
input->resetLeftClicked();
|
||||
|
@ -2886,6 +2885,10 @@ void the_game(
|
|||
{
|
||||
player->sprinting_timer = 0.3;
|
||||
}
|
||||
if(player->sprinting_timer == -30)
|
||||
{
|
||||
player->sprinting_timer = -10;
|
||||
}
|
||||
if(player->sprinting_timer != -10)
|
||||
{
|
||||
if(player->sprinting_timer > 0.0)
|
||||
|
@ -2908,6 +2911,10 @@ void the_game(
|
|||
{
|
||||
player->sprinting_timer = 0;
|
||||
}
|
||||
if(player->sprinting_timer == -30)
|
||||
{
|
||||
player->sprinting_timer = -20;
|
||||
}
|
||||
if(player->sprinting_timer != -20)
|
||||
{
|
||||
if(player->sprinting_timer < 0.3)
|
||||
|
|
|
@ -64,6 +64,7 @@ ItemDefinition& ItemDefinition::operator=(const ItemDefinition &def)
|
|||
stack_max = def.stack_max;
|
||||
usable = def.usable;
|
||||
liquids_pointable = def.liquids_pointable;
|
||||
eatable = def.eatable;
|
||||
if(def.tool_capabilities)
|
||||
{
|
||||
tool_capabilities = new ToolCapabilities(
|
||||
|
@ -108,6 +109,7 @@ void ItemDefinition::reset()
|
|||
stack_max = 99;
|
||||
usable = false;
|
||||
liquids_pointable = false;
|
||||
eatable = false;
|
||||
if(tool_capabilities)
|
||||
{
|
||||
delete tool_capabilities;
|
||||
|
@ -137,6 +139,7 @@ void ItemDefinition::serialize(std::ostream &os) const
|
|||
writeS16(os, stack_max);
|
||||
writeU8(os, usable);
|
||||
writeU8(os, liquids_pointable);
|
||||
writeU8(os, eatable);
|
||||
std::string tool_capabilities_s = "";
|
||||
if(tool_capabilities){
|
||||
std::ostringstream tmp_os(std::ios::binary);
|
||||
|
@ -170,6 +173,7 @@ void ItemDefinition::deSerialize(std::istream &is)
|
|||
stack_max = readS16(is);
|
||||
usable = readU8(is);
|
||||
liquids_pointable = readU8(is);
|
||||
eatable = readU8(is);
|
||||
std::string tool_capabilities_s = deSerializeString(is);
|
||||
if(!tool_capabilities_s.empty())
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ struct ItemDefinition
|
|||
s16 stack_max;
|
||||
bool usable;
|
||||
bool liquids_pointable;
|
||||
bool eatable;
|
||||
// May be NULL. If non-NULL, deleted by destructor
|
||||
ToolCapabilities *tool_capabilities;
|
||||
ItemGroupList groups;
|
||||
|
|
|
@ -189,6 +189,7 @@ void ContentFeatures::reset()
|
|||
diggable = true;
|
||||
climbable = false;
|
||||
buildable_to = false;
|
||||
eatable = false;
|
||||
metadata_name = "";
|
||||
liquid_type = LIQUID_NONE;
|
||||
liquid_alternative_flowing = "";
|
||||
|
@ -240,6 +241,7 @@ void ContentFeatures::serialize(std::ostream &os)
|
|||
writeU8(os, diggable);
|
||||
writeU8(os, climbable);
|
||||
writeU8(os, buildable_to);
|
||||
writeU8(os, eatable);
|
||||
os<<serializeString(metadata_name);
|
||||
writeU8(os, liquid_type);
|
||||
os<<serializeString(liquid_alternative_flowing);
|
||||
|
@ -296,6 +298,7 @@ void ContentFeatures::deSerialize(std::istream &is)
|
|||
diggable = readU8(is);
|
||||
climbable = readU8(is);
|
||||
buildable_to = readU8(is);
|
||||
eatable = readU8(is);
|
||||
metadata_name = deSerializeString(is);
|
||||
liquid_type = (enum LiquidType)readU8(is);
|
||||
liquid_alternative_flowing = deSerializeString(is);
|
||||
|
|
|
@ -183,6 +183,8 @@ struct ContentFeatures
|
|||
bool climbable;
|
||||
// Player can build on these
|
||||
bool buildable_to;
|
||||
// Player can eat this
|
||||
bool eatable;
|
||||
// Metadata name of node (eg. "furnace")
|
||||
std::string metadata_name;
|
||||
// Whether the node is non-liquid, source liquid or flowing liquid
|
||||
|
|
|
@ -46,7 +46,7 @@ Player::Player(IGameDef *gamedef):
|
|||
hp(PLAYER_MAX_HP),
|
||||
hurt_tilt_timer(0),
|
||||
hurt_tilt_timer_max(0),
|
||||
sprinting_timer(0.0),
|
||||
sprinting_timer(-30),
|
||||
enable_sprinting_timer(0),
|
||||
enable_flying_timer(0),
|
||||
hunger(PLAYER_MAX_HUNGER),
|
||||
|
|
|
@ -984,6 +984,7 @@ static ItemDefinition read_item_definition(lua_State *L, int index)
|
|||
getstringfield(L, index, "description", def.description);
|
||||
getstringfield(L, index, "inventory_image", def.inventory_image);
|
||||
getstringfield(L, index, "wield_image", def.wield_image);
|
||||
getboolfield(L, index, "eatable", def.eatable);
|
||||
|
||||
lua_getfield(L, index, "wield_scale");
|
||||
if(lua_istable(L, -1)){
|
||||
|
@ -1144,6 +1145,8 @@ static ContentFeatures read_content_features(lua_State *L, int index)
|
|||
getboolfield(L, index, "climbable", f.climbable);
|
||||
// Player can build on these
|
||||
getboolfield(L, index, "buildable_to", f.buildable_to);
|
||||
// Player can eat these
|
||||
getboolfield(L, index, "eatable", f.eatable);
|
||||
// Metadata name of node (eg. "furnace")
|
||||
getstringfield(L, index, "metadata_name", f.metadata_name);
|
||||
// Whether the node is non-liquid, source liquid or flowing liquid
|
||||
|
|
|
@ -3124,7 +3124,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
{
|
||||
// Skip if object has been removed
|
||||
if(pointed_object->m_removed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
actionstream<<player->getName()<<" punches object "
|
||||
<<pointed.object_id<<": "
|
||||
|
@ -3198,7 +3200,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
// Reset build time counter
|
||||
if(pointed.type == POINTEDTHING_NODE &&
|
||||
item.getDefinition(m_itemdef).type == ITEM_NODE)
|
||||
{
|
||||
getClient(peer_id)->m_time_from_building = 0.0;
|
||||
}
|
||||
|
||||
if(pointed.type == POINTEDTHING_OBJECT)
|
||||
{
|
||||
|
@ -3206,7 +3210,9 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
|
|||
|
||||
// Skip if object has been removed
|
||||
if(pointed_object->m_removed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
actionstream<<player->getName()<<" right-clicks object "
|
||||
<<pointed.object_id<<": "
|
||||
|
|
Loading…
Reference in New Issue