Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F618900
empire.as
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
empire.as
View Options
import
ftl
;
import
empire_data
;
uint
majorEmpireCount
=
0
;
uint
getMajorEmpireCount
()
{
return
majorEmpireCount
;
}
void
recvPeriodic
(
Empire
&
emp
,
Message
&
msg
)
{
if
(!
msg
.
readBit
())
return
;
msg
>>
emp
.
visionMask
>>
emp
.
hostileMask
;
emp
.
cacheVision
();
msg
>>
emp
.
GlobalLoyalty
.
value
;
emp
.
Victory
=
msg
.
readSignedSmall
();
emp
.
readResources
(
msg
);
if
(
msg
.
readBit
())
emp
.
readAbilityDelta
(
msg
);
emp
.
readNotifications
(
msg
,
true
);
emp
.
readResearch
(
msg
);
emp
.
readInfluenceManager
(
msg
);
emp
.
readAttributes
(
msg
);
emp
.
readObjects
(
msg
);
emp
.
readSyncedStates
(
msg
);
emp
.
readEvents
(
msg
);
emp
.
readDelta
(
msg
);
emp
.
readAttitudes
(
msg
,
false
);
}
void
syncInitial
(
Empire
&
emp
,
Message
&
msg
)
{
emp
.
readNotifications
(
msg
,
false
);
emp
.
readInfluenceManager
(
msg
);
emp
.
readAttributes
(
msg
);
emp
.
readObjects
(
msg
);
emp
.
readResearch
(
msg
);
emp
.
readSyncedStates
(
msg
);
emp
.
readAbilities
(
msg
);
emp
.
readTraits
(
msg
);
emp
.
readAttitudes
(
msg
,
true
);
emp
.
readEvents
(
msg
);
msg
>>
emp
.
major
;
msg
>>
emp
.
backgroundDef
;
msg
>>
emp
.
portraitDef
;
msg
>>
emp
.
flagDef
;
msg
>>
emp
.
flagID
;
msg
>>
emp
.
RaceName
;
msg
>>
emp
.
ColonizerModel
;
msg
>>
emp
.
ColonizerMaterial
;
@
emp
.
background
=
getMaterial
(
emp
.
backgroundDef
);
auto
@
flag
=
getEmpireFlag
(
emp
.
flagDef
);
if
(
flag
is
null
)
@
flag
=
getEmpireFlag
(
emp
.
id
%
getEmpireFlagCount
());
@
emp
.
flag
=
flag
.
flag
;
@
emp
.
portrait
=
getMaterial
(
emp
.
portraitDef
);
if
(
emp
.
portrait
is
material
::
error
)
@
emp
.
portrait
=
getEmpirePortrait
(
randomi
(
0
,
getEmpirePortraitCount
()-
1
)).
portrait
;
}
void
recvPeriodic
(
Message
&
msg
)
{
uint
cnt
=
getEmpireCount
();
for
(
uint
i
=
0
;
i
<
cnt
;
++
i
)
recvPeriodic
(
getEmpire
(
i
),
msg
);
}
void
init
()
{
spectatorEmpire
.
visionMask
=
0
;
spectatorEmpire
.
ContactMask
.
value
=
int
(~
0
);
}
void
tick
(
double
time
)
{
uint
cnt
=
getEmpireCount
();
for
(
uint
i
=
0
;
i
<
cnt
;
++
i
)
{
Empire
@
emp
=
getEmpire
(
i
);
emp
.
influenceTick
(
time
);
}
}
void
syncInitial
(
Message
&
msg
)
{
uint
cnt
=
getEmpireCount
();
for
(
uint
i
=
0
;
i
<
cnt
;
++
i
)
{
Empire
@
emp
=
getEmpire
(
i
);
syncInitial
(
emp
,
msg
);
if
(
emp
.
major
)
++
majorEmpireCount
;
}
}
void
allowPlayEmpire
(
Empire
@
emp
)
{
if
(
emp
is
spectatorEmpire
)
spectatorEmpire
.
visionMask
=
~
0
;
@
playerEmpire
=
emp
;
CURRENT_PLAYER
.
linkEmpire
(
emp
);
playingEmpire
(
emp
);
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Nov 14, 3:53 PM (7 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
145786
Default Alt Text
empire.as (2 KB)
Attached To
Mode
R80 StarRuler2-Source
Attached
Detach File
Event Timeline