Skip to content
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: 6 additions & 2 deletions scripts/Door.nlvm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public abstract class Door extends Behaviour implements InteractionActionListene
m_Config.OpenTime = configJson.Get("open_time").GetFloat();
m_Config.CloseTime = configJson.Get("close_time").GetFloat();

if(configJson.HasKey("interaction_range"))
m_Config.InteractionRange = configJson.Get("interaction_range").GetFloat();


m_DoorOpenDelegate = new Delegate1();
m_DoorCloseDelegate = new Delegate1();
m_DoorStateChangeDelegate = new Delegate1();
Expand Down Expand Up @@ -115,7 +119,7 @@ public abstract class Door extends Behaviour implements InteractionActionListene

public void Open()
{
if(m_DoorState != DOOR_CLOSED)
if(m_DoorState == DOOR_OPEN || m_DoorState == DOOR_OPENING)
return;

SetInteractionHandlesEnabled(false);
Expand All @@ -126,7 +130,7 @@ public abstract class Door extends Behaviour implements InteractionActionListene
}
public void Close()
{
if(m_DoorState != DOOR_OPEN)
if(m_DoorState == DOOR_CLOSED || m_DoorState == DOOR_CLOSING)
return;

SetInteractionHandlesEnabled(false);
Expand Down
1 change: 1 addition & 0 deletions scripts/DoorConfig.nlvm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public class DoorConfig extends Object
{
public float OpenTime = 1.0f;
public float CloseTime = 1.0f;
public float InteractionRange = 1.0f;

public DoorConfig() { }
}
8 changes: 7 additions & 1 deletion scripts/DoorSingle.nlvm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DoorSingle extends Door implements InteractionActionListener, IFunc
m_InteractionHandle = new InteractionObject[1];
m_InteractionHandle[0] = InteractionObject.createSimpleButton();
m_InteractionHandle[0].addActionListener(this);
m_InteractionHandle[0].setRadius(1.75f);
m_InteractionHandle[0].setRadius(m_Config.InteractionRange);
m_InteractionHandle[0].setActive(true);


Expand Down Expand Up @@ -65,9 +65,15 @@ public class DoorSingle extends Door implements InteractionActionListener, IFunc
{
int state = ((Door)arg).GetDoorState();
if(state == DOOR_OPENING)
{
m_OpenTween.Play();
m_CloseTween.Cancel();
}
else if(state == DOOR_CLOSING)
{
m_CloseTween.Play();
m_OpenTween.Cancel();
}
}
}
}
Loading