File size: 1,912 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
class ConstructionPart
{
	string 	m_Name;				//localized text name that is displayed ingame
	int		m_Id;				//a number used for synchronization and persistence purposes, must be unique and withing sync limit (total number of bits in all sync/persistence variables)
	string 	m_PartName;			//config class name
	string 	m_MainPartName;		//main (parent) config class name
	bool 	m_IsBuilt;			//defines part build state
	bool 	m_IsBase;			//defines if this part is the foundation of the whole construction
	bool 	m_IsGate;			//defines part gate state
	ref array<string> m_RequiredParts; //list of parts required by this part
	
	void ConstructionPart( string name, string part_name, string main_part_name, int id, bool is_built, bool is_base, bool is_gate, array<string> required_parts )
	{
		m_Name = name;
		m_PartName = part_name;
		m_MainPartName = main_part_name;
		m_Id = id;
		m_IsBuilt = is_built;
		m_IsBase = is_base;
		m_IsGate = is_gate;
		m_RequiredParts = required_parts;
	}
	
	string GetName()
	{
		string ret = Widget.TranslateString(m_Name);
		return ret;
	}
	
	string GetPartName()
	{
		return m_PartName;
	}

	string GetMainPartName()
	{
		return m_MainPartName;
	}
	
	int GetId()
	{
		return m_Id;
	}
	
	bool IsBuilt()
	{
		return m_IsBuilt;
	}
	
	void SetBuiltState( bool is_built )
	{
		if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] SetBuildState=" + is_built + " part=" + m_PartName);
		m_IsBuilt = is_built;
	}
	
	void SetRequestBuiltState( bool req_built )
	{
		if (LogManager.IsBaseBuildingLogEnable()) bsbDebugPrint("[bsb] SetRequestBuiltState=" + req_built + " part=" + m_PartName);
		if (GetGame().IsMultiplayer())
			SetBuiltState(req_built);
		else
			; // skip set to true in single player - will be synced later
	}
	
	bool IsBase()
	{
		return m_IsBase;
	}
	
	bool IsGate()
	{
		return m_IsGate;
	}
	
	array<string> GetRequiredParts()
	{
		return m_RequiredParts;
	}
}