Door Base - Nanos World

Description

Door simple system for Nanos World


# Door Base System

version: 0.2.0

door-base system for nanos world bĂȘta.


## How to use

 ```lua

 local door_exmple = Door:new(data, isRotate, isFrame, isDouble, isLocked)

 ```

 - data: table

 - isRotate: boolean

 - isFrame: boolean

 - isDouble: boolean

 - isLocked: boolean


All Doors are stored in a "DoorInstance" class.

it is possible to recover them


Data is a table that contains the following information:

```lua

    -- Data for Single Door :

    -- Frame information for the door :

    frame = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "AssetPack::Example_Door_Frame" },

    -- Door information for the door :

    Door1 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "AssetPack::Example_Door_Door" },

    -- Trigger information for the door :

    Trigger = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), Radius = Vector(0, 0, 0), debug = true, only = { "Character", "CharacterSimple" } }, -- Optional

    sound = { Assets = "AssetPack::Example_Sound", Type = 0, Volume = 0.5, Pitch = 1.0, inner_radius = 400, falloff_distance = 600}, -- Optional

    max = Vector(0, 0, 0), -- max position of the door

    time = 0, -- time to open the door

    exp = 0, -- exp of the door

    id = 0 -- id of the door in the door instance


    -- Data for Double Door :

    -- Frame information for the door :

    frame = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "AssetPack::Example_Door_Frame" },

    -- Door information for the door :

    Door1 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "AssetPack::Example_Door_Door" },

    Door2 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "AssetPack::Example_Door_Door" },

    -- Trigger information for the door :

    Trigger = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), Radius = Vector(0, 0, 0), debug = true, only = { "Character", "CharacterSimple" } }, -- Optional

    sound = { Assets = "AssetPack::Example_Sound", Type = 0, Volume = 0.5, Pitch = 1.0, inner_radius = 400, falloff_distance = 600}, -- Optional

    max = Vector(0, 0, 0), -- max position of the door

    time = 0, -- time to open the door

    exp = 0, -- exp of the door

    id = 0 -- id of the door in the door instance

```


## Function to use in door

```lua

Door:Open(id) -- open the door with the id


Door:Close(id) -- close the door with the id


Door:Lock(id) -- lock the door with the id


Door:Unlock(id) -- unlock the door with the id


Door:Destroy(id) -- destroy the door with the id

```



## To create translate door Single


```lua

local Door_Exmple = Door:new({

    frame = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::Door_Single_Door_F_Single" },

    Door1 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::Door_Single_Door_D_Single" },

    Trigger = { position = Vector(0, 0, 100), rotation = Rotator(0, 0, 0), Radius = Vector(100, 150, 100), debug = true, only = { "Character", "CharacterSimple" } }, -- Optional

    sound = { Assets = "AssetPack::Example_Sound", Type = 0, Volume = 0.5, Pitch = 1.0, inner_radius = 400, falloff_distance = 600}, -- Optional

    max = Vector(105, 0, 0),

    time = 2,

    exp = 2,

    id = 1

}, false, true, false, false)

```


## To create translate door double


```lua

local Door_Exmple = Door:new({

    frame = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::door_test_Door_F_test" },

    Door1 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::door_test_Door_R_test" },

    Door2 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::door_test_Door_L_test" },

    Trigger = { position = Vector(0, 0, 100), rotation = Rotator(0, 0, 0), Radius = Vector(300, 150, 150), debug = true, only = { "Character", "CharacterSimple" } }, -- Optional

    sound = { Assets = "AssetPack::Example_Sound", Type = 0, Volume = 0.5, Pitch = 1.0, inner_radius = 400, falloff_distance = 600}, -- Optional

    max = Vector(0, 350, 0),

    time = 2,

    exp = 2,

    id = 2

}, false, true, true, false)

```

## To create rotate door Single

```lua

local Door_Exmple_Rotate = Door:new({

    frame = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::Door_Single_Door_F_Single" },

    Door1 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::Door_Single_Door_D_Single" },

    Trigger = { position = Vector(0, 0, 100), rotation = Rotator(0, 0, 0), Radius = Vector(100, 150, 100), debug = true, only = { "Character", "CharacterSimple" } }, -- Optional

    sound = { Assets = "AssetPack::Example_Sound", Type = 0, Volume = 0.5, Pitch = 1.0, inner_radius = 400, falloff_distance = 600}, -- Optional

    max = Rotator(0, 90, 0),

    time = 2,

    exp = 2,

    id = 3

}, true, true, false, false)

```

## To create rotate door double

```lua

local Door_Exmple_Rotate = Door:new({

    frame = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::door_test_Door_F_test" },

    Door1 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::door_test_Door_R_test" },

    Door2 = { position = Vector(0, 0, 0), rotation = Rotator(0, 0, 0), mesh = "door-asset-pack::door_test_Door_L_test" },

    Trigger = { position = Vector(0, 0, 100), rotation = Rotator(0, 0, 0), Radius = Vector(300, 150, 150), debug = true, only = { "Character", "CharacterSimple" } }, -- Optional

    sound = { Assets = "AssetPack::Example_Sound", Type = 0, Volume = 0.5, Pitch = 1.0, inner_radius = 400, falloff_distance = 600}, -- Optional

    max = Rotator(-90, 0, 0),

    time = 2,

    exp = 2,

    id = 4

}, true, true, true, false)

```

Get it

TheMaxee Team

1 members - 5 resources
Views
85
Downloads
5
Rating
(0)
Created at
2024-12-17 19:56:01
Updated at
2025-04-03 10:52:31
Category
script
Languages
French, Portuguese, German, English
Tags
open-world, base-building, freeroam, roleplay, sandbox