![]() Despite its misleading name, armor_groups specify the percentage damage taken from particular damage groups, not the resistance. How vulnerable an object is to particular types of damage depends on its armor_groups object property. However, it’s common to use the same group names as with node digging. Just like node dig groups, these groups can take any name and do not need to be registered. We will go over an example of this calculation in a bit. This is then limited depending on how recent the last punch was. The total damage is calculated by multiplying the punch’s damage groups with the target’s vulnerabilities. A punch isn’t necessarily an actual punch - it can be an explosion, a sword slash, or something else. An object can punch another object to inflict damage. Local hp = object : get_hp () object : set_hp ( hp + 3 ) Punch, Damage Groups, and Armor Groupsĭamage is the reduction of an object’s HP. You can change how an object looks, among other things, at any time by updating its properties. Unlike nodes, objects have a dynamic rather than set appearance. It’s not possible to define custom properties, because the properties are for the engine to use, by definition. Object properties are used to tell the client how to render and deal with an object. All this results in the client seeing different things to the server, which is something you need to be aware of. Moves may not be similarly spaced, which makes it difficult to use them for animation. Position messages may arrive out of order, resulting in some set_pos calls being skipped as there’s no point going to a position older than the current known position. However, unless you’re in singleplayer, this isn’t an ideal world. In an ideal world, messages about entity movements would arrive immediately, in the correct order, and with a similar interval as to how you sent them. Object : move_to ()Īn important thing to think about when dealing with entities is network latency. Get_pos and set_pos exist to allow you to get and set an entity’s position. This distinction is muddied by the fact that Entities are controlled using a table which is referred to as a Lua entity, as discussed later. Another difference is that Players will cause map blocks to be loaded, whereas Entities will just be saved and become inactive. This means that the velocity of a player cannot be set by mods - players are client-side, and entities are server-side. The biggest one is that Players are player-controlled, whereas Entities are mod-controlled. There are a few differences between Players and Entities. Objects aren’t items, and they have their own separate registration system. An object is something that can move independently of the node grid and has properties such as velocity and scale. Players and Entities are both types of Objects. What are Objects, Players, and Entities?.In this chapter, you will learn how to manipulate objects and how to define your own. En Objects, Players, and Entities Introduction
0 Comments
Leave a Reply. |