forked from 0ad/0ad
Improve template code style for the Decay component.
This was SVN commit r16171.
This commit is contained in:
parent
b65dcaba48
commit
b5b9c0f2ae
@ -14,7 +14,6 @@
|
||||
</Resources>
|
||||
</Cost>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>3.0</SinkRate>
|
||||
<SinkAccel>9.8</SinkAccel>
|
||||
|
@ -6,7 +6,6 @@
|
||||
</Melee>
|
||||
</Attack>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>3.0</SinkRate>
|
||||
<SinkAccel>9.8</SinkAccel>
|
||||
|
@ -14,7 +14,6 @@
|
||||
</Resources>
|
||||
</Cost>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>3.0</SinkRate>
|
||||
<SinkAccel>9.8</SinkAccel>
|
||||
|
@ -10,7 +10,6 @@
|
||||
</Resources>
|
||||
</Cost>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>2.0</SinkRate>
|
||||
<SinkAccel>9.0</SinkAccel>
|
||||
|
@ -27,8 +27,7 @@
|
||||
<EjectClassesOnDestroy datatype="tokens" />
|
||||
</GarrisonHolder>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<SinkingAnim/>
|
||||
<SinkingAnim>true</SinkingAnim>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>3.0</SinkRate>
|
||||
<SinkAccel>7.0</SinkAccel>
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity>
|
||||
<Decay>
|
||||
<Active>true</Active>
|
||||
<SinkingAnim>false</SinkingAnim>
|
||||
<DelayTime>15.0</DelayTime>
|
||||
<SinkRate>0.2</SinkRate>
|
||||
<SinkAccel>0</SinkAccel>
|
||||
|
@ -32,7 +32,8 @@
|
||||
</Resources>
|
||||
</Cost>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<Active>false</Active>
|
||||
<SinkingAnim>false</SinkingAnim>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>3.0</SinkRate>
|
||||
<SinkAccel>9.8</SinkAccel>
|
||||
|
@ -17,7 +17,8 @@
|
||||
</Resources>
|
||||
</Cost>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<Active>false</Active>
|
||||
<SinkingAnim>false</SinkingAnim>
|
||||
<DelayTime>80.0</DelayTime>
|
||||
<SinkRate>0.01</SinkRate>
|
||||
<SinkAccel>0.0</SinkAccel>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="template_unit">
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>0.0</SinkRate>
|
||||
<SinkAccel>2.0</SinkAccel>
|
||||
|
@ -16,8 +16,7 @@
|
||||
</Resources>
|
||||
</Cost>
|
||||
<Decay>
|
||||
<Inactive/>
|
||||
<SinkingAnim/>
|
||||
<SinkingAnim>true</SinkingAnim>
|
||||
<DelayTime>0.0</DelayTime>
|
||||
<SinkRate>0.5</SinkRate>
|
||||
<SinkAccel>7.0</SinkAccel>
|
||||
|
@ -393,9 +393,9 @@ void CTemplateLoader::CopyPreviewSubset(CParamNode& out, const CParamNode& in, b
|
||||
|
||||
if (corpse)
|
||||
{
|
||||
// Corpses should include decay components and un-inactivate them
|
||||
// Corpses should include decay components and activate them
|
||||
if (out.GetChild("Entity").GetChild("Decay").IsOk())
|
||||
CParamNode::LoadXMLString(out, "<Entity><Decay><Inactive disable=''/></Decay></Entity>");
|
||||
CParamNode::LoadXMLString(out, "<Entity><Decay><Active>true</Active></Decay></Entity>");
|
||||
|
||||
// Corpses shouldn't display silhouettes (especially since they're often half underground)
|
||||
if (out.GetChild("Entity").GetChild("VisualActor").IsOk())
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2012 Wildfire Games.
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -70,6 +70,12 @@ public:
|
||||
static std::string GetSchema()
|
||||
{
|
||||
return
|
||||
"<element name='Active' a:help='If false, the entity will not do any decaying'>"
|
||||
"<data type='boolean'/>"
|
||||
"</element>"
|
||||
"<element name='SinkingAnim' a:help='If true, the entity will decay in a ship-like manner'>"
|
||||
"<data type='boolean'/>"
|
||||
"</element>"
|
||||
"<element name='DelayTime' a:help='Time to wait before starting to sink, in seconds'>"
|
||||
"<ref name='nonNegativeDecimal'/>"
|
||||
"</element>"
|
||||
@ -78,23 +84,13 @@ public:
|
||||
"</element>"
|
||||
"<element name='SinkAccel' a:help='Acceleration rate of sinking, in metres per second per second'>"
|
||||
"<ref name='nonNegativeDecimal'/>"
|
||||
"</element>"
|
||||
"<optional>"
|
||||
"<element name='Inactive' a:help='If this element is present, the entity will not do any decaying'>"
|
||||
"<empty/>"
|
||||
"</element>"
|
||||
"</optional>"
|
||||
"<optional>"
|
||||
"<element name='SinkingAnim' a:help='If this element is present, the entity will decay in a ship-like manner'>"
|
||||
"<empty/>"
|
||||
"</element>"
|
||||
"</optional>";
|
||||
"</element>";
|
||||
}
|
||||
|
||||
virtual void Init(const CParamNode& paramNode)
|
||||
{
|
||||
m_Active = !paramNode.GetChild("Inactive").IsOk();
|
||||
m_ShipSink = paramNode.GetChild("SinkingAnim").IsOk();
|
||||
m_Active = paramNode.GetChild("Active").ToBool();
|
||||
m_ShipSink = paramNode.GetChild("SinkingAnim").ToBool();
|
||||
m_DelayTime = paramNode.GetChild("DelayTime").ToFixed().ToFloat();
|
||||
m_SinkRate = paramNode.GetChild("SinkRate").ToFixed().ToFloat();
|
||||
m_SinkAccel = paramNode.GetChild("SinkAccel").ToFixed().ToFloat();
|
||||
|
Loading…
Reference in New Issue
Block a user