1 /* 2 Minetest 3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU Lesser General Public License as published by 7 the Free Software Foundation; either version 2.1 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public License along 16 with this program; if not, write to the Free Software Foundation, Inc., 17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #pragma once 21 22 #include "irr_v3d.h" 23 #include "cpp_api/s_base.h" 24 #include "cpp_api/s_nodemeta.h" 25 #include "util/string.h" 26 27 struct MapNode; 28 class ServerActiveObject; 29 30 class ScriptApiNode 31 : virtual public ScriptApiBase, 32 public ScriptApiNodemeta 33 { 34 public: 35 ScriptApiNode() = default; 36 virtual ~ScriptApiNode() = default; 37 38 bool node_on_punch(v3s16 p, MapNode node, 39 ServerActiveObject *puncher, const PointedThing &pointed); 40 bool node_on_dig(v3s16 p, MapNode node, 41 ServerActiveObject *digger); 42 void node_on_construct(v3s16 p, MapNode node); 43 void node_on_destruct(v3s16 p, MapNode node); 44 bool node_on_flood(v3s16 p, MapNode node, MapNode newnode); 45 void node_after_destruct(v3s16 p, MapNode node); 46 bool node_on_timer(v3s16 p, MapNode node, f32 dtime); 47 void node_on_receive_fields(v3s16 p, 48 const std::string &formname, 49 const StringMap &fields, 50 ServerActiveObject *sender); 51 public: 52 static struct EnumString es_DrawType[]; 53 static struct EnumString es_ContentParamType[]; 54 static struct EnumString es_ContentParamType2[]; 55 static struct EnumString es_LiquidType[]; 56 static struct EnumString es_NodeBoxType[]; 57 static struct EnumString es_TextureAlphaMode[]; 58 }; 59