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

Adding airlocks and making normal doors leak air #166

Merged
merged 20 commits into from
Aug 19, 2016
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Refactor LUA, Airlock leaks when open
emilkris33 committed Aug 18, 2016

Verified

This commit was signed with the committer’s verified signature.
acao Rikki Schulte
commit 2893c8d494c8b7a1371fac1b879e44f91438d6d0
4 changes: 3 additions & 1 deletion Assets/StreamingAssets/Data/Furniture.xml
Original file line number Diff line number Diff line change
@@ -48,6 +48,7 @@
</DeconstructJob>

<OnUpdate FunctionName="OnUpdate_Door" />
<OnUpdate FunctionName="OnUpdate_Leak_Door" />

<IsEnterable FunctionName="IsEnterable_Door" />

@@ -80,7 +81,8 @@
<Inventory objectType="Steel Plate" amount="7" />
</DeconstructJob>

<OnUpdate FunctionName="OnUpdate_Airlock" />
<OnUpdate FunctionName="OnUpdate_Door" />
<OnUpdate FunctionName="OnUpdate_Leak_Airlock" />

<IsEnterable FunctionName="IsEnterable_Door" />

17 changes: 4 additions & 13 deletions Assets/StreamingAssets/LUA/Furniture.lua
Original file line number Diff line number Diff line change
@@ -43,23 +43,14 @@ function OnUpdate_Door( furniture, deltaTime )
furniture.SetParameter("openness", Clamp01(furniture.GetParameter("openness")) )

furniture.UpdateOnChanged(furniture);
end

function OnUpdate_Leak_Door( furniture, deltaTime )
furniture.tile.EqualiseGas(1.0 * (furniture.GetParameter("openness") + 0.1))
end

function OnUpdate_Airlock( furniture, deltaTime )
if (furniture.GetParameter("is_opening") >= 1.0) then
furniture.ChangeParameter("openness", deltaTime * 4) -- FIXME: Maybe a door open speed parameter?
if (furniture.GetParameter("openness") >= 1) then
furniture.SetParameter("is_opening", 0)
end
else
furniture.ChangeParameter("openness", deltaTime * -4)
end

furniture.SetParameter("openness", Clamp01(furniture.GetParameter("openness")) )

furniture.UpdateOnChanged(furniture);
function OnUpdate_Leak_Airlock( furniture, deltaTime )
furniture.tile.EqualiseGas(1.0 * (furniture.GetParameter("openness")))
end

function IsEnterable_Door( furniture )