Luanti 5.16.0-dev
Loading...
Searching...
No Matches
object_properties.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include <optional>
8#include <string>
10#include <iostream>
11#include <vector>
12#include "util/pointabilities.h"
13#include "mapnode.h"
14
15struct EnumString;
16
27
28extern const EnumString es_ObjectVisual[];
29
30enum class StepUpMode : u8 {
34};
35
36extern const EnumString es_StepUpMode[];
37
39{
40 /* member variables ordered roughly by size */
41
42 std::vector<std::string> textures;
43 std::vector<video::SColor> colors; // Currently unused
44 // Values are BS=1
45 aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
46 // Values are BS=1
47 aabb3f selectionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
49 std::string mesh;
50 std::string damage_texture_modifier = "^[brighten";
51 std::string nametag;
52 std::string infotext;
53 // For dropped items, this contains the serialized item.
54 std::string wield_item;
55 v3f visual_size = v3f(1, 1, 1);
56 video::SColor nametag_color = video::SColor(255, 255, 255, 255);
57 std::optional<video::SColor> nametag_bgcolor;
60 f32 stepheight = 0.0f;
61 float automatic_rotate = 0.0f;
64 float eye_height = 1.625f;
65 float zoom_fov = 0.0f;
66 std::optional<u32> nametag_fontsize;
68 u16 hp_max = 1;
69 u16 breath_max = 0;
70 s8 glow = 0;
72 // In a future protocol these could be a flag field.
73 bool physical = false;
74 bool collideWithObjects = true;
75 bool rotate_selectionbox = false;
76 bool is_visible = true;
79 bool backface_culling = true;
80 bool static_save = true;
81 bool use_texture_alpha = false;
82 bool shaded = true;
83 bool show_on_minimap = false;
84 bool nametag_scale_z = false;
86
88
89 std::string dump() const;
90
91 bool operator==(const ObjectProperties &other) const;
92 bool operator!=(const ObjectProperties &other) const {
93 return !(*this == other);
94 }
95
101 bool validate();
102
103 void serialize(std::ostream &os) const;
104 void deSerialize(std::istream &is);
105};
core::aabbox3d< f32 > aabb3f
Definition irr_aabb3d.h:11
core::vector2d< s16 > v2s16
Definition irr_v2d.h:12
core::vector3df v3f
Definition irr_v3d.h:11
#define CONTENT_IGNORE
Definition mapnode.h:52
const struct EnumString es_ObjectVisual[]
Definition object_properties.cpp:17
const struct EnumString es_StepUpMode[]
Definition object_properties.cpp:30
ObjectVisual
Definition object_properties.h:17
@ OBJECTVISUAL_UPRIGHT_SPRITE
Definition object_properties.h:20
@ OBJECTVISUAL_ITEM
Definition object_properties.h:23
@ OBJECTVISUAL_NODE
Definition object_properties.h:25
@ OBJECTVISUAL_WIELDITEM
Definition object_properties.h:24
@ OBJECTVISUAL_CUBE
Definition object_properties.h:21
@ OBJECTVISUAL_MESH
Definition object_properties.h:22
@ OBJECTVISUAL_UNKNOWN
Definition object_properties.h:18
@ OBJECTVISUAL_SPRITE
Definition object_properties.h:19
StepUpMode
Definition object_properties.h:30
@ FLOATY
Definition object_properties.h:32
@ LEGACY
Definition object_properties.h:31
@ RIGID
Definition object_properties.h:33
PointabilityType
Definition pointabilities.h:13
@ POINTABLE
Definition pointabilities.h:21
Definition enum_string.h:11
Definition mapnode.h:115
u16 hp_max
Definition object_properties.h:68
bool is_visible
Definition object_properties.h:76
float eye_height
Definition object_properties.h:64
std::string dump() const
Definition object_properties.cpp:43
std::string wield_item
Definition object_properties.h:54
v2s16 spritediv
Definition object_properties.h:58
f32 automatic_face_movement_dir_offset
Definition object_properties.h:62
std::string damage_texture_modifier
Definition object_properties.h:50
std::string mesh
Definition object_properties.h:49
video::SColor nametag_color
Definition object_properties.h:56
s8 glow
Definition object_properties.h:70
float zoom_fov
Definition object_properties.h:65
StepUpMode step_up_mode
Definition object_properties.h:85
void serialize(std::ostream &os) const
Definition object_properties.cpp:160
bool operator==(const ObjectProperties &other) const
Definition object_properties.cpp:122
std::string infotext
Definition object_properties.h:52
ObjectProperties()
Definition object_properties.cpp:38
void deSerialize(std::istream &is)
Definition object_properties.cpp:234
v3f visual_size
Definition object_properties.h:55
u16 breath_max
Definition object_properties.h:69
float automatic_rotate
Definition object_properties.h:61
bool makes_footstep_sound
Definition object_properties.h:77
bool operator!=(const ObjectProperties &other) const
Definition object_properties.h:92
bool static_save
Definition object_properties.h:80
bool rotate_selectionbox
Definition object_properties.h:75
std::optional< video::SColor > nametag_bgcolor
Definition object_properties.h:57
PointabilityType pointable
Definition object_properties.h:71
bool nametag_scale_z
Definition object_properties.h:84
v2s16 initial_sprite_basepos
Definition object_properties.h:59
bool collideWithObjects
Definition object_properties.h:74
bool show_on_minimap
Definition object_properties.h:83
bool physical
Definition object_properties.h:73
ObjectVisual visual
Definition object_properties.h:48
f32 stepheight
Definition object_properties.h:60
f32 automatic_face_movement_max_rotation_per_sec
Definition object_properties.h:63
aabb3f selectionbox
Definition object_properties.h:47
bool validate()
Check limits of some important properties that'd cause exceptions later on.
Definition object_properties.cpp:127
MapNode node
Definition object_properties.h:67
aabb3f collisionbox
Definition object_properties.h:45
bool shaded
Definition object_properties.h:82
std::vector< video::SColor > colors
Definition object_properties.h:43
std::string nametag
Definition object_properties.h:51
bool use_texture_alpha
Definition object_properties.h:81
std::optional< u32 > nametag_fontsize
Definition object_properties.h:66
std::vector< std::string > textures
Definition object_properties.h:42
bool backface_culling
Definition object_properties.h:79
bool automatic_face_movement_dir
Definition object_properties.h:78