is there a way to make it so that it sets either a custom duration for closing when swiped, or make it use the default time for a rust door. having it stay open indefinitely is not ideal.
Door stuck open when swiped with supercardSolved
in the code i tadded a timer so that, 30 seconds after a swipe. i need to invert the cardReader.Invoke(cardReader.GrantCard~ so it stops outputting power to the circuit and has to be reswiped. what in the world is the syntax for the opposite of GrantCard.... Revoke does not work, and i cant for the life of me find any documentation on it.
private object OnCardSwipe(CardReader cardReader, Keycard keyCard, BasePlayer player)
{
if (cardReader == null || keyCard == null || player == null) return null;
var card = player.GetActiveItem();
if (card == null || !_config.Item.IsSame(card) || card.conditionNormalized <= 0.0) return null;
if (cardReader.IsOn()) return true;
cardReader.Invoke(cardReader.GrantCard, 0.5f);
Log($"Opening door");
timer.Once(30f,() =>
{
Log($"Closing door");
cardReader.Invoke(cardReader.CancelAccess, 0.5f);
});
this all works now so thats good.
this all works now so thats good.
Locked automatically