aboutsummaryrefslogtreecommitdiff
path: root/src/script/common/c_converter.h
Commit message (Collapse)AuthorAge
* Revert "Adding particle blend, glow and animation (#4705)"sfan52016-11-14
| | | | This reverts commit 93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.
* Adding particle blend, glow and animation (#4705)Foghrye42016-11-15
|
* Replace various std::map with UNORDERED_MAP + various cleanupsLoic Blot2016-10-05
| | | | | | | | | | | | This is part 2 for 5f084cd98d7b3326b51320455364337539710efd Other improvements: * Use the defined ItemGroupList when used * make Client::checkPrivilege const * inline some trivial functions * Add ActiveObjectMap typedef * Add SettingsEntries typedef
* Add Lua interface to HTTPFetchRequestJeija2016-02-22
| | | | | | | | | | This allows mods to perform both asynchronous and synchronous HTTP requests. Mods are only granted access to HTTP APIs if either mod security is disabled or if they are whitelisted in any of the the secure.http_mods and secure.trusted_mods settings. Adds httpfetch_caller_alloc_secure to generate random, non-predictable caller IDs so that lua mods cannot spy on each others HTTP queries.
* Fix code style from recent commits and add misc. optimizationskwolekr2015-07-02
|
* Add some missing getter functions to the lua APITeTpaAka2015-05-28
| | | | | | | | | | | | | | | | | | | | | | | ObjectRef: get_properties get_armor_groups get_animation get_attach get_bone_position Players: get_physics_override hud_get_hotbar_itemcount hud_get_hotbar_image hud_get_hotbar_selected_image get_sky get_day_night_ratio get_local_animation get_eye_offset Global: minetest.get_gen_notify minetest.get_noiseparams
* SAPI/Noise: Add PerlinNoiseMap:getMapSlice() functionkwolekr2015-05-17
| | | | | | This adds the ability to grab 'slices' of noise calculated by PerlinNoiseMap. Retrieving smaller slices of noise from the computation result as needed optimizes memory usage while maintaining a reasonable amount of CPU overhead.
* SAPI: Accept either ARGB8 table or ColorString to specify colorskwolekr2015-05-16
|
* Add push_ARGB8 to script/common/c_converterTeTpaAka2015-05-15
|
* Schematics: Add per-node force placement optionkwolekr2015-05-09
|
* Add 'persistence' alias for Lua noiseparams and validate more vector parameterskwolekr2015-04-19
|
* Schematics: Refactor NodeResolver and add NodeResolveMethodkwolekr2015-04-16
| | | | | | | | | NodeResolver name lists now belong to the NodeResolver object instead of the associated NodeDefManager. In addition to minimizing unnecessary abstraction and overhead, this move permits NodeResolvers to look up nodes that they had previously set pending for resolution. So far, this functionality has been used in the case of schematics for serialization/deserialization.
* Add NodeResolver and clean up node name -> content ID resolution systemkwolekr2014-10-26
|
* Use integers instead of float valuesBlockMen2014-04-12
|
* Move scriptapi to separate folder (by sapier)sapier2013-05-25
On the lua side, notably minetest.env:<function>(<args>) should now be replaced by minetest.<function>(<args>). The old way is and will stay supported for a long time. Also: Update and clean up lua_api.txt (by celeron55) Move EnvRef to lua and remove add_rat and add_firefly (by kahrl) Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl)
"> objects, based on how close players are to them. */ class ServerEnvironment; struct ItemStack; struct ToolCapabilities; struct ObjectProperties; struct PlayerHPChangeReason; class ServerActiveObject : public ActiveObject { public: /* NOTE: m_env can be NULL, but step() isn't called if it is. Prototypes are used that way. */ ServerActiveObject(ServerEnvironment *env, v3f pos); virtual ~ServerActiveObject() = default; virtual ActiveObjectType getSendType() const { return getType(); } // Called after id has been set and has been inserted in environment virtual void addedToEnvironment(u32 dtime_s){}; // Called before removing from environment virtual void removingFromEnvironment(){}; // Returns true if object's deletion is the job of the // environment virtual bool environmentDeletes() const { return true; } // Create a certain type of ServerActiveObject static ServerActiveObject* create(ActiveObjectType type, ServerEnvironment *env, u16 id, v3f pos, const std::string &data); /* Some simple getters/setters */ v3f getBasePosition() const { return m_base_position; } void setBasePosition(v3f pos){ m_base_position = pos; } ServerEnvironment* getEnv(){ return m_env; } /* Some more dynamic interface */ virtual void setPos(const v3f &pos) { setBasePosition(pos); } // continuous: if true, object does not stop immediately at pos virtual void moveTo(v3f pos, bool continuous) { setBasePosition(pos); } // If object has moved less than this and data has not changed, // saving to disk may be omitted virtual float getMinimumSavedMovement(); virtual std::string getDescription(){return "SAO";} /* Step object in time. Messages added to messages are sent to client over network. send_recommended: True at around 5-10 times a second, same for all objects. This is used to let objects send most of the data at the same time so that the data can be combined in a single packet. */ virtual void step(float dtime, bool send_recommended){} /* The return value of this is passed to the client-side object when it is created */ virtual std::string getClientInitializationData(u16 protocol_version){return "";} /* The return value of this is passed to the server-side object when it is created (converted from static to active - actually the data is the static form) */ virtual void getStaticData(std::string *result) const { assert(isStaticAllowed()); *result = ""; } /* Return false in here to never save and instead remove object on unload. getStaticData() will not be called in that case. */ virtual bool isStaticAllowed() const {return true;} // Returns tool wear virtual int punch(v3f dir, const ToolCapabilities *toolcap=NULL, ServerActiveObject *puncher=NULL, float time_from_last_punch=1000000) { return 0; } virtual void rightClick(ServerActiveObject *clicker) {} virtual void setHP(s32 hp, const PlayerHPChangeReason &reason) {} virtual u16 getHP() const { return 0; } virtual void setArmorGroups(const ItemGroupList &armor_groups) {} virtual const ItemGroupList &getArmorGroups() { static ItemGroupList rv; return rv; } virtual void setPhysicsOverride(float physics_override_speed, float physics_override_jump, float physics_override_gravity) {} virtual void setAnimation(v2f frames, float frame_speed, float frame_blend, bool frame_loop) {} virtual void getAnimation(v2f *frames, float *frame_speed, float *frame_blend, bool *frame_loop) {} virtual void setAnimationSpeed(float frame_speed) {} virtual void setBonePosition(const std::string &bone, v3f position, v3f rotation) {} virtual void getBonePosition(const std::string &bone, v3f *position, v3f *lotation) {} virtual void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation) {} virtual void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation) {} virtual void clearChildAttachments() {} virtual void clearParentAttachment() {} virtual void addAttachmentChild(int child_id) {} virtual void removeAttachmentChild(int child_id) {} virtual const std::unordered_set<int> &getAttachmentChildIds() { static std::unordered_set<int> rv; return rv; } virtual ServerActiveObject *getParent() const { return nullptr; } virtual ObjectProperties* accessObjectProperties() { return NULL; } virtual void notifyObjectPropertiesModified() {} // Inventory and wielded item virtual Inventory* getInventory() { return NULL; } virtual const Inventory* getInventory() const { return NULL; } virtual InventoryLocation getInventoryLocation() const { return InventoryLocation(); } virtual void setInventoryModified() {} virtual std::string getWieldList() const { return ""; } virtual int getWieldIndex() const { return 0; } virtual ItemStack getWieldedItem() const; virtual bool setWieldedItem(const ItemStack &item); inline void attachParticleSpawner(u32 id) { m_attached_particle_spawners.insert(id); } inline void detachParticleSpawner(u32 id) { m_attached_particle_spawners.erase(id); } /* Number of players which know about this object. Object won't be deleted until this is 0 to keep the id preserved for the right object. */ u16 m_known_by_count = 0; /* - Whether this object is to be removed when nobody knows about it anymore. - Removal is delayed to preserve the id for the time during which it could be confused to some other object by some client. - This is usually set to true by the step() method when the object wants to be deleted but can be set by anything else too. */ bool m_pending_removal = false; /* Same purpose as m_pending_removal but for deactivation. deactvation = save static data in block, remove active object If this is set alongside with m_pending_removal, removal takes priority. */ bool m_pending_deactivation = false; /* A getter that unifies the above to answer the question: "Can the environment still interact with this object?" */ inline bool isGone() const { return m_pending_removal || m_pending_deactivation; } /* Whether the object's static data has been stored to a block */ bool m_static_exists = false; /* The block from which the object was loaded from, and in which a copy of the static data resides. */ v3s16 m_static_block = v3s16(1337,1337,1337); /* Queue of messages to be sent to the client */ std::queue<ActiveObjectMessage> m_messages_out; protected: virtual void onAttach(int parent_id) {} virtual void onDetach(int parent_id) {} // Used for creating objects based on type typedef ServerActiveObject* (*Factory) (ServerEnvironment *env, v3f pos, const std::string &data); static void registerType(u16 type, Factory f); ServerEnvironment *m_env; v3f m_base_position; std::unordered_set<u32> m_attached_particle_spawners; private: // Used for creating objects based on type static std::map<u16, Factory> m_types; };