aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_nodetimer.h
blob: b894c5c8ca7ad2012eada0c27c427ab6dd096663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#pragma once

#include "irr_v3d.h"
#include "lua_api/l_base.h"

class ServerEnvironment;

class NodeTimerRef : public ModApiBase
{
private:
	v3s16 m_p;
	ServerEnvironment *m_env = nullptr;

	static const char className[];
	static const luaL_Reg methods[];

	static int gc_object(lua_State *L);

	static NodeTimerRef *checkobject(lua_State *L, int narg);

	static int l_set(lua_State *L);

	static int l_start(lua_State *L);

	static int l_stop(lua_State *L);

	static int l_is_started(lua_State *L);

	static int l_get_timeout(lua_State *L);

	static int l_get_elapsed(lua_State *L);

public:
	NodeTimerRef(v3s16 p, ServerEnvironment *env);
	~NodeTimerRef() = default;

	// Creates an NodeTimerRef and leaves it on top of stack
	// Not callable from Lua; all references are created on the C side.
	static void create(lua_State *L, v3s16 p, ServerEnvironment *env);

	static void set_null(lua_State *L);

	static void Register(lua_State *L);
};
dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="512" height="512" viewBox="0 0 135.46666 135.46667" version="1.1" id="svg8" inkscape:version="0.92.1 r15371" sodipodi:docname="fast_btn.svg" inkscape:export-filename="/home/stu/Desktop/icons/png/fast_btn.png" inkscape:export-xdpi="24.000002" inkscape:export-ydpi="24.000002"> <defs id="defs2"> <filter style="color-interpolation-filters:sRGB;" inkscape:label="Colorize" id="filter4628"> <feComposite in2="SourceGraphic" operator="arithmetic" k1="0" k2="1" result="composite1" id="feComposite4614" /> <feColorMatrix in="composite1" values="1" type="saturate" result="colormatrix1" id="feColorMatrix4616" /> <feFlood flood-opacity="1" flood-color="rgb(158,0,0)" result="flood1" id="feFlood4618" /> <feBlend in="flood1" in2="colormatrix1" mode="multiply" result="blend1" id="feBlend4620" /> <feBlend in2="blend1" mode="screen" result="blend2" id="feBlend4622" /> <feColorMatrix in="blend2" values="1" type="saturate" result="colormatrix2" id="feColorMatrix4624" /> <feComposite in="colormatrix2" in2="SourceGraphic" operator="in" k2="1" result="composite2" id="feComposite4626" /> </filter> </defs> <sodipodi:namedview id="base" pagecolor="#404040" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:zoom="0.7" inkscape:cx="-123.33594" inkscape:cy="234.93088" inkscape:document-units="mm" inkscape:current-layer="layer2" showgrid="true" units="px" inkscape:window-width="1920" inkscape:window-height="1023" inkscape:window-x="0" inkscape:window-y="34" inkscape:window-maximized="1" inkscape:pagecheckerboard="false" inkscape:snap-grids="true" inkscape:snap-page="true" showguides="false"> <inkscape:grid type="xygrid" id="grid16" spacingx="0.26458333" spacingy="0.26458333" empspacing="4" color="#40ff40" opacity="0.1254902" empcolor="#40ff40" empopacity="0.25098039" /> </sodipodi:namedview> <metadata id="metadata5"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <dc:title></dc:title> <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" /> </cc:Work> <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/4.0/"> <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction" /> <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution" /> <cc:requires rdf:resource="http://creativecommons.org/ns#Notice" /> <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution" /> <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike" /> </cc:License> </rdf:RDF> </metadata> <g inkscape:groupmode="layer" id="layer2" inkscape:label="Layer 2" style="display:inline"> <path style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 52.349702,78.770237 c 8.223364,2.478851 17.933206,1.627099 22.678571,-5.85863 L 86.367558,52.311904" id="path4630" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc" /> <path style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 99.195826,95.244627 C 95.407287,83.585464 90.120793,78.524425 79.752975,74.045534 L 90.856024,53.96555" id="path4632" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc" /> <path style="fill:none;stroke:#ffffff;stroke-width:8;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="m 64.539433,56.942114 c 4.52339,-7.945233 16.596076,-10.248496 24.001489,-4.535715 6.443481,4.79704 18.068938,2.827548 22.314838,-3.012345" id="path4495" inkscape:connector-curvature="0" sodipodi:nodetypes="ccc" /> <ellipse style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.947;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path4496" cx="95.061012" cy="40.783634" rx="6.9582553" ry="7.1472435" /> <path style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.22683655px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 47.624999,35.454168 1.058334,-1.5875 h 29.633333 l -0.921774,1.663097 z" id="path4509" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" /> <path style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.22683655px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 21.030106,52.841071 1.058334,-1.5875 h 29.633333 l -0.921774,1.663097 z" id="path4509-3" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" /> <path style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.22683655px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 29.496773,69.774404 1.058334,-1.5875 H 60.18844 l -0.921774,1.663097 z" id="path4509-56" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" /> <path style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.22683655px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 18.91344,88.824411 1.058334,-1.5875 h 29.633333 l -0.921774,1.66309 z" id="path4509-2" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" /> </g> </svg>