2023-05-17 05:55:07 +00:00
import { _ as e , c as s , o as a , N as n } from "./chunks/framework.0799945b.js" ; const D = JSON . parse ( '{"title":"Features","description":"","frontmatter":{},"headers":[],"relativePath":"guide/important-concepts/features.md","lastUpdated":1684302845000}' ) , t = { name : "guide/important-concepts/features.md" } , o = n ( ` <h1 id="features" tabindex="-1">Features <a class="header-anchor" href="#features" aria-label="Permalink to "Features""> </a></h1><p>A <a href="./layers">layer</a> is made up of features. There are many types of features included in Profectus, and more can be created once you become familiar with the engine.</p><p>To create a feature, the feature type will have one or more functions to help you. They'll typically look something like this:</p><div class="language-ts"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#C792EA;">const</span><span style="color:#A6ACCD;"> addGainUpgrade </span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#82AAFF;">createUpgrade</span><span style="color:#A6ACCD;">(</span><span style="color:#89DDFF;">()</span><span style="color:#A6ACCD;"> </span><span style="color:#C792EA;">=></span><span style="color:#A6ACCD;"> (</span><span style="color:#89DDFF;">{</span></span>
2023-04-06 05:16:50 +00:00
< span class = "line" > < span style = "color:#A6ACCD;" > < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > d i s p l a y < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > { < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#A6ACCD;" > < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > t i t l e < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > & q u o t ; < / s p a n > < s p a n s t y l e = " c o l o r : # C 3 E 8 8 D ; " > G e n e r a t o r o f G e n e r i c n e s s < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > & q u o t ; < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > , < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#A6ACCD;" > < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > d e s c r i p t i o n < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > & q u o t ; < / s p a n > < s p a n s t y l e = " c o l o r : # C 3 E 8 8 D ; " > G a i n 1 p o i n t e v e r y s e c o n d < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > & q u o t ; < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#A6ACCD;" > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > } , < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#A6ACCD;" > < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > c o s t < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # F 7 8 C 6 C ; " > 1 < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > , < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#A6ACCD;" > < / s p a n > < s p a n s t y l e = " c o l o r : # F 0 7 1 7 8 ; " > r e s o u r c e < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > : < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > p o i n t s < / s p a n > < / s p a n >
< span class = "line" > < span style = "color:#89DDFF;" > } < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > ) ) < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > ; < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < p > T h e r e s u l t w i l l b e a < a h r e f = " . / l a y e r s # l a z y - p r o x i e s " > l a z y p r o x y < / a > o f t h e f e a t u r e b e i n g c r e a t e d . T h e f e a t u r e c a n t h e n b e u s e d t h r o u g h o u t t h e r e s t o f t h e l a y e r . T h e m a i n t h i n g t o k e e p i n m i n d w h e n c r e a t i n g f e a t u r e s i s t h a t t h e y s h o u l d t y p i c a l l y b e i n c l u d e d i n t h e l a y e r o b j e c t t h a t g e t s r e t u r n e d . I f a f e a t u r e h a s a n y < a h r e f = " . / r e a c t i v i t y # p e r s i s t e n t " > p e r s i s t e n t r e f s < / a > t h e y m u s t b e i n c l u d e d o r e l s e t h e y w i l l n o t h a v e t h e i r v a l u e s s a v e d a n d l o a d e d c o r r e c t l y . < / p > < p > W h i l e t h e s t r u c t u r e o f l a y e r s i s i n t e n t i o n a l l y l e f t u p t o t h e c r e a t o r , i t i s r e c o m m e n d e d t o a v o i d s t o r i n g t h e m i n a r r a y s . I f y o u e v e r r e m o v e a n u p g r a d e f r o m a n a r r a y , o r a d d a n u p g r a d e i n b e t w e e n o t h e r s , t h e n i t w i l l i n t e r f e r e w i t h t h e s a v e d a t a o f e x i s t i n g u s e r s . Y o u c a n m a n u a l l y f i x t h e s e i s s u e s i n < a h r e f = " . / . . / c r e a t i n g - y o u r - p r o j e c t / p r o j e c t - e n t r y # f i x o l d s a v e " > f i x O l d S a v e < / a > , b u t i t & # 3 9 ; s r e c o m m e n d e d t o a v o i d t h e e r r o r e n t i r e l y . < / p > < p > S i n c e u s u a l l y y o u w a n t t o a c c e s s a s p e c i f i c f e a t u r e , s t o r i n g t h e m i n a n o b j e c t i s m u c h m o r e r e l i a b l e a n d m a k e s t h e c o d e e a s i e r t o r e a d . F o r t h i n g s l i k e c h e c k i n g n u m b e r o f u p g r a d e s b o u g h t , f o r e x a m p l e , y o u c a n s t i l l u s e < c o d e > O b j e c t . v a l u e s < / c o d e > t o g e t a n a r r a y o f t h e o b j e c t s i n s t e a d . < / p > < h 4 i d = " e x a m p l e " t a b i n d e x = " - 1 " > E x a m p l e < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # e x a m p l e " a r i a - l a b e l = " P e r m a l i n k t o & q u o t ; E x a m p l e & q u o t ; " > < / a > < / h 4 > < d i v c l a s s = " l a n g u a g e - t s " > < b u t t o n t i t l e = " C o p y C o d e " c l a s s = " c o p y " > < / b u t t o n > < s p a n c l a s s = " l a n g " > t s < / s p a n > < p r e c l a s s = " s h i k i m a t e r i a l - t h e m e - p a l e n i g h t " > < c o d e > < s p a n c l a s s = " l i n e " > < s p a n s t y l e = " c o l o r : # C 7 9 2 E A ; " > c o n s t < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > u p g r a d e s < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > = < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > { < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > a d d G a i n U p g r a d e < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > , < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > g a i n M u l t U p g r a d e < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > , < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > u p g M u l t U p g r a d e < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > } ; < / s p a n > < / s p a n >
2023-05-17 00:11:58 +00:00
< span class = "line" > < span style = "color:#C792EA;" > const < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > n u m U p g r a d e s < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > = < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # 8 2 A A F F ; " > c o m p u t e d < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > ( < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > ( ) < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > < / s p a n > < s p a n s t y l e = " c o l o r : # C 7 9 2 E A ; " > = & g t ; < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > O b j e c t < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > . < / s p a n > < s p a n s t y l e = " c o l o r : # 8 2 A A F F ; " > v a l u e s < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > ( u p g r a d e s ) < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > . < / s p a n > < s p a n s t y l e = " c o l o r : # A 6 A C C D ; " > l e n g t h ) < / s p a n > < s p a n s t y l e = " c o l o r : # 8 9 D D F F ; " > ; < / s p a n > < / s p a n > < / c o d e > < / p r e > < / d i v > < h 2 i d = " t r e e - s h a k i n g " t a b i n d e x = " - 1 " > T r e e S h a k i n g < a c l a s s = " h e a d e r - a n c h o r " h r e f = " # t r e e - s h a k i n g " a r i a - l a b e l = " P e r m a l i n k t o & q u o t ; T r e e S h a k i n g & q u o t ; " > < / a > < / h 2 > < p > S i n c e P r o f e c t u s t a k e s a d v a n t a g e o f < a h r e f = " h t t p s : / / d e v e l o p e r . m o z i l l a . o r g / e n - U S / d o c s / G l o s s a r y / T r e e _ s h a k i n g " t a r g e t = " _ b l a n k " r e l = " n o r e f e r r e r " > t r e e s h a k i n g < / a > , a n y t y p e o f f e a t u r e t h a t i s n o t u s e d w i l l n o t b e i n c l u d e d i n t h e o u t p u t o f t h e p r o j e c t . T h a t m e a n s u s e r s h a v e l e s s c o d e t o d o w n l o a d , a s l i g h t p e r f o r m a n c e b o o s t , a n d y o u d o n & # 3 9 ; t n e e d t o w o r r y a b o u t f e a t u r e t y p e - s p e c i f i c s e t t i n g s a p p e a r i n g ( s u c h a s w h e t h e r t o s h o w m a x e d c h a l l e n g e s ) . < / p > < p > I t s h o u l d b e n o t e d t h a t a c o u p l e f e a t u r e s d e p e n d o n e a c h o t h e r , s u c h a s B u y a b l e s d e p e n d i n g o n C l i c k a b l e s . T h a t m e a n s y o u m a y s e e f e a t u r e s i n c l u d e d i n t h e o u t p u t d e s p i t e n o t d i r e c t l y u s i n g t h e m . S o m e f e a t u r e s , s u c h a s L i n k s a n d T o o l t i p s , a r e u s e d b y t h e e n g i n e i t s e l f a n d w i l l a l w a y s b e i n c l u d e d i n t h e o u t p u t . < / p > ` , 1 2 ) , l = [ o ] ; f u n c t i o n p ( r , c , i , y , d , u ) { r e t u r n a ( ) , s ( " d i v " , n u l l , l ) } c o n s t C = e ( t , [ [ " r e n d e r " , p ] ] ) ; e x p o r t { D a s _ _ p a g e D a t a , C a s d e f a u l t } ;