diff --git a/data/models/sheep.b3d b/data/models/sheep.b3d new file mode 100644 index 0000000..cdb6824 Binary files /dev/null and b/data/models/sheep.b3d differ diff --git a/data/textures/cooked_meat.png b/data/textures/cooked_meat.png new file mode 100644 index 0000000..bd8b7ab Binary files /dev/null and b/data/textures/cooked_meat.png differ diff --git a/data/textures/fur.png b/data/textures/fur.png new file mode 100644 index 0000000..dcb3aeb Binary files /dev/null and b/data/textures/fur.png differ diff --git a/data/textures/meat.png b/data/textures/meat.png new file mode 100644 index 0000000..69aa024 Binary files /dev/null and b/data/textures/meat.png differ diff --git a/data/textures/mob_sheep.png b/data/textures/mob_sheep.png new file mode 100644 index 0000000..df7db6f Binary files /dev/null and b/data/textures/mob_sheep.png differ diff --git a/src/activeobject.h b/src/activeobject.h index 24d1e33..782b9a5 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -1,21 +1,28 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* activeobject.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ #ifndef ACTIVEOBJECT_HEADER #define ACTIVEOBJECT_HEADER diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 2d24c38..835e417 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* content_cao.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "content_cao.h" #include "content_mob.h" @@ -354,9 +360,9 @@ void MobCAO::updateNodePos() v3f rot = m_node->getRotation(); if (m_draw_type == MDT_MODEL) { - rot.Y = (90-m_yaw)+content_mob_features(m_content).model_rotation.Y; + rot.Y = (90-pos_translator.yaw_show)+content_mob_features(m_content).model_rotation.Y; }else if (m_draw_type == MDT_SPRITE) { - rot.Y = m_yaw+content_mob_features(m_content).model_rotation.Y; + rot.Y = pos_translator.yaw_show+content_mob_features(m_content).model_rotation.Y; } m_node->setRotation(rot); } @@ -439,9 +445,9 @@ void MobCAO::processMessage(const std::string &data) if (cmd == 0) { // pos m_position = readV3F1000(is); - pos_translator.update(m_position); // yaw m_yaw = readF1000(is); + pos_translator.update(m_position,m_yaw); if (!m_walking) { m_walking = true; @@ -521,7 +527,7 @@ bool MobCAO::directReportPunch(const std::string &toolname, v3f dir) m_position += dir * BS; pos_translator.sharpen(); - pos_translator.update(m_position); + pos_translator.update(m_position,m_yaw); updateNodePos(); return false; diff --git a/src/content_cao.h b/src/content_cao.h index 6a802a7..50c7760 100644 --- a/src/content_cao.h +++ b/src/content_cao.h @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* content_cao.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #ifndef CONTENT_CAO_HEADER #define CONTENT_CAO_HEADER @@ -40,6 +46,9 @@ struct SmoothTranslator f32 anim_counter; f32 anim_time; f32 anim_time_counter; + f32 yaw_old; + f32 yaw_show; + f32 yaw_aim; SmoothTranslator(): vect_old(0,0,0), @@ -47,7 +56,10 @@ struct SmoothTranslator vect_aim(0,0,0), anim_counter(0), anim_time(0), - anim_time_counter(0) + anim_time_counter(0), + yaw_old(0), + yaw_show(0), + yaw_aim(0) {} void init(v3f vect) @@ -58,6 +70,9 @@ struct SmoothTranslator anim_counter = 0; anim_time = 0; anim_time_counter = 0; + yaw_old = 0; + yaw_show = 0; + yaw_aim = 0; } void sharpen() @@ -65,14 +80,17 @@ struct SmoothTranslator init(vect_show); } - void update(v3f vect_new) + void update(v3f vect_new,f32 yaw_new) { vect_old = vect_show; vect_aim = vect_new; - if(anim_time < 0.001 || anim_time > 1.0) + yaw_old = yaw_show; + yaw_aim = wrapDegrees_0_360(yaw_new); + if (anim_time < 0.001 || anim_time > 1.0) { anim_time = anim_time_counter; - else + }else{ anim_time = anim_time * 0.9 + anim_time_counter * 0.1; + } anim_time_counter = 0; anim_counter = 0; } @@ -82,14 +100,21 @@ struct SmoothTranslator anim_time_counter = anim_time_counter + dtime; anim_counter = anim_counter + dtime; v3f vect_move = vect_aim - vect_old; + f32 yaw_move = yaw_aim - yaw_old; + if (yaw_move > 200) { + yaw_move -= 180; + }else if (yaw_move < -200) { + yaw_move += 180; + } f32 moveratio = 1.0; - if(anim_time > 0.001) + if (anim_time > 0.001) moveratio = anim_time_counter / anim_time; // Move a bit less than should, to avoid oscillation moveratio = moveratio * 0.5; - if(moveratio > 1.5) + if (moveratio > 1.5) moveratio = 1.5; vect_show = vect_old + vect_move * moveratio; + yaw_show = yaw_old + yaw_move * moveratio; } bool is_moving() diff --git a/src/content_craftitem.cpp b/src/content_craftitem.cpp index 745e668..962504b 100644 --- a/src/content_craftitem.cpp +++ b/src/content_craftitem.cpp @@ -719,4 +719,33 @@ void content_craftitem_init() lists::add("creative",i); lists::add("cooking",i); + i = CONTENT_CRAFTITEM_FUR; + f = &g_content_craftitem_features[i]; + f->content = CONTENT_CRAFTITEM_FUR; + f->texture = "fur.png"; + f->name = "fur"; + f->description = wgettext("Fur"); + lists::add("creative",i); + + i = CONTENT_CRAFTITEM_MEAT; + f = &g_content_craftitem_features[i]; + f->content = CONTENT_CRAFTITEM_MEAT; + f->texture = "meat.png"; + f->name = "meat"; + f->description = wgettext("Meat"); + f->cook_result = "CraftItem cooked_meat 1"; + lists::add("creative",i); + lists::add("cooking",i); + + i = CONTENT_CRAFTITEM_COOKED_MEAT; + f = &g_content_craftitem_features[i]; + f->content = CONTENT_CRAFTITEM_COOKED_MEAT; + f->texture = "cooked_meat.png"; + f->name = "cooked_meat"; + f->description = wgettext("Cooked Meat"); + f->cook_result = "CraftItem ash 1"; + f->edible = 6; + lists::add("creative",i); + lists::add("cooking",i); + } diff --git a/src/content_craftitem.h b/src/content_craftitem.h index a076489..a7d3b6d 100644 --- a/src/content_craftitem.h +++ b/src/content_craftitem.h @@ -105,5 +105,8 @@ CraftItemFeatures & content_craftitem_features(std::string subname); #define CONTENT_CRAFTITEM_OERKKI_DUST (CONTENT_CRAFTITEM_MASK | 0x44) #define CONTENT_CRAFTITEM_FISH (CONTENT_CRAFTITEM_MASK | 0x45) #define CONTENT_CRAFTITEM_COOKED_FISH (CONTENT_CRAFTITEM_MASK | 0x46) +#define CONTENT_CRAFTITEM_FUR (CONTENT_CRAFTITEM_MASK | 0x47) +#define CONTENT_CRAFTITEM_MEAT (CONTENT_CRAFTITEM_MASK | 0x48) +#define CONTENT_CRAFTITEM_COOKED_MEAT (CONTENT_CRAFTITEM_MASK | 0x49) #endif diff --git a/src/content_mob.cpp b/src/content_mob.cpp index f32e53a..4e029b0 100644 --- a/src/content_mob.cpp +++ b/src/content_mob.cpp @@ -22,6 +22,7 @@ #include "serverobject.h" #include "content_sao.h" #include "content_mob.h" +#include "content_craftitem.h" #include "main.h" #include "settings.h" #include "environment.h" @@ -111,6 +112,12 @@ bool content_mob_spawn(ServerEnvironment *env, v3s16 pos, u32 active_object_coun content_t c2 = a2.getContent(); u8 light = a1.getLightBlend(env->getDayNightRatio()); u8 level = mobLevelI(g_settings->get("max_mob_level")); + v3f pf = intToFloat(pos,BS); + Player *nearest = env->getNearestConnectedPlayer(pf); + f32 distance = 30000.0; + if (nearest) + distance = pf.getDistanceFrom(nearest->getPosition()); + if (c0 == CONTENT_IGNORE || c1 == CONTENT_IGNORE || c2 == CONTENT_IGNORE) return false; @@ -121,6 +128,12 @@ bool content_mob_spawn(ServerEnvironment *env, v3s16 pos, u32 active_object_coun continue; if (m.spawn_max_nearby_mobs < active_object_count) continue; + if (m.spawn_nearest_player != m.spawn_farthest_player) { + if (m.spawn_nearest_player > distance) + continue; + if (m.spawn_farthest_player < distance) + continue; + } if (m.spawn_min_height > pos.Y) continue; if (m.spawn_max_height < pos.Y) @@ -200,7 +213,6 @@ void content_mob_init() f = &g_content_mob_features[i]; f->content = i; f->level = MOB_PASSIVE; - //f->model = "rat.x"; f->model_scale = v3f(0.5,0.5,0.5); f->setTexture("mob_firefly.png"); f->punch_action = MPA_PICKUP; @@ -227,6 +239,7 @@ void content_mob_init() f->setAnimationFrames(MA_STAND,24,36); f->setAnimationFrames(MA_ATTACK,37,49); f->punch_action = MPA_HARM; + f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_OERKKI_DUST)+" 2"; f->motion = MM_SEEKER; f->spawn_on = CONTENT_STONE; f->spawn_in = CONTENT_AIR; @@ -251,11 +264,13 @@ void content_mob_init() f->setAnimationFrames(MA_MOVE,31,60); f->setAnimationFrames(MA_ATTACK,61,90); f->punch_action = MPA_HARM; + f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_GUNPOWDER)+" 4"; f->motion = MM_SENTRY; f->spawn_on = CONTENT_STONE; f->spawn_in = CONTENT_AIR; f->spawn_max_light = LIGHT_MAX/3; f->spawn_max_nearby_mobs = 1; + f->spawn_farthest_player = 20.0*BS; f->notices_player = true; f->attack_throw_object = CONTENT_MOB_FIREBALL; f->attack_glow_light = LIGHT_MAX-1; @@ -267,7 +282,6 @@ void content_mob_init() f = &g_content_mob_features[i]; f->content = i; f->level = MOB_DESTRUCTIVE; - //f->model = "rat.x"; f->setTexture("mob_fireball.png"); f->punch_action = MPA_IGNORE; f->motion = MM_CONSTANT; @@ -293,6 +307,7 @@ void content_mob_init() f->setAnimationFrames(MA_MOVE,0,60); f->setAnimationFrames(MA_ATTACK,0,60); f->punch_action = MPA_HARM; + f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_FUR)+" 2"; f->motion = MM_SEEKER; f->motion_type = MMT_WALK; f->spawn_on = CONTENT_WILDGRASS_SHORT; @@ -318,6 +333,7 @@ void content_mob_init() f->setAnimationFrames(MA_MOVE,0,60); f->setAnimationFrames(MA_ATTACK,0,60); f->punch_action = MPA_HARM; + f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_MEAT)+" 2"; f->motion = MM_WANDER; f->motion_type = MMT_WALK; f->angry_motion = MM_SEEKER; @@ -370,6 +386,7 @@ void content_mob_init() f->setAnimationFrames(MA_MOVE,80,160); f->setAnimationFrames(MA_ATTACK,80,160); f->punch_action = MPA_HARM; + f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_MEAT)+" 2"; f->motion = MM_SEEKER; f->motion_type = MMT_SWIM; f->spawn_on = CONTENT_SAND; @@ -413,5 +430,29 @@ void content_mob_init() i = CONTENT_MOB_SHEEP; f = &g_content_mob_features[i]; - //f->content = i; + f->content = i; + f->level = MOB_PASSIVE; + f->hp = 30; + f->model = "sheep.b3d"; + f->model_scale = v3f(0.8,0.8,0.8); + f->model_rotation = v3f(0,-90,0); + f->model_offset = v3f(0,0.6,0); + f->setTexture("mob_sheep.png"); + f->setAnimationFrames(MA_STAND,61,120); + f->setAnimationFrames(MA_MOVE,0,60); + f->setAnimationFrames(MA_ATTACK,0,60); + f->punch_action = MPA_HARM; + f->dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_MEAT)+" 2"; + f->special_punch_item = TT_SHEAR; + f->special_dropped_item = std::string("CraftItem2 ")+itos(CONTENT_CRAFTITEM_STRING)+" 4"; + f->motion = MM_SEEKER; + f->motion_type = MMT_WALK; + f->spawn_on = CONTENT_WILDGRASS_SHORT; + f->spawn_in = CONTENT_AIR; + f->spawn_min_height = 2; + f->spawn_max_height = 20; + f->spawn_min_light = LIGHT_MAX/2; + f->spawn_max_nearby_mobs = 3; + f->lifetime = 900.0; + f->setCollisionBox(aabb3f(-0.4*BS, 0., -0.4*BS, 0.4*BS, 1.*BS, 0.4*BS)); } diff --git a/src/content_mob.h b/src/content_mob.h index 042c51d..be44540 100644 --- a/src/content_mob.h +++ b/src/content_mob.h @@ -24,6 +24,7 @@ #include "mapnode.h" #include "serverobject.h" +#include "content_toolitem.h" #ifndef SERVER #include "common_irrlicht.h" #endif @@ -105,6 +106,8 @@ struct MobFeatures { MobMotionType motion_type; MobMotion angry_motion; bool is_tamable; + content_t hunted_node; + content_t fleed_node; bool notices_player; content_t tamed_mob; content_t attack_throw_object; @@ -115,6 +118,8 @@ struct MobFeatures { u8 attack_glow_light; u16 hp; std::string dropped_item; + ToolType special_punch_item; + std::string special_dropped_item; f32 lifetime; u16 contact_explosion_diameter; @@ -126,6 +131,8 @@ struct MobFeatures { s16 spawn_max_height; u8 spawn_max_nearby_mobs; s16 spawn_chance; + s16 spawn_nearest_player; + s16 spawn_farthest_player; MobFeatures() { @@ -214,6 +221,8 @@ struct MobFeatures { motion_type = MMT_WALK; angry_motion = MM_STATIC; is_tamable = false; + hunted_node = CONTENT_IGNORE; + fleed_node = CONTENT_IGNORE; notices_player = false; tamed_mob = CONTENT_IGNORE; attack_throw_object = CONTENT_IGNORE; @@ -224,6 +233,8 @@ struct MobFeatures { attack_glow_light = 0; hp = 20; dropped_item = ""; + special_punch_item = TT_NONE; + special_dropped_item = ""; lifetime = 0.0; contact_explosion_diameter = 0; spawn_on = CONTENT_IGNORE; @@ -234,6 +245,8 @@ struct MobFeatures { spawn_max_height = 100; spawn_max_nearby_mobs = 3; spawn_chance = 100; + spawn_nearest_player = 0; + spawn_farthest_player = 0; } }; diff --git a/src/content_object.h b/src/content_object.h index 353b01c..4c4ed72 100644 --- a/src/content_object.h +++ b/src/content_object.h @@ -1,21 +1,28 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* content_object.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ #ifndef CONTENT_OBJECT_HEADER #define CONTENT_OBJECT_HEADER diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 432a7f4..e7a8f82 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* content_sao.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "content_sao.h" #include "content_mob.h" @@ -473,10 +479,7 @@ void MobSAO::step(float dtime, bool send_recommended) if (m_next_pos_exists) { v3f pos_f = m_base_position; v3f next_pos_f = intToFloat(m_next_pos_i, BS); - v3f v = next_pos_f - pos_f; - m_yaw = atan2(v.Z, v.X) / PI * 180; - v3f diff = next_pos_f - pos_f; v3f dir = diff; dir.normalize(); @@ -485,6 +488,7 @@ void MobSAO::step(float dtime, bool send_recommended) speed = BS * 2.0; if (m_falling) speed = BS * 3.0; + dir *= dtime * speed; bool arrived = false; if (dir.getLength() > diff.getLength()) { @@ -492,6 +496,7 @@ void MobSAO::step(float dtime, bool send_recommended) arrived = true; } pos_f += dir; + m_yaw = wrapDegrees_180(180./PI*atan2(dir.Z, dir.X)); m_base_position = pos_f; if ((pos_f - next_pos_f).getLength() < 0.1 || arrived) @@ -556,8 +561,11 @@ void MobSAO::stepMotionWander(float dtime) } u32 order[3*3*3]; get_random_u32_array(order, num_dps); + v3s16 op = floatToInt(m_oldpos,BS); for (int i=0; idispatchEvent(&event); } -InventoryItem* MobSAO::createPickedUpItem() +InventoryItem* MobSAO::createPickedUpItem(content_t punch_item) { MobFeatures m = content_mob_features(m_content); + ToolItemFeatures f = content_toolitem_features(punch_item); if (m.punch_action != MPA_PICKUP) { - if (!m_removed) + if (!m_removed) { + if (m.special_dropped_item != "" && (m.special_punch_item == TT_NONE || f.type == m.special_punch_item)) { + std::istringstream is(m.special_dropped_item, std::ios_base::binary); + InventoryItem *item = InventoryItem::deSerialize(is); + return item; + } return NULL; + } } if (m.dropped_item == "") return NULL; @@ -1098,14 +1128,15 @@ InventoryItem* MobSAO::createPickedUpItem() m_removed = true; return item; } -u16 MobSAO::punch(const std::string &toolname, v3f dir, const std::string &playername) +u16 MobSAO::punch(content_t punch_item, v3f dir, const std::string &playername) { MobFeatures m = content_mob_features(m_content); if (m.punch_action == MPA_IGNORE) return 0; + ToolItemFeatures f = content_toolitem_features(punch_item); actionstream< - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* content_sao.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #ifndef CONTENT_SAO_HEADER #define CONTENT_SAO_HEADER @@ -38,7 +44,7 @@ public: std::string getClientInitializationData(); std::string getStaticData(); InventoryItem* createInventoryItem(); - InventoryItem* createPickedUpItem(){return createInventoryItem();} + InventoryItem* createPickedUpItem(content_t punch_item){return createInventoryItem();} void rightClick(Player *player); private: std::string m_inventorystring; @@ -60,8 +66,8 @@ public: std::string getStaticData(); std::string getClientInitializationData(); void step(float dtime, bool send_recommended); - InventoryItem* createPickedUpItem(); - u16 punch(const std::string &toolname, v3f dir, const std::string &playername); + InventoryItem* createPickedUpItem(content_t punch_item); + u16 punch(content_t punch_item, v3f dir, const std::string &playername); u8 level(); private: void sendPosition(); diff --git a/src/environment.cpp b/src/environment.cpp index 37c29dc..7012570 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* environment.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "environment.h" #include "filesys.h" diff --git a/src/environment.h b/src/environment.h index c614656..545c91a 100644 --- a/src/environment.h +++ b/src/environment.h @@ -1,21 +1,28 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* environment.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ #ifndef ENVIRONMENT_HEADER #define ENVIRONMENT_HEADER diff --git a/src/game.cpp b/src/game.cpp index c8c7ba0..b5ef512 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* game.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "game.h" #include "common_irrlicht.h" diff --git a/src/inventory.cpp b/src/inventory.cpp index cd10120..ab2f192 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -1,25 +1,28 @@ -/* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* inventory.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ - -/* -(c) 2010 Perttu Ahola -*/ #include "inventory.h" #include "serialization.h" diff --git a/src/inventory.h b/src/inventory.h index 5b4b5ce..7af0458 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -1,25 +1,28 @@ -/* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* inventory.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ - -/* -(c) 2010 Perttu Ahola -*/ #ifndef INVENTORY_HEADER #define INVENTORY_HEADER diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 69bd98b..43e313c 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* mapblock.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "mapblock.h" #include "map.h" diff --git a/src/mapblock.h b/src/mapblock.h index 0ff442e..95d9072 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -1,21 +1,28 @@ -/* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* mapblock.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ #ifndef MAPBLOCK_HEADER #define MAPBLOCK_HEADER diff --git a/src/mapnode.h b/src/mapnode.h index 767fc0f..9d00cd3 100644 --- a/src/mapnode.h +++ b/src/mapnode.h @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* mapnode.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #ifndef MAPNODE_HEADER #define MAPNODE_HEADER diff --git a/src/server.cpp b/src/server.cpp index 93d1423..bd55a66 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* server.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "server.h" #include "utility.h" @@ -30,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" #include "servercommand.h" #include "filesys.h" +#include "content_object.h" #include "content_mapnode.h" #include "content_craft.h" #include "content_craftitem.h" @@ -2291,10 +2298,22 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) // Left click, pick object up (usually) if(button == 0) { + content_t wield_item = CONTENT_IGNORE; + ToolItem *titem = NULL; + + InventoryList *mlist = player->inventory.getList("main"); + if (mlist != NULL) { + InventoryItem *item = mlist->getItem(item_i); + if (item) { + wield_item = item->getContent(); + if ((wield_item&CONTENT_TOOLITEM_MASK) == CONTENT_TOOLITEM_MASK) + titem = (ToolItem*)item; + } + } /* Try creating inventory item */ - InventoryItem *item = obj->createPickedUpItem(); + InventoryItem *item = obj->createPickedUpItem(wield_item); if (item) { InventoryList *ilist = player->inventory.getList("main"); @@ -2315,7 +2334,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) } // Remove object from environment - obj->m_removed = true; + if (obj->getType() != ACTIVEOBJECT_TYPE_MOB) + obj->m_removed = true; } }else{ /* @@ -2325,24 +2345,12 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) actionstream<getName()<<" punches object " <getId()<inventory.getList("main"); - if (mlist != NULL) { - InventoryItem *item = mlist->getItem(item_i); - if (item && (std::string)item->getName() == "ToolItem") { - titem = (ToolItem*)item; - toolname = titem->getToolName(); - } - } - v3f playerpos = player->getPosition(); v3f objpos = obj->getBasePosition(); v3f dir = (objpos - playerpos).normalize(); - u16 wear = obj->punch(toolname, dir, player->getName()); - item = obj->createPickedUpItem(); + u16 wear = obj->punch(wield_item, dir, player->getName()); + item = obj->createPickedUpItem(wield_item); /* killing something might have caused a drop */ if (item) { InventoryList *ilist = player->inventory.getList("main"); @@ -2365,8 +2373,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) } if (titem && g_settings->getBool("tool_wear")) { - bool weared_out = titem->addWear(wear); - if(weared_out) + if (titem->addWear(wear)) mlist->deleteItem(item_i); SendInventory(player->peer_id); } diff --git a/src/serverobject.cpp b/src/serverobject.cpp index d01cf42..29c53d2 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -1,21 +1,27 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* serverobject.cpp +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #include "serverobject.h" #include diff --git a/src/serverobject.h b/src/serverobject.h index bff0705..db81642 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -1,27 +1,34 @@ -/* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 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 General Public License for more details. - -You should have received a copy of the GNU 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. -*/ +/************************************************************************ +* Minetest-c55 +* Copyright (C) 2010-2011 celeron55, Perttu Ahola +* +* serverobject.h +* voxelands - 3d voxel world sandbox game +* Copyright (C) Lisa 'darkrose' Milne 2013-2014 +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see +* +* License updated from GPLv2 or later to GPLv3 or later by Lisa Milne +* for Voxelands. +************************************************************************/ #ifndef SERVEROBJECT_HEADER #define SERVEROBJECT_HEADER #include "common_irrlicht.h" #include "activeobject.h" +#include "mapnode.h" #include "utility.h" #define MOB_PASSIVE 0 @@ -102,15 +109,13 @@ public: Item that the player gets when this object is picked up. If NULL, object cannot be picked up. */ - virtual InventoryItem* createPickedUpItem(){return NULL;} + virtual InventoryItem* createPickedUpItem(content_t punch_item) {return NULL;} /* If the object doesn't return an item, this will be called. Return value is tool wear. */ - virtual u16 punch(const std::string &toolname, v3f dir, - const std::string &playername) - {return 0;} + virtual u16 punch(content_t punch_item, v3f dir, const std::string &playername) {return 0;} /* */