Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Done]New cloning pod With Animation #1005

Merged
merged 13 commits into from
Aug 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Assets/StreamingAssets/Data/Furniture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
</Furniture>


<Furniture objectType="Cloning Pod">
<Furniture objectType="cloning_pod">
<Name>Cloning Pod</Name>
<Description>Creates an additional worker, then is destroyed.</Description>
<MovementCost>50</MovementCost>
Expand All @@ -228,10 +228,16 @@
<Inventory objectType="Steel Plate" amount="15" />
</DeconstructJob>

<Params>
<Param name="animationTimer" value="1" />
<Param name="animationStep" value="0" />
</Params>

<JobSpotOffset X="0" Y="-1" />
<JobSpawnSpotOffset X="1" Y="-1" />

<Action event="OnUpdate" functionName="CloningPod_UpdateAction" />
<GetSpriteName FunctionName="CloningPod_GetSpriteName" />

<LocalizationCode>furn_cloning_pod</LocalizationCode>
<UnlocalizedDescription>furn_cloning_pod_desc</UnlocalizedDescription>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions Assets/StreamingAssets/Images/Furniture/cloning_pod.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Assets/StreamingAssets/Images/Furniture/cloning_pod.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Sprites>
<Sprite name="cloning_pod_0" x="0" y="4" w="2" h="4" pixelPerUnit="32" />
<Sprite name="cloning_pod_1" x="2" y="4" w="2" h="4" pixelPerUnit="32" />
<Sprite name="cloning_pod" x="0" y="0" w="2" h="4" pixelPerUnit="32" />
</Sprites>
8 changes: 8 additions & 0 deletions Assets/StreamingAssets/Images/Furniture/cloning_pod.xml.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Assets/StreamingAssets/LUA/Furniture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,31 @@ function CloningPod_UpdateAction(furniture, deltaTime)
false
)

j.RegisterJobWorkedCallback("CloningPod_JobRunning")
j.RegisterJobCompletedCallback("CloningPod_JobComplete")
j.JobDescription = "job_cloning_pod_cloning_desc"
furniture.AddJob(j)
end

function CloningPod_JobRunning(j)
local step = 0
if (math.floor(math.abs(j.JobTime * j.furniture.Parameters["animationTimer"].ToFloat())) % 2 == 0) then
step = 1
end
if (j.furniture.Parameters["animationStep"].ToFloat() != step) then
j.furniture.Parameters["animationStep"].SetValue(step)
j.furniture.UpdateOnChanged(j.furniture)
end
end

function CloningPod_GetSpriteName(furniture)
local baseName = "cloning_pod"
if (furniture.JobCount() < 1) then
return baseName
end
return baseName .. "_" .. furniture.Parameters["animationStep"].ToFloat()
end

function CloningPod_JobComplete(j)
World.Current.CreateCharacter(j.furniture.GetSpawnSpotTile())
j.furniture.Deconstruct()
Expand Down