Luanti 5.10.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
15{
16 /* member variables ordered roughly by size */
17
18 std::vector<std::string> textures;
19 std::vector<video::SColor> colors;
20 // Values are BS=1
21 aabb3f collisionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
22 // Values are BS=1
23 aabb3f selectionbox = aabb3f(-0.5f, -0.5f, -0.5f, 0.5f, 0.5f, 0.5f);
24 std::string visual = "sprite";
25 std::string mesh;
26 std::string damage_texture_modifier = "^[brighten";
27 std::string nametag;
28 std::string infotext;
29 // For dropped items, this contains the serialized item.
30 std::string wield_item;
31 v3f visual_size = v3f(1, 1, 1);
32 video::SColor nametag_color = video::SColor(255, 255, 255, 255);
33 std::optional<video::SColor> nametag_bgcolor;
36 f32 stepheight = 0.0f;
37 float automatic_rotate = 0.0f;
40 float eye_height = 1.625f;
41 float zoom_fov = 0.0f;
42 u16 hp_max = 1;
43 u16 breath_max = 0;
44 s8 glow = 0;
46 // In a future protocol these could be a flag field.
47 bool physical = false;
48 bool collideWithObjects = true;
49 bool rotate_selectionbox = false;
50 bool is_visible = true;
53 bool backface_culling = true;
54 bool static_save = true;
55 bool use_texture_alpha = false;
56 bool shaded = true;
57 bool show_on_minimap = false;
58
60
61 std::string dump() const;
62
63 bool operator==(const ObjectProperties &other) const;
64 bool operator!=(const ObjectProperties &other) const {
65 return !(*this == other);
66 }
67
73 bool validate();
74
75 void serialize(std::ostream &os) const;
76 void deSerialize(std::istream &is);
77};
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
PointabilityType
Definition pointabilities.h:13
Definition object_properties.h:15
u16 hp_max
Definition object_properties.h:42
bool is_visible
Definition object_properties.h:50
std::string visual
Definition object_properties.h:24
float eye_height
Definition object_properties.h:40
std::string dump() const
Definition object_properties.cpp:22
std::string wield_item
Definition object_properties.h:30
v2s16 spritediv
Definition object_properties.h:34
f32 automatic_face_movement_dir_offset
Definition object_properties.h:38
std::string damage_texture_modifier
Definition object_properties.h:26
std::string mesh
Definition object_properties.h:25
video::SColor nametag_color
Definition object_properties.h:32
s8 glow
Definition object_properties.h:44
float zoom_fov
Definition object_properties.h:41
void serialize(std::ostream &os) const
Definition object_properties.cpp:128
bool operator==(const ObjectProperties &other) const
Definition object_properties.cpp:90
std::string infotext
Definition object_properties.h:28
ObjectProperties()
Definition object_properties.cpp:16
void deSerialize(std::istream &is)
Definition object_properties.cpp:186
v3f visual_size
Definition object_properties.h:31
u16 breath_max
Definition object_properties.h:43
float automatic_rotate
Definition object_properties.h:37
bool makes_footstep_sound
Definition object_properties.h:51
bool operator!=(const ObjectProperties &other) const
Definition object_properties.h:64
bool static_save
Definition object_properties.h:54
bool rotate_selectionbox
Definition object_properties.h:49
std::optional< video::SColor > nametag_bgcolor
Definition object_properties.h:33
PointabilityType pointable
Definition object_properties.h:45
v2s16 initial_sprite_basepos
Definition object_properties.h:35
bool collideWithObjects
Definition object_properties.h:48
bool show_on_minimap
Definition object_properties.h:57
bool physical
Definition object_properties.h:47
f32 stepheight
Definition object_properties.h:36
f32 automatic_face_movement_max_rotation_per_sec
Definition object_properties.h:39
aabb3f selectionbox
Definition object_properties.h:23
bool validate()
Check limits of some important properties that'd cause exceptions later on.
Definition object_properties.cpp:95
aabb3f collisionbox
Definition object_properties.h:21
bool shaded
Definition object_properties.h:56
std::vector< video::SColor > colors
Definition object_properties.h:19
std::string nametag
Definition object_properties.h:27
bool use_texture_alpha
Definition object_properties.h:55
std::vector< std::string > textures
Definition object_properties.h:18
bool backface_culling
Definition object_properties.h:53
bool automatic_face_movement_dir
Definition object_properties.h:52