repo stringclasses 245
values | file_path stringlengths 29 241 | code stringlengths 100 233k | tokens int64 14 69.4k |
|---|---|---|---|
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Action/init.lua | --!strict
return {
UNINITIALIZED = 0x00000000, -- (0x000)
-- group 0x000: stationary actions
IDLE = 0x0C400201, -- (0x001 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
START_SLEEPING = 0x0C400202, -- (0x002 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SLEEPING = 0x0C000203, -- (0x003 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
WAKING_UP = 0x0C000204, -- (0x004 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
PANTING = 0x0C400205, -- (0x005 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
HOLD_PANTING_UNUSED = 0x08000206, -- (0x006 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
HOLD_IDLE = 0x08000207, -- (0x007 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
HOLD_HEAVY_IDLE = 0x08000208, -- (0x008 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
STANDING_AGAINST_WALL = 0x0C400209, -- (0x009 | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
COUGHING = 0x0C40020A, -- (0x00A | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SHIVERING = 0x0C40020B, -- (0x00B | FLAG_STATIONARY | FLAG_IDLE | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
IN_QUICKSAND = 0x0002020D, -- (0x00D | FLAG_STATIONARY | FLAG_INVULNERABLE)
UNKNOWN_0002020E = 0x0002020E, -- (0x00E | FLAG_STATIONARY | FLAG_INVULNERABLE)
CROUCHING = 0x0C008220, -- (0x020 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
START_CROUCHING = 0x0C008221, -- (0x021 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
STOP_CROUCHING = 0x0C008222, -- (0x022 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
START_CRAWLING = 0x0C008223, -- (0x023 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
STOP_CRAWLING = 0x0C008224, -- (0x024 | FLAG_STATIONARY | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SLIDE_KICK_SLIDE_STOP = 0x08000225, -- (0x025 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
SHOCKWAVE_BOUNCE = 0x00020226, -- (0x026 | FLAG_STATIONARY | FLAG_INVULNERABLE)
FIRST_PERSON = 0x0C000227, -- (0x027 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
BACKFLIP_LAND_STOP = 0x0800022F, -- (0x02F | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
JUMP_LAND_STOP = 0x0C000230, -- (0x030 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
DOUBLE_JUMP_LAND_STOP = 0x0C000231, -- (0x031 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
FREEFALL_LAND_STOP = 0x0C000232, -- (0x032 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
SIDE_FLIP_LAND_STOP = 0x0C000233, -- (0x033 | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
HOLD_JUMP_LAND_STOP = 0x08000234, -- (0x034 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
HOLD_FREEFALL_LAND_STOP = 0x08000235, -- (0x035 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
AIR_THROW_LAND = 0x80000A36, -- (0x036 | FLAG_STATIONARY | FLAG_AIR | FLAG_THROWING)
TWIRL_LAND = 0x18800238, -- (0x038 | FLAG_STATIONARY | FLAG_ATTACKING | FLAG_PAUSE_EXIT | FLAG_SWIMMING_OR_FLYING)
LAVA_BOOST_LAND = 0x08000239, -- (0x039 | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
TRIPLE_JUMP_LAND_STOP = 0x0800023A, -- (0x03A | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
LONG_JUMP_LAND_STOP = 0x0800023B, -- (0x03B | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
GROUND_POUND_LAND = 0x0080023C, -- (0x03C | FLAG_STATIONARY | FLAG_ATTACKING)
BRAKING_STOP = 0x0C00023D, -- (0x03D | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
BUTT_SLIDE_STOP = 0x0C00023E, -- (0x03E | FLAG_STATIONARY | FLAG_ALLOW_FIRST_PERSON | FLAG_PAUSE_EXIT)
HOLD_BUTT_SLIDE_STOP = 0x0800043F, -- (0x03F | FLAG_MOVING | FLAG_PAUSE_EXIT)
-- group 0x040: moving (ground) actions
WALKING = 0x04000440, -- (0x040 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
HOLD_WALKING = 0x00000442, -- (0x042 | FLAG_MOVING)
TURNING_AROUND = 0x00000443, -- (0x043 | FLAG_MOVING)
FINISH_TURNING_AROUND = 0x00000444, -- (0x044 | FLAG_MOVING)
BRAKING = 0x04000445, -- (0x045 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
RIDING_SHELL_GROUND = 0x20810446, -- (0x046 | FLAG_MOVING | FLAG_RIDING_SHELL | FLAG_ATTACKING | FLAG_WATER_OR_TEXT)
HOLD_HEAVY_WALKING = 0x00000447, -- (0x047 | FLAG_MOVING)
CRAWLING = 0x04008448, -- (0x048 | FLAG_MOVING | FLAG_SHORT_HITBOX | FLAG_ALLOW_FIRST_PERSON)
BURNING_GROUND = 0x00020449, -- (0x049 | FLAG_MOVING | FLAG_INVULNERABLE)
DECELERATING = 0x0400044A, -- (0x04A | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
HOLD_DECELERATING = 0x0000044B, -- (0x04B | FLAG_MOVING)
BEGIN_SLIDING = 0x00000050, -- (0x050)
HOLD_BEGIN_SLIDING = 0x00000051, -- (0x051)
BUTT_SLIDE = 0x00840452, -- (0x052 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_ATTACKING)
STOMACH_SLIDE = 0x008C0453, -- (0x053 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_DIVING | FLAG_ATTACKING)
HOLD_BUTT_SLIDE = 0x00840454, -- (0x054 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_ATTACKING)
HOLD_STOMACH_SLIDE = 0x008C0455, -- (0x055 | FLAG_MOVING | FLAG_BUTT_OR_STOMACH_SLIDE | FLAG_DIVING | FLAG_ATTACKING)
DIVE_SLIDE = 0x00880456, -- (0x056 | FLAG_MOVING | FLAG_DIVING | FLAG_ATTACKING)
MOVE_PUNCHING = 0x00800457, -- (0x057 | FLAG_MOVING | FLAG_ATTACKING)
CROUCH_SLIDE = 0x04808459, -- (0x059 | FLAG_MOVING | FLAG_SHORT_HITBOX | FLAG_ATTACKING | FLAG_ALLOW_FIRST_PERSON)
SLIDE_KICK_SLIDE = 0x0080045A, -- (0x05A | FLAG_MOVING | FLAG_ATTACKING)
HARD_BACKWARD_GROUND_KB = 0x00020460, -- (0x060 | FLAG_MOVING | FLAG_INVULNERABLE)
HARD_FORWARD_GROUND_KB = 0x00020461, -- (0x061 | FLAG_MOVING | FLAG_INVULNERABLE)
BACKWARD_GROUND_KB = 0x00020462, -- (0x062 | FLAG_MOVING | FLAG_INVULNERABLE)
FORWARD_GROUND_KB = 0x00020463, -- (0x063 | FLAG_MOVING | FLAG_INVULNERABLE)
SOFT_BACKWARD_GROUND_KB = 0x00020464, -- (0x064 | FLAG_MOVING | FLAG_INVULNERABLE)
SOFT_FORWARD_GROUND_KB = 0x00020465, -- (0x065 | FLAG_MOVING | FLAG_INVULNERABLE)
GROUND_BONK = 0x00020466, -- (0x066 | FLAG_MOVING | FLAG_INVULNERABLE)
DEATH_EXIT_LAND = 0x00020467, -- (0x067 | FLAG_MOVING | FLAG_INVULNERABLE)
JUMP_LAND = 0x04000470, -- (0x070 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
FREEFALL_LAND = 0x04000471, -- (0x071 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
DOUBLE_JUMP_LAND = 0x04000472, -- (0x072 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
SIDE_FLIP_LAND = 0x04000473, -- (0x073 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
HOLD_JUMP_LAND = 0x00000474, -- (0x074 | FLAG_MOVING)
HOLD_FREEFALL_LAND = 0x00000475, -- (0x075 | FLAG_MOVING)
QUICKSAND_JUMP_LAND = 0x00000476, -- (0x076 | FLAG_MOVING)
HOLD_QUICKSAND_JUMP_LAND = 0x00000477, -- (0x077 | FLAG_MOVING)
TRIPLE_JUMP_LAND = 0x04000478, -- (0x078 | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
LONG_JUMP_LAND = 0x00000479, -- (0x079 | FLAG_MOVING)
BACKFLIP_LAND = 0x0400047A, -- (0x07A | FLAG_MOVING | FLAG_ALLOW_FIRST_PERSON)
-- group 0x080: airborne actions
JUMP = 0x03000880, -- (0x080 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
DOUBLE_JUMP = 0x03000881, -- (0x081 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
TRIPLE_JUMP = 0x01000882, -- (0x082 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BACKFLIP = 0x01000883, -- (0x083 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
STEEP_JUMP = 0x03000885, -- (0x085 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
WALL_KICK_AIR = 0x03000886, -- (0x086 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
SIDE_FLIP = 0x01000887, -- (0x087 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
LONG_JUMP = 0x03000888, -- (0x088 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
WATER_JUMP = 0x01000889, -- (0x089 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
DIVE = 0x0188088A, -- (0x08A | FLAG_AIR | FLAG_DIVING | FLAG_ATTACKING | FLAG_ALLOW_VERTICAL_WIND_ACTION)
FREEFALL = 0x0100088C, -- (0x08C | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
TOP_OF_POLE_JUMP = 0x0300088D, -- (0x08D | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
BUTT_SLIDE_AIR = 0x0300088E, -- (0x08E | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
FLYING_TRIPLE_JUMP = 0x03000894, -- (0x094 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
SHOT_FROM_CANNON = 0x00880898, -- (0x098 | FLAG_AIR | FLAG_DIVING | FLAG_ATTACKING)
FLYING = 0x10880899, -- (0x099 | FLAG_AIR | FLAG_DIVING | FLAG_ATTACKING | FLAG_SWIMMING_OR_FLYING)
RIDING_SHELL_JUMP = 0x0281089A, -- (0x09A | FLAG_AIR | FLAG_RIDING_SHELL | FLAG_ATTACKING | FLAG_CONTROL_JUMP_HEIGHT)
RIDING_SHELL_FALL = 0x0081089B, -- (0x09B | FLAG_AIR | FLAG_RIDING_SHELL | FLAG_ATTACKING)
VERTICAL_WIND = 0x1008089C, -- (0x09C | FLAG_AIR | FLAG_DIVING | FLAG_SWIMMING_OR_FLYING)
HOLD_JUMP = 0x030008A0, -- (0x0A0 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
HOLD_FREEFALL = 0x010008A1, -- (0x0A1 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HOLD_BUTT_SLIDE_AIR = 0x010008A2, -- (0x0A2 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HOLD_WATER_JUMP = 0x010008A3, -- (0x0A3 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
TWIRLING = 0x108008A4, -- (0x0A4 | FLAG_AIR | FLAG_ATTACKING | FLAG_SWIMMING_OR_FLYING)
FORWARD_ROLLOUT = 0x010008A6, -- (0x0A6 | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
AIR_HIT_WALL = 0x000008A7, -- (0x0A7 | FLAG_AIR)
RIDING_HOOT = 0x000004A8, -- (0x0A8 | FLAG_MOVING)
GROUND_POUND = 0x008008A9, -- (0x0A9 | FLAG_AIR | FLAG_ATTACKING)
SLIDE_KICK = 0x018008AA, -- (0x0AA | FLAG_AIR | FLAG_ATTACKING | FLAG_ALLOW_VERTICAL_WIND_ACTION)
AIR_THROW = 0x830008AB, -- (0x0AB | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT | FLAG_THROWING)
JUMP_KICK = 0x018008AC, -- (0x0AC | FLAG_AIR | FLAG_ATTACKING | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BACKWARD_ROLLOUT = 0x010008AD, -- (0x0AD | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION)
CRAZY_BOX_BOUNCE = 0x000008AE, -- (0x0AE | FLAG_AIR)
SPECIAL_TRIPLE_JUMP = 0x030008AF, -- (0x0AF | FLAG_AIR | FLAG_ALLOW_VERTICAL_WIND_ACTION | FLAG_CONTROL_JUMP_HEIGHT)
BACKWARD_AIR_KB = 0x010208B0, -- (0x0B0 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
FORWARD_AIR_KB = 0x010208B1, -- (0x0B1 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HARD_FORWARD_AIR_KB = 0x010208B2, -- (0x0B2 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
HARD_BACKWARD_AIR_KB = 0x010208B3, -- (0x0B3 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BURNING_JUMP = 0x010208B4, -- (0x0B4 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
BURNING_FALL = 0x010208B5, -- (0x0B5 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
SOFT_BONK = 0x010208B6, -- (0x0B6 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
LAVA_BOOST = 0x010208B7, -- (0x0B7 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
GETTING_BLOWN = 0x010208B8, -- (0x0B8 | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
THROWN_FORWARD = 0x010208BD, -- (0x0BD | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
THROWN_BACKWARD = 0x010208BE, -- (0x0BE | FLAG_AIR | FLAG_INVULNERABLE | FLAG_ALLOW_VERTICAL_WIND_ACTION)
-- group 0x0C0: submerged actions
WATER_IDLE = 0x380022C0, -- (0x0C0 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_PAUSE_EXIT | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_WATER_IDLE = 0x380022C1, -- (0x0C1 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_PAUSE_EXIT | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_ACTION_END = 0x300022C2, -- (0x0C2 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_WATER_ACTION_END = 0x300022C3, -- (0x0C3 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
DROWNING = 0x300032C4, -- (0x0C4 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
BACKWARD_WATER_KB = 0x300222C5, -- (0x0C5 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
FORWARD_WATER_KB = 0x300222C6, -- (0x0C6 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_DEATH = 0x300032C7, -- (0x0C7 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_SHOCKED = 0x300222C8, -- (0x0C8 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
BREASTSTROKE = 0x300024D0, -- (0x0D0 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
SWIMMING_END = 0x300024D1, -- (0x0D1 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
FLUTTER_KICK = 0x300024D2, -- (0x0D2 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_BREASTSTROKE = 0x300024D3, -- (0x0D3 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_SWIMMING_END = 0x300024D4, -- (0x0D4 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
HOLD_FLUTTER_KICK = 0x300024D5, -- (0x0D5 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_SHELL_SWIMMING = 0x300024D6, -- (0x0D6 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_THROW = 0x300024E0, -- (0x0E0 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_PUNCH = 0x300024E1, -- (0x0E1 | FLAG_MOVING | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
WATER_PLUNGE = 0x300022E2, -- (0x0E2 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
CAUGHT_IN_WHIRLPOOL = 0x300222E3, -- (0x0E3 | FLAG_STATIONARY | FLAG_SWIMMING | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING | FLAG_WATER_OR_TEXT)
METAL_WATER_STANDING = 0x080042F0, -- (0x0F0 | FLAG_STATIONARY | FLAG_METAL_WATER | FLAG_PAUSE_EXIT)
HOLD_METAL_WATER_STANDING = 0x080042F1, -- (0x0F1 | FLAG_STATIONARY | FLAG_METAL_WATER | FLAG_PAUSE_EXIT)
METAL_WATER_WALKING = 0x000044F2, -- (0x0F2 | FLAG_MOVING | FLAG_METAL_WATER)
HOLD_METAL_WATER_WALKING = 0x000044F3, -- (0x0F3 | FLAG_MOVING | FLAG_METAL_WATER)
METAL_WATER_FALLING = 0x000042F4, -- (0x0F4 | FLAG_STATIONARY | FLAG_METAL_WATER)
HOLD_METAL_WATER_FALLING = 0x000042F5, -- (0x0F5 | FLAG_STATIONARY | FLAG_METAL_WATER)
METAL_WATER_FALL_LAND = 0x000042F6, -- (0x0F6 | FLAG_STATIONARY | FLAG_METAL_WATER)
HOLD_METAL_WATER_FALL_LAND = 0x000042F7, -- (0x0F7 | FLAG_STATIONARY | FLAG_METAL_WATER)
METAL_WATER_JUMP = 0x000044F8, -- (0x0F8 | FLAG_MOVING | FLAG_METAL_WATER)
HOLD_METAL_WATER_JUMP = 0x000044F9, -- (0x0F9 | FLAG_MOVING | FLAG_METAL_WATER)
METAL_WATER_JUMP_LAND = 0x000044FA, -- (0x0FA | FLAG_MOVING | FLAG_METAL_WATER)
HOLD_METAL_WATER_JUMP_LAND = 0x000044FB, -- (0x0FB | FLAG_MOVING | FLAG_METAL_WATER)
-- group 0x100: cutscene actions
DISAPPEARED = 0x00001300, -- (0x100 | FLAG_STATIONARY | FLAG_INTANGIBLE)
INTRO_CUTSCENE = 0x04001301, -- (0x101 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_ALLOW_FIRST_PERSON)
STAR_DANCE_EXIT = 0x00001302, -- (0x102 | FLAG_STATIONARY | FLAG_INTANGIBLE)
STAR_DANCE_WATER = 0x00001303, -- (0x103 | FLAG_STATIONARY | FLAG_INTANGIBLE)
FALL_AFTER_STAR_GRAB = 0x00001904, -- (0x104 | FLAG_AIR | FLAG_INTANGIBLE)
READING_AUTOMATIC_DIALOG = 0x20001305, -- (0x105 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_WATER_OR_TEXT)
READING_NPC_DIALOG = 0x20001306, -- (0x106 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_WATER_OR_TEXT)
STAR_DANCE_NO_EXIT = 0x00001307, -- (0x107 | FLAG_STATIONARY | FLAG_INTANGIBLE)
READING_SIGN = 0x00001308, -- (0x108 | FLAG_STATIONARY | FLAG_INTANGIBLE)
JUMBO_STAR_CUTSCENE = 0x00001909, -- (0x109 | FLAG_AIR | FLAG_INTANGIBLE)
WAITING_FOR_DIALOG = 0x0000130A, -- (0x10A | FLAG_STATIONARY | FLAG_INTANGIBLE)
DEBUG_FREE_MOVE = 0x0000130F, -- (0x10F | FLAG_STATIONARY | FLAG_INTANGIBLE)
STANDING_DEATH = 0x00021311, -- (0x111 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
QUICKSAND_DEATH = 0x00021312, -- (0x112 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
ELECTROCUTION = 0x00021313, -- (0x113 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
SUFFOCATION = 0x00021314, -- (0x114 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
DEATH_ON_STOMACH = 0x00021315, -- (0x115 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
DEATH_ON_BACK = 0x00021316, -- (0x116 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
EATEN_BY_BUBBA = 0x00021317, -- (0x117 | FLAG_STATIONARY | FLAG_INTANGIBLE | FLAG_INVULNERABLE)
END_PEACH_CUTSCENE = 0x00001918, -- (0x118 | FLAG_AIR | FLAG_INTANGIBLE)
CREDITS_CUTSCENE = 0x00001319, -- (0x119 | FLAG_STATIONARY | FLAG_INTANGIBLE)
END_WAVING_CUTSCENE = 0x0000131A, -- (0x11A | FLAG_STATIONARY | FLAG_INTANGIBLE)
PULLING_DOOR = 0x00001320, -- (0x120 | FLAG_STATIONARY | FLAG_INTANGIBLE)
PUSHING_DOOR = 0x00001321, -- (0x121 | FLAG_STATIONARY | FLAG_INTANGIBLE)
WARP_DOOR_SPAWN = 0x00001322, -- (0x122 | FLAG_STATIONARY | FLAG_INTANGIBLE)
EMERGE_FROM_PIPE = 0x00001923, -- (0x123 | FLAG_AIR | FLAG_INTANGIBLE)
SPAWN_SPIN_AIRBORNE = 0x00001924, -- (0x124 | FLAG_AIR | FLAG_INTANGIBLE)
SPAWN_SPIN_LANDING = 0x00001325, -- (0x125 | FLAG_STATIONARY | FLAG_INTANGIBLE)
EXIT_AIRBORNE = 0x00001926, -- (0x126 | FLAG_AIR | FLAG_INTANGIBLE)
EXIT_LAND_SAVE_DIALOG = 0x00001327, -- (0x127 | FLAG_STATIONARY | FLAG_INTANGIBLE)
DEATH_EXIT = 0x00001928, -- (0x128 | FLAG_AIR | FLAG_INTANGIBLE)
UNUSED_DEATH_EXIT = 0x00001929, -- (0x129 | FLAG_AIR | FLAG_INTANGIBLE)
FALLING_DEATH_EXIT = 0x0000192A, -- (0x12A | FLAG_AIR | FLAG_INTANGIBLE)
SPECIAL_EXIT_AIRBORNE = 0x0000192B, -- (0x12B | FLAG_AIR | FLAG_INTANGIBLE)
SPECIAL_DEATH_EXIT = 0x0000192C, -- (0x12C | FLAG_AIR | FLAG_INTANGIBLE)
FALLING_EXIT_AIRBORNE = 0x0000192D, -- (0x12D | FLAG_AIR | FLAG_INTANGIBLE)
UNLOCKING_KEY_DOOR = 0x0000132E, -- (0x12E | FLAG_STATIONARY | FLAG_INTANGIBLE)
UNLOCKING_STAR_DOOR = 0x0000132F, -- (0x12F | FLAG_STATIONARY | FLAG_INTANGIBLE)
ENTERING_STAR_DOOR = 0x00001331, -- (0x131 | FLAG_STATIONARY | FLAG_INTANGIBLE)
SPAWN_NO_SPIN_AIRBORNE = 0x00001932, -- (0x132 | FLAG_AIR | FLAG_INTANGIBLE)
SPAWN_NO_SPIN_LANDING = 0x00001333, -- (0x133 | FLAG_STATIONARY | FLAG_INTANGIBLE)
BBH_ENTER_JUMP = 0x00001934, -- (0x134 | FLAG_AIR | FLAG_INTANGIBLE)
BBH_ENTER_SPIN = 0x00001535, -- (0x135 | FLAG_MOVING | FLAG_INTANGIBLE)
TELEPORT_FADE_OUT = 0x00001336, -- (0x136 | FLAG_STATIONARY | FLAG_INTANGIBLE)
TELEPORT_FADE_IN = 0x00001337, -- (0x137 | FLAG_STATIONARY | FLAG_INTANGIBLE)
SHOCKED = 0x00020338, -- (0x138 | FLAG_STATIONARY | FLAG_INVULNERABLE)
SQUISHED = 0x00020339, -- (0x139 | FLAG_STATIONARY | FLAG_INVULNERABLE)
HEAD_STUCK_IN_GROUND = 0x0002033A, -- (0x13A | FLAG_STATIONARY | FLAG_INVULNERABLE)
BUTT_STUCK_IN_GROUND = 0x0002033B, -- (0x13B | FLAG_STATIONARY | FLAG_INVULNERABLE)
FEET_STUCK_IN_GROUND = 0x0002033C, -- (0x13C | FLAG_STATIONARY | FLAG_INVULNERABLE)
PUTTING_ON_CAP = 0x0000133D, -- (0x13D | FLAG_STATIONARY | FLAG_INTANGIBLE)
-- group 0x140: "automatic" actions
HOLDING_POLE = 0x08100340, -- (0x140 | FLAG_STATIONARY | FLAG_ON_POLE | FLAG_PAUSE_EXIT)
GRAB_POLE_SLOW = 0x00100341, -- (0x141 | FLAG_STATIONARY | FLAG_ON_POLE)
GRAB_POLE_FAST = 0x00100342, -- (0x142 | FLAG_STATIONARY | FLAG_ON_POLE)
CLIMBING_POLE = 0x00100343, -- (0x143 | FLAG_STATIONARY | FLAG_ON_POLE)
TOP_OF_POLE_TRANSITION = 0x00100344, -- (0x144 | FLAG_STATIONARY | FLAG_ON_POLE)
TOP_OF_POLE = 0x00100345, -- (0x145 | FLAG_STATIONARY | FLAG_ON_POLE)
START_HANGING = 0x08200348, -- (0x148 | FLAG_STATIONARY | FLAG_HANGING | FLAG_PAUSE_EXIT)
HANGING = 0x00200349, -- (0x149 | FLAG_STATIONARY | FLAG_HANGING)
HANG_MOVING = 0x0020054A, -- (0x14A | FLAG_MOVING | FLAG_HANGING)
LEDGE_GRAB = 0x0800034B, -- (0x14B | FLAG_STATIONARY | FLAG_PAUSE_EXIT)
LEDGE_CLIMB_SLOW = 0x0000054C, -- (0x14C | FLAG_MOVING)
LEDGE_CLIMB_DOWN = 0x0000054D, -- (0x14D | FLAG_MOVING)
LEDGE_CLIMB_FAST = 0x0000054E, -- (0x14E | FLAG_MOVING)
GRABBED = 0x00020370, -- (0x170 | FLAG_STATIONARY | FLAG_INVULNERABLE)
IN_CANNON = 0x00001371, -- (0x171 | FLAG_STATIONARY | FLAG_INTANGIBLE)
TORNADO_TWIRLING = 0x10020372, -- (0x172 | FLAG_STATIONARY | FLAG_INVULNERABLE | FLAG_SWIMMING_OR_FLYING)
-- group 0x180: object actions
PUNCHING = 0x00800380, -- (0x180 | FLAG_STATIONARY | FLAG_ATTACKING)
PICKING_UP = 0x00000383, -- (0x183 | FLAG_STATIONARY)
DIVE_PICKING_UP = 0x00000385, -- (0x185 | FLAG_STATIONARY)
STOMACH_SLIDE_STOP = 0x00000386, -- (0x186 | FLAG_STATIONARY)
PLACING_DOWN = 0x00000387, -- (0x187 | FLAG_STATIONARY)
THROWING = 0x80000588, -- (0x188 | FLAG_MOVING | FLAG_THROWING)
HEAVY_THROW = 0x80000589, -- (0x189 | FLAG_MOVING | FLAG_THROWING)
PICKING_UP_BOWSER = 0x00000390, -- (0x190 | FLAG_STATIONARY)
HOLDING_BOWSER = 0x00000391, -- (0x191 | FLAG_STATIONARY)
RELEASING_BOWSER = 0x00000392, -- (0x192 | FLAG_STATIONARY)
}
| 7,809 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Buttons.lua | --!strict
return {
A_BUTTON = 0x8000,
B_BUTTON = 0x4000,
L_TRIG = 0x0020,
R_TRIG = 0x0010,
Z_TRIG = 0x2000,
START_BUTTON = 0x1000,
U_JPAD = 0x0800,
L_JPAD = 0x0200,
R_JPAD = 0x0100,
D_JPAD = 0x0400,
U_CBUTTONS = 0x0008,
L_CBUTTONS = 0x0002,
R_CBUTTONS = 0x0001,
D_CBUTTONS = 0x0004,
}
| 149 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/InputFlags.lua | --!strict
return {
NONZERO_ANALOG = 0x0001,
A_PRESSED = 0x0002,
OFF_FLOOR = 0x0004,
ABOVE_SLIDE = 0x0008,
FIRST_PERSON = 0x0010,
NO_MOVEMENT = 0x0020,
SQUISHED = 0x0040,
A_DOWN = 0x0080,
IN_POISON_GAS = 0x0100,
IN_WATER = 0x0200,
STOMPED = 0x0400,
INTERACT_OBJ_GRABBABLE = 0x0800,
UNKNOWN_12 = 0x1000,
B_PRESSED = 0x2000,
Z_DOWN = 0x4000,
Z_PRESSED = 0x8000,
}
| 177 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Mario/Cap.lua | --!strict
return {
DEFAULT_CAP_ON = 0,
DEFAULT_CAP_OFF = 1,
WING_CAP_ON = 2,
WING_CAP_OFF = 3,
}
| 39 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Mario/Flags.lua | --!strict
local MarioFlags = {
NORMAL_CAP = 0x00000001,
VANISH_CAP = 0x00000002,
METAL_CAP = 0x00000004,
WING_CAP = 0x00000008,
CAP_ON_HEAD = 0x00000010,
CAP_IN_HAND = 0x00000020,
METAL_SHOCK = 0x00000040,
TELEPORTING = 0x00000080,
MOVING_UP_IN_AIR = 0x00000100,
ACTION_SOUND_PLAYED = 0x00010000,
MARIO_SOUND_PLAYED = 0x00020000,
FALLING_FAR = 0x00040000,
PUNCHING = 0x00100000,
KICKING = 0x00200000,
TRIPPING = 0x00400000,
}
MarioFlags.SPECIAL_CAPS = MarioFlags.VANISH_CAP + MarioFlags.METAL_CAP + MarioFlags.WING_CAP
MarioFlags.CAPS = MarioFlags.NORMAL_CAP + MarioFlags.SPECIAL_CAPS
return MarioFlags
| 239 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Mario/Hands.lua | --!strict
return {
FISTS = 0,
OPEN = 1,
PEACE_SIGN = 2,
HOLDING_CAP = 3,
HOLDING_WING_CAP = 4,
RIGHT_OPEN = 5,
}
| 52 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Mario/Input.lua | --!strict
return {
NONZERO_ANALOG = 0x0001,
A_PRESSED = 0x0002,
OFF_FLOOR = 0x0004,
ABOVE_SLIDE = 0x0008,
FIRST_PERSON = 0x0010,
NO_MOVEMENT = 0x0020,
SQUISHED = 0x0040,
A_DOWN = 0x0080,
IN_POISON_GAS = 0x0100,
IN_WATER = 0x0200,
STOMPED = 0x0400,
INTERACT_OBJ_GRABBABLE = 0x0800,
B_PRESSED = 0x2000,
Z_DOWN = 0x4000,
Z_PRESSED = 0x8000,
}
| 166 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/ParticleFlags.lua | --!strict
return {
DUST = bit32.lshift(1, 0),
VERTICAL_STAR = bit32.lshift(1, 1),
SPARKLES = bit32.lshift(1, 3),
HORIZONTAL_STAR = bit32.lshift(1, 4),
BUBBLE = bit32.lshift(1, 5),
WATER_SPLASH = bit32.lshift(1, 6),
IDLE_WATER_WAVE = bit32.lshift(1, 7),
SHALLOW_WATER_WAVE = bit32.lshift(1, 8),
PLUNGE_BUBBLE = bit32.lshift(1, 9),
WAVE_TRAIL = bit32.lshift(1, 10),
FIRE = bit32.lshift(1, 11),
SHALLOW_WATER_SPLASH = bit32.lshift(1, 12),
LEAF = bit32.lshift(1, 13),
SNOW = bit32.lshift(1, 14),
DIRT = bit32.lshift(1, 15),
MIST_CIRCLE = bit32.lshift(1, 16),
BREATH = bit32.lshift(1, 17),
TRIANGLE = bit32.lshift(1, 18),
}
| 272 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Steps/Air.lua | --!strict
return {
NONE = 0,
LANDED = 1,
HIT_WALL = 2,
GRABBED_LEDGE = 3,
GRABBED_CEILING = 4,
HIT_LAVA_WALL = 6,
CHECK_LEDGE_GRAB = 1,
CHECK_HANG = 2,
}
| 72 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/Steps/Ground.lua | --!strict
return {
LEFT_GROUND = 0,
NONE = 1,
HIT_WALL = 2,
HIT_WALL_STOP_QSTEPS = 2,
HIT_WALL_CONTINUE_QSTEPS = 3,
}
| 49 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/SurfaceClass.lua | --!strict
return {
DEFAULT = 0x0000,
VERY_SLIPPERY = 0x0013,
SLIPPERY = 0x0014,
NOT_SLIPPERY = 0x0015,
}
| 54 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/TerrainType.lua | --!strict
local TerrainType = {
DEFAULT = 0,
GRASS = 1,
WATER = 2,
STONE = 3,
SPOOKY = 4,
SNOW = 5,
ICE = 6,
SAND = 7,
METAL = 8,
}
TerrainType.FROM_MATERIAL = {
[Enum.Material.Mud] = TerrainType.GRASS,
[Enum.Material.Grass] = TerrainType.GRASS,
[Enum.Material.Ground] = TerrainType.GRASS,
[Enum.Material.LeafyGrass] = TerrainType.GRASS,
[Enum.Material.Ice] = TerrainType.ICE,
[Enum.Material.Marble] = TerrainType.ICE,
[Enum.Material.Glacier] = TerrainType.ICE,
[Enum.Material.Wood] = TerrainType.SPOOKY,
[Enum.Material.WoodPlanks] = TerrainType.SPOOKY,
[Enum.Material.Foil] = TerrainType.METAL,
[Enum.Material.Metal] = TerrainType.METAL,
[Enum.Material.DiamondPlate] = TerrainType.METAL,
[Enum.Material.CorrodedMetal] = TerrainType.METAL,
[Enum.Material.Rock] = TerrainType.STONE,
[Enum.Material.Salt] = TerrainType.STONE,
[Enum.Material.Brick] = TerrainType.STONE,
[Enum.Material.Slate] = TerrainType.STONE,
[Enum.Material.Basalt] = TerrainType.STONE,
[Enum.Material.Pebble] = TerrainType.STONE,
[Enum.Material.Granite] = TerrainType.STONE,
[Enum.Material.Sandstone] = TerrainType.STONE,
[Enum.Material.Cobblestone] = TerrainType.STONE,
[Enum.Material.CrackedLava] = TerrainType.STONE,
[Enum.Material.Snow] = TerrainType.SNOW,
[Enum.Material.Sand] = TerrainType.SAND,
[Enum.Material.Water] = TerrainType.WATER,
[Enum.Material.Fabric] = TerrainType.SNOW,
}
return TerrainType
| 460 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Enums/init.lua | --!strict
local Enums = {
Action = require(script.Action),
Buttons = require(script.Buttons),
ActionFlags = require(script.Action.Flags),
ActionGroups = require(script.Action.Groups),
MarioCap = require(script.Mario.Cap),
MarioEyes = require(script.Mario.Eyes),
MarioFlags = require(script.Mario.Flags),
MarioHands = require(script.Mario.Hands),
MarioInput = require(script.Mario.Input),
AirStep = require(script.Steps.Air),
WaterStep = require(script.Steps.Water),
GroundStep = require(script.Steps.Ground),
FloorType = require(script.FloorType),
InputFlags = require(script.InputFlags),
ModelFlags = require(script.ModelFlags),
SurfaceClass = require(script.SurfaceClass),
TerrainType = require(script.TerrainType),
ParticleFlags = require(script.ParticleFlags),
}
local nameIndex: { [any]: { [number]: string } } = {}
function Enums.GetName(map, value): string
if not nameIndex[map] then
local index = {}
for name, value in pairs(map) do
index[value] = name
end
nameIndex[map] = index
end
return nameIndex[map][value]
end
return table.freeze(Enums)
| 268 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Mario/Airborne/init.server.lua | --!strict
local System = require(script.Parent)
local Animations = System.Animations
local Sounds = System.Sounds
local Enums = System.Enums
local Util = System.Util
local Action = Enums.Action
local ActionFlags = Enums.ActionFlags
local AirStep = Enums.AirStep
local MarioEyes = Enums.MarioEyes
local InputFlags = Enums.InputFlags
local MarioFlags = Enums.MarioFlags
local ParticleFlags = Enums.ParticleFlags
type Mario = System.Mario
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Helpers
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local function stopRising(m: Mario)
if m.Velocity.Y > 0 then
m.Velocity *= Vector3.new(1, 0, 1)
end
end
local function playFlipSounds(m: Mario, frame1: number, frame2: number, frame3: number)
local animFrame = m.AnimFrame
if animFrame == frame1 or animFrame == frame2 or animFrame == frame3 then
m:PlaySound(Sounds.ACTION_SPIN)
end
end
local function playKnockbackSound(m: Mario)
if m.ActionArg == 0 and math.abs(m.ForwardVel) >= 28 then
m:PlaySoundIfNoFlag(Sounds.MARIO_DOH, MarioFlags.MARIO_SOUND_PLAYED)
else
m:PlaySoundIfNoFlag(Sounds.MARIO_UH, MarioFlags.MARIO_SOUND_PLAYED)
end
end
local function lavaBoostOnWall(m: Mario)
local wall = m.Wall
if wall then
local angle = Util.Atan2s(wall.Normal.Z, wall.Normal.X)
m.FaceAngle = Util.SetY(m.FaceAngle, angle)
end
if m.ForwardVel < 24 then
m.ForwardVel = 24
end
if not m.Flags:Has(MarioFlags.METAL_CAP) then
m.HurtCounter += if m.Flags:Has(MarioFlags.CAP_ON_HEAD) then 12 else 18
end
m:PlaySound(Sounds.MARIO_ON_FIRE)
m:SetAction(Action.LAVA_BOOST, 1)
end
local function checkFallDamage(m: Mario, hardFallAction: number): boolean
local fallHeight = m.PeakHeight - m.Position.Y
local damageHeight = 1150
if m.Action() == Action.TWIRLING then
return false
end
if m.Velocity.Y < -55 and fallHeight > 3000 then
m.HurtCounter += if m.Flags:Has(MarioFlags.CAP_ON_HEAD) then 16 else 24
m:PlaySound(Sounds.MARIO_ATTACKED)
m:SetAction(hardFallAction, 4)
elseif fallHeight > damageHeight and not m:FloorIsSlippery() then
m.HurtCounter += if m.Flags:Has(MarioFlags.CAP_ON_HEAD) then 8 else 12
m:PlaySound(Sounds.MARIO_ATTACKED)
m.SquishTimer = 30
end
return false
end
local function checkKickOrDiveInAir(m: Mario): boolean
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(if m.ForwardVel > 28 then Action.DIVE else Action.JUMP_KICK)
end
return false
end
local function updateAirWithTurn(m: Mario)
local dragThreshold = if m.Action() == Action.LONG_JUMP then 48 else 32
m.ForwardVel = Util.ApproachFloat(m.ForwardVel, 0, 0.35)
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
local intendedDYaw = m.IntendedYaw - m.FaceAngle.Y
local intendedMag = m.IntendedMag / 32
m.ForwardVel += 1.5 * Util.Coss(intendedDYaw) * intendedMag
m.FaceAngle += Vector3int16.new(0, 512 * Util.Sins(intendedDYaw) * intendedMag, 0)
end
if m.ForwardVel > dragThreshold then
m.ForwardVel -= 1
end
if m.ForwardVel < -16 then
m.ForwardVel += 2
end
m.SlideVelX = m.ForwardVel * Util.Sins(m.FaceAngle.Y)
m.SlideVelZ = m.ForwardVel * Util.Coss(m.FaceAngle.Y)
m.Velocity = Vector3.new(m.SlideVelX, m.Velocity.Y, m.SlideVelZ)
end
local function updateAirWithoutTurn(m: Mario)
local dragThreshold = 32
if m.Action() == Action.LONG_JUMP then
dragThreshold = 48
end
local sidewaysSpeed = 0
m.ForwardVel = Util.ApproachFloat(m.ForwardVel, 0, 0.35)
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
local intendedDYaw = m.IntendedYaw - m.FaceAngle.Y
local intendedMag = m.IntendedMag / 32
m.ForwardVel += intendedMag * Util.Coss(intendedDYaw) * 1.5
sidewaysSpeed = intendedMag * Util.Sins(intendedDYaw) * 10
end
--! Uncapped air speed. Net positive when moving forward.
if m.ForwardVel > dragThreshold then
m.ForwardVel -= 1
end
if m.ForwardVel < -16 then
m.ForwardVel += 2
end
m.SlideVelX = m.ForwardVel * Util.Sins(m.FaceAngle.Y)
m.SlideVelZ = m.ForwardVel * Util.Coss(m.FaceAngle.Y)
m.SlideVelX += sidewaysSpeed * Util.Sins(m.FaceAngle.Y + 0x4000)
m.SlideVelZ += sidewaysSpeed * Util.Coss(m.FaceAngle.Y + 0x4000)
m.Velocity = Vector3.new(m.SlideVelX, m.Velocity.Y, m.SlideVelZ)
end
local function updateLavaBoostOrTwirling(m: Mario)
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
local intendedDYaw = m.IntendedYaw - m.FaceAngle.Y
local intendedMag = m.IntendedMag / 32
m.ForwardVel += Util.Coss(intendedDYaw) * intendedMag
m.FaceAngle += Vector3int16.new(0, Util.Sins(intendedDYaw) * intendedMag * 1024, 0)
if m.ForwardVel < 0 then
m.FaceAngle += Vector3int16.new(0, 0x8000, 0)
m.ForwardVel *= -1
end
if m.ForwardVel > 32 then
m.ForwardVel -= 2
end
end
m.SlideVelX = m.ForwardVel * Util.Sins(m.FaceAngle.Y)
m.SlideVelZ = m.ForwardVel * Util.Coss(m.FaceAngle.Y)
m.Velocity = Vector3.new(m.SlideVelX, m.Velocity.Y, m.SlideVelZ)
end
local function updateFlyingYaw(m: Mario)
local targetYawVel = -Util.SignedShort(m.Controller.StickX * (m.ForwardVel / 4))
if targetYawVel > 0 then
if m.AngleVel.Y < 0 then
m.AngleVel += Vector3int16.new(0, 0x40, 0)
if m.AngleVel.Y > 0x10 then
m.AngleVel = Util.SetY(m.AngleVel, 0x10)
end
else
local y = Util.ApproachInt(m.AngleVel.Y, targetYawVel, 0x10, 0x20)
m.AngleVel = Util.SetY(m.AngleVel, y)
end
elseif targetYawVel < 0 then
if m.AngleVel.Y > 0 then
m.AngleVel -= Vector3int16.new(0, 0x40, 0)
if m.AngleVel.Y < -0x10 then
m.AngleVel = Util.SetY(m.AngleVel, -0x10)
end
else
local y = Util.ApproachInt(m.AngleVel.Y, targetYawVel, 0x20, 0x10)
m.AngleVel = Util.SetY(m.AngleVel, y)
end
else
local y = Util.ApproachInt(m.AngleVel.Y, 0, 0x40)
m.AngleVel = Util.SetY(m.AngleVel, y)
end
m.FaceAngle += Vector3int16.new(0, m.AngleVel.Y, 0)
m.FaceAngle = Util.SetZ(m.FaceAngle, 20 * -m.AngleVel.Y)
end
local function updateFlyingPitch(m: Mario)
local targetPitchVel = -Util.SignedShort(m.Controller.StickY * (m.ForwardVel / 5))
if targetPitchVel > 0 then
if m.AngleVel.X < 0 then
m.AngleVel += Vector3int16.new(0x40, 0, 0)
if m.AngleVel.X > 0x20 then
m.AngleVel = Util.SetX(m.AngleVel, 0x20)
end
else
local x = Util.ApproachInt(m.AngleVel.X, targetPitchVel, 0x20, 0x40)
m.AngleVel = Util.SetX(m.AngleVel, x)
end
elseif targetPitchVel < 0 then
if m.AngleVel.X > 0 then
m.AngleVel -= Vector3int16.new(0x40, 0, 0)
if m.AngleVel.X < -0x20 then
m.AngleVel = Util.SetX(m.AngleVel, -0x20)
end
else
local x = Util.ApproachInt(m.AngleVel.X, targetPitchVel, 0x40, 0x20)
m.AngleVel = Util.SetX(m.AngleVel, x)
end
else
local x = Util.ApproachInt(m.AngleVel.X, 0, 0x40)
m.AngleVel = Util.SetX(m.AngleVel, x)
end
end
local function updateFlying(m: Mario)
updateFlyingPitch(m)
updateFlyingYaw(m)
m.ForwardVel -= 2 * (m.FaceAngle.X / 0x4000) + 0.1
m.ForwardVel -= 0.5 * (1 - Util.Coss(m.AngleVel.Y))
if m.ForwardVel < 0 then
m.ForwardVel = 0
end
if m.ForwardVel > 16 then
m.FaceAngle += Vector3int16.new((m.ForwardVel - 32) * 6, 0, 0)
elseif m.ForwardVel > 4 then
m.FaceAngle += Vector3int16.new((m.ForwardVel - 32) * 10, 0, 0)
else
m.FaceAngle -= Vector3int16.new(0x400, 0, 0)
end
m.FaceAngle += Vector3int16.new(m.AngleVel.X, 0, 0)
if m.FaceAngle.X > 0x2AAA then
m.FaceAngle = Util.SetX(m.FaceAngle, 0x2AAA)
end
if m.FaceAngle.X < -0x2AAA then
m.FaceAngle = Util.SetX(m.FaceAngle, -0x2AAA)
end
local velX = Util.Coss(m.FaceAngle.X) * Util.Sins(m.FaceAngle.Y)
m.SlideVelX = m.ForwardVel * velX
local velZ = Util.Coss(m.FaceAngle.X) * Util.Coss(m.FaceAngle.Y)
m.SlideVelZ = m.ForwardVel * velZ
local velY = Util.Sins(m.FaceAngle.X)
m.Velocity = m.ForwardVel * Vector3.new(velX, velY, velZ)
end
local function commonAirActionStep(m: Mario, landAction: number, anim: Animation, stepArg: number): number
local stepResult
do
updateAirWithoutTurn(m)
stepResult = m:PerformAirStep(stepArg)
end
if stepResult == AirStep.NONE then
m:SetAnimation(anim)
elseif stepResult == AirStep.LANDED then
if not checkFallDamage(m, Action.HARD_BACKWARD_GROUND_KB) then
m:SetAction(landAction)
end
elseif stepResult == AirStep.HIT_WALL then
m:SetAnimation(anim)
if m.ForwardVel > 16 then
m:BonkReflection()
m.FaceAngle += Vector3int16.new(0, 0x8000, 0)
if m.Wall then
m:SetAction(Action.AIR_HIT_WALL)
else
stopRising(m)
if m.ForwardVel >= 38 then
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
m:SetAction(Action.BACKWARD_AIR_KB)
else
if m.ForwardVel > 8 then
m:SetForwardVel(-8)
end
m:SetAction(Action.SOFT_BONK)
end
end
else
m:SetForwardVel(0)
end
elseif stepResult == AirStep.GRABBED_LEDGE then
m:SetAnimation(Animations.IDLE_ON_LEDGE)
m:SetAction(Action.LEDGE_GRAB)
elseif stepResult == AirStep.GRABBED_CEILING then
m:SetAction(Action.START_HANGING)
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
return stepResult
end
local function commonRolloutStep(m: Mario, anim: Animation)
local stepResult
if m.ActionState == 0 then
m.Velocity = Util.SetY(m.Velocity, 30)
m.ActionState = 1
end
m:PlaySound(Sounds.ACTION_TERRAIN_JUMP)
updateAirWithoutTurn(m)
stepResult = m:PerformAirStep()
if stepResult == AirStep.NONE then
if m.ActionState == 1 then
if m:SetAnimation(anim) == 4 then
m:PlaySound(Sounds.ACTION_SPIN)
end
else
m:SetAnimation(Animations.GENERAL_FALL)
end
elseif stepResult == AirStep.LANDED then
m:SetAction(Action.FREEFALL_LAND_STOP)
m:PlayLandingSound()
elseif stepResult == AirStep.HIT_WALL then
m:SetForwardVel(0)
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
if m.ActionState == 1 and m:IsAnimPastEnd() then
m.ActionState = 2
end
end
local function commonAirKnockbackStep(
m: Mario,
landAction: number,
hardFallAction: number,
anim: Animation,
speed: number
)
local stepResult
do
m:SetForwardVel(speed)
stepResult = m:PerformAirStep()
end
if stepResult == AirStep.NONE then
m:SetAnimation(anim)
elseif stepResult == AirStep.LANDED then
if not checkFallDamage(m, hardFallAction) then
local action = m.Action()
if action == Action.THROWN_FORWARD or action == Action.THROWN_BACKWARD then
m:SetAction(landAction, m.HurtCounter)
else
m:SetAction(landAction, m.ActionArg)
end
end
elseif stepResult == AirStep.HIT_WALL then
m:SetAnimation(Animations.BACKWARD_AIR_KB)
m:BonkReflection()
stopRising(m)
m:SetForwardVel(-speed)
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
return stepResult
end
local function checkWallKick(m: Mario)
if m.WallKickTimer ~= 0 then
if m.Input:Has(InputFlags.A_PRESSED) then
if m.PrevAction() == Action.AIR_HIT_WALL then
m.FaceAngle += Vector3int16.new(0, 0x8000, 0)
end
end
end
return false
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Actions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local AIR_STEP_CHECK_BOTH = bit32.bor(AirStep.CHECK_LEDGE_GRAB, AirStep.CHECK_HANG)
local DEF_ACTION: (number, (Mario) -> boolean) -> () = System.RegisterAction
DEF_ACTION(Action.JUMP, function(m: Mario)
if checkKickOrDiveInAir(m) then
return true
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP)
commonAirActionStep(m, Action.JUMP_LAND, Animations.SINGLE_JUMP, AIR_STEP_CHECK_BOTH)
return false
end)
DEF_ACTION(Action.DOUBLE_JUMP, function(m: Mario)
local anim = if m.Velocity.Y >= 0 then Animations.DOUBLE_JUMP_RISE else Animations.DOUBLE_JUMP_FALL
if checkKickOrDiveInAir(m) then
return true
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP, Sounds.MARIO_HOOHOO)
commonAirActionStep(m, Action.DOUBLE_JUMP_LAND, anim, AIR_STEP_CHECK_BOTH)
return false
end)
DEF_ACTION(Action.TRIPLE_JUMP, function(m: Mario)
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.DIVE)
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP)
commonAirActionStep(m, Action.TRIPLE_JUMP_LAND, Animations.TRIPLE_JUMP, 0)
playFlipSounds(m, 2, 8, 20)
return false
end)
DEF_ACTION(Action.BACKFLIP, function(m: Mario)
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP, Sounds.MARIO_YAH_WAH_HOO)
commonAirActionStep(m, Action.BACKFLIP_LAND, Animations.BACKFLIP, 0)
playFlipSounds(m, 2, 3, 17)
return false
end)
DEF_ACTION(Action.FREEFALL, function(m: Mario)
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.DIVE)
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
local anim
if m.ActionArg == 0 then
anim = Animations.GENERAL_FALL
elseif m.ActionArg == 1 then
anim = Animations.FALL_FROM_SLIDE
elseif m.ActionArg == 2 then
anim = Animations.FALL_FROM_SLIDE_KICK
end
commonAirActionStep(m, Action.FREEFALL_LAND, anim, AirStep.CHECK_LEDGE_GRAB)
return false
end)
DEF_ACTION(Action.SIDE_FLIP, function(m: Mario)
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.DIVE, 0)
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP)
commonAirActionStep(m, Action.SIDE_FLIP_LAND, Animations.SLIDEFLIP, AirStep.CHECK_LEDGE_GRAB)
if m.AnimFrame == 6 then
m:PlaySound(Sounds.ACTION_SIDE_FLIP)
end
return false
end)
DEF_ACTION(Action.WALL_KICK_AIR, function(m: Mario)
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.DIVE)
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayJumpSound()
commonAirActionStep(m, Action.JUMP_LAND, Animations.SLIDEJUMP, AirStep.CHECK_LEDGE_GRAB)
return false
end)
DEF_ACTION(Action.LONG_JUMP, function(m: Mario)
local anim = if m.LongJumpIsSlow then Animations.SLOW_LONGJUMP else Animations.FAST_LONGJUMP
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP, Sounds.MARIO_YAHOO)
commonAirActionStep(m, Action.LONG_JUMP_LAND, anim, AirStep.CHECK_LEDGE_GRAB)
return false
end)
DEF_ACTION(Action.TWIRLING, function(m: Mario)
local startTwirlYaw = m.TwirlYaw
local yawVelTarget = 0x1000
if m.Input:Has(InputFlags.A_DOWN) then
yawVelTarget = 0x2000
end
local yVel = Util.ApproachInt(m.AngleVel.Y, yawVelTarget, 0x200)
m.AngleVel = Util.SetY(m.AngleVel, yVel)
m.TwirlYaw += yVel
m:SetAnimation(if m.ActionArg == 0 then Animations.START_TWIRL else Animations.TWIRL)
if m:IsAnimPastEnd() then
m.ActionArg = 1
end
if startTwirlYaw > m.TwirlYaw then
m:PlaySound(Sounds.ACTION_TWIRL)
end
local step = m:PerformAirStep()
if step == AirStep.LANDED then
m:SetAction(Action.TWIRL_LAND)
elseif step == AirStep.HIT_WALL then
m:BonkReflection(false)
elseif step == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
m.GfxAngle += Vector3int16.new(0, m.TwirlYaw, 0)
return false
end)
DEF_ACTION(Action.DIVE, function(m: Mario)
local airStep
if m.ActionArg == 0 then
m:PlayMarioSound(Sounds.ACTION_THROW, Sounds.MARIO_HOOHOO)
else
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP)
end
m:SetAnimation(Animations.DIVE)
updateAirWithoutTurn(m)
airStep = m:PerformAirStep()
if airStep == AirStep.NONE then
if m.Velocity.Y < 0 and m.FaceAngle.X > -0x2AAA then
m.FaceAngle -= Vector3int16.new(0x200, 0, 0)
if m.FaceAngle.X < -0x2AAA then
m.FaceAngle = Util.SetX(m.FaceAngle, -0x2AAA)
end
end
m.GfxAngle = Util.SetX(m.GfxAngle, -m.FaceAngle.X)
elseif airStep == AirStep.LANDED then
if not checkFallDamage(m, Action.HARD_FORWARD_GROUND_KB) then
m:SetAction(Action.DIVE_SLIDE)
end
m.FaceAngle *= Vector3int16.new(0, 1, 1)
elseif airStep == AirStep.HIT_WALL then
m:BonkReflection(true)
m.FaceAngle *= Vector3int16.new(0, 1, 1)
stopRising(m)
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
m:SetAction(Action.BACKWARD_AIR_KB)
elseif airStep == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
return false
end)
DEF_ACTION(Action.WATER_JUMP, function(m: Mario)
if m.ForwardVel < 15 then
m:SetForwardVel(15)
end
m:PlaySound(Sounds.ACTION_WATER_EXIT)
m:SetAnimation(Animations.SINGLE_JUMP)
local step = m:PerformAirStep(AirStep.CHECK_LEDGE_GRAB)
if step == AirStep.LANDED then
m:SetAction(Action.JUMP_LAND)
elseif step == AirStep.HIT_WALL then
m:SetForwardVel(15)
elseif step == AirStep.GRABBED_LEDGE then
m:SetAnimation(Animations.IDLE_ON_LEDGE)
m:SetAction(Action.LEDGE_GRAB)
elseif step == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
return false
end)
DEF_ACTION(Action.STEEP_JUMP, function(m: Mario)
local airStep
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.DIVE)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP)
m:SetForwardVel(0.98 * m.ForwardVel)
airStep = m:PerformAirStep()
if airStep == AirStep.LANDED then
if not checkFallDamage(m, Action.HARD_BACKWARD_GROUND_KB) then
m.FaceAngle *= Vector3int16.new(0, 1, 1)
m:SetAction(if m.ForwardVel < 0 then Action.BEGIN_SLIDING else Action.JUMP_LAND)
end
elseif airStep == AirStep.HIT_WALL then
m:SetForwardVel(0)
elseif airStep == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
m:SetAnimation(Animations.SINGLE_JUMP)
m.GfxAngle = Util.SetY(m.GfxAngle, m.SteepJumpYaw)
return false
end)
DEF_ACTION(Action.GROUND_POUND, function(m: Mario)
local stepResult
local yOffset
m:PlaySoundIfNoFlag(Sounds.ACTION_THROW, MarioFlags.ACTION_SOUND_PLAYED)
if m.ActionState == 0 then
if m.ActionTimer < 10 then
yOffset = 20 - 2 * m.ActionTimer
if m.Position.Y + yOffset + 160 < m.CeilHeight then
m.Position += Vector3.new(0, yOffset, 0)
m.PeakHeight = m.Position.Y
end
end
m.Velocity = Util.SetY(m.Velocity, -50)
m:SetForwardVel(0)
m:SetAnimation(if m.ActionArg == 0 then Animations.START_GROUND_POUND else Animations.TRIPLE_JUMP_GROUND_POUND)
if m.ActionTimer == 0 then
m:PlaySound(Sounds.ACTION_SPIN)
end
m.ActionTimer += 1
m.GfxAngle = Vector3int16.new(0, m.FaceAngle.Y, 0)
if m.ActionTimer >= m.AnimFrameCount + 4 then
m:PlaySound(Sounds.MARIO_GROUND_POUND_WAH)
m.ActionState = 1
end
else
m:SetAnimation(Animations.GROUND_POUND)
stepResult = m:PerformAirStep()
if stepResult == AirStep.LANDED then
m:PlayHeavyLandingSound(Sounds.ACTION_HEAVY_LANDING)
if not checkFallDamage(m, Action.HARD_BACKWARD_GROUND_KB) then
m.ParticleFlags:Add(ParticleFlags.MIST_CIRCLE, ParticleFlags.HORIZONTAL_STAR)
m:SetAction(Action.GROUND_POUND_LAND)
end
elseif stepResult == AirStep.HIT_WALL then
m:SetForwardVel(-16)
stopRising(m)
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
m:SetAction(Action.BACKWARD_AIR_KB)
end
end
return false
end)
DEF_ACTION(Action.BURNING_JUMP, function(m: Mario)
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP)
m:SetForwardVel(m.ForwardVel)
if m:PerformAirStep() == AirStep.LANDED then
m:PlayLandingSound()
m:SetAction(Action.BURNING_GROUND)
end
m:SetAnimation(Animations.GENERAL_FALL)
m.ParticleFlags:Add(ParticleFlags.FIRE)
m:PlaySound(Sounds.MOVING_LAVA_BURN)
m.BurnTimer += 3
m.Health -= 10
if m.Health < 0x100 then
m.Health = 0xFF
end
return false
end)
DEF_ACTION(Action.BURNING_FALL, function(m: Mario)
m:SetForwardVel(m.ForwardVel)
if m:PerformAirStep() == AirStep.LANDED then
m:PlayLandingSound(Sounds.ACTION_TERRAIN_LANDING)
m:SetAction(Action.BURNING_GROUND)
end
m:SetAnimation(Animations.GENERAL_FALL)
m.ParticleFlags:Add(ParticleFlags.FIRE)
m.BurnTimer += 3
m.Health -= 10
if m.Health < 0x100 then
m.Health = 0xFF
end
return false
end)
DEF_ACTION(Action.BACKWARD_AIR_KB, function(m: Mario)
if checkWallKick(m) then
return true
end
playKnockbackSound(m)
commonAirKnockbackStep(
m,
Action.BACKWARD_GROUND_KB,
Action.HARD_BACKWARD_GROUND_KB,
Animations.BACKWARD_AIR_KB,
-16
)
return false
end)
DEF_ACTION(Action.FORWARD_AIR_KB, function(m: Mario)
if checkWallKick(m) then
return true
end
playKnockbackSound(m)
commonAirKnockbackStep(m, Action.FORWARD_GROUND_KB, Action.HARD_FORWARD_GROUND_KB, Animations.FORWARD_AIR_KB, 16)
return false
end)
DEF_ACTION(Action.HARD_BACKWARD_AIR_KB, function(m: Mario)
if checkWallKick(m) then
return true
end
playKnockbackSound(m)
commonAirKnockbackStep(
m,
Action.HARD_BACKWARD_GROUND_KB,
Action.HARD_BACKWARD_GROUND_KB,
Animations.BACKWARD_AIR_KB,
-16
)
return false
end)
DEF_ACTION(Action.HARD_FORWARD_AIR_KB, function(m: Mario)
if checkWallKick(m) then
return true
end
playKnockbackSound(m)
commonAirKnockbackStep(
m,
Action.HARD_FORWARD_GROUND_KB,
Action.HARD_FORWARD_GROUND_KB,
Animations.FORWARD_AIR_KB,
16
)
return false
end)
DEF_ACTION(Action.THROWN_BACKWARD, function(m: Mario)
local landAction = if m.ActionArg ~= 0 then Action.HARD_BACKWARD_GROUND_KB else Action.BACKWARD_GROUND_KB
m:PlaySoundIfNoFlag(Sounds.MARIO_WAAAOOOW, MarioFlags.MARIO_SOUND_PLAYED)
commonAirKnockbackStep(m, landAction, Action.HARD_BACKWARD_GROUND_KB, Animations.BACKWARD_AIR_KB, m.ForwardVel)
m.ForwardVel *= 0.98
return false
end)
DEF_ACTION(Action.THROWN_FORWARD, function(m: Mario)
local landAction = if m.ActionArg ~= 0 then Action.HARD_FORWARD_GROUND_KB else Action.FORWARD_GROUND_KB
m:PlaySoundIfNoFlag(Sounds.MARIO_WAAAOOOW, MarioFlags.MARIO_SOUND_PLAYED)
if
commonAirKnockbackStep(m, landAction, Action.HARD_FORWARD_GROUND_KB, Animations.FORWARD_AIR_KB, m.ForwardVel)
== AirStep.NONE
then
local pitch = Util.Atan2s(m.ForwardVel, -m.Velocity.Y)
if pitch > 0x1800 then
pitch = 0x1800
end
m.GfxAngle = Util.SetX(m.GfxAngle, pitch + 0x1800)
end
m.ForwardVel *= 0.98
return false
end)
DEF_ACTION(Action.SOFT_BONK, function(m: Mario)
if checkWallKick(m) then
return true
end
playKnockbackSound(m)
commonAirKnockbackStep(
m,
Action.FREEFALL_LAND,
Action.HARD_BACKWARD_GROUND_KB,
Animations.GENERAL_FALL,
m.ForwardVel
)
return false
end)
DEF_ACTION(Action.AIR_HIT_WALL, function(m: Mario)
m.ActionTimer += 1
if m.ActionTimer <= 2 then
if m.Input:Has(InputFlags.A_PRESSED) then
m.Velocity = Util.SetY(m.Velocity, 52)
m.FaceAngle += Vector3int16.new(0, 0x8000, 0)
return m:SetAction(Action.WALL_KICK_AIR)
end
elseif m.ForwardVel >= 38 then
m.WallKickTimer = 5
if m.Velocity.Y > 0 then
m.Velocity = Util.SetY(m.Velocity, 0)
end
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
return m:SetAction(Action.BACKWARD_AIR_KB)
else
m.WallKickTimer = 5
if m.Velocity.Y > 0 then
m.Velocity = Util.SetY(m.Velocity, 0)
end
if m.ForwardVel > 8 then
m:SetForwardVel(-8)
end
return m:SetAction(Action.SOFT_BONK)
end
return m:SetAnimation(Animations.START_WALLKICK) > 0
end)
DEF_ACTION(Action.FORWARD_ROLLOUT, function(m: Mario)
commonRolloutStep(m, Animations.FORWARD_SPINNING)
return false
end)
DEF_ACTION(Action.BACKWARD_ROLLOUT, function(m: Mario)
commonRolloutStep(m, Animations.BACKWARD_SPINNING)
return false
end)
DEF_ACTION(Action.BUTT_SLIDE_AIR, function(m: Mario)
local stepResult
m.ActionTimer += 1
if m.ActionTimer > 30 and m.Position.Y - m.FloorHeight > 500 then
return m:SetAction(Action.FREEFALL, 1)
end
updateAirWithTurn(m)
stepResult = m:PerformAirStep()
if stepResult == AirStep.LANDED then
if m.ActionState == 0 and m.Velocity.Y < 0 then
local floor = m.Floor
if floor and floor.Normal.Y > 0.9848077 then
m.Velocity *= Vector3.new(1, -0.5, 1)
m.ActionState = 1
else
m:SetAction(Action.BUTT_SLIDE)
end
else
m:SetAction(Action.BUTT_SLIDE)
end
m:PlayLandingSound()
elseif stepResult == AirStep.HIT_WALL then
stopRising(m)
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
m:SetAction(Action.BACKWARD_AIR_KB)
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
m:SetAnimation(Animations.SLIDE)
return false
end)
DEF_ACTION(Action.LAVA_BOOST, function(m: Mario)
local stepResult
m:PlaySoundIfNoFlag(Sounds.MARIO_ON_FIRE, MarioFlags.MARIO_SOUND_PLAYED)
if not m.Input:Has(InputFlags.NONZERO_ANALOG) then
m.ForwardVel = Util.ApproachFloat(m.ForwardVel, 0, 0.35)
end
updateLavaBoostOrTwirling(m)
stepResult = m:PerformAirStep()
if stepResult == AirStep.LANDED then
local floor = m.Floor
local floorType: Enum.Material?
if floor then
floorType = floor.Material
end
if floorType == Enum.Material.CrackedLava then
m.ActionState = 0
if not m.Flags:Has(MarioFlags.METAL_CAP) then
m.HurtCounter += if m.Flags:Has(MarioFlags.CAP_ON_HEAD) then 12 else 18
end
m.Velocity = Util.SetY(m.Velocity, 84)
m:PlaySound(Sounds.MARIO_ON_FIRE)
else
m:PlayHeavyLandingSound(Sounds.ACTION_TERRAIN_BODY_HIT_GROUND)
if m.ActionState < 2 and m.Velocity.Y < 0 then
m.Velocity *= Vector3.new(1, -0.4, 1)
m:SetForwardVel(m.ForwardVel / 2)
m.ActionState += 1
else
m:SetAction(Action.LAVA_BOOST_LAND)
end
end
elseif stepResult == AirStep.HIT_WALL then
m:BonkReflection()
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
m:SetAnimation(Animations.FIRE_LAVA_BURN)
if not m.Flags:Has(MarioFlags.METAL_CAP) and m.Velocity.Y > 0 then
m.ParticleFlags:Add(ParticleFlags.FIRE)
if m.ActionState == 0 then
m:PlaySound(Sounds.MOVING_LAVA_BURN)
end
end
m.BodyState.EyeState = MarioEyes.DEAD
return false
end)
DEF_ACTION(Action.SLIDE_KICK, function(m: Mario)
local stepResult
if m.ActionState == 0 and m.ActionTimer == 0 then
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP, Sounds.MARIO_HOOHOO)
m:SetAnimation(Animations.SLIDE_KICK)
end
m.ActionTimer += 1
if m.ActionTimer > 30 and m.Position.Y - m.FloorHeight > 500 then
return m:SetAction(Action.FREEFALL, 2)
end
updateAirWithoutTurn(m)
stepResult = m:PerformAirStep()
if stepResult == AirStep.NONE then
if m.ActionState == 0 then
local tilt = Util.Atan2s(m.ForwardVel, -m.Velocity.Y)
if tilt > 0x1800 then
tilt = 0x1800
end
m.GfxAngle = Util.SetX(m.GfxAngle, tilt)
end
elseif stepResult == AirStep.LANDED then
if m.ActionState == 0 and m.Velocity.Y < 0 then
m.Velocity *= Vector3.new(1, -0.5, 1)
m.ActionState = 1
m.ActionTimer = 0
else
m:SetAction(Action.SLIDE_KICK_SLIDE)
end
m:PlayLandingSound()
elseif stepResult == AirStep.HIT_WALL then
stopRising(m)
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
m:SetAction(Action.BACKWARD_AIR_KB)
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
return false
end)
DEF_ACTION(Action.JUMP_KICK, function(m: Mario)
local stepResult
if m.ActionState == 0 then
m:PlaySoundIfNoFlag(Sounds.MARIO_PUNCH_HOO, MarioFlags.MARIO_SOUND_PLAYED)
m.AnimReset = true
m:SetAnimation(Animations.AIR_KICK)
m.ActionState = 1
end
local animFrame = m.AnimFrame
if animFrame == 0 then
m.BodyState.PunchType = 2
m.BodyState.PunchTimer = 6
end
if animFrame >= 0 and animFrame < 8 then
m.Flags:Add(MarioFlags.KICKING)
end
updateAirWithoutTurn(m)
stepResult = m:PerformAirStep()
if stepResult == AirStep.LANDED then
if not checkFallDamage(m, Action.HARD_BACKWARD_GROUND_KB) then
m:SetAction(Action.FREEFALL_LAND)
end
elseif stepResult == AirStep.HIT_WALL then
m:SetForwardVel(0)
end
return false
end)
DEF_ACTION(Action.FLYING, function(m: Mario)
local startPitch = m.FaceAngle.X
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
if not m.Flags:Has(MarioFlags.WING_CAP) then
return m:SetAction(Action.FREEFALL)
end
if m.ActionState == 0 then
if m.ActionArg == 0 then
m:SetAnimation(Animations.FLY_FROM_CANNON)
else
m:SetAnimation(Animations.FORWARD_SPINNING_FLIP)
if m.AnimFrame == 1 then
m:PlaySound(Sounds.ACTION_SPIN)
end
end
if m:IsAnimAtEnd() then
m:SetAnimation(Animations.WING_CAP_FLY)
m.ActionState = 1
end
end
local stepResult
do
updateFlying(m)
stepResult = m:PerformAirStep()
end
if stepResult == AirStep.NONE then
m.GfxAngle = Util.SetX(m.GfxAngle, -m.FaceAngle.X)
m.GfxAngle = Util.SetZ(m.GfxAngle, m.FaceAngle.Z)
m.ActionTimer = 0
elseif stepResult == AirStep.LANDED then
m:SetAction(Action.DIVE_SLIDE)
m:SetAnimation(Animations.DIVE)
m:SetAnimToFrame(7)
m.FaceAngle *= Vector3int16.new(0, 1, 1)
elseif stepResult == AirStep.HIT_WALL then
if m.Wall then
m:SetForwardVel(-16)
m.FaceAngle *= Vector3int16.new(0, 1, 1)
stopRising(m)
m:PlaySound(if m.Flags:Has(MarioFlags.METAL_CAP) then Sounds.ACTION_METAL_BONK else Sounds.ACTION_BONK)
m.ParticleFlags:Add(ParticleFlags.VERTICAL_STAR)
m:SetAction(Action.BACKWARD_AIR_KB)
else
m.ActionTimer += 1
if m.ActionTimer == 0 then
m:PlaySound(Sounds.ACTION_HIT)
end
if m.ActionTimer == 30 then
m.ActionTimer = 0
end
m.FaceAngle -= Vector3int16.new(0x200, 0, 0)
if m.FaceAngle.X < -0x2AAA then
m.FaceAngle = Util.SetX(m.FaceAngle, -0x2AAA)
end
m.GfxAngle = Util.SetX(m.GfxAngle, -m.FaceAngle.X)
m.GfxAngle = Util.SetZ(m.GfxAngle, m.FaceAngle.Z)
end
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
if m.FaceAngle.X > 0x800 and m.ForwardVel >= 48 then
m.ParticleFlags:Add(ParticleFlags.DUST)
end
if startPitch <= 0 and m.FaceAngle.X > 0 and m.ForwardVel >= 48 then
m:PlaySound(Sounds.ACTION_FLYING_FAST)
m:PlaySound(Sounds.MARIO_YAHOO_WAHA_YIPPEE)
end
m:PlaySound(Sounds.MOVING_FLYING)
m:AdjustSoundForSpeed()
return false
end)
DEF_ACTION(Action.FLYING_TRIPLE_JUMP, function(m: Mario)
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.DIVE)
end
if m.Input:Has(InputFlags.Z_PRESSED) then
return m:SetAction(Action.GROUND_POUND)
end
m:PlayMarioSound(Sounds.ACTION_TERRAIN_JUMP, Sounds.MARIO_YAHOO)
if m.ActionState == 0 then
m:SetAnimation(Animations.TRIPLE_JUMP_FLY)
if m.AnimFrame == 7 then
m:PlaySound(Sounds.ACTION_SPIN)
end
if m:IsAnimPastEnd() then
m:SetAnimation(Animations.FORWARD_SPINNING)
m.ActionState = 1
end
end
if m.ActionState == 1 and m.AnimFrame == 1 then
m:PlaySound(Sounds.ACTION_SPIN)
end
if m.Velocity.Y < 4 then
if m.ForwardVel < 32 then
m:SetForwardVel(32)
end
m:SetAction(Action.FLYING, 1)
end
m.ActionTimer += 1
local stepResult
do
updateAirWithoutTurn(m)
stepResult = m:PerformAirStep()
end
if stepResult == AirStep.LANDED then
if not checkFallDamage(m, Action.HARD_BACKWARD_GROUND_KB) then
m:SetAction(Action.DOUBLE_JUMP_LAND)
end
elseif stepResult == AirStep.HIT_WALL then
m:BonkReflection()
elseif stepResult == AirStep.HIT_LAVA_WALL then
lavaBoostOnWall(m)
end
return false
end)
DEF_ACTION(Action.SPAWN_SPIN_AIRBORNE, function(m: Mario)
m:SetForwardVel(m.ForwardVel)
if m:PerformAirStep() == AirStep.LANDED then
m:PlayLandingSound(Sounds.ACTION_TERRAIN_LANDING)
m:SetAction(Action.SPAWN_SPIN_LANDING)
end
if m.ActionState == 0 and m.Position.Y - m.FloorHeight > 300 then
if m:SetAnimation(Animations.FORWARD_SPINNING) == 0 then
m:PlaySound(Sounds.ACTION_SPIN)
end
else
m.ActionState = 1
m:SetAnimation(Animations.GENERAL_FALL)
end
return false
end)
DEF_ACTION(Action.SPAWN_SPIN_LANDING, function(m: Mario)
m:StopAndSetHeightToFloor()
m:SetAnimation(Animations.GENERAL_LAND)
if m:IsAnimAtEnd() then
m:SetAction(Action.IDLE)
end
return false
end)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 10,003 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Mario/Automatic/init.server.lua | --!strict
local System = require(script.Parent)
local Animations = System.Animations
local Sounds = System.Sounds
local Enums = System.Enums
local Util = System.Util
local Action = Enums.Action
local ActionFlags = Enums.ActionFlags
local ActionGroup = Enums.ActionGroups
local AirStep = Enums.AirStep
local MarioEyes = Enums.MarioEyes
local InputFlags = Enums.InputFlags
local MarioFlags = Enums.MarioFlags
local ParticleFlags = Enums.ParticleFlags
type Mario = System.Mario
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Helpers
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local function letGoOfLedge(m: Mario)
local floorHeight
m.Velocity *= Vector3.new(1, 0, 1)
m.ForwardVel = -8
local x = 60 * Util.Sins(m.FaceAngle.Y)
local z = 60 * Util.Coss(m.FaceAngle.Y)
m.Position -= Vector3.new(x, 0, z)
floorHeight = Util.FindFloor(m.Position)
if floorHeight < m.Position.Y - 100 then
m.Position -= (Vector3.yAxis * 100)
else
m.Position = Util.SetY(m.Position, floorHeight)
end
return m:SetAction(Action.SOFT_BONK)
end
local function climbUpLedge(m: Mario)
local x = 14 * Util.Sins(m.FaceAngle.Y)
local z = 14 * Util.Coss(m.FaceAngle.Y)
m:SetAnimation(Animations.IDLE_HEAD_LEFT)
m.Position += Vector3.new(x, 0, z)
end
local function updateLedgeClimb(m: Mario, anim: Animation, endAction: number)
m:StopAndSetHeightToFloor()
m:SetAnimation(anim)
if m:IsAnimAtEnd() then
m:SetAction(endAction)
if endAction == Action.IDLE then
climbUpLedge(m)
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Actions
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local DEF_ACTION: (number, (Mario) -> boolean) -> () = System.RegisterAction
DEF_ACTION(Action.LEDGE_GRAB, function(m: Mario)
local intendedDYaw = m.IntendedYaw - m.FaceAngle.Y
local hasSpaceForMario = m.CeilHeight - m.FloorHeight >= 160
if m.ActionTimer < 10 then
m.ActionTimer += 1
end
if m.Floor and m.Floor.Normal.Y < 0.9063078 then
return letGoOfLedge(m)
end
if m.Input:Has(InputFlags.Z_PRESSED, InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
if m.Input:Has(InputFlags.A_PRESSED) and hasSpaceForMario then
return m:SetAction(Action.LEDGE_CLIMB_FAST)
end
if m.Input:Has(InputFlags.STOMPED) then
return letGoOfLedge(m)
end
if m.ActionTimer == 10 and m.Input:Has(InputFlags.NONZERO_ANALOG) then
if math.abs(intendedDYaw) <= 0x4000 then
if hasSpaceForMario then
return m:SetAction(Action.LEDGE_CLIMB_SLOW)
end
else
return letGoOfLedge(m)
end
end
local heightAboveFloor = m.Position.Y - m:FindFloorHeightRelativePolar(-0x8000, 30)
if hasSpaceForMario and heightAboveFloor < 100 then
return m:SetAction(Action.LEDGE_CLIMB_FAST)
end
if m.ActionArg == 0 then
m:PlaySoundIfNoFlag(Sounds.MARIO_WHOA, MarioFlags.MARIO_SOUND_PLAYED)
end
m:StopAndSetHeightToFloor()
m:SetAnimation(Animations.IDLE_ON_LEDGE)
return false
end)
DEF_ACTION(Action.LEDGE_CLIMB_SLOW, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
if m.ActionTimer >= 28 then
if
m.Input:Has(InputFlags.NONZERO_ANALOG, InputFlags.A_PRESSED, InputFlags.OFF_FLOOR, InputFlags.ABOVE_SLIDE)
then
climbUpLedge(m)
return m:CheckCommonActionExits()
end
end
if m.ActionTimer == 10 then
m:PlaySoundIfNoFlag(Sounds.MARIO_EEUH, MarioFlags.MARIO_SOUND_PLAYED)
end
updateLedgeClimb(m, Animations.SLOW_LEDGE_GRAB, Action.IDLE)
return false
end)
DEF_ACTION(Action.LEDGE_CLIMB_DOWN, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
m:PlaySoundIfNoFlag(Sounds.MARIO_WHOA, MarioFlags.MARIO_SOUND_PLAYED)
updateLedgeClimb(m, Animations.CLIMB_DOWN_LEDGE, Action.LEDGE_GRAB)
m.ActionArg = 1
return false
end)
DEF_ACTION(Action.LEDGE_CLIMB_FAST, function(m: Mario)
if m.Input:Has(InputFlags.OFF_FLOOR) then
return letGoOfLedge(m)
end
m:PlaySoundIfNoFlag(Sounds.MARIO_UH2, MarioFlags.MARIO_SOUND_PLAYED)
updateLedgeClimb(m, Animations.FAST_LEDGE_GRAB, Action.IDLE)
if m.AnimFrame == 8 then
m:PlayLandingSound(Sounds.ACTION_TERRAIN_LANDING)
end
return false
end)
| 1,213 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Mario/Submerged/init.server.lua | local System = require(script.Parent)
local Animations = System.Animations
local Sounds = System.Sounds
local Enums = System.Enums
local Util = System.Util
local Action = Enums.Action
local AirStep = Enums.AirStep
local WaterStep = Enums.WaterStep
local GroundStep = Enums.GroundStep
local InputFlags = Enums.InputFlags
local MarioFlags = Enums.MarioFlags
local ActionFlags = Enums.ActionFlags
local ParticleFlags = Enums.ParticleFlags
local MIN_SWIM_STRENGTH = 160
local MIN_SWIM_SPEED = 16
local sWasAtSurface = false
local sSwimStrength = MIN_SWIM_STRENGTH
local sBobTimer = 0
local sBobIncrement = 0
local sBobHeight = 0
type Mario = System.Mario
local function setSwimmingAtSurfaceParticles(m: Mario, particleFlag: number)
local atSurface = m.Position.Y >= m.WaterLevel - 130
if atSurface then
m.ParticleFlags:Add(particleFlag)
if atSurface ~= sWasAtSurface then
m:PlaySound(Sounds.ACTION_UNKNOWN431)
end
end
sWasAtSurface = atSurface
end
local function swimmingNearSurface(m: Mario)
if m.Flags:Has(MarioFlags.METAL_CAP) then
return false
end
return (m.WaterLevel - 80) - m.Position.Y < 400
end
local function getBuoyancy(m: Mario)
local buoyancy = 0
if m.Flags:Has(MarioFlags.METAL_CAP) then
if m.Action:Has(ActionFlags.INVULNERABLE) then
buoyancy = -2
else
buoyancy = -18
end
elseif swimmingNearSurface(m) then
buoyancy = 1.25
elseif not m.Action:Has(ActionFlags.MOVING) then
buoyancy = -2
end
return buoyancy
end
local function performWaterFullStep(m: Mario, nextPos: Vector3)
local adjusted, wall = Util.FindWallCollisions(nextPos, 10, 110)
nextPos = adjusted
local floorHeight, floor = Util.FindFloor(nextPos)
local ceilHeight = Util.FindCeil(nextPos, floorHeight)
if floor == nil then
return WaterStep.CANCELLED
end
if nextPos.Y >= floorHeight then
if ceilHeight - nextPos.Y >= 160 then
m.Position = nextPos
m.Floor = floor
m.FloorHeight = floorHeight
if wall then
return WaterStep.HIT_WALL
else
return WaterStep.NONE
end
end
if ceilHeight - floorHeight < 160 then
return WaterStep.CANCELLED
end
--! Water ceiling downwarp
m.Position = Util.SetY(nextPos, ceilHeight - 160)
m.Floor = floor
m.FloorHeight = floorHeight
return WaterStep.HIT_CEILING
else
if ceilHeight - floorHeight < 160 then
return WaterStep.CANCELLED
end
m.Position = Util.SetY(nextPos, floorHeight)
m.Floor = floor
m.FloorHeight = floorHeight
return WaterStep.HIT_FLOOR
end
end
local function applyWaterCurrent(m: Mario, step: Vector3): Vector3
-- TODO: Implement if actually needed.
-- This normally handles whirlpools and moving
-- water, neither of which I think I'll be using.
return step
end
local function performWaterStep(m: Mario)
local nextPos = m.Position
local step = m.Velocity
if m.Action:Has(ActionFlags.SWIMMING) then
step = applyWaterCurrent(m, step)
end
nextPos += step
if nextPos.Y > m.WaterLevel - 80 then
nextPos = Util.SetY(nextPos, m.WaterLevel - 80)
m.Velocity *= Vector3.new(1, 0, 1)
end
local stepResult = performWaterFullStep(m, nextPos)
m.GfxAngle = m.FaceAngle * Vector3int16.new(-1, 1, 1)
m.GfxPos = m.Position
return stepResult
end
local function updateWaterPitch(m: Mario)
local gfxAngle = m.GfxAngle
if gfxAngle.X > 0 then
local angle = 60 * Util.Sins(gfxAngle.X) * Util.Sins(gfxAngle.X)
m.GfxPos += Vector3.new(0, angle, 0)
end
if gfxAngle.X < 0 then
local x = gfxAngle.X * 6 / 10
gfxAngle = Util.SetX(gfxAngle, x)
end
if gfxAngle.X > 0 then
local x = gfxAngle.X * 10 / 8
gfxAngle = Util.SetX(gfxAngle, x)
end
m.GfxAngle = gfxAngle
end
local function stationarySlowDown(m: Mario)
local buoyancy = getBuoyancy(m)
m.AngleVel *= Vector3int16.new(0, 0, 1)
m.ForwardVel = Util.ApproachFloat(m.ForwardVel, 0, 1, 1)
local faceY = m.FaceAngle.Y
local faceX = Util.ApproachInt(m.FaceAngle.X, 0, 0x200, 0x200)
local faceZ = Util.ApproachInt(m.FaceAngle.Z, 0, 0x100, 0x100)
local velY = Util.ApproachFloat(m.Velocity.Y, buoyancy, 2, 1)
local velX = m.ForwardVel * Util.Coss(faceX) * Util.Sins(faceY)
local velZ = m.ForwardVel * Util.Coss(faceX) * Util.Coss(faceY)
m.FaceAngle = Vector3int16.new(faceX, faceY, faceZ)
m.Velocity = Vector3.new(velX, velY, velZ)
end
local function updateSwimmingSpeed(m: Mario, maybeDecelThreshold: number?)
local buoyancy = getBuoyancy(m)
local decelThreshold = maybeDecelThreshold or MIN_SWIM_SPEED
if m.Action:Has(ActionFlags.STATIONARY) then
m.ForwardVel -= 2
end
m.ForwardVel = math.clamp(m.ForwardVel, 0, 28)
if m.ForwardVel > decelThreshold then
m.ForwardVel -= 0.5
end
m.Velocity = Vector3.new(
m.ForwardVel * Util.Coss(m.FaceAngle.X) * Util.Sins(m.FaceAngle.Y),
m.ForwardVel * Util.Sins(m.FaceAngle.X) + buoyancy,
m.ForwardVel * Util.Coss(m.FaceAngle.X) * Util.Coss(m.FaceAngle.Y)
)
end
local function updateSwimmingYaw(m: Mario)
local targetYawVel = -Util.SignedShort(10 * m.Controller.StickX)
if targetYawVel > 0 then
if m.AngleVel.Y < 0 then
m.AngleVel += Vector3int16.new(0, 0x40, 0)
if m.AngleVel.Y > 0x10 then
m.AngleVel = Util.SetY(m.AngleVel, 0x10)
end
else
local velY = Util.ApproachInt(m.AngleVel.Y, targetYawVel, 0x10, 0x20)
m.AngleVel = Util.SetY(m.AngleVel, velY)
end
elseif targetYawVel < 0 then
if m.AngleVel.Y > 0 then
m.AngleVel -= Vector3int16.new(0, 0x40, 0)
if m.AngleVel.Y < -0x10 then
m.AngleVel = Util.SetY(m.AngleVel, -0x10)
end
else
local velY = Util.ApproachInt(m.AngleVel.Y, targetYawVel, 0x20, 0x10)
m.AngleVel = Util.SetY(m.AngleVel, velY)
end
else
local velY = Util.ApproachInt(m.AngleVel.Y, 0, 0x40, 0x40)
m.AngleVel = Util.SetY(m.AngleVel, velY)
end
m.FaceAngle += Vector3int16.new(0, m.AngleVel.Y, 0)
m.FaceAngle = Util.SetZ(m.FaceAngle, -m.AngleVel.Y * 8)
end
local function updateSwimmingPitch(m: Mario)
local targetPitch = -Util.SignedShort(252 * m.Controller.StickY)
-- stylua: ignore
local pitchVel = if m.FaceAngle.X < 0
then 0x100
else 0x200
if m.FaceAngle.X < targetPitch then
m.FaceAngle += Vector3int16.new(pitchVel, 0, 0)
if m.FaceAngle.X > targetPitch then
m.FaceAngle = Util.SetX(m.FaceAngle, targetPitch)
end
elseif m.FaceAngle.X > targetPitch then
m.FaceAngle -= Vector3int16.new(pitchVel, 0, 0)
if m.FaceAngle.X < targetPitch then
m.FaceAngle = Util.SetX(m.FaceAngle, targetPitch)
end
end
end
local function commonIdleStep(m: Mario, anim: Animation, maybeAccel: number?)
local accel = maybeAccel or 0
local bodyState = m.BodyState
local headAngleX = bodyState.HeadAngle.X
updateSwimmingYaw(m)
updateSwimmingPitch(m)
updateSwimmingSpeed(m)
performWaterStep(m)
updateWaterPitch(m)
if m.FaceAngle.X > 0 then
headAngleX = Util.ApproachInt(headAngleX, m.FaceAngle.X / 2, 0x80, 0x200)
else
headAngleX = Util.ApproachInt(headAngleX, 0, 0x200, 0x200)
end
if accel == 0 then
m:SetAnimation(anim)
else
m:SetAnimationWithAccel(anim, accel)
end
setSwimmingAtSurfaceParticles(m, ParticleFlags.IDLE_WATER_WAVE)
end
local function resetBobVariables(m: Mario)
sBobTimer = 0
sBobIncrement = 0x800
sBobHeight = m.FaceAngle.X / 256 + 20
end
local function surfaceSwimBob(m: Mario)
if sBobIncrement ~= 0 and m.Position.Y > m.WaterLevel - 85 and m.FaceAngle.Y >= 0 then
sBobTimer += sBobIncrement
if sBobTimer >= 0 then
m.GfxPos += Vector3.new(0, sBobHeight * Util.Sins(sBobTimer), 0)
return
end
end
sBobIncrement = 0
end
local function commonSwimmingStep(m: Mario, swimStrength: number)
local waterStep
updateSwimmingYaw(m)
updateSwimmingPitch(m)
updateSwimmingSpeed(m, swimStrength / 10)
-- do water step
waterStep = performWaterStep(m)
if waterStep == WaterStep.HIT_FLOOR then
local floorPitch = -m:FindFloorSlope(-0x8000)
if m.FaceAngle.X < floorPitch then
m.FaceAngle = Util.SetX(m.FaceAngle, floorPitch)
end
elseif waterStep == WaterStep.HIT_CEILING then
if m.FaceAngle.Y > -0x3000 then
m.FaceAngle -= Vector3int16.new(0, 0x100, 0)
end
elseif waterStep == WaterStep.HIT_WALL then
if m.Controller.StickY == 0 then
if m.FaceAngle.X > 0 then
m.FaceAngle += Vector3int16.new(0x200, 0, 0)
if m.FaceAngle.X > 0x3F00 then
m.FaceAngle = Util.SetX(m.FaceAngle, 0x3F00)
end
else
m.FaceAngle -= Vector3int16.new(0x200, 0, 0)
if m.FaceAngle.X < -0x3F00 then
m.FaceAngle = Util.SetX(m.FaceAngle, -0x3F00)
end
end
end
end
local headAngle = m.BodyState.HeadAngle
updateWaterPitch(m)
local angleX = Util.ApproachInt(headAngle.X, 0, 0x200, 0x200)
m.BodyState.HeadAngle = Util.SetX(headAngle, angleX)
surfaceSwimBob(m)
setSwimmingAtSurfaceParticles(m, ParticleFlags.WAVE_TRAIL)
end
local function playSwimmingNoise(m: Mario)
local animFrame = m.AnimFrame
if animFrame == 0 or animFrame == 12 then
m:PlaySound(Sounds.ACTION_SWIM_KICK)
end
end
local function checkWaterJump(m: Mario)
local probe = Util.SignedInt(m.Position.Y + 1.5)
if m.Input:Has(InputFlags.A_PRESSED) then
if probe >= m.WaterLevel - 80 and m.FaceAngle.X >= 0 and m.Controller.StickY < -60 then
m.AngleVel = Vector3int16.new()
m.Velocity = Util.SetY(m.Velocity, 62)
return m:SetAction(Action.WATER_JUMP)
end
end
return false
end
local function playMetalWaterJumpingSound(m: Mario, landing: boolean)
if not m.Flags:Has(MarioFlags.ACTION_SOUND_PLAYED) then
m.ParticleFlags:Add(ParticleFlags.MIST_CIRCLE)
end
m:PlaySoundIfNoFlag(
landing and Sounds.ACTION_METAL_LAND_WATER or Sounds.ACTION_METAL_JUMP_WATER,
MarioFlags.ACTION_SOUND_PLAYED
)
end
local function playMetalWaterWalkingSound(m: Mario)
if m:IsAnimPastFrame(10) or m:IsAnimPastFrame(49) then
m:PlaySound(Sounds.ACTION_METAL_STEP_WATER)
m.ParticleFlags:Add(ParticleFlags.DUST)
end
end
local function updateMetalWaterWalkingSpeed(m: Mario)
local val = m.IntendedMag / 1.5
local floor = m.Floor
if m.ForwardVel <= 0 then
m.ForwardVel += 1.1
elseif m.ForwardVel <= val then
m.ForwardVel += 1.1 - m.ForwardVel / 43
elseif floor and floor.Normal.Y >= 0.95 then
m.ForwardVel -= 1
end
if m.ForwardVel > 32 then
m.ForwardVel = 32
end
local faceY = m.IntendedYaw - Util.ApproachInt(Util.SignedShort(m.IntendedYaw - m.FaceAngle.Y), 0, 0x800, 0x800)
m.FaceAngle = Util.SetY(m.FaceAngle, faceY)
m.SlideVelX = m.ForwardVel * Util.Sins(faceY)
m.SlideVelZ = m.ForwardVel * Util.Coss(faceY)
m.Velocity = Vector3.new(m.SlideVelX, 0, m.SlideVelZ)
end
local function updateMetalWaterJumpSpeed(m: Mario)
local waterSurface = m.WaterLevel - 100
if m.Velocity.Y > 0 and m.Position.Y > waterSurface then
return true
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
local intendedDYaw = Util.SignedShort(m.IntendedYaw - m.FaceAngle.Y)
m.ForwardVel += 0.8 * Util.Coss(intendedDYaw)
m.FaceAngle += Vector3int16.new(0, 0x200 * Util.Sins(intendedDYaw), 0)
else
m.ForwardVel = Util.ApproachFloat(m.ForwardVel, 0, 0.25, 0.25)
end
if m.ForwardVel > 16 then
m.ForwardVel -= 1
end
if m.ForwardVel < 0 then
m.ForwardVel += 2
end
local velY = m.Velocity.Y
local velX = m.ForwardVel * Util.Sins(m.FaceAngle.Y)
local velZ = m.ForwardVel * Util.Coss(m.FaceAngle.Y)
m.SlideVelX = velX
m.SlideVelZ = velZ
m.Velocity = Vector3.new(velX, velY, velZ)
return false
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local DEF_ACTION: (number, (Mario) -> boolean) -> () = System.RegisterAction
DEF_ACTION(Action.WATER_IDLE, function(m: Mario)
local val = 0x10000
if m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.METAL_WATER_FALLING, 1)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.WATER_PUNCH)
end
if m.Input:Has(InputFlags.A_PRESSED) then
return m:SetAction(Action.BREASTSTROKE)
end
if m.FaceAngle.X < -0x1000 then
val = 0x30000
end
commonIdleStep(m, Animations.WATER_IDLE, val)
return false
end)
DEF_ACTION(Action.WATER_ACTION_END, function(m: Mario)
if m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.METAL_WATER_FALLING, 1)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.WATER_PUNCH)
end
if m.Input:Has(InputFlags.A_PRESSED) then
return m:SetAction(Action.BREASTSTROKE)
end
commonIdleStep(m, Animations.WATER_ACTION_END)
if m:IsAnimAtEnd() then
m:SetAction(Action.WATER_IDLE)
end
return false
end)
DEF_ACTION(Action.BREASTSTROKE, function(m: Mario)
if m.ActionArg == 0 then
sSwimStrength = MIN_SWIM_STRENGTH
end
if m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.METAL_WATER_FALLING, 1)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.WATER_PUNCH)
end
m.ActionTimer += 1
if m.ActionTimer == 14 then
return m:SetAction(Action.FLUTTER_KICK)
end
if checkWaterJump(m) then
return true
end
if m.ActionTimer < 6 then
m.ForwardVel += 0.5
end
if m.ActionTimer >= 9 then
m.ForwardVel += 1.5
end
if m.ActionTimer >= 2 then
if m.ActionTimer < 6 and m.Input:Has(InputFlags.A_PRESSED) then
m.ActionState = 1
end
if m.ActionTimer == 9 and m.ActionState == 1 then
m:SetAnimToFrame(0)
m.ActionState = 0
m.ActionTimer = 1
sSwimStrength = MIN_SWIM_STRENGTH
end
end
if m.ActionTimer == 1 then
m:PlaySound(sSwimStrength == MIN_SWIM_STRENGTH and Sounds.ACTION_SWIM or Sounds.ACTION_SWIM_FAST)
resetBobVariables(m)
end
m:SetAnimation(Animations.SWIM_PART1)
commonSwimmingStep(m, sSwimStrength)
return false
end)
DEF_ACTION(Action.SWIMMING_END, function(m: Mario)
if m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.METAL_WATER_FALLING, 1)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.WATER_PUNCH)
end
if m.ActionTimer >= 15 then
return m:SetAction(Action.WATER_ACTION_END)
end
if checkWaterJump(m) then
return true
end
if m.Input:Has(InputFlags.A_DOWN) and m.ActionTimer >= 7 then
if m.ActionTimer == 7 and sSwimStrength < 280 then
sSwimStrength += 10
end
return m:SetAction(Action.BREASTSTROKE, 1)
end
if m.ActionTimer >= 7 then
sSwimStrength = MIN_SWIM_STRENGTH
end
m.ActionTimer += 1
m.ForwardVel -= 0.25
m:SetAnimation(Animations.SWIM_PART2)
commonSwimmingStep(m, sSwimStrength)
return false
end)
DEF_ACTION(Action.FLUTTER_KICK, function(m: Mario)
if m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.METAL_WATER_FALLING, 1)
end
if m.Input:Has(InputFlags.B_PRESSED) then
return m:SetAction(Action.WATER_PUNCH)
end
if not m.Input:Has(InputFlags.A_DOWN) then
if m.ActionTimer == 0 and sSwimStrength < 280 then
sSwimStrength += 10
end
return m:SetAction(Action.SWIMMING_END)
end
m.ForwardVel = Util.ApproachFloat(m.ForwardVel, 12, 0.1, 0.15)
m.ActionTimer = 1
sSwimStrength = MIN_SWIM_STRENGTH
if m.ForwardVel < 14 then
playSwimmingNoise(m)
m:SetAnimation(Animations.FLUTTERKICK)
end
commonSwimmingStep(m, sSwimStrength)
return false
end)
DEF_ACTION(Action.WATER_PUNCH, function(m: Mario)
if m.ForwardVel < 7 then
m.ForwardVel += 1
end
updateSwimmingYaw(m)
updateSwimmingPitch(m)
updateSwimmingSpeed(m)
performWaterStep(m)
updateWaterPitch(m)
local headAngle = m.BodyState.HeadAngle
local angleX = Util.ApproachInt(headAngle.X, 0, 0x200, 0x200)
m.BodyState.HeadAngle = Util.SetX(headAngle, angleX)
m:PlaySoundIfNoFlag(Sounds.ACTION_SWIM, MarioFlags.ACTION_SOUND_PLAYED)
if m.ActionState == 0 then
m:SetAnimation(Animations.WATER_GRAB_OBJ_PART1)
if m:IsAnimAtEnd() then
m.ActionState = 1
end
elseif m.ActionState == 1 then
m:SetAnimation(Animations.WATER_GRAB_OBJ_PART2)
if m:IsAnimAtEnd() then
m:SetAction(Action.WATER_ACTION_END)
end
end
return false
end)
DEF_ACTION(Action.WATER_PLUNGE, function(m: Mario)
local stepResult
local endVSpeed = swimmingNearSurface(m) and 0 or -5
local hasMetalCap = m.Flags:Has(MarioFlags.METAL_CAP)
local isDiving = m.PrevAction:Has(ActionFlags.DIVING) or m.Input:Has(InputFlags.A_DOWN)
m.ActionTimer += 1
stationarySlowDown(m)
stepResult = performWaterStep(m)
if m.ActionState == 0 then
m:PlaySound(Sounds.ACTION_WATER_ENTER)
if m.PeakHeight - m.Position.Y > 1150 then
m:PlaySound(Sounds.MARIO_HAHA)
end
m.ParticleFlags:Add(ParticleFlags.WATER_SPLASH)
m.ActionState = 1
end
if stepResult == WaterStep.HIT_FLOOR or m.Velocity.Y >= endVSpeed or m.ActionTimer > 20 then
if hasMetalCap then
m:SetAction(Action.METAL_WATER_FALLING)
elseif isDiving then
m:SetAction(Action.FLUTTER_KICK)
else
m:SetAction(Action.WATER_ACTION_END)
end
sBobIncrement = 0
end
if hasMetalCap then
m:SetAnimation(Animations.GENERAL_FALL)
elseif isDiving then
m:SetAnimation(Animations.FLUTTERKICK)
else
m:SetAnimation(Animations.WATER_ACTION_END)
end
m.Flags:Add(ParticleFlags.PLUNGE_BUBBLE)
return false
end)
DEF_ACTION(Action.METAL_WATER_STANDING, function(m: Mario)
if not m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.WATER_IDLE)
end
if m.Input:Has(InputFlags.A_PRESSED) then
return m:SetAction(Action.METAL_WATER_JUMP)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
return m:SetAction(Action.METAL_WATER_WALKING)
end
if m.ActionState == 0 then
m:SetAnimation(Animations.IDLE_HEAD_LEFT)
elseif m.ActionState == 1 then
m:SetAnimation(Animations.IDLE_HEAD_RIGHT)
elseif m.ActionState == 2 then
m:SetAnimation(Animations.IDLE_HEAD_CENTER)
end
if m:IsAnimAtEnd() then
m.ActionState += 1
if m.ActionState == 3 then
m.ActionState = 0
end
end
m:StopAndSetHeightToFloor()
if m.Position.Y >= m.WaterLevel - 150 then
m.ParticleFlags:Add(ParticleFlags.IDLE_WATER_WAVE)
end
return false
end)
DEF_ACTION(Action.METAL_WATER_WALKING, function(m: Mario)
if not m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.WATER_IDLE)
end
if m.Input:Has(InputFlags.A_PRESSED) then
return m:SetAction(Action.METAL_WATER_JUMP)
end
if m.Input:Has(InputFlags.NO_MOVEMENT) then
return m:SetAction(Action.METAL_WATER_STANDING)
end
local accel = Util.SignedInt(m.ForwardVel / 4 * 0x10000)
local groundStep
if accel < 0x1000 then
accel = 0x1000
end
m:SetAnimationWithAccel(Animations.WALKING, accel)
playMetalWaterWalkingSound(m)
updateMetalWaterWalkingSpeed(m)
groundStep = m:PerformGroundStep()
if groundStep == GroundStep.LEFT_GROUND then
m:SetAction(Action.METAL_WATER_FALLING, 1)
elseif groundStep == GroundStep.HIT_WALL then
m.ForwardVel = 0
end
return false
end)
DEF_ACTION(Action.METAL_WATER_JUMP, function(m: Mario)
local airStep
if not m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.WATER_IDLE)
end
if updateMetalWaterJumpSpeed(m) then
return m:SetAction(Action.WATER_JUMP, 1)
end
playMetalWaterJumpingSound(m, false)
m:SetAnimation(Animations.SINGLE_JUMP)
airStep = m:PerformAirStep()
if airStep == AirStep.LANDED then
m:SetAction(Action.METAL_WATER_JUMP_LAND)
elseif airStep == AirStep.HIT_WALL then
m.ForwardVel = 0
end
return false
end)
DEF_ACTION(Action.METAL_WATER_FALLING, function(m: Mario)
if not m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.WATER_IDLE)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
m.FaceAngle += Vector3int16.new(0, 0x400 * Util.Sins(m.IntendedYaw - m.FaceAngle.Y), 0)
end
m:SetAnimation(m.ActionArg == 0 and Animations.GENERAL_FALL or Animations.FALL_FROM_WATER)
stationarySlowDown(m)
if bit32.btest(performWaterStep(m), WaterStep.HIT_FLOOR) then
m:SetAction(Action.METAL_WATER_FALL_LAND)
end
return false
end)
DEF_ACTION(Action.METAL_WATER_JUMP_LAND, function(m: Mario)
playMetalWaterJumpingSound(m, true)
if not m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.WATER_IDLE)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
return m:SetAction(Action.METAL_WATER_WALKING)
end
m:StopAndSetHeightToFloor()
m:SetAnimation(Animations.LAND_FROM_SINGLE_JUMP)
if m:IsAnimAtEnd() then
return m:SetAction(Action.METAL_WATER_STANDING)
end
return false
end)
DEF_ACTION(Action.METAL_WATER_FALL_LAND, function(m: Mario)
playMetalWaterJumpingSound(m, true)
if not m.Flags:Has(MarioFlags.METAL_CAP) then
return m:SetAction(Action.WATER_IDLE)
end
if m.Input:Has(InputFlags.NONZERO_ANALOG) then
return m:SetAction(Action.METAL_WATER_WALKING)
end
m:StopAndSetHeightToFloor()
m:SetAnimation(Animations.GENERAL_LAND)
if m:IsAnimAtEnd() then
return m:SetAction(Action.METAL_WATER_STANDING)
end
return false
end)
| 6,401 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Types/Flags.lua | --!strict
local Flags = {}
Flags.__index = Flags
export type Flags = { Value: number }
export type Class = typeof(setmetatable({} :: Flags, Flags))
function Flags.new(...: number): Class
local flags = { Value = bit32.bor(...) }
return setmetatable(flags, Flags)
end
function Flags.__call(self: Class): number
return self.Value
end
function Flags.Get(self: Class): number
return self.Value
end
function Flags.Set(self: Class, ...: number)
self.Value = bit32.bor(...)
end
function Flags.Copy(self: Class, flags: Class)
self.Value = flags.Value
end
function Flags.Add(self: Class, ...: number)
self.Value = bit32.bor(self.Value, ...)
end
function Flags.Has(self: Class, ...: number): boolean
local mask = bit32.bor(...)
return bit32.btest(self.Value, mask)
end
function Flags.Remove(self: Class, ...: number)
local mask = bit32.bor(...)
local invert = bit32.bnot(mask)
self.Value = bit32.band(self.Value, invert)
end
function Flags.Band(self: Class, ...: number)
self.Value = bit32.band(self.Value, ...)
end
function Flags.Clear(self: Class)
self.Value = 0
end
return Flags
| 278 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/Types/init.lua | --!strict
local Flags = require(script.Flags)
export type Flags = Flags.Class
export type Controller = {
RawStickX: number,
RawStickY: number,
StickX: number,
StickY: number,
StickMag: number,
ButtonDown: Flags,
ButtonPressed: Flags,
}
export type BodyState = {
Action: number,
CapState: Flags,
EyeState: number,
HandState: Flags,
WingFlutter: boolean,
ModelState: Flags,
GrabPos: number,
PunchType: number,
PunchTimer: number,
TorsoAngle: Vector3int16,
HeadAngle: Vector3int16,
HeldObjLastPos: Vector3,
}
export type MarioState = {
Input: Flags,
Flags: Flags,
Action: Flags,
PrevAction: Flags,
ParticleFlags: Flags,
HitboxHeight: number,
TerrainType: number,
HeldObj: Instance?,
ActionState: number,
ActionTimer: number,
ActionArg: number,
IntendedMag: number,
IntendedYaw: number,
InvincTimer: number,
FramesSinceA: number,
FramesSinceB: number,
WallKickTimer: number,
DoubleJumpTimer: number,
FaceAngle: Vector3int16,
AngleVel: Vector3int16,
ThrowMatrix: CFrame?,
GfxAngle: Vector3int16,
GfxPos: Vector3,
SlideYaw: number,
TwirlYaw: number,
Position: Vector3,
Velocity: Vector3,
ForwardVel: number,
SlideVelX: number,
SlideVelZ: number,
Wall: RaycastResult?,
Ceil: RaycastResult?,
Floor: RaycastResult?,
CeilHeight: number,
FloorHeight: number,
FloorAngle: number,
WaterLevel: number,
BodyState: BodyState,
Controller: Controller,
Health: number,
HurtCounter: number,
HealCounter: number,
SquishTimer: number,
CapTimer: number,
BurnTimer: number,
PeakHeight: number,
SteepJumpYaw: number,
WalkingPitch: number,
QuicksandDepth: number,
LongJumpIsSlow: boolean,
AnimCurrent: Animation?,
AnimFrameCount: number,
AnimAccel: number,
AnimAccelAssist: number,
AnimFrame: number,
AnimDirty: boolean,
AnimReset: boolean,
AnimSetFrame: number,
AnimSkipInterp: number,
}
return table.freeze({
Flags = Flags,
})
| 556 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/client/init.server.lua | --!strict
local Core = script.Parent
if Core:GetAttribute("HotLoading") then
task.wait(3)
end
for i, desc in script:GetDescendants() do
if desc:IsA("BaseScript") then
desc.Enabled = true
end
end
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local StarterGui = game:GetService("StarterGui")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ContextActionService = game:GetService("ContextActionService")
local Shared = require(Core.Shared)
local Sounds = Shared.Sounds
local Enums = require(script.Enums)
local Mario = require(script.Mario)
local Types = require(script.Types)
local Util = require(script.Util)
local Action = Enums.Action
local Buttons = Enums.Buttons
local MarioFlags = Enums.MarioFlags
local ParticleFlags = Enums.ParticleFlags
type InputType = Enum.UserInputType | Enum.KeyCode
type Controller = Types.Controller
type Mario = Mario.Class
local player: Player = assert(Players.LocalPlayer)
local mario: Mario = Mario.new()
local STEP_RATE = 30
local NULL_TEXT = `<font color="#FF0000">NULL</font>`
local FLIP = CFrame.Angles(0, math.pi, 0)
local debugStats = Instance.new("BoolValue")
debugStats.Name = "DebugStats"
debugStats.Archivable = false
debugStats.Parent = game
local PARTICLE_CLASSES = {
Fire = true,
Smoke = true,
Sparkles = true,
ParticleEmitter = true,
}
local AUTO_STATS = {
"Position",
"Velocity",
"AnimFrame",
"FaceAngle",
"ActionState",
"ActionTimer",
"ActionArg",
"ForwardVel",
"SlideVelX",
"SlideVelZ",
"CeilHeight",
"FloorHeight",
"WaterLevel",
}
local ControlModule: {
GetMoveVector: (self: any) -> Vector3,
}
while not ControlModule do
local inst = player:FindFirstChild("ControlModule", true)
if inst then
ControlModule = (require :: any)(inst)
end
task.wait(0.1)
end
-------------------------------------------------------------------------------------------------------------------------------------------------
-- Input Driver
-------------------------------------------------------------------------------------------------------------------------------------------------
-- NOTE: I had to replace the default BindAction via KeyCode and UserInputType
-- BindAction forces some mappings (such as R2 mapping to MouseButton1) which you
-- can't turn off otherwise.
local BUTTON_FEED = {}
local BUTTON_BINDS = {}
local function toStrictNumber(str: string): number
local result = tonumber(str)
return assert(result, "Invalid number!")
end
local function processAction(id: string, state: Enum.UserInputState, input: InputObject)
if id == "MarioDebug" and Core:GetAttribute("DebugToggle") then
if state == Enum.UserInputState.Begin then
local character = player.Character
if character then
local isDebug = not character:GetAttribute("Debug")
character:SetAttribute("Debug", isDebug)
end
end
else
local button = toStrictNumber(id:sub(5))
BUTTON_FEED[button] = state
end
end
local function processInput(input: InputObject, gameProcessedEvent: boolean)
if gameProcessedEvent then
return
end
if BUTTON_BINDS[input.UserInputType] ~= nil then
processAction(BUTTON_BINDS[input.UserInputType], input.UserInputState, input)
end
if BUTTON_BINDS[input.KeyCode] ~= nil then
processAction(BUTTON_BINDS[input.KeyCode], input.UserInputState, input)
end
end
UserInputService.InputBegan:Connect(processInput)
UserInputService.InputChanged:Connect(processInput)
UserInputService.InputEnded:Connect(processInput)
local function bindInput(button: number, label: string, ...: InputType)
local id = "BTN_" .. button
if UserInputService.TouchEnabled then
ContextActionService:BindAction(id, processAction, true)
ContextActionService:SetTitle(id, label)
end
for i, input in { ... } do
BUTTON_BINDS[input] = id
end
end
local function updateCollisions()
for i, player in Players:GetPlayers() do
-- stylua: ignore
local character = player.Character
local rootPart = character and character.PrimaryPart
if rootPart then
local parts = rootPart:GetConnectedParts(true)
for i, part in parts do
if part:IsA("BasePart") then
part.CanCollide = false
end
end
end
end
end
local function updateController(controller: Controller, humanoid: Humanoid?)
if not humanoid then
return
end
local moveDir = ControlModule:GetMoveVector()
local pos = Vector2.new(moveDir.X, -moveDir.Z)
local mag = 0
if pos.Magnitude > 0 then
if pos.Magnitude > 1 then
pos = pos.Unit
end
mag = pos.Magnitude
end
controller.StickMag = mag * 64
controller.StickX = pos.X * 64
controller.StickY = pos.Y * 64
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
controller.ButtonPressed:Clear()
if humanoid.Jump then
BUTTON_FEED[Buttons.A_BUTTON] = Enum.UserInputState.Begin
elseif controller.ButtonDown:Has(Buttons.A_BUTTON) then
BUTTON_FEED[Buttons.A_BUTTON] = Enum.UserInputState.End
end
local lastButtonValue = controller.ButtonDown()
for button, state in pairs(BUTTON_FEED) do
if state == Enum.UserInputState.Begin then
controller.ButtonDown:Add(button)
elseif state == Enum.UserInputState.End then
controller.ButtonDown:Remove(button)
end
end
table.clear(BUTTON_FEED)
local buttonValue = controller.ButtonDown()
controller.ButtonPressed:Set(buttonValue)
controller.ButtonPressed:Band(bit32.bxor(buttonValue, lastButtonValue))
local character = humanoid.Parent
if (character and character:GetAttribute("TAS")) or Core:GetAttribute("ToolAssistedInput") then
if not mario.Action:Has(Enums.ActionFlags.SWIMMING) then
if controller.ButtonDown:Has(Buttons.A_BUTTON) then
controller.ButtonPressed:Set(Buttons.A_BUTTON)
end
end
end
end
ContextActionService:BindAction("MarioDebug", processAction, false, Enum.KeyCode.P)
bindInput(Buttons.B_BUTTON, "B", Enum.UserInputType.MouseButton1, Enum.KeyCode.ButtonX)
bindInput(
Buttons.Z_TRIG,
"Z",
Enum.KeyCode.LeftShift,
Enum.KeyCode.RightShift,
Enum.KeyCode.ButtonL2,
Enum.KeyCode.ButtonR2
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Network Dispatch
-------------------------------------------------------------------------------------------------------------------------------------------------------------
local Commands = {}
local soundDecay = {}
local lazyNetwork = ReplicatedStorage:WaitForChild("LazyNetwork")
assert(lazyNetwork:IsA("RemoteEvent"), "bad lazyNetwork!")
local function stepDecay(sound: Sound)
local decay = soundDecay[sound]
if decay then
task.cancel(decay)
end
soundDecay[sound] = task.delay(0.1, function()
sound:Stop()
sound:Destroy()
soundDecay[sound] = nil
end)
sound.Playing = true
end
function Commands.PlaySound(player: Player, name: string)
local sound: Sound? = Sounds[name]
local character = player.Character
local rootPart = character and character.PrimaryPart
if rootPart and sound then
local oldSound: Instance? = rootPart:FindFirstChild(name)
local canPlay = true
if oldSound and oldSound:IsA("Sound") then
canPlay = false
if name:sub(1, 6) == "MOVING" or sound:GetAttribute("Decay") then
-- Keep decaying audio alive.
stepDecay(oldSound)
elseif name:sub(1, 5) == "MARIO" then
-- Restart mario sound if a 30hz interval passed.
local now = os.clock()
local lastPlay = oldSound:GetAttribute("LastPlay") or 0
if now - lastPlay >= 2 / STEP_RATE then
oldSound.TimePosition = 0
oldSound:SetAttribute("LastPlay", now)
end
else
-- Allow stacking.
canPlay = true
end
end
if canPlay then
local newSound: Sound = sound:Clone()
newSound.Parent = rootPart
newSound:Play()
if name:find("MOVING") then
-- Audio will decay if PlaySound isn't continuously called.
stepDecay(newSound)
end
newSound.Ended:Connect(function()
newSound:Destroy()
end)
newSound:SetAttribute("LastPlay", os.clock())
end
end
end
function Commands.SetParticle(player: Player, name: string, set: boolean)
local character = player.Character
local rootPart = character and character.PrimaryPart
if rootPart then
local particles = rootPart:FindFirstChild("Particles")
local inst = particles and particles:FindFirstChild(name, true)
if inst and PARTICLE_CLASSES[inst.ClassName] then
local particle = inst :: ParticleEmitter
local emit = particle:GetAttribute("Emit")
if typeof(emit) == "number" then
particle:Emit(emit)
elseif set ~= nil then
particle.Enabled = set
end
else
warn("particle not found:", name)
end
end
end
function Commands.SetTorsoAngle(player: Player, angle: Vector3int16)
local character = player.Character
local waist = character and character:FindFirstChild("Waist", true)
if waist and waist:IsA("Motor6D") then
local props = { C1 = Util.ToRotation(-angle) + waist.C1.Position }
local tween = TweenService:Create(waist, TweenInfo.new(0.1), props)
tween:Play()
end
end
function Commands.SetHeadAngle(player: Player, angle: Vector3int16)
local character = player.Character
local neck = character and character:FindFirstChild("Neck", true)
if neck and neck:IsA("Motor6D") then
local props = { C1 = Util.ToRotation(-angle) + neck.C1.Position }
local tween = TweenService:Create(neck, TweenInfo.new(0.1), props)
tween:Play()
end
end
function Commands.SetCamera(player: Player, cf: CFrame?)
local camera = workspace.CurrentCamera
if cf ~= nil then
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = cf
else
camera.CameraType = Enum.CameraType.Custom
end
end
local function processCommand(player: Player, cmd: string, ...: any)
local command = Commands[cmd]
if command then
task.spawn(command, player, ...)
else
warn("Unknown Command:", cmd, ...)
end
end
local function networkDispatch(cmd: string, ...: any)
lazyNetwork:FireServer(cmd, ...)
processCommand(player, cmd, ...)
end
local function onNetworkReceive(target: Player, cmd: string, ...: any)
if target ~= player then
processCommand(target, cmd, ...)
end
end
lazyNetwork.OnClientEvent:Connect(onNetworkReceive)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mario Driver
-------------------------------------------------------------------------------------------------------------------------------------------------------------
local lastUpdate = os.clock()
local lastHeadAngle: Vector3int16?
local lastTorsoAngle: Vector3int16?
local activeScale = 1
local subframe = 0 -- 30hz subframe
local emptyId = ""
local goalCF: CFrame
local prevCF: CFrame
local activeTrack: AnimationTrack?
local reset = Instance.new("BindableEvent")
reset.Archivable = false
reset.Parent = script
reset.Name = "Reset"
if RunService:IsStudio() then
local dummySequence = Instance.new("KeyframeSequence")
local provider = game:GetService("KeyframeSequenceProvider")
emptyId = provider:RegisterKeyframeSequence(dummySequence)
end
while not player.Character do
player.CharacterAdded:Wait()
end
local character = assert(player.Character)
local pivot = character:GetPivot()
mario.Position = Util.ToSM64(pivot.Position)
goalCF = pivot
prevCF = pivot
local function setDebugStat(key: string, value: any)
if typeof(value) == "Vector3" then
value = string.format("%.3f, %.3f, %.3f", value.X, value.Y, value.Z)
elseif typeof(value) == "Vector3int16" then
value = string.format("%i, %i, %i", value.X, value.Y, value.Z)
elseif type(value) == "number" then
value = string.format("%.3f", value)
end
debugStats:SetAttribute(key, value)
end
local function onReset()
local roblox = Vector3.yAxis * 100
local sm64 = Util.ToSM64(roblox)
local char = player.Character
if char then
local reset = char:FindFirstChild("Reset")
local cf = CFrame.new(roblox)
char:PivotTo(cf)
goalCF = cf
prevCF = cf
if reset and reset:IsA("RemoteEvent") then
reset:FireServer()
end
end
mario.SlideVelX = 0
mario.SlideVelZ = 0
mario.ForwardVel = 0
mario.IntendedYaw = 0
mario.Position = sm64
mario.Velocity = Vector3.zero
mario.FaceAngle = Vector3int16.new()
mario:SetAction(Action.SPAWN_SPIN_AIRBORNE)
end
local function getWaterLevel(pos: Vector3)
local terrain = workspace.Terrain
local voxelPos = terrain:WorldToCellPreferSolid(pos)
local voxelRegion = Region3.new(voxelPos * 4, (voxelPos + Vector3.one + (Vector3.yAxis * 3)) * 4)
voxelRegion = voxelRegion:ExpandToGrid(4)
local materials, occupancies = terrain:ReadVoxels(voxelRegion, 4)
local size: Vector3 = occupancies.Size
local waterLevel = -11000
for y = 1, size.Y do
local occupancy = occupancies[1][y][1]
local material = materials[1][y][1]
if occupancy >= 0.9 and material == Enum.Material.Water then
local top = ((voxelPos.Y * 4) + (4 * y + 2))
waterLevel = math.max(waterLevel, top / Util.Scale)
end
end
return waterLevel
end
local function update()
local character = player.Character
if not character then
return
end
local now = os.clock()
local gfxRot = CFrame.identity
local scale = character:GetScale()
if scale ~= activeScale then
local marioPos = Util.ToRoblox(mario.Position)
Util.Scale = scale / 20 -- HACK! Should this be instanced?
mario.Position = Util.ToSM64(marioPos)
activeScale = scale
end
-- Disabled for now because this causes parallel universes to break.
-- TODO: Find a better way to do two-way syncing between these values.
-- local pos = character:GetPivot().Position
-- local dist = (Util.ToRoblox(mario.Position) - pos).Magnitude
-- if dist > (scale * 20) then
-- mario.Position = Util.ToSM64(pos)
-- end
local humanoid = character:FindFirstChildOfClass("Humanoid")
local simSpeed = tonumber(character:GetAttribute("TimeScale") or nil) or 1
local robloxPos = Util.ToRoblox(mario.Position)
mario.WaterLevel = getWaterLevel(robloxPos)
Util.DebugWater(mario.WaterLevel)
subframe += (now - lastUpdate) * (STEP_RATE * simSpeed)
lastUpdate = now
if character:GetAttribute("WingCap") or Core:GetAttribute("WingCap") then
mario.Flags:Add(MarioFlags.WING_CAP)
else
mario.Flags:Remove(MarioFlags.WING_CAP)
end
if character:GetAttribute("Metal") then
mario.Flags:Add(MarioFlags.METAL_CAP)
else
mario.Flags:Remove(MarioFlags.METAL_CAP)
end
subframe = math.min(subframe, 4) -- Prevent execution runoff
while subframe >= 1 do
subframe -= 1
updateCollisions()
updateController(mario.Controller, humanoid)
mario:ExecuteAction()
local gfxPos = Util.ToRoblox(mario.Position)
gfxRot = Util.ToRotation(mario.GfxAngle)
prevCF = goalCF
goalCF = CFrame.new(gfxPos) * FLIP * gfxRot
end
if character and goalCF then
local cf = character:GetPivot()
local rootPart = character.PrimaryPart
local animator = character:FindFirstChildWhichIsA("Animator", true)
if animator and (mario.AnimDirty or mario.AnimReset) and mario.AnimFrame >= 0 then
local anim = mario.AnimCurrent
local animSpeed = 0.1 / simSpeed
if activeTrack and (activeTrack.Animation ~= anim or mario.AnimReset) then
if tostring(activeTrack.Animation) == "TURNING_PART1" then
if anim and anim.Name == "TURNING_PART2" then
mario.AnimSkipInterp = 2
animSpeed *= 2
end
end
activeTrack:Stop(animSpeed)
activeTrack = nil
end
if not activeTrack and anim then
if anim.AnimationId == "" then
if RunService:IsStudio() then
warn("!! FIXME: Empty AnimationId for", anim.Name, "will break in live games!")
end
anim.AnimationId = emptyId
end
local track = animator:LoadAnimation(anim)
track:Play(animSpeed, 1, 0)
activeTrack = track
end
if activeTrack then
local speed = mario.AnimAccel / 0x10000
if speed > 0 then
activeTrack:AdjustSpeed(speed * simSpeed)
else
activeTrack:AdjustSpeed(simSpeed)
end
end
mario.AnimDirty = false
mario.AnimReset = false
end
if activeTrack and mario.AnimSetFrame > -1 then
activeTrack.TimePosition = mario.AnimSetFrame / STEP_RATE
mario.AnimSetFrame = -1
end
if rootPart then
local particles = rootPart:FindFirstChild("Particles")
local alignPos = rootPart:FindFirstChildOfClass("AlignPosition")
local alignCF = rootPart:FindFirstChildOfClass("AlignOrientation")
local actionId = mario.Action()
local throw = mario.ThrowMatrix
if throw then
local throwPos = Util.ToRoblox(throw.Position)
goalCF = throw.Rotation * FLIP + throwPos
end
if alignCF then
local nextCF = prevCF:Lerp(goalCF, subframe)
-- stylua: ignore
cf = if mario.AnimSkipInterp > 0
then cf.Rotation + nextCF.Position
else nextCF
alignCF.CFrame = cf.Rotation
end
local isDebug = character:GetAttribute("Debug")
local limits = character:GetAttribute("EmulateLimits")
script.Util:SetAttribute("Debug", isDebug)
debugStats.Value = isDebug
if limits ~= nil then
Core:SetAttribute("TruncateBounds", limits)
end
if isDebug then
local animName = activeTrack and tostring(activeTrack.Animation)
setDebugStat("Animation", animName)
local actionName = Enums.GetName(Action, actionId)
setDebugStat("Action", actionName)
local wall = mario.Wall
setDebugStat("Wall", wall and wall.Instance.Name or NULL_TEXT)
local floor = mario.Floor
setDebugStat("Floor", floor and floor.Instance.Name or NULL_TEXT)
local ceil = mario.Ceil
setDebugStat("Ceiling", ceil and ceil.Instance.Name or NULL_TEXT)
end
for _, name in AUTO_STATS do
local value = rawget(mario :: any, name)
setDebugStat(name, value)
end
if alignPos then
alignPos.Position = cf.Position
end
local bodyState = mario.BodyState
local headAngle = bodyState.HeadAngle
local torsoAngle = bodyState.TorsoAngle
if actionId ~= Action.BUTT_SLIDE and actionId ~= Action.WALKING then
bodyState.TorsoAngle *= 0
end
if torsoAngle ~= lastTorsoAngle then
networkDispatch("SetTorsoAngle", torsoAngle)
lastTorsoAngle = torsoAngle
end
if headAngle ~= lastHeadAngle then
networkDispatch("SetHeadAngle", headAngle)
lastHeadAngle = headAngle
end
if particles then
for name, flag in pairs(ParticleFlags) do
local inst = particles:FindFirstChild(name, true)
if inst and PARTICLE_CLASSES[inst.ClassName] then
local particle = inst :: ParticleEmitter
local emit = particle:GetAttribute("Emit")
local hasFlag = mario.ParticleFlags:Has(flag)
if hasFlag then
print("SetParticle", name)
end
if emit then
if hasFlag then
networkDispatch("SetParticle", name)
end
elseif particle.Enabled ~= hasFlag then
networkDispatch("SetParticle", name, hasFlag)
end
end
end
end
for name: string, sound: Sound in pairs(Sounds) do
local looped = false
if sound:IsA("Sound") then
if sound.TimeLength == 0 then
continue
end
looped = sound.Looped
end
if sound:GetAttribute("Play") then
networkDispatch("PlaySound", sound.Name)
if not looped then
sound:SetAttribute("Play", false)
end
elseif looped then
sound:Stop()
end
end
character:PivotTo(cf)
end
end
end
reset.Event:Connect(onReset)
RunService.Heartbeat:Connect(update)
while task.wait(1) do
local success = pcall(function()
return StarterGui:SetCore("ResetButtonCallback", reset)
end)
if success then
break
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
| 5,022 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/server/LazyNetworking.server.lua | --!strict
local Validators: { [string]: (Player, ...any) -> boolean } = {}
type Echo = () -> ()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Core = script.Parent.Parent
local Shared = require(Core.Shared)
local Sounds = Shared.Sounds
local lazy = Instance.new("RemoteEvent")
lazy.Parent = ReplicatedStorage
lazy.Name = "LazyNetwork"
lazy.Archivable = false
function Validators.PlaySound(player: Player, name: string)
local sound: Instance? = Sounds[name]
if sound and sound:IsA("Sound") then
return true
end
return false
end
function Validators.SetParticle(player: Player, name: string, set: boolean?)
if typeof(name) ~= "string" then
return false
end
local character = player.Character
local rootPart = character and character.PrimaryPart
if rootPart then
local particles = rootPart:FindFirstChild("Particles")
local particle = particles and particles:FindFirstChild(name, true)
if particle then
return true
end
end
return false
end
function Validators.SetTorsoAngle(player: Player, angle: Vector3int16)
return typeof(angle) == "Vector3int16"
end
function Validators.SetHeadAngle(player: Player, angle: Vector3int16)
return typeof(angle) == "Vector3int16"
end
local function onNetworkReceive(player: Player, cmd: string, ...)
local validate = Validators[cmd]
if validate and validate(player, ...) then
lazy:FireAllClients(player, cmd, ...)
end
end
lazy.OnServerEvent:Connect(onNetworkReceive)
| 348 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/server/StarterCharacter/Appearance/init.server.lua | --!strict
local Players = game:GetService("Players")
local character: Instance = assert(script.Parent)
assert(character:IsA("Model"), "Not a character")
local player = Players:GetPlayerFromCharacter(character)
assert(player, "No player!")
local userId = player.UserId
local hDesc: HumanoidDescription?
local metalPointers = {} :: {
[MeshPart]: {
Metal: SurfaceAppearance?,
},
}
local function updateMetal(part: MeshPart)
local isMetal = character:GetAttribute("Metal")
local ptr = metalPointers[part]
if ptr == nil then
ptr = {}
metalPointers[part] = ptr
end
if isMetal and not ptr.Metal then
local surface = script.METAL_MARIO:Clone()
surface.Parent = part
ptr.Metal = surface
elseif ptr.Metal and not isMetal then
ptr.Metal:Destroy()
ptr.Metal = nil
end
end
local function onMetalChanged()
for meshPart in metalPointers do
updateMetal(meshPart)
end
end
local function onDescendantAdded(desc: Instance)
if desc:IsA("BasePart") then
if desc.CollisionGroup ~= "Player" then
local canCollide = desc:GetPropertyChangedSignal("CanCollide")
desc.CollisionGroup = "Player"
desc.CanQuery = false
desc.CanTouch = false
desc.Massless = true
canCollide:Connect(function()
desc.CanCollide = false
end)
desc.CanCollide = false
end
if desc:IsA("MeshPart") then
updateMetal(desc)
end
end
end
local function onDescendantRemoving(desc: Instance)
if desc:IsA("MeshPart") then
metalPointers[desc] = nil
end
end
local metalListener = character:GetAttributeChangedSignal("Metal")
metalListener:Connect(onMetalChanged)
for i, desc in character:GetDescendants() do
task.spawn(onDescendantAdded, desc)
end
character:SetAttribute("TimeScale", 1)
character.DescendantAdded:Connect(onDescendantAdded)
character.DescendantRemoving:Connect(onDescendantRemoving)
local function reload()
character:ScaleTo(1)
task.spawn(function()
for i = 1, 5 do
character:PivotTo(CFrame.new(0, 100, 0))
task.wait()
end
end)
for retry = 1, 10 do
local success, result = pcall(function()
return Players:GetHumanoidDescriptionFromUserId(userId)
end)
if success then
hDesc = result
break
else
task.wait(retry / 2)
end
end
if hDesc then
hDesc.HeadScale = 1.8
hDesc.WidthScale = 1.3
hDesc.DepthScale = 1.4
hDesc.HeightScale = 1.2
hDesc.BodyTypeScale = 0
hDesc.ProportionScale = 0
else
return
end
local humanoid = character:WaitForChild("Humanoid")
assert(hDesc)
if humanoid:IsA("Humanoid") then
while not humanoid.RootPart do
humanoid.Changed:Wait()
end
local rootPart = humanoid.RootPart
assert(rootPart, "No HumanoidRootPart??")
local particles = rootPart:FindFirstChild("Particles")
humanoid:ApplyDescription(hDesc)
if particles and particles:IsA("Attachment") then
local floorDec = humanoid.HipHeight + (rootPart.Size.Y / 2)
local pos = Vector3.new(0, -floorDec, 0)
rootPart.PivotOffset = CFrame.new(pos)
particles.Position = pos
end
end
end
local reset = Instance.new("RemoteEvent")
reset.Parent = character
reset.Name = "Reset"
reset.OnServerEvent:Connect(function(player)
if player == Players:GetPlayerFromCharacter(character) then
reload()
end
end)
task.spawn(reload)
| 883 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/server/StarterCharacter/init.server.lua | --!strict
local Players = game:GetService("Players")
local StarterPlayer = game:GetService("StarterPlayer")
local PhysicsService = game:GetService("PhysicsService")
local StarterCharacterScripts = StarterPlayer.StarterCharacterScripts
local hDesc = Instance.new("HumanoidDescription")
hDesc.HeightScale = 1.3
hDesc.WidthScale = 1.3
hDesc.DepthScale = 1.4
hDesc.HeadScale = 2
local character = Players:CreateHumanoidModelFromDescription(hDesc, Enum.HumanoidRigType.R15)
local bodyColors = character:FindFirstChildOfClass("BodyColors")
local animate = character:FindFirstChild("Animate")
local oldRoot = character.PrimaryPart
if animate then
animate:Destroy()
end
if oldRoot then
oldRoot:Destroy()
end
if bodyColors then
bodyColors:Destroy()
end
local newRoot = script.HumanoidRootPart
newRoot.Parent = character :: any
local humanoid = assert(character:FindFirstChildOfClass("Humanoid"))
humanoid:BuildRigFromAttachments()
local dummyScripts = {
"Animate",
"Health",
"Sound",
}
for _, dummy in dummyScripts do
local stub = Instance.new("Hole", StarterCharacterScripts)
stub.Name = dummy
end
for _, child in script:GetChildren() do
child.Parent = StarterCharacterScripts
if child:IsA("Script") then
child.Disabled = false
end
end
character.Name = "StarterCharacter"
character.PrimaryPart = newRoot
character.Parent = StarterPlayer
PhysicsService:RegisterCollisionGroup("Player")
PhysicsService:CollisionGroupSetCollidable("Default", "Player", false)
for _, player in Players:GetPlayers() do
task.spawn(player.LoadCharacter, player)
end
| 376 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/tools/ImportAnimations.lua | local AvatarImportService = game:GetService("AvatarImportService")
local resume = Instance.new("BindableEvent")
for i, anim in pairs(game.ReplicatedFirst.SM64.Assets.Animations:GetChildren()) do
local path = "C:/Users/clone/Desktop/MarioAnims/" .. anim.Name .. ".fbx"
print("Importing", anim)
task.defer(function()
local success, err = pcall(function()
AvatarImportService:ImportFBXAnimationFromFilePathUserMayChooseModel(path, workspace.Mario, function()
local bin = game.ServerStorage.AnimSaves
local old = bin:FindFirstChild(anim.Name)
if old then
old:Destroy()
end
local kfs = AvatarImportService:ImportLoadedFBXAnimation(false)
kfs.Name = anim.Name
kfs.Parent = bin
resume:Fire()
end)
end)
if not success then
warn("ERROR IMPORTING", anim, err)
resume:Fire()
end
end)
resume.Event:Wait()
end
| 229 |
MaximumADHD/sm64-roblox | MaximumADHD-sm64-roblox-79d5372/tools/RetargetAnimations.lua | -- This script was written (quite rigidly) for use in the provided RetargetAnimations.rbxl place.
-- KeyframeSequences are not provided as mentioned in the README, you'll have to extract them yourself :)
--!strict
local ServerStorage = game:GetService("ServerStorage")
local StarterCharacter = workspace.StarterCharacter
local MarioAnim = workspace.MarioAnim
local MarioBase = workspace.MarioBase
local Player = workspace.Player
local HIERARCHY: { [string]: { [string]: string }? } = {
HumanoidRootPart = { LowerTorso = "Root" },
LowerTorso = {
UpperTorso = "Waist",
LeftUpperLeg = "LeftHip",
RightUpperLeg = "RightHip",
},
UpperTorso = {
Head = "Neck",
LeftUpperArm = "LeftShoulder",
RightUpperArm = "RightShoulder",
},
LeftUpperArm = { LeftLowerArm = "LeftElbow" },
LeftLowerArm = { LeftHand = "LeftWrist" },
RightUpperArm = { RightLowerArm = "RightElbow" },
RightLowerArm = { RightHand = "RightWrist" },
LeftUpperLeg = { LeftLowerLeg = "LeftKnee" },
LeftLowerLeg = { LeftFoot = "LeftAnkle" },
RightUpperLeg = { RightLowerLeg = "RightKnee" },
RightLowerLeg = { RightFoot = "RightAnkle" },
}
local BASE_KEYFRAME = ServerStorage.BASE_KEYFRAME
local statusHint = Instance.new("Hint")
local statusText = "%s [%d/%d]"
statusHint.Parent = workspace
statusHint.Name = "Status"
local function updateAnim()
StarterCharacter.Humanoid.Animator:StepAnimations(0)
Player.Humanoid.Animator:StepAnimations(0)
task.wait()
end
local function clearAnims()
for i, desc: Instance in pairs(workspace:GetDescendants()) do
if desc:IsA("Bone") then
desc.Transform = CFrame.identity
elseif desc:IsA("Motor6D") then
desc.Transform = CFrame.identity
elseif desc:IsA("Animator") then
task.defer(desc.StepAnimations, desc, 0)
end
end
task.wait()
end
local function applyMotors(at: Instance)
local name0 = if at:IsA("Keyframe") then "HumanoidRootPart" else at.Name
local part0 = StarterCharacter:FindFirstChild(name0)
local data = HIERARCHY[name0]
if data and part0 and part0:IsA("BasePart") then
for name1, motorName in data do
local part1 = StarterCharacter:FindFirstChild(name1)
if part1 and part1:IsA("BasePart") then
local att: Attachment = part1:FindFirstChild(motorName .. "RigAttachment")
local bone: Bone = MarioBase:FindFirstChild(motorName, true)
local motor: Motor6D = part1:FindFirstChild(motorName)
motor.Transform = att.WorldCFrame:ToObjectSpace(bone.TransformedWorldCFrame)
local playerMotor = workspace.Player:FindFirstChild(motorName, true)
local pose = at:FindFirstChild(name1)
if playerMotor and playerMotor:IsA("Motor6D") then
if motorName:find("Left") or motorName:find("Right") then
playerMotor.Transform = motor.Transform.Rotation
else
playerMotor.Transform = motor.Transform
end
end
updateAnim()
if pose and pose:IsA("Pose") then
if motorName:find("Left") or motorName:find("Right") then
pose.CFrame = motor.Transform.Rotation
else
pose.CFrame = motor.Transform
end
applyMotors(pose)
end
end
end
end
end
local function remapKeyframe(keyframe: Keyframe): Keyframe
clearAnims()
for i, desc: Instance in pairs(keyframe:GetDescendants()) do
if desc:IsA("Pose") then
local bone: Instance? = MarioAnim:FindFirstChild(desc.Name, true)
if bone and bone:IsA("Bone") then
bone.Transform = desc.CFrame
end
end
end
for i, desc in MarioBase:GetDescendants() do
if desc:IsA("Bone") then
local anim = MarioAnim:FindFirstChild(desc.Name, true)
if anim then
local offset = desc.TransformedWorldCFrame:ToObjectSpace(anim.TransformedWorldCFrame)
desc.Transform = offset
end
end
end
local newKeyframe = BASE_KEYFRAME:Clone()
newKeyframe.Name = keyframe.Name
newKeyframe.Time = keyframe.Time
applyMotors(newKeyframe)
return newKeyframe
end
local function remapKeyframeSequence(kfs: KeyframeSequence): KeyframeSequence
local keyframes = kfs:GetKeyframes()
clearAnims()
local newKfs = kfs:Clone()
newKfs:ClearAllChildren()
for i, keyframe in keyframes do
if keyframe:IsA("Keyframe") then
local text = statusText:format(kfs.Name, i, #keyframes)
statusHint.Text = text
local newKeyframe = remapKeyframe(keyframe)
newKeyframe.Parent = newKfs
end
end
return newKfs
end
local animSaves = ServerStorage.AnimSaves:GetChildren()
local animSavesR15 = ServerStorage.AnimSaves_R15
table.sort(animSaves, function(a, b)
return a.Name < b.Name
end)
for i, animSave in animSaves do
if animSave:IsA("KeyframeSequence") then
local kfs = remapKeyframeSequence(animSave)
kfs.Parent = animSavesR15
end
end
clearAnims()
statusHint:Destroy()
| 1,311 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Plugins/Client-Example Plugin.luau | return function(Vargs)
local client, service = Vargs.Client, Vargs.Service
--Acts the same as a server plugin but with client functions instead of server.
--[[
local window = client.UI.Make("Window",{
Title = "Changing DataStore";
Size = {700,300};
Icon = "rbxassetid://357249130";
})
window:Add("ImageLabel",{
Image = "rbxassetid://531490964";
})
--]]
end
| 109 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Plugins/Server-Example Plugin.luau | --[[
SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"
Plugins have full access to the server/client tables and most variables.
You can use the MakePluginEvent to use the script instead of setting up an event.
PlayerJoined will fire after the player finishes initial loading
CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
service.Events.PlayerAdded:Connect(function(p)
print(`{p.Name} Joined! Example Plugin`)
end)
service.Events.CharacterAdded:Connect(function(p)
server.RunCommand('name', plr.Name, 'BobTest Example Plugin')
end)
--]]
return function(Vargs)
local server, service = Vargs.Server, Vargs.Service
server.Commands.ExampleCommand = {
Prefix = server.Settings.Prefix; -- Prefix to use for command
Commands = {"example"}; -- Commands
Args = {"arg1"}; -- Command arguments
Description = "Example command"; -- Command Description
Hidden = true; -- Is it hidden from the command list?
Fun = false; -- Is it fun?
AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
Function = function(plr,args) -- Function to run for command
print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
print(`Player supplied args[1] {args[1]}`)
end
}
end
| 344 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Settings/Cameras.luau | --[[
Use the below table to define "pre-set" cameras
Format example:
Cameras = {
{
Name = "CameraName";
Position = Vector3; -- Example: Vector3.new(0, 0, 0) or workspace.ExampleCameraPart.Position
}
}
--]]
----------------------
-- CAMERAS SETTINGS --
----------------------
return {
Cameras = {
-- {
-- Name = "ExampleCamera1;
-- Position = Vector3.new(0, 50, 0)
-- }
}
} | 130 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Settings/CommandAdjustments.luau | -------------------------------
-- Scroll down for settings --
-------------------------------
--[[
Format example for Aliases:
Aliases = {
[":alias <arg1> <arg2> ..."] = ":command <arg1> <arg2> ..."
}
Format example for CommandCooldowns:
CommandCooldowns = {
[":commandname"] = {
Player = 0; -- (optional) Per player cooldown in seconds
Server = 0; -- (optional) Per server cooldown in seconds
Cross = 0; -- (optional) Global cooldown in seconds
}
}
Make sure to include the prefix infront of the command name.
Format example for Permissions:
Permissions = {
"CommandName:NewLevel";
"CommandName:CustomRank1,CustomRank2,CustomRank3";
};
--]]
----------------------------------
-- COMMAND ADJUSTMENTS SETTINGS --
----------------------------------
return {
Aliases = {
-- [":examplealias <player> <fireColor>"] = ":ff <player> | :fling <player> | :fire <player> <fireColor>" -- Order arguments appear in alias string determines their required order in the command message when ran later
};
CommandCooldowns = {
-- [":logs"] = {
-- Player = 5; -- 5 seconds
-- }
};
Permissions = {
-- "ff:HeadAdmins"; -- Changes :ff to HeadAdmins and higher (HeadAdmins = Level 300 by default)
-- "kill:300"; -- Changes :kill to level 300 and higher (Level 300 = HeadAdmins by default)
-- "ban:200,300"; -- Makes it so :ban is only usable by levels 200 and 300 specifically (nothing higher or lower or in between)
};
} | 407 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Settings/Donor.luau | --------------------
-- DONOR SETTINGS --
--------------------
return {
DonorCapes = true; -- Donors get to show off their capes; Not disruptive :)
DonorCommands = true; -- Show your support for the script and let donors use harmless commands like !sparkles
LocalCapes = false; -- Makes Donor capes local so only the donors see their cape [All players can still disable capes locally]
}; | 94 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Settings/General.luau | ----------------------
-- GENERAL SETTINGS --
----------------------
return {
Prefix = {":", ";"}; -- A list of prefixes for commands, the : in :kill me
PlayerPrefix = "!"; -- The ! in !donate; Mainly used for commands that any player can run; Do not make it the same as Prefix
SpecialPrefix = ""; -- Used for things like "all", "me" and "others" (If changed to ! you would do :kill !me)
SplitKey = " "; -- The space in :kill me (eg if you change it to / :kill me would be :kill/me)
BatchKey = "|"; -- :kill me | :ff bob | :explode scel
ConsoleKeyCode = "Quote"; -- Keybind to open the console; Rebindable per player in userpanel; KeyCodes: https://developer.roblox.com/en-us/api-reference/enum/KeyCode
HideScript = true; -- When the game starts the Adonis_Loader model will be hidden so other scripts cannot access the settings module; Disable if your game uses AssetService:SavePlaceAsync()
DataStoreEnabled = true; -- Disable if you don't want to load settings and admins from the datastore; PlayerData will still save
LocalDatastore = false; -- If this is turned on, a mock DataStore will forcibly be used instead and shall never save across servers
DataStore = "Adonis_1"; -- DataStore the script will use for saving data; Changing this will lose any saved data
DataStoreKey = "CHANGE_THIS"; -- CHANGE THIS TO ANYTHING RANDOM! Key used to encrypt all datastore entries; Changing this will lose any saved data
SaveAdmins = true; -- If true anyone you :admin or :headadmin in-game will save
LoadAdminsFromDS = true; -- If false, any admins saved in your DataStores will not load
SaveCommandLogs = true; -- If command logs are saved to the datastores
MaxLogs = 5000; -- Maximum logs to save before deleting the oldest
Storage = game:GetService("ServerStorage"); -- Where things like tools are stored
RecursiveTools = false; -- Whether tools that are included in sub-containers within Storage will be available via the :give command (useful if your tools are organized into multiple folders)
Theme = "Default"; -- UI theme
MobileTheme = "Mobilius"; -- Theme to use on mobile devices; Some UI elements are disabled
DefaultTheme = "Default"; -- Theme to be used as a replacement for "Default". The new replacement theme can still use "Default" as its Base_Theme however any other theme that references "Default" as its redirects to this theme.
HiddenThemes = {}; -- Hide themes from the theme selector tab inside the userpanel. Each theme name must be the specific name such as "Mobilius"
BanMessage = "Banned"; -- Message shown to banned users upon kick
LockMessage = "Not Whitelisted"; -- Message shown to people when they are kicked while :slock is on in the server
SystemTitle = "System Message"; -- Title to display in :sm and :bc
--[[
Format example for Banned, Muted, Blacklist and Whitelist:
Banned, Muted, Blacklist or Whitelist = {
"Username"; -- Example: "roblox"
"Username:UserId"; -- Example: "roblox:1"
UserId; -- Example: 1
"Group:GroupId:GroupRank"; -- Example: "Group:123456:50"
"Group:GroupId"; -- Example: "Group:123456"
"Item:ItemID"; -- Example: "Item:123456"
"GamePass:GamePassID"; -- Example: "GamePass:123456"
"Subscription:SubscriptionId"; -- Example: "Subscription:123456"
}
--]]
Banned = {}; -- List of people banned from the game Format: See the above format example
Muted = {}; -- List of people muted (cannot send chat messages) Format: See the above format example
Blacklist = {}; -- List of people banned from running commands Format: See the above format example
Whitelist = {}; -- People who can join if whitelist enabled Format: See the above format example
WhitelistEnabled = false; -- If true enables the whitelist/server lock; Only lets admins & whitelisted users join
MusicList = {}; -- List of songs to appear in the :musiclist Format: {{Name = "somesong", ID = 1234567}, {Name = "anotherone", ID = 1243562}}
CapeList = {}; -- List of capes Format: {{Name = "somecape", Material = "Fabric", Color = "Bright yellow", ID = 12345567, Reflectance = 1}; {etc more stuff here}}
InsertList = {}; -- List of models to appear in the :insertlist and can be inserted using ':insert <name>' Format: {{Name = "somemodel", ID = 1234567}; {Name = "anotherone", ID = 1243562}}
OnStartup = {}; -- List of commands ran at server start Format: {":notif TestNotif"}
OnJoin = {}; -- List of commands ran as player on join (ignores adminlevel) Format: {":cmds"}
OnSpawn = {}; -- List of commands ran as player on spawn (ignores adminlevel) Format: {"!fire Really red",":ff me"}
FunCommands = true; -- Are fun commands enabled?
PlayerCommands = true; -- Are player-level utility commands enabled?
AgeRestrictedCommands = true; -- Are age restricted commands enabled?
ChatCommands = true; -- If false you will not be able to run commands via the chat; Instead, you MUST use the console or you will be unable to run commands
CrossServerCommands = true; -- Are commands which affect more than one server enabled?
WarnDangerousCommand = false; -- Do dangerous commands ask for confirmation?
CommandFeedback = false; -- Should players be notified when commands with non-obvious effects are run on them?
SilentCommandDenials = false; -- If true, there will be no differences between the error messages shown when a user enters an invalid command and when they have insufficient permissions for the command
OverrideChatCallbacks = true; -- If the TextChatService ShouldDeliverCallbacks of all channels are overridden by Adonis on load. Required for slowmode. Mutes use a CanSend method to mute when this is set to false.
ChatCreateRobloxCommands = false; -- Whether "/" commands for Roblox should get created in new Chat
CodeExecution = false; -- Enables the use of code execution in Adonis. Scripting related (such as :s) and a few other commands require this
Notification = true; -- Whether or not to show the "You're an admin" and "Updated" notifications
SongHint = true; -- Display a hint with the current song name and ID when a song is played via :music
TopBarShift = false; -- By default hints and notifications will appear from the top edge of the window. Set this to true if you don't want hints/notifications to appear in that region.
AutoClean = false; -- Will auto clean workspace of things like hats and tools
AutoCleanDelay = 60; -- Time between auto cleans
AutoBackup = false; -- Run :backupmap automatically when the server starts. To restore the map, run :restoremap
ReJail = false; -- If true then when a player rejoins they'll go back into jail. Or if the moderator leaves everybody gets unjailed
Console = true; -- Whether the command console is enabled
Console_AdminsOnly = false; -- If true, only admins will be able to access the console
HelpSystem = true; -- Allows players to call admins for help using !help
HelpButton = true; -- Shows a little help button in the bottom right corner.
HelpButtonImage = "rbxassetid://357249130"; -- Sets the image used for the Adonis help button above.
HttpWait = 60; -- How long things that use the HttpService will wait before updating again
}; | 1,871 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Settings/JoinMessages.luau | --[[
Format example for Join Messages:
Messages = {
"This is a message using the defaults!";
{
Title = "Message title";
Message = "Message body";
Time = 10;
Icon = "rbxassetid://7510999669";
Level = 300;
};
}
Messages are shown to HeadAdmins+ (300) by default but tables can define a different minimum level via .Level
--]]
return {
Messages = {
-- {
-- Title = "Message title";
-- Message = "Message body";
-- Time = 10;
-- Icon = "rbxassetid://7510999669";
-- Level = 300;
-- };
}; -- A list of notifications shown on join. Messages can either be strings or tables.
}; | 196 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/Config/Settings/Waypoints.luau | --[[
List of waypoints you can teleport via ':to wp-WAYPOINTNAME' or ':teleport PLAYER tp.WAYPOINTNAME'
Use the below table to define "pre-set" waypoints
Format example:
Waypoints = {
EXAMPLEWAYPOINT1NAME = Vector3; -- Example: Vector3.new(0, 0, 0) or workspace.ExampleWaypointPart.Position
}
--]]
------------------------
-- WAYPOINTS SETTINGS --
------------------------
return {
Waypoints = {
-- YOURNAME1 = Vector3.new(5, 20, 10)
};
}; | 128 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/Loader/README.luau | --[[
--------------------------------------------
-- Adonis --
-- By Epix Incorporated --
--------------------------------------------
-- Not Everything is so Black and White --
--------------------------------------------
A lot of time goes into maintaining and updating Adonis. If you enjoy using Adonis,
please consider leaving us a review, as your feedback means a lot:
https://create.roblox.com/store/asset/7510622625/
---------------------
-- Getting started --
---------------------
- It's recommend you store Adonis_Loader in 'ServerScriptService'.
- Configure Ranks in Config -> Settings -> Ranks module.
- Configure general settings like prefixes, command settings, etc in Config -> Settings -> General module.
- You can find the rest of the settings modules at Config -> Settings. They are sorted by categories.
- You can create custom commands and plugins in Config -> Plugins.
---------------------
-- Basic luau info --
---------------------
This is only here to help you when editing settings so you understand how they work
and don't break something.
In case you don't know what Luau is; Luau is the scripting language Roblox uses...
so every script you see (such as this one) and pretty much any code on Roblox is
written in Luau.
Anything that looks like {} is known as a table.
Tables contain things, like the Luau version of a box.
An example of a table would be setting = {"John", "Mary", "Bill"}
You can have tables inside of tables, such in the case of setting = {{Group = 1234, Rank = 123, Type = "Admin"}}
Just like real boxes, tables can contain pretty much anything including other tables.
Note: Commas (,) as well as semicolons (;) can both be used to separate things inside a table.
Anything that looks like "Bob" is what's known as a string. Strings
are basically plain text; setting = "Bob" would be correct however
setting = Bob would not; because if it's not surrounded by quotes Luau will think
that Bob is a variable; Quotes indicate something is a string and therefore not a variable/number/code
Numbers do not use quotes. setting = 56
This block of text you are reading is called a comment. It's like a message
from the programmer to anyone who reads their stuff. Anything in a comment will
not be seen by Luau when the script is run.
Comments can be made by putting -- at the start of a line
For more information about roblox luau visit: https://create.roblox.com/docs/luau
--]] | 567 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/Plugins/Misc_Features.luau | --// NOTE: THIS IS NOT A *CONFIG/USER* PLUGIN! ANYTHING IN THE MAINMODULE PLUGIN FOLDERS IS ALREADY PART OF/LOADED BY THE SCRIPT! DO NOT ADD THEM TO YOUR CONFIG>PLUGINS FOLDER!
return function(Vargs, GetEnv)
local client = Vargs.Client;
local service = Vargs.Service;
local Settings = client.Settings
local Functions, Anti, Core, Logs, Remote, Process, Variables = client.Functions, client.Anti, client.Core, client.Logs, client.Remote, client.Process, client.Variables
-- // Backwards compatibility
local Pcall = client.Pcall
local function cPcall(func, ...)
return Pcall(function(...)
return coroutine.resume(coroutine.create(func), ...)
end, ...)
end
client.cPcall, service.cPcall = cPcall, cPcall
service.CloneTable = function(tbl)
return (getmetatable(tbl) and not pcall(setmetatable(tbl, getmetatable(tbl)))) and setmetatable({}, {__index = function(_, k) return tbl[k] end}) or table.clone(tbl)
end
service.AltUnpack = function(args, shift) -- TODO: Remove. This is not used in Adonis at all and is easily replicatable so you can safely remove it withour fear
return table.unpack(args, 1 + (shift and shift - 1 or 0), 10 + (shift and shift - 1 or 0))
end
service.GoodSignal = service.Signal
service.Yield = function()
local event = service.Signal.new()
return {
Release = function(...) event:Fire(...) end;
Wait = function(...) return event:Wait(...) end;
Destroy = function() event:Destroy() end;
Event = event;
}
end
Remote.UnEncrypted = setmetatable({}, {
__newindex = function(_, ind, val)
warn("Unencrypted remote commands are deprecated; moving", ind, "to Remote.Commands. Replace `Remote.Unencrypted` with `Remote.Commands`!")
Remote.Commands[ind] = val
Logs:AddLog("Script", `Attempted to add {ind} to legacy Remote.Unencrypted. Moving to Remote.Commands`)
end
})
client.Folder:SetSpecial("Shared", client.Shared)
Functions.GetRandom = function(pLen)
local random = math.random
local format = string.format
local Len = (type(pLen) == "number" and pLen) or random(5,10) --// reru
local Res = {}
for Idx = 1, Len do
Res[Idx] = format("%02x", random(255))
end
return table.concat(Res)
end
-- TODO: Remove \\/
service.OwnsAsset = service.CheckAssetOwnership
Functions.CatchError = client.Pcall
Logs:AddLog("Script", "Misc Features Module Loaded")
end
| 626 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Default/Music/Slider.luau | --!native
--------------------------------------------------------------------------------------------
-------------------------------------- Slider Module ---------------------------------------
-- [Adonis Maintainer]: P3tray
-- [Author]: Krypt
-- [Description]: Creates a slider based on a start, end and incremental value. Allows ...
-- ... sliders to be moved, tracked/untracked, reset, and have specific properties such ...
-- ... as their current value and increment to be overriden.
-- [Version]: 2.1.1
-- [Created]: 22/12/2021
-- [Updated]: 23/11/2022
-- [Dev Forum Link]: https://devforum.roblox.com/t/1597785/
--------------------------------------------------------------------------------------------
--!nonstrict
local Slider = {Sliders = {}}
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
assert(RunService:IsClient(), "Slider module can only be used on the Client!")
local SliderFuncs = {}
do
function SliderFuncs.snapToScale(val: number, step: number): number
return math.clamp(math.round(val / step) * step, 0, 1)
end
function lerp(start: number, finish: number, percent: number): number
return (1 - percent) * start + percent * finish
end
function SliderFuncs.map(value: number, start: number, stop: number, newStart: number, newEnd: number, constrain: boolean): number
local newVal = lerp(newStart, newEnd, SliderFuncs.getAlphaBetween(start, stop, value))
if not constrain then
return newVal
end
if newStart < newEnd then
newStart, newEnd = newEnd, newStart
end
return math.max(math.min(newVal, newStart), newEnd)
end
function SliderFuncs.getNewPosition(self): UDim2
local absoluteSize = self._data.Button.AbsoluteSize[self._config.Axis]
local holderSize = self._holder.AbsoluteSize[self._config.Axis]
local anchorPoint = self._data.Button.AnchorPoint[self._config.Axis]
local paddingScale = (self._config.Padding / holderSize)
local minScale = ((anchorPoint * absoluteSize) / holderSize + paddingScale)
local decrement = ((2 * absoluteSize) * anchorPoint) - absoluteSize
local maxScale = (1 - minScale) + (decrement / holderSize)
local newPercent = SliderFuncs.map(self._data._percent, 0, 1, minScale, maxScale, true)
return
if self._config.Axis == "X" then UDim2.fromScale(newPercent, self._data.Button.Position.Y.Scale)
else UDim2.fromScale(self._data.Button.Position.X.Scale, newPercent)
end
function SliderFuncs.getScaleIncrement(self)
return 1 / ((self._config.SliderData.End - self._config.SliderData.Start) / self._config.SliderData.Increment)
end
function SliderFuncs.getAlphaBetween(a: number, b: number, c: number): number
return (c - a) / (b - a)
end
function SliderFuncs.getNewValue(self)
local newValue = lerp(self._config.SliderData.Start, self._config.SliderData.End, self._data._percent)
local incrementScale = (1 / self._config.SliderData.Increment)
newValue = math.round(newValue * incrementScale) / incrementScale
return newValue
end
end
local Signal = require(script.Parent.Signal)
Slider.__index = function(object, indexed)
local deprecated = {
{".OnChange", ".Changed", rawget(object, "Changed")}
}
for _, tbl in ipairs(deprecated) do
local deprecatedStr = string.sub(tbl[1], 2)
if deprecatedStr == indexed then
warn(string.format("%s is deprecated, please use %s instead", tbl[1], tbl[2]))
return tbl[3]
end
end
return Slider[indexed]
end
export type configDictionary = {
SliderData: {Start: number, End: number, Increment: number, DefaultValue: number | nil},
MoveType: "Tween" | "Instant" | nil,
MoveInfo: TweenInfo | nil,
Axis: string | nil,
Padding: number | nil,
AllowBackgroundClick: boolean
}
function Slider.new(holder: GuiBase2d, config: configDictionary)
assert(pcall(function()
return holder.AbsoluteSize, holder.AbsolutePosition
end), "Holder argument does not have an AbsoluteSize/AbsolutePosition")
local duplicate = false
for _, slider in ipairs(Slider.Sliders) do
if slider._holder == holder then
duplicate = true
break
end
end
assert(not duplicate, "Cannot set two sliders with same frame!")
assert(config.SliderData.Increment ~= nil, "Failed to find Increment in SliderData table")
assert(config.SliderData.Start ~= nil, "Failed to find Start in SliderData table")
assert(config.SliderData.End ~= nil, "Failed to find End in SliderData table")
assert(config.SliderData.Increment > 0, "SliderData.Increment must be greater than 0")
assert(config.SliderData.End > config.SliderData.Start, string.format("Slider end value must be greater than its start value! (%.1f <= %.1f)", config.SliderData.End, config.SliderData.Start))
local self = setmetatable({}, Slider)
self._holder = holder
self._data = {
-- Buttons
Button = nil,
HolderButton = nil,
-- Clicking
_clickOverride = false,
_mainConnection = nil,
_clickConnections = {},
_otherConnections = {},
_inputPos = nil,
-- Internal
_percent = 0,
_value = 0,
_scaleIncrement = 0,
_currentTween = nil,
_allowBackgroundClick = if config.AllowBackgroundClick == false then false else true
}
self._config = config
self._config.Axis = string.upper(config.Axis or "X")
self._config.Padding = config.Padding or 5
self._config.MoveInfo = config.MoveInfo or TweenInfo.new(0.2)
self._config.MoveType = config.MoveType or "Tween"
self.IsHeld = false
local sliderBtn = holder:FindFirstChild("Slider")
assert(sliderBtn ~= nil, "Failed to find slider button.")
assert(sliderBtn:IsA("GuiButton"), "Slider is not a GuiButton")
self._data.Button = sliderBtn
-- Holder button --
if self._data._allowBackgroundClick then
local holderClickButton = Instance.new("TextButton")
holderClickButton.BackgroundTransparency = 1
holderClickButton.Text = ""
holderClickButton.Name = "HolderClickButton"
holderClickButton.Size = UDim2.fromScale(1, 1)
holderClickButton.ZIndex = -1
holderClickButton.Parent = self._holder
self._data.HolderButton = holderClickButton
end
-- Finalise --
self._data._percent = 0
if config.SliderData.DefaultValue then
config.SliderData.DefaultValue = math.clamp(config.SliderData.DefaultValue, config.SliderData.Start, config.SliderData.End)
self._data._percent = SliderFuncs.getAlphaBetween(config.SliderData.Start, config.SliderData.End, config.SliderData.DefaultValue)
end
self._data._percent = math.clamp(self._data._percent, 0, 1)
self._data._value = SliderFuncs.getNewValue(self)
self._data._increment = config.SliderData.Increment
self._data._scaleIncrement = SliderFuncs.getScaleIncrement(self)
self.Changed = Signal.new()
self.Dragged = Signal.new()
self.Released = Signal.new()
self._data._percent = SliderFuncs.snapToScale(self._data._percent, self._data._scaleIncrement)
self:Move()
table.insert(self._data._otherConnections, sliderBtn:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
self:Move("Instant")
end))
table.insert(Slider.Sliders, self)
return self
end
function Slider:Track()
for _, connection in ipairs(self._data._clickConnections) do
connection:Disconnect()
end
table.insert(self._data._clickConnections, self._data.Button.MouseButton1Down:Connect(function()
self.IsHeld = true
end))
table.insert(self._data._clickConnections, self._data.Button.MouseButton1Up:Connect(function()
if self.IsHeld then
self.Released:Fire(self._data._value)
end
self.IsHeld = false
end))
if self._data._allowBackgroundClick then
table.insert(self._data._clickConnections, self._data.HolderButton.Activated:Connect(function(inputObject: InputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 or inputObject.UserInputType == Enum.UserInputType.Touch then
self._data._inputPos = inputObject.Position
self._data._clickOverride = true
self:Update()
self._data._clickOverride = false
end
end))
end
if self.Changed then
self.Changed:Fire(self._data._value)
end
if self._data._mainConnection then
self._data._mainConnection:Disconnect()
end
self._data._mainConnection = UserInputService.InputChanged:Connect(function(inputObject, gameProcessed)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement or inputObject.UserInputType == Enum.UserInputType.Touch then
self._data._inputPos = inputObject.Position
self:Update()
end
end)
end
function Slider:Update()
if (self.IsHeld or self._data._clickOverride) and self._data._inputPos then
local sliderSize = self._holder.AbsoluteSize[self._config.Axis]
local sliderPos = self._holder.AbsolutePosition[self._config.Axis]
local mousePos = self._data._inputPos[self._config.Axis]
if mousePos then
local relativePos = (mousePos - sliderPos)
local newPos = SliderFuncs.snapToScale(relativePos / sliderSize, self._data._scaleIncrement)
local percent = math.clamp(newPos, 0, 1)
self._data._percent = percent
self.Dragged:Fire(self._data._value)
self:Move()
end
end
end
function Slider:Untrack()
for _, connection in ipairs(self._data._clickConnections) do
connection:Disconnect()
end
if self._data._mainConnection then
self._data._mainConnection:Disconnect()
end
self.IsHeld = false
end
function Slider:Reset()
for _, connection in ipairs(self._data._clickConnections) do
connection:Disconnect()
end
if self._data._mainConnection then
self._data._mainConnection:Disconnect()
end
self.IsHeld = false
self._data._percent = 0
if self._config.SliderData.DefaultValue then
self._data._percent = SliderFuncs.getAlphaBetween(self._config.SliderData.Start, self._config.SliderData.End, self._config.SliderData.DefaultValue)
end
self._data._percent = math.clamp(self._data._percent, 0, 1)
self:Move()
end
function Slider:OverrideValue(newValue: number, supressEvent: boolean?) -- Patch by ccuser44 to prevent music glitching
self.IsHeld = false
self._data._percent = SliderFuncs.getAlphaBetween(self._config.SliderData.Start, self._config.SliderData.End, newValue)
self._data._percent = math.clamp(self._data._percent, 0, 1)
self._data._percent = SliderFuncs.snapToScale(self._data._percent, self._data._scaleIncrement)
self:Move(nil, supressEvent)
end
function Slider:Move(override: string, supressEvent: boolean?)
self._data._value = SliderFuncs.getNewValue(self)
local moveType = if override ~= nil then override else self._config.MoveType
if moveType == "Tween" or moveType == nil then
if self._data._currentTween then
self._data._currentTween:Cancel()
end
self._data._currentTween = TweenService:Create(self._data.Button, self._config.MoveInfo, {
Position = SliderFuncs.getNewPosition(self)
})
self._data._currentTween:Play()
elseif moveType == "Instant" then
self._data.Button.Position = SliderFuncs.getNewPosition(self)
end
if not supressEvent then
self.Changed:Fire(self._data._value)
end
end
function Slider:OverrideIncrement(newIncrement: number)
self._config.SliderData.Increment = newIncrement
self._data._increment = newIncrement
self._data._scaleIncrement = SliderFuncs.getScaleIncrement(self)
self._data._percent = math.clamp(self._data._percent, 0, 1)
self._data._percent = SliderFuncs.snapToScale(self._data._percent, self._data._scaleIncrement)
self:Move()
end
function Slider:GetValue()
return self._data._value
end
function Slider:GetIncrement()
return self._data._increment
end
function Slider:Destroy()
for _, connection in ipairs(self._data._clickConnections) do
connection:Disconnect()
end
for _, connection in ipairs(self._data._otherConnections) do
connection:Disconnect()
end
if self._data._mainConnection then
self._data._mainConnection:Disconnect()
end
if self._data.HolderButton then
self._data.HolderButton:Destroy()
self._data.HolderButton = nil
end
self.Changed:Destroy()
self.Dragged:Destroy()
self.Released:Destroy()
for index = 1, #Slider.Sliders do
if Slider.Sliders[index] == self then
table.remove(Slider.Sliders, index)
end
end
setmetatable(self, nil)
self = nil
end
UserInputService.InputEnded:Connect(function(inputObject: InputObject, internallyProcessed: boolean)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 or inputObject.UserInputType == Enum.UserInputType.Touch then
for _, slider in ipairs(Slider.Sliders) do
if slider.IsHeld then
slider.Released:Fire(slider._data._value)
end
slider.IsHeld = false
end
end
end)
return Slider
-----------------------------------------------------------------------------------------
| 3,206 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Default/Music/Visualizer.luau | --!native
--!optimize 2
local RunService = game:GetService("RunService")
local module = {}
local function AlphaColorSequence(Sequence, Alpha)
local Keypoints = Sequence.Keypoints
local StartKeypoint, EndKeypoint = 1, #Keypoints
for i, Keypoint in ipairs(Keypoints) do
if Keypoint.Time >= Alpha then
EndKeypoint = Keypoint
StartKeypoint = Keypoints[math.max(1, i-1)]
break
end
end
local StartTime, EndTime = StartKeypoint.Time, EndKeypoint.Time
local StartValue, EndValue = StartKeypoint.Value, EndKeypoint.Value
local KeyframeAlpha = (Alpha - StartTime) / (EndTime - StartTime)
return StartValue:Lerp(EndValue, KeyframeAlpha)
end
function module.new(Frame, BarCount)
-- Determine settings
local BAR_COUNT = math.clamp(type(BarCount) == "number" and BarCount or 41, 11,601)
local SAMPLE_HZ = math.clamp(BAR_COUNT/2,10,500)
if BAR_COUNT%2==0 then
BAR_COUNT += 1
end
local BAR_SIZE = 1/BAR_COUNT
local BUFFER_COUNT = math.ceil(BAR_COUNT/2)
local BAR_TO_BUFFER = table.create(BAR_COUNT)
local BAR_TO_MULTIPLIER = table.create(BAR_COUNT)
for i=1, BAR_COUNT do
BAR_TO_BUFFER[i] = math.abs(BUFFER_COUNT- (i+ (i<=BUFFER_COUNT and -1 or 1) ))
BAR_TO_MULTIPLIER[i] = 1-(math.clamp(math.abs(BUFFER_COUNT- (i+ (i<=BUFFER_COUNT and -1 or 1) ))/BUFFER_COUNT, 0.01,1)^2)
end
local UPDATE_WAIT = 1/SAMPLE_HZ
-- Setup visualizer
local Visualizer = {
Frame = Frame;
VolumeBuffer = table.create(BUFFER_COUNT+1);
Bars = {};
BufferConnection = nil;
PlayingConnection = nil;
Sound = nil;
}
-- Create the bar guis
for i=1, BAR_COUNT do
local Bar = Frame:Add("Frame", {
BorderSizePixel = 0;
BackgroundColor3 = Color3.new(0.98,0.98,0.99);
AnchorPoint = Vector2.new(0,0.5);
Size = UDim2.new(BAR_SIZE,0,0.02,0);
Position = UDim2.new(BAR_SIZE* (i-1), 0,0.5,0);
})
Visualizer.Bars[i] = Bar
end
local function HandlePlaying()
if Visualizer.BufferConnection then
Visualizer.BufferConnection:Disconnect()
Visualizer.BufferConnection = nil
end
local Sound = Visualizer.Sound
if not Sound then return end
if Sound.Playing then
local LastStored = os.clock()
Visualizer.BufferConnection = RunService.Heartbeat:Connect(function()
local success, void = pcall(function()
Visualizer.VolumeBuffer[1] = Sound.PlaybackLoudness
Visualizer.Bars[BUFFER_COUNT]:TweenSize(
UDim2.new(
BAR_SIZE,0,
math.clamp((Sound.PlaybackLoudness/400), 0.02,1),0
),
Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.014, true
)
if os.clock()-LastStored > UPDATE_WAIT then
LastStored = os.clock()
table.insert(Visualizer.VolumeBuffer,1,Sound.PlaybackLoudness)
local Length = #Visualizer.VolumeBuffer
if Length > BUFFER_COUNT then
Visualizer.VolumeBuffer[#Visualizer.VolumeBuffer] = nil
end
local Color = Visualizer.Color
local ColorType = typeof(Color)
for i,Bar in ipairs(Visualizer.Bars) do
local Alpha = math.clamp(
((Visualizer.VolumeBuffer[BAR_TO_BUFFER[i]] or 0)/400),
0.02, 1
)
Bar:TweenSize(
UDim2.new(
BAR_SIZE,0,
Alpha,0
),
Enum.EasingDirection.Out, Enum.EasingStyle.Linear, UPDATE_WAIT, true
)
if Color then
if ColorType == "Color3" then
Bar.BackgroundColor3 = Color
elseif ColorType == "ColorSequence" then
Bar.BackgroundColor3 = AlphaColorSequence(Color, Alpha)
end
end
end
end
end)
if not success then Visualizer:UnlinkFromSound() end
end)
else
table.clear(Visualizer.VolumeBuffer)
for i,Bar in ipairs(Visualizer.Bars) do
Bar:TweenSize(
UDim2.new(BAR_SIZE,0,0.02,0),
Enum.EasingDirection.Out, Enum.EasingStyle.Linear, UPDATE_WAIT, true
)
end
end
end
function Visualizer:LinkToSound(Sound)
Visualizer:UnlinkFromSound()
table.clear(Visualizer.VolumeBuffer)
Visualizer.Sound = Sound
HandlePlaying()
Visualizer.PlayingConnection = Sound:GetPropertyChangedSignal("Playing"):Connect(HandlePlaying)
end
function Visualizer:UnlinkFromSound()
if Visualizer.PlayingConnection then
Visualizer.PlayingConnection:Disconnect()
Visualizer.PlayingConnection = nil
end
if Visualizer.BufferConnection then
Visualizer.BufferConnection:Disconnect()
Visualizer.BufferConnection = nil
end
Visualizer.Sound = nil
for i,Bar in ipairs(Visualizer.Bars) do
Bar:TweenSize(
UDim2.new(BAR_SIZE,0,0.02,0),
Enum.EasingDirection.Out, Enum.EasingStyle.Linear, UPDATE_WAIT, true
)
end
end
function Visualizer:Destroy()
if Visualizer.PlayingConnection then
Visualizer.PlayingConnection:Disconnect()
Visualizer.PlayingConnection = nil
end
if Visualizer.BufferConnection then
Visualizer.BufferConnection:Disconnect()
Visualizer.BufferConnection = nil
end
for i,Bar in ipairs(Visualizer.Bars) do
Bar:Destroy()
end
table.clear(Visualizer.VolumeBuffer)
end
return Visualizer
end
return module
| 1,473 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/AdonisModernComponents.storybook.luau | local AdonisModernComponents = script.Parent
local Packages = AdonisModernComponents.Parent.Packages
local Roact = require(Packages.Roact)
local function SortProps(Props)
table.sort(Props, function(A, B)
return A.Name < B.Name
end)
end
local function ParseDocument(Document: string)
local Summary = ''
local RequiredProps = {}
local OptionalProps = {}
local Styles = {}
Summary = Document:split('\n')[1]
for _, Line in pairs(Document:split('\n')) do
if Line:find('@prop') then
Line = Line:gsub('@prop', '')
-- Optional
local Target = RequiredProps
if Line:find('@optional') then
Line = Line:gsub('@optional', '')
Target = OptionalProps
end
-- Style
if Line:find('@style') then
Line = Line:gsub('@style', '')
Target = Styles
end
-- Parse
local Name, Type, Comment = Line:match('([%w%p]+)%s([%w%p]+)%s(.+)')
if not (Name and Type and Comment) then
warn('Invalid prop tag:' .. Line)
continue
end
table.insert(Target, {
Name = Name,
Type = Type,
Comment = Comment
})
end
end
-- Sort the props
SortProps(RequiredProps)
SortProps(OptionalProps)
return {
Summary = Summary,
Docs = {
Required = RequiredProps,
Optional = OptionalProps,
Style = Styles
}
}
end
return {
name = 'Adonis Modern Theme',
roact = Roact,
storyRoots = {
script.Parent
},
mapDefinition = function (Story)
-- Parse the document
local Parsed = ParseDocument(Story.source.Parent:FindFirstChild((Story.source.Name::string):gsub('.story', '')).Source)
Story.summary = Parsed.Summary
Story.docs = Parsed.Docs
return Story
end
}
| 461 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/FadeInOutAnimationWrapper.luau | local Components = script.Parent
local Packages = Components.Parent.Packages
local Maid = require(Packages.Maid)
local Flipper = require(Packages.Flipper)
local Roact = require(Packages.Roact)
local new = Roact.createElement
-- ////////// AnimationWrapper for Message component
local AnimationWrapper = Roact.PureComponent:extend(script.Name)
function AnimationWrapper:init()
local props = self.props
self.Maid = Maid.new()
self.CurrentAnimationState = 'Rest'
self.TransparencyMotor = Flipper.SingleMotor.new(1)
self.Transparency, self.SetTransparency = Roact.createBinding(1)
self.Maid.TransparencyMotor = function()
self.TransparencyMotor:destroy()
end
-- ////////// Animation
self.TransparencyMotor:onStep(function(Value)
self.SetTransparency(Value)
end)
self.TransparencyMotor:onComplete(function()
if self.CurrentAnimationState == 'FadeOut' then
props.OnFadeOutCompleted()
end
self.CurrentAnimationState = 'Rest'
end)
self.Maid.FadeIn = props.FadeInSignal:Connect(function()
self.CurrentAnimationState = 'FadeIn'
self.TransparencyMotor:setGoal(Flipper.Linear.new(0, {
velocity = props.FadeInVelocity,
}))
end)
self.Maid.FadeOut = props.FadeOutSignal:Connect(function()
self.CurrentAnimationState = 'FadeOut'
self.TransparencyMotor:setGoal(Flipper.Linear.new(1, {
velocity = props.FadeOutVelocity,
}))
end)
end
function AnimationWrapper:willUnmount()
self.Maid:Destroy()
end
function AnimationWrapper:render()
local props = self.props
return new('CanvasGroup', {
GroupTransparency = self.Transparency,
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
}, props[Roact.Children])
end
return AnimationWrapper
| 410 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/Hint.luau | -- Hint: Subtle hint appearing on the top of the screen
local Components = script.Parent
local Packages = Components.Parent.Packages
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Hint = Roact.PureComponent:extend(script.Name)
Hint.validateProps = t.strictInterface({
--- @prop @optional Image string Image
Image = t.optional(t.string),
--- @prop @optional TitleText string Title text
TitleText = t.optional(t.string),
--- @prop @optional BodyText string Message content
BodyText = t.optional(t.string),
})
local FONT_FACE = Font.fromId(12187364147)
local FONT_SIZE = 18
function Hint:render()
local props = self.props
self.HasThumbnailAsImage = (props.Image and props.Image:find("rbxthumb")) and true or false
self.HasAvatarThumbnailAsImage = (
self.HasThumbnailAsImage and (props.Image:match("type=Avatar") or props.Image:match("type=HeadShot"))
)
and true or false
return new("Frame", {
AutomaticSize = Enum.AutomaticSize.Y,
BackgroundColor3 = Color3.fromRGB(43, 43, 43),
BackgroundTransparency = 0.2,
BorderSizePixel = 0,
Size = UDim2.fromScale(1, 0),
}, {
Layout = new("UIListLayout", {
Padding = UDim.new(0, 10),
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
Padding = new("UIPadding", {
PaddingBottom = UDim.new(0, 5),
PaddingTop = UDim.new(0, 5),
}),
Text = new("Frame", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = 1,
}, {
Layout = new("UIListLayout", {
FillDirection = Enum.FillDirection.Vertical,
HorizontalAlignment = Enum.HorizontalAlignment.Left,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Top,
}),
SizeConstraint = new("UISizeConstraint", {
MaxSize = Vector2.new(500, math.huge),
}),
Body = props.BodyText and new("TextLabel", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = 1,
FontFace = FONT_FACE,
RichText = true,
Text = props.BodyText,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = FONT_SIZE,
TextWrapped = true,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
}),
Title = props.TitleText and new("TextLabel", {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = 0,
FontFace = FONT_FACE,
RichText = true,
Text = props.TitleText,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = FONT_SIZE,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
}),
}),
Image = props.Image and new("ImageLabel", {
BackgroundColor3 = Color3.fromRGB(45, 45, 45),
BackgroundTransparency = self.HasThumbnailAsImage and 0 or 1,
Size = UDim2.fromOffset(48/2, 48/2),
Image = props.Image,
}, {
Corner = self.HasThumbnailAsImage and new("UICorner", {
CornerRadius = UDim.new(
self.HasAvatarThumbnailAsImage and 0.5 or 0,
(not self.HasAvatarThumbnailAsImage) and 4 or 0
),
}) or nil,
}),
})
end
return Hint | 926 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/Hint.story.luau | local Components = script.Parent
local Packages = Components.Parent.Packages
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Hint = require(script.Parent.Hint)
local HintStory = Roact.PureComponent:extend(script.Name)
function HintStory:render()
local props = self.props
local Image = props.Image and "rbxthumb://type=AvatarHeadShot&id=649787117&w=48&h=48" or nil
if Image and not props.ThumbnailAsImage then
Image = "rbxassetid://8303332379"
end
return new(Hint, {
TitleText = props.Title and "<i>subtle</i> hint" or nil,
BodyText = "Hints shouldnt have that much text",
Image = Image,
})
end
return {
controls = {
Title = false,
ThumbnailAsImage = true,
Image = true,
},
story = function(StoryProps)
return new(HintStory, StoryProps.controls)
end,
}
| 223 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/Message.luau | -- Message: Attention grabbing on screen message
local Components = script.Parent
local Packages = Components.Parent.Packages
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Message = Roact.PureComponent:extend(script.Name)
Message.validateProps = t.strictInterface({
--- @prop @optional Image string Image
Image = t.optional(t.string),
--- @prop @optional TitleText string Title text
TitleText = t.optional(t.string),
--- @prop @optional BodyText string Message content
BodyText = t.optional(t.string),
})
function Message:render()
local props = self.props
self.HasThumbnailAsImage = (props.Image and props.Image:find('rbxthumb')) and true or false
self.HasAvatarThumbnailAsImage = (self.HasThumbnailAsImage and (
props.Image:match('type=Avatar') or
props.Image:match('type=HeadShot')
)) and true or false
return new('Frame', {
AnchorPoint = props.Condensed and Vector2.new(0.5, 0) or Vector2.new(0, 0.5),
AutomaticSize = props.Condensed and Enum.AutomaticSize.XY or Enum.AutomaticSize.Y,
BackgroundColor3 = Color3.fromRGB(0, 0, 0),
BackgroundTransparency = 0.2,
BorderSizePixel = 0,
Position = props.Condensed and UDim2.new(0.5, 0, 0, 150) or UDim2.fromScale(0, 0.5),
Size = props.Condensed and UDim2.fromScale(0.5, 0.5) or UDim2.fromScale(1, 0),
}, {
Layout = new('UIListLayout', {
Padding = UDim.new(0, 15),
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
Padding = new('UIPadding', {
PaddingBottom = UDim.new(0, 15),
PaddingTop = UDim.new(0, 15),
PaddingLeft = UDim.new(0, props.Condensed and 15 or 50),
PaddingRight = UDim.new(0, props.Condensed and 15 or 50),
}),
Corners = props.Condensed and new('UICorner', {
CornerRadius = UDim.new(0, 8),
}) or nil,
Text = new('Frame', {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = 1,
}, {
Layout = new('UIListLayout', {
Padding = UDim.new(0, 5),
FillDirection = Enum.FillDirection.Vertical,
HorizontalAlignment = props.Image and Enum.HorizontalAlignment.Left or Enum.HorizontalAlignment.Center,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Top,
}),
SizeConstraint = new('UISizeConstraint', {
MaxSize = Vector2.new(500, math.huge),
}),
Body = props.BodyText and new('TextLabel', {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = 1,
FontFace = Font.fromEnum(Enum.Font.SourceSans),
RichText = true,
Text = props.BodyText,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = 18,
TextWrapped = true,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
}),
Title = props.TitleText and new('TextLabel', {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
LayoutOrder = 0,
FontFace = Font.fromEnum(Enum.Font.SourceSansBold),
RichText = true,
Text = props.TitleText,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = 18,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
}),
}),
Image = props.Image and new('ImageLabel', {
BackgroundColor3 = Color3.fromRGB(45, 45, 45),
BackgroundTransparency = self.HasThumbnailAsImage and 0 or 1,
Size = UDim2.fromOffset(48, 48),
Image = props.Image,
}, {
Corner = self.HasThumbnailAsImage and new('UICorner', {
CornerRadius = UDim.new(self.HasAvatarThumbnailAsImage and 0.5 or 0, (not self.HasAvatarThumbnailAsImage) and 4 or 0),
}) or nil,
}),
})
end
return Message
| 1,107 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/Message.story.luau | local Components = script.Parent
local Packages = Components.Parent.Packages
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Message = require(script.Parent.Message)
local MessageStory = Roact.PureComponent:extend(script.Name)
function MessageStory:render()
local props = self.props
local Image = props.Image and 'rbxthumb://type=AvatarHeadShot&id=649787117&w=48&h=48' or nil
if Image and not props.ThumbnailAsImage then
Image = 'rbxassetid://8303332379'
end
return new(Message, {
TitleText = props.TitleText or 'Message from <b>omwot</b>',
BodyText = 'Dont we all love text wrapping because it is so great and this text should be wrapped, if it is not wrapped then something is wrong or it is just bad design. We all know about the things that we have to do but this is just some nonsense text in order to test some stuff. Blah blah blah is all i hear right now because yes and the yeaaou aou afouwa elf oug.',
Image = Image,
Condensed = props.Condensed,
})
end
return {
controls = {
ThumbnailAsImage = true,
Image = true,
},
stories = {
Message = function(props)
return new(MessageStory, props.controls)
end,
SmallMessage = function(props)
local controlprops = table.clone(props.controls)
controlprops.Condensed = true
return new(MessageStory, controlprops)
end
}
}
| 344 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/Notification.luau | -- Notification: Ported from roblox studio using codify plugin due to complexity, work on a better component soon
local Components = script.Parent
local Packages = Components.Parent.Packages
local Roact = require(Packages.Roact)
local new = Roact.createElement
return function (props)
return new("Frame", {
AutomaticSize = Enum.AutomaticSize.Y,
BackgroundColor3 = Color3.fromRGB(0, 0, 0),
BackgroundTransparency = 0.4,
BorderSizePixel = 0,
Size = UDim2.fromScale(1, 0),
AutoLocalize = false,
}, {
content = new("Frame", {
AutomaticSize = Enum.AutomaticSize.Y,
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BackgroundTransparency = 1,
LayoutOrder = 1,
Size = UDim2.fromScale(1, 0),
}, props[Roact.Children]),
uIListLayout = new("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Bottom,
}),
header = new("Frame", {
BackgroundColor3 = Color3.fromRGB(0, 0, 0),
BackgroundTransparency = 1,
BorderColor3 = Color3.fromRGB(27, 42, 53),
BorderSizePixel = 0,
Size = UDim2.new(1, 0, 0, 25),
}, {
fill = new("CanvasGroup", {
GroupColor3 = Color3.fromRGB(0, 0, 0),
GroupTransparency = 0.5,
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BackgroundTransparency = 1,
BorderSizePixel = 0,
Size = UDim2.fromScale(1, 1),
ZIndex = 0,
}, {
corner = new("Frame", {
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
Size = UDim2.new(1, 0, 0, 35),
}, {
uICorner = new("UICorner", {
CornerRadius = UDim.new(0, 4),
}),
cornerFilling = new("Frame", {
AnchorPoint = Vector2.new(0, 1),
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BorderSizePixel = 0,
Position = UDim2.fromScale(0, 1),
Size = UDim2.new(1, 0, 0, 5),
}),
}),
}),
wrapper = new("Frame", {
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
}, {
uIPadding = new("UIPadding", {
PaddingBottom = UDim.new(0, 5),
PaddingLeft = UDim.new(0, 5),
PaddingRight = UDim.new(0, 5),
PaddingTop = UDim.new(0, 5),
}),
left = new("Frame", {
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
}, {
icon = props.Image and new("ImageLabel", {
Image = props.Image,
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BackgroundTransparency = 1,
BorderSizePixel = 0,
Position = UDim2.fromOffset(5, 5),
Size = UDim2.fromOffset(16, 16),
ZIndex = 10,
AutoLocalize = false,
}),
title = new("TextLabel", {
FontFace = Font.fromEnum(Enum.Font.SourceSansBold),
Text = props.TitleText,
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = 14,
TextStrokeColor3 = Color3.fromRGB(90, 90, 90),
TextWrapped = true,
TextXAlignment = Enum.TextXAlignment.Left,
BackgroundTransparency = 1,
BorderSizePixel = 0,
Position = UDim2.fromOffset(30, 8),
Size = UDim2.new(1, -60, 0, 15),
ZIndex = 10,
AutoLocalize = false,
}),
uIListLayout1 = new("UIListLayout", {
Padding = UDim.new(0, 5),
FillDirection = Enum.FillDirection.Horizontal,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
}),
right = new("Frame", {
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
}, {
close = new("TextButton", {
FontFace = Font.fromEnum(Enum.Font.FredokaOne),
Text = "x",
TextColor3 = Color3.fromRGB(255, 255, 255),
TextSize = 19,
TextWrapped = true,
BackgroundColor3 = Color3.fromRGB(195, 33, 35),
BackgroundTransparency = 1,
BorderSizePixel = 0,
Position = UDim2.new(1, -25, 0, 5),
Size = UDim2.fromOffset(12, 12),
ZIndex = 10,
AutoLocalize = false,
[Roact.Event.Activated] = props.OnClose,
}),
uIListLayout2 = new("UIListLayout", {
Padding = UDim.new(0, 5),
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = Enum.HorizontalAlignment.Right,
SortOrder = Enum.SortOrder.LayoutOrder,
}),
}),
}),
}),
uICorner1 = new("UICorner", {
CornerRadius = UDim.new(0, 4),
}),
})
end
| 1,453 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/AdonisModernComponents/Notification.story.luau | local Components = script.Parent
local Packages = Components.Parent.Packages
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Notification = require(script.Parent.Notification)
local NotificationStory = Roact.PureComponent:extend(script.Name)
function NotificationStory:render()
return new(Notification, {
TitleText = "Notification",
OnClose = warn,
}, {
Test = new('TextLabel', {
Size = UDim2.fromOffset(200, 100),
BackgroundTransparency = 0.9,
Text = '[Roact.Children] goes here.\n200 x 100 test TextLabel',
TextColor3 = Color3.fromRGB(255, 255, 255),
})
})
end
return NotificationStory
| 163 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Effect/DropShadow.luau | -- DropShadow: A component that is the base structure for a UI DropShadow
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local DropShadow = Roact.PureComponent:extend(script.Name)
DropShadow.defaultProps = {
CornerRadius = UDim.new(0, 8), --- @defaultProp
}
DropShadow.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The DropShadow's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional @style BackgroundColor string|table The DropShadow's background color
BackgroundColor = t.optional(StyleValidator),
--- @prop @optional CornerRadius UDim Corner radius
CornerRadius = t.optional(t.UDim),
--- @prop @optional AutomaticSize Enum.AutomaticSize Auto sizing
AutomaticSize = t.optional(t.EnumItem),
--- @prop @optional Position UDim2 The DropShadow's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The DropShadow's size
Size = t.union(t.UDim2, t.table),
--- @prop @optional [Roact.Children] table The contents to display in the DropShadow area
[Roact.Children] = t.optional(t.table),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function DropShadow:render()
local props = self.props or {}
return WithTheme(function(Theme)
-- ////////// DropShadow
return new('ImageLabel', Sift.Dictionary.join({
BackgroundTransparency = 1,
AnchorPoint = props.AnchorPoint,
Position = props.Position,
Image = 'rbxassetid://186491278',
ImageTransparency = 0.25,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(20, 15, 76, 71),
SliceScale = props.CornerRadius.Offset / 4, -- This works kinda?
Size = props.Size,
}, props.Native), props[Roact.Children])
end)
end
return DropShadow
| 527 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Effect/FocusFrame.luau | -- FocusFrame: This frame will show above all other ui
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local FocusFrame = Roact.PureComponent:extend(script.Name)
FocusFrame.defaultProps = {
Priority = 1, --- @defaultProp
RelativeToParent = false, --- @defaultProp
ConsumeInput = true, --- @defaultProp
BackgroundTransparency = 1, --- @defaultProp
Size = UDim2.fromScale(1, 1), --- @defaultProp
}
FocusFrame.validateProps = t.interface({
--- @prop @optional Priority number THe priority the frame will be shown at
Priority = t.optional(t.number),
--- @prop Reason string The reason that this frame is being used for orver another frame, this is for futureproofing, a few examples are: DROPDOWN, TOOLTIP, MOUSECURSORADORNMENT
Reason = t.string,
--- @prop @optional RelativeToParent boolean Determines if the position is relative to the Frame's parent
RelativeToParent = t.optional(t.boolean),
--- @prop @optional ConsumeInput boolean If true, the FocusFrame will block all input to other components, any attempt to interact with external components will cause the focus to be lost
ConsumeInput = t.optional(t.boolean),
--- @prop @optional [Roact.Event.FocusLost] function The functin to call when the focus is lost
[Roact.Event.FocusLost] = t.optional(t.callback),
})
function FocusFrame:init()
local props = self.props
-- Connection container
self.Connections = {}
-- ////////// Safe Props
local SafeProps = Sift.Dictionary.copy(props)
-- Remove unsafe props
SafeProps.Priority = nil
SafeProps.RelativeToParent = nil
SafeProps.Reason = nil
SafeProps.ConsumeInput = nil
SafeProps[Roact.Event.FocusLost] = nil
-- Register safe props
self.SafeProps = SafeProps
-- ////////// Wrapper Frame
-- Frame reference for mirroring size and position
self.rbx = props[Roact.Ref] or Roact.createRef() -- Roact does not support multiple refs, use provided
end
function FocusFrame:didMount()
local SafeProps = self.SafeProps
-- ////////// Wrapper Frame
-- Create a wrapper frame
local WrapperFrame = Instance.new('Frame')
for Property, Value in pairs(SafeProps) do
-- Avoid Roact PropMarkers
if typeof(Property) ~= 'string' then
continue
end
WrapperFrame[Property] = Value
end
-- Register
self.WrapperFrame = WrapperFrame
-- ////////// Mirror
-- Mirror
self:Update()
local rbx = self.rbx.current
local Gui = rbx:FindFirstAncestorWhichIsA('GuiMain') or rbx:FindFirstAncestorWhichIsA('PluginGui')
self.Connections.Changed = rbx.Changed:Connect(function()
self:Update()
end)
end
function FocusFrame:didUpdate()
self:Update()
end
function FocusFrame:Update()
local props = self.props
local rbx = self.rbx.current
local WrapperFrame = self.WrapperFrame
local Gui = rbx:FindFirstAncestorWhichIsA('GuiMain') or rbx:FindFirstAncestorWhichIsA('PluginGui')
if not Gui then
return
end
-- ////////// Input Consumer
if props.ConsumeInput and not self.InputConsumer then
local InputConsumer = Instance.new('ImageButton')
InputConsumer.BackgroundTransparency = 1
InputConsumer.Size = UDim2.fromScale(1, 1)
-- Sink input
self.Connections.InputConsumerHover = InputConsumer.MouseEnter:Connect(function()end)
self.Connections.InputConsumerFocusLost = InputConsumer.MouseButton1Down:Connect(function()
self:ReleaseFocus()
end)
self.InputConsumer = InputConsumer
InputConsumer.Parent = Gui
local ScrollConsumer = Instance.new('ScrollingFrame')
ScrollConsumer.Size = UDim2.fromScale(1, 1)
ScrollConsumer.ScrollingEnabled = true
ScrollConsumer.CanvasSize = UDim2.fromScale(1, 1)
ScrollConsumer.BorderSizePixel = 1
ScrollConsumer.BackgroundTransparency = 1
ScrollConsumer.ScrollBarImageTransparency = 1
ScrollConsumer.ScrollBarThickness = 0
ScrollConsumer.Parent = InputConsumer
end
-- ////////// Wrapper Frame
local AbsoluteSize = rbx.AbsoluteSize
local AbsolutePosition = rbx.AbsolutePosition
local AbsoluteRotation = rbx.AbsoluteRotation
WrapperFrame.Size = UDim2.fromOffset(AbsoluteSize.X, AbsoluteSize.Y)
WrapperFrame.Position = UDim2.fromOffset(AbsolutePosition.X, AbsolutePosition.Y)
WrapperFrame.Rotation = AbsoluteRotation
-- Move children
for _, Child in pairs(rbx:GetChildren()) do
Child.Parent = WrapperFrame
end
-- Priority level
WrapperFrame.ZIndex = props.Priority
-- Show above all Gui with the MainGui
WrapperFrame.Parent = Gui
end
function FocusFrame:ReleaseFocus()
if self.props[Roact.Event.FocusLost] then
task.spawn(self.props[Roact.Event.FocusLost], self.rbx.current)
end
end
function FocusFrame:Cleanup()
self.WrapperFrame:Destroy()
if self.InputConsumer then
self.InputConsumer:Destroy()
end
for _, Connection in pairs(self.Connections) do
pcall(Connection.Disconnect, Connection)
end
end
function FocusFrame:willUnmount()
self:Cleanup()
end
function FocusFrame:render()
local SafeProps = self.SafeProps
-- ////////// FocusFrame
return new('Frame', Sift.Dictionary.join({
[Roact.Ref] = self.rbx,
}, SafeProps))
end
return FocusFrame
| 1,300 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Effect/UIStroke.luau | -- UIStroke: A custom UIStroke wrapper with support for stroke inset
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local UIStroke = Roact.PureComponent:extend(script.Name)
UIStroke.defaultProps = {
Thickness = 1, --- @defaultProp
BorderMode = Enum.BorderMode.Inset, --- @defaultProp
}
function UIStroke:ClearConnections()
if self.SizeChangedConnection then
self.SizeChangedConnection = self.SizeChangedConnection:Disconnect()
end
if self.CornerChangedConnection then
self.CornerChangedConnection = self.CornerChangedConnection:Disconnect()
end
if self.ChildAddedConnection then
self.ChildAddedConnection = self.ChildAddedConnection:Disconnect()
end
end
function UIStroke:willUnmount()
self:ClearConnections()
end
function UIStroke:ApplyChanges(rbx)
local props = self.props
local Parent = rbx and rbx.Parent
if rbx and Parent and Parent:IsA('GuiObject') then
-- Apply the size
local AbsoluteSize = Parent.AbsoluteSize
rbx.Size = UDim2.fromOffset(AbsoluteSize.X, AbsoluteSize.Y)
- (props.BorderMode == Enum.BorderMode.Inset and UDim2.fromOffset(props.Thickness * 2, props.Thickness * 2) or UDim2.new()) -- Account for stroke width and inset
-- Apply corner radius
local Corner = Parent:FindFirstChildOfClass('UICorner')
if Corner then
if not self.CornerChangedConnection then
self.CornerChangedConnection = Corner:GetPropertyChangedSignal('CornerRadius'):Connect(function()
self:ApplyChanges(rbx)
end)
end
rbx.Corner.CornerRadius = Corner.CornerRadius - (props.BorderMode == Enum.BorderMode.Inset and UDim.new(0, props.Thickness) or UDim.new()) -- Account for stroke width
end
end
end
function UIStroke:render()
local props = self.props
local SafeProps = Sift.Dictionary.copy(props)
SafeProps.BorderMode = nil
return new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Position = UDim2.fromScale(0.5, 0.5),
-- Used for size and corner detection
[Roact.Ref] = function (rbx: GuiObject)
if rbx and rbx.Parent and rbx.Parent:IsA('GuiObject') then
-- Prepare
self:ClearConnections()
self:ApplyChanges(rbx)
-- Detect whenever an applicable UI modifier is added
self.ChildAddedConnection = rbx.Parent.ChildAdded:Connect(function()
self:ApplyChanges(rbx)
end)
-- Detect whenever the parent frame's size is changed
self.SizeChangedConnection = rbx.Parent:GetPropertyChangedSignal('AbsoluteSize'):Connect(function()
self:ApplyChanges(rbx)
end)
end
end
}, {
Stroke = new('UIStroke', SafeProps),
Corner = new('UICorner', {
CornerRadius = UDim.new(0, 0),
}),
})
end
return UIStroke
| 727 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Flyout/Flyout.luau | -- Flyout: Flyout component
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Acrylic = require(Winro.App.Surface.Acrylic)
local FLYOUT_BASE_FILL = "colors/Background/Fill_Color/Acrylic_Background/Base"
local FLYOUT_BASE_STROKE = "colors/Stroke_Color/Surface_Stroke/Flyout"
local FLYOUT_TEXT_STYLE = "colors/Fill_Color/Text/Primary"
local FLYOUT_FONT_STYLE = "fonts/Body"
local Flyout = Roact.PureComponent:extend(script.Name)
Flyout.defaultProps = {
Size = UDim2.fromOffset(320, 72), --- @defaultProp
FitContents = true, --- @defaultProp
}
Flyout.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Flyout's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional Position UDim2 The Flyout's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The Flyout's size
Size = t.optional(t.UDim2),
--- @prop @optional RichText boolean The Flyout's rich text property
RichText = t.optional(t.boolean),
--- @prop @optional Text string The Flyout's text
Text = t.optional(t.string),
--- @prop @optional FitContents boolean Determines if the Flyout will resize to fit it's contents
FitContents = t.optional(t.boolean),
--- @prop @optional Native table {property:value} The native props for the Flyout's main element
Native = t.optional(t.table),
--- @prop @optional [Roact.Children] table The flyout's contents
[Roact.Children] = t.optional(t.table),
})
function Flyout:init()
-- Content fitting
self.ContentSize, self.SetContentSize = Roact.createBinding(self.props.Size)
end
function Flyout:render()
local props = self.props
return WithTheme(function(Theme)
-- ////////// Flyout Surface
local SurfaceStyle = Theme[FLYOUT_BASE_FILL]
local StrokeStyle = Theme[FLYOUT_BASE_STROKE]
local Base = new(Acrylic, {
BackgroundColor3 = SurfaceStyle.Color,
BackgroundTransparency = SurfaceStyle.Transparency,
BorderSizePixel = 0,
Size = self.ContentSize,
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer'] - 1), -- -1px to account for stroke
}),
Stroke = new('UIStroke', {
Color = StrokeStyle.Color,
Transparency = StrokeStyle.Transparency,
Thickness = 1,
}),
})
-- ////////// Flyout Content
local TextStyle = Theme[FLYOUT_TEXT_STYLE]
local TextFont = Theme[FLYOUT_FONT_STYLE]
local Container = new('Frame', {
AutomaticSize = props.FitContents and 'Y' or 'None',
BackgroundTransparency = 1,
Size = self.ContentSize,
}, {
Layout = new('UIListLayout', {
SortOrder = Enum.SortOrder.LayoutOrder
}),
Content = new('Frame', {
AutomaticSize = props.FitContents and 'Y' or 'None',
BackgroundTransparency = 1,
Size = self.ContentSize,
[Roact.Change.AbsoluteSize] = function(rbx)
if props.FitContents then
self.SetContentSize(UDim2.fromOffset(rbx.AbsoluteSize.X, rbx.AbsoluteSize.Y))
end
end,
}, {
Contents = Roact.createFragment(props[Roact.Children] or {}),
_Padding = new('UIPadding', {
PaddingBottom = UDim.new(0, 16),
PaddingLeft = UDim.new(0, 16),
PaddingRight = UDim.new(0, 16),
PaddingTop = UDim.new(0, 16),
}),
_Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Vertical,
Padding = UDim.new(0, 16),
SortOrder = Enum.SortOrder.LayoutOrder,
}),
_Text = props.Text and new('TextLabel', {
LayoutOrder = -1,
BackgroundTransparency = 1,
AutomaticSize = props.FitContents and 'Y' or 'None',
FontFace = TextFont.Font,
Size = UDim2.fromScale(1, props.FitContents and 0 or 1),
LineHeight = TextFont.LineHeight,
RichText = props.RichText,
Text = props.Text,
TextColor3 = TextStyle.Color,
TextSize = TextFont.Size,
TextTransparency = TextStyle.Transparency,
TextWrapped = true,
TextXAlignment = 'Left',
TextYAlignment = 'Top',
}),
})
})
-- ////////// Flyout
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
AutomaticSize = props.FitContents and 'Y' or 'None',
BackgroundTransparency = 1,
Position = props.Position,
Size = self.ContentSize,
[Roact.Change.AbsoluteSize] = function(rbx)
self.SetContentSize(UDim2.fromOffset(rbx.AbsoluteSize.X, rbx.AbsoluteSize.Y))
end,
}, props.Native), {
Base = Base,
Container = Container,
})
end)
end
return Flyout
| 1,291 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Flyout/Flyout.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Flyout = require(script.Parent.Flyout)
local Button = require(Winro.App.Input.Button.Button)
local FlyoutStory = Roact.PureComponent:extend(script.Name)
function FlyoutStory:render()
return new(Flyout, Sift.Dictionary.join({
Size = UDim2.new(1, 0, 0, 0),
FitContents = true,
Text = 'This is the flyout component\nThe flyout component should not be used as a dialog but instead to show quick actions or notification alerts.',
[Roact.Children] = self.props.IncludeContents and new(Button, {
Size = UDim2.new(0, 150, 0, 30),
Text = 'Contents'
})
}, self.props.controls))
end
return {
controls = {
IncludeContents = true,
},
stories = {
Flyout = function (props)
return new(FlyoutStory, props.controls)
end
}
}
| 256 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Info/Tooltip.luau | -- Tooltip: A flyout style label
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local GetTextSize = require(Winro.Utility.GetTextSize)
local DropShadow = require(Winro.App.Effect.DropShadow)
local Acrylic = require(Winro.App.Surface.Acrylic)
local Tooltip = Roact.PureComponent:extend(script.Name)
Tooltip.defaultProps = {
AutomaticSize = Enum.AutomaticSize.XY, --- @defaultProp
Position = UDim2.new(), --- @defaultProp
Size = UDim2.fromOffset(0, 28), --- @defaultProp
DropShadowEnabled = true, --- @defaultProp
}
Tooltip.validateProps = t.strictInterface({
--- @prop @optional AutomaticSize Enum.AutomaticSize The Tooltip's automatic scaling
AutomaticSize = t.optional(t.enum(Enum.AutomaticSize)),
--- @prop @optional AnchorPoint Vector2 Anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional DropShadowEnabled boolan Drop shadow's enabled status
DropShadowEnabled = t.optional(t.boolean),
--- @prop @optional Position UDim2 Position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 Size
Size = t.optional(t.UDim2),
--- @prop Text string The Tooltip's text
Text = t.string,
--- @prop @optional Icon string|table The Tooltip's icon
Icon = t.optional(StyleValidator),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function Tooltip:init()
-- Size binding, for `AutomaticSize`
self.Size, self.SetSize = Roact.createBinding(UDim2.new())
end
function Tooltip:render()
local props = self.props
return WithTheme(function(Theme)
-- ////////// Text label
local LabelFontStyle = Theme['fonts/Caption']
local LabelTextStyle = Theme['colors/Fill_Color/Text/Primary']
local GotTextSize, TextSize = GetTextSize(props.Text, LabelFontStyle.Font, LabelFontStyle.Size)
-- Fallback TextSize
if not GotTextSize then
warn('GetTextSize() Failed:', TextSize)
TextSize = Vector2.new(0, 100)
end
local Label = new('TextLabel', {
AutomaticSize = if GotTextSize then props.AutomaticSize else Enum.AutomaticSize.X,
BackgroundTransparency = 1,
FontFace = LabelFontStyle.Font,
LayoutOrder = 2,
Size = UDim2.fromOffset(TextSize.X, TextSize.Y),
Text = props.Text,
TextColor3 = LabelTextStyle.Color,
TextSize = LabelFontStyle.Size,
TextTransparency = LabelTextStyle.Transparency,
TextXAlignment = Enum.TextXAlignment.Left,
})
-- ////////// Icon
local IconImage = props.Icon and Theme[props.Icon]
local IconImageSize = nil
if IconImage then
local IconImageRectSize = IconImage.ImageRectSize == Vector2.new() and Vector2.new(16, 16) or IconImage.ImageRectSize
IconImageSize = UDim2.fromOffset(
math.clamp(IconImageRectSize.X, 0, 9*4),
math.clamp(IconImageRectSize.Y, 0, 9*4)
)
else
IconImageSize = UDim2.fromOffset(16, 16)
end
local Icon = IconImage and new('ImageLabel', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Image = IconImage.Image,
ImageColor3 = LabelTextStyle.Color,
ImageRectOffset = IconImage.ImageRectOffset,
ImageRectSize = IconImage.ImageRectSize,
ImageTransparency = LabelTextStyle.Transparency,
Position = UDim2.fromScale(0.5, 0.5),
ResampleMode = IconImage.ResampleMode,
Size = IconImageSize,
})
-- ////////// Text and Icon Wrapper
local Wrapper = new('Frame', {
AutomaticSize = props.AutomaticSize,
BackgroundTransparency = 1,
}, {
Text = Label,
Icon = Icon,
Layout = new('UIListLayout', {
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Center,
FillDirection = Enum.FillDirection.Horizontal,
Padding = UDim.new(0, 8),
}),
})
-- ////////// Stroke
local StrokeStyle = Theme['colors/Stroke_Color/Surface_Stroke/Flyout']
local Stroke = new('UIStroke', {
Color = StrokeStyle.Color,
Transparency = StrokeStyle.Transparency,
})
-- ////////// Tooltip
local TooltipStyle = Theme['colors/Background/Fill_Color/Acrylic_Background/Default']
local Tooltip = new(Acrylic, {
AutomaticSize = props.AutomaticSize,
AnchorPoint = props.DropShadowEnabled and Vector2.new(0.5, 0.5) or props.AnchorPoint,
BackgroundColor3 = TooltipStyle.Color,
BackgroundTransparency = TooltipStyle.Transparency,
Position = props.DropShadowEnabled and UDim2.fromScale(0.5, 0.5) or props.Position,
Size = props.Size,
[Roact.Change.AbsoluteSize] = function (rbx)
local AbsoluteSize = rbx.AbsoluteSize
self.SetSize(UDim2.fromOffset(AbsoluteSize.X, AbsoluteSize.Y) - UDim2.fromOffset(8 + 8, 7 + 5)) -- Account for padding
end
}, {
TextAndIconWrapper = Wrapper,
Stroke = Stroke,
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Inner']),
}),
Layout = new('UIListLayout', {
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Center,
Padding = UDim.new(0, 10),
}),
Padding = new('UIPadding', {
PaddingBottom = UDim.new(0, 7),
PaddingLeft = UDim.new(0, 8),
PaddingRight = UDim.new(0, 8),
PaddingTop = UDim.new(0, 5),
}),
})
if props.DropShadowEnabled then
return new(DropShadow, {
AnchorPoint = props.AnchorPoint,
Position = props.Position - UDim2.fromOffset(20 / 2, 20 / 2),
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Inner']),
Size = self.Size:map(function(Size)
return Size + UDim2.fromOffset(20, 20) + UDim2.fromOffset(8 + 8, 7 + 5) -- Accont for padding
end),
}, Tooltip)
else
return Tooltip
end
end)
end
return Tooltip
| 1,646 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Info/Tooltip.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Tooltip = require(script.Parent.Tooltip)
local TooltipStory = Roact.PureComponent:extend(script.Name)
function TooltipStory:render()
local props = self.props
return new(Tooltip, Sift.Dictionary.join({
Text = props.Text .. (props.Wrapped and '\nThat is wrapped' or ''),
Icon = props.Icon and 'images/roblox/icons/logo/studiologo_small/1x' or nil,
}, props.Props))
end
return {
controls = {
Text = 'Tooltip Text',
Icon = false,
Wrapped = false,
},
stories = {
Tooltip = function(props)
return new(TooltipStory, props.controls)
end,
}
}
| 196 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/Button.luau | -- Button: The basic button component
-- https://www.figma.com/file/uNmIxgdbUT44MZjQCTIMe3/Windows-UI-3-(Community)?node-id=24412%3A121169
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local ApplyDescription = Theme.ApplyDescription
local RegisterStateAction = Theme.RegisterStateAction
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ButtonRoot = script.Parent
local ButtonStyleValidator = require(ButtonRoot.Validators.ButtonStyleValidator)
local Descriptions = require(ButtonRoot.Descriptions.ButtonStateDescriptions)
local BUTTON_COLOR_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/Input/Button/Color"
local BUTTON_TRANSPARENCY_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/Input/Button/Transparency"
local Button = Roact.PureComponent:extend(script.Name)
Button.StyleBindings = {
'Fill',
'Stroke',
'Text',
}
Button.defaultProps = {
AnchorPoint = Vector2.new(0.5, 0.5), --- @defaultProp
BorderSizePixel = 1, --- @defaultProp
Font = "fonts/Body", --- @defaultProp
Position = UDim2.fromScale(0.5, 0.5), --- @defaultProp
Size = UDim2.fromOffset(240, 30), --- @defaultProp
Style = 'Standard', --- @defaultProp
Text = 'Text', --- @defaultProp
}
Button.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Button's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional @style BackgroundColor string|table The style to use for the Button's background color
BackgroundColor = t.optional(StyleValidator),
--- @prop @optional @style BorderColor string|table The button's border style
BorderColor = t.optional(StyleValidator),
--- @prop @optional BorderSizePixel number The size, in pixels, of the border
BorderSizePixel = t.optional(t.numberPositive),
--- @prop @optional CornerRadius UDim The radius of the Button's corners
CornerRadius = t.optional(t.UDim),
--- @prop @optional Disabled boolean If `true`, the button will appear as disabled
Disabled = t.optional(t.boolean),
--- @prop @optional @style Font string|table The font style of the Button's text
Font = t.optional(StyleValidator),
--- @prop @optional LayoutOrder number The Button's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Position UDim2 The Button's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The Button's size
Size = t.optional(t.UDim2),
--- @prop @optional Style string The Button's style
Style = t.optional(ButtonStyleValidator),
--- @prop @optional Text string The Button's text
Text = t.optional(t.string),
--- @prop @optional Native table The native props
Native = t.optional(t.table),
--- @prop @optional [Roact.Children] table Child contents
[Roact.Children] = t.optional(t.table),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
})
function Button:init()
-- Create Style Bindings
for _, StyleBinding in pairs(self.StyleBindings) do
self[StyleBinding], self['Set' .. StyleBinding] = Roact.createBinding({})
end
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial State
self:setState({
State = 'Rest'
})
end
function Button:willUnmount()
-- Clear motors for each style binding
for _, StyleBinding in pairs(self.StyleBindings) do
-- Look for a motor
local Motor = self[StyleBinding .. 'Motor']
-- Remove motor if found
if Motor then
pcall(Motor.destroy, Motor)
self[StyleBinding .. 'Motor'] = nil
end
end
end
function Button:ApplyDescription(Description, Theme)
local props = self.props
Description = Sift.Dictionary.copy(Description)
-- Prop Overrides
local FillOverride = props.BackgroundColor
local StrokeOverride = props.BorderColor
local TextOverride = props.TextColor
if FillOverride then
Description.Fill = FillOverride
end
if StrokeOverride then
Description.Stroke = StrokeOverride
end
if TextOverride then
Description.Text = TextOverride
end
ApplyDescription(self, Description, Theme, Theme[BUTTON_COLOR_ANIMATION_SPRING_SETTINGS], Theme[BUTTON_TRANSPARENCY_ANIMATION_SPRING_SETTINGS])
end
function Button:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- Apply Description
if props.Style == 'Accent' then
if props.Disabled then
self:ApplyDescription(Descriptions.Accent.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Accent.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Accent.Hover, Theme)
elseif state.State == 'Pressed' then
self:ApplyDescription(Descriptions.Accent.Pressed, Theme)
end
elseif props.Style == 'Standard' or props.Style == 'Default' then
if props.Disabled then
self:ApplyDescription(Descriptions.Standard.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Standard.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Standard.Hover, Theme)
elseif state.State == 'Pressed' then
self:ApplyDescription(Descriptions.Standard.Pressed, Theme)
end
elseif props.Style == 'Primary' then
if props.Disabled then
self:ApplyDescription(Descriptions.Primary.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Primary.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Primary.Hover, Theme)
elseif state.State == 'Pressed' then
self:ApplyDescription(Descriptions.Primary.Pressed, Theme)
end
elseif props.Style == 'Secondary' then
if props.Disabled then
self:ApplyDescription(Descriptions.Secondary.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Secondary.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Secondary.Hover, Theme)
elseif state.State == 'Pressed' then
self:ApplyDescription(Descriptions.Secondary.Pressed, Theme)
end
end
-- ////////// Button Stroke
local Stroke = new('UIStroke', {
Enabled = not props.Disabled,
ApplyStrokeMode = 'Border',
Thickness = props.BorderSizePixel,
Color = self.Stroke:map(function(Style)
return Style.Color
end),
}, {
Gradient = new('UIGradient', {
Rotation = 90,
Color = self.Stroke:map(function(Style)
return (Style.ColorSequence or ColorSequence.new(Style.Color))
end),
Transparency = self.Stroke:map(function(Style)
return (Style.TransparencySequence or NumberSequence.new(Style.Transparency))
end),
})
})
-- ////////// Button
local ButtonFont = Theme[props.Font]
local Button = new('TextButton', {
AutoButtonColor = false,
AnchorPoint = Vector2.new(0.5, 0.5),
FontFace = ButtonFont.Font,
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.fromScale(1, 1) - UDim2.fromOffset(2, 2), -- Account for stroke thickness
Text = props.Text,
TextSize = ButtonFont.Size,
BackgroundColor3 = self.Fill:map(function(Style)
return Style.Color
end),
BackgroundTransparency = self.Fill:map(function(Style)
return Style.Transparency
end),
TextColor3 = self.Text:map(function(Style)
return Style.Color
end),
TextTransparency = self.Text:map(function(Style)
return Style.Transparency
end),
[Roact.Event.Activated] = self[Roact.Event.Activated],
[Roact.Event.MouseButton1Down] = self[Roact.Event.MouseButton1Down],
[Roact.Event.MouseButton1Up] = self[Roact.Event.MouseButton1Up],
[Roact.Event.MouseEnter] = self[Roact.Event.MouseEnter],
[Roact.Event.MouseLeave] = self[Roact.Event.MouseLeave],
}, {
Stroke = Stroke,
Corners = new('UICorner', {
CornerRadius = props.CornerRadius or UDim.new(0, Theme['styles/CornerRadius/Default/Inner']),
}),
})
-- ////////// Content Wrapper
local ContentWrapper = props[Roact.Children] and new('Frame', {
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
}, props[Roact.Children]) or nil
-- ////////// Button Wrapper
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
LayoutOrder = props.LayoutOrder,
Position = props.Position,
Size = props.Size,
}, props.Native), {
Button = Button,
ContentWrapper = ContentWrapper,
})
end)
end
return Button
| 2,411 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/Button.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ButtonRoot = script.Parent
local Button = require(ButtonRoot.Button)
local BORDER_PADDING = UDim.new(0, 8)
local ButtonStory = Roact.PureComponent:extend(script.Name)
function ButtonStory:render()
local props = self.props
return WithTheme(function(Theme)
return new('Frame', {
BackgroundTransparency = props.BackgroundTransparency,
BackgroundColor3 = Theme['colors/Background/Fill_Color/Solid_Background/Base'].Color,
AutomaticSize = 'XY'
}, {
Padding = new('UIPadding', {
PaddingBottom = BORDER_PADDING,
PaddingLeft = BORDER_PADDING,
PaddingRight = BORDER_PADDING,
PaddingTop = BORDER_PADDING,
}),
Button = new(Button, {
AnchorPoint = Vector2.new(0, 0),
Disabled = props.Disabled,
Position = UDim2.fromScale(0, 0),
Style = props.Style,
[Roact.Event.Activated] = print
})
})
end)
end
return {
controls = {
Disabled = false,
Style = {
'Accent',
'Primary',
'Secondary',
'Standard',
'Default',
}
},
stories = {
Button = function (props)
return Roact.createFragment({
OnBackground = new(ButtonStory, Sift.Dictionary.join({
BackgroundTransparency = 0,
}, props.controls)),
NoBackground = new(ButtonStory, Sift.Dictionary.join({
BackgroundTransparency = 1,
}, props.controls))
})
end
}
}
| 425 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/ButtonStack-DESKTOP-5MGM2GN.luau | -- ButtonStack: A button list
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ButtonRoot = script.Parent
local Button = require(ButtonRoot.Button)
local ButtonStack = Roact.PureComponent:extend(script.Name)
ButtonStack.defaultProps = {
ButtonHeight = UDim.new(0, 30), --- @defaultProp,
Padding = UDim.new(0, 8), --- @defaultProp
ButtonAlignment = Enum.HorizontalAlignment.Left, --- @defaultProp
HorizontalAlignment = Enum.HorizontalAlignment.Right, --- @defaultProp
VerticalAlignment = Enum.VerticalAlignment.Center, --- @defaultProp
MinSlack = 50, --- @defaultProp
StackWidth = UDim.new(1, 0), --- @defaultProp
PaddingLeft = UDim.new(), --- @defaultProp
PaddingRight = UDim.new(), --- @defaultProp
PaddingBottom = UDim.new(), --- @defaultProp
PaddingTop = UDim.new(), --- @defaultProp
}
ButtonStack.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Stack's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional LayoutOrder number THe Stack's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Position UDim2 The Stack's position
Position = t.optional(t.UDim2),
--- @prop @optional FillWidth boolean Determines if buttons fill the entire Stack
FillWidth = t.optional(t.boolean),
--- @prop @optional Padding UDim The padding between each button
Padding = t.optional(t.UDim),
--- @prop @optional PaddingLeft UDim The left padding
PaddingLeft = t.optional(t.UDim),
--- @prop @optional PaddingRight UDim The right padding
PaddingRight = t.optional(t.UDim),
--- @prop @optional PaddingTop UDim The top padding
PaddingTop = t.optional(t.UDim),
--- @prop @optional PaddingBottom UDim The bottom padding
PaddingBottom = t.optional(t.UDim),
--- @prop @optional Size UDim2 The Stack's size
Size = t.optional(t.UDim2),
--- @prop @optional StackWidth UDim The space to fill
StackWidth = t.optional(t.UDim),
--- @prop Buttons table The props for the buttons to display
Buttons = t.table,
--- @prop @optional ButtonHeight UDim Each Button's height
ButtonHeight = t.optional(t.UDim),
--- @prop @optional ButtonAlignment Enum.HorizontalAlignment The aligmnent of buttons
ButtonAlignment = t.optional(t.enum(Enum.HorizontalAlignment)),
--- @prop @optional HorizontalAlignment Enum.HorizontalAlignment The Horizontal alignment of the buttons
HorizontalAlignment = t.optional(t.enum(Enum.HorizontalAlignment)),
--- @prop @optional VerticalAlignment Enum.VerticalAlignment The Vertical alignment of the buttons
VerticalAlignment = t.optional(t.enum(Enum.VerticalAlignment)),
--- @prop @optional MinSlack number The MinSlack width between the end of the buttons to the end of the stack before buttons fill the entire Stack
MinSlack = t.optional(t.number),
--- @prop @optional [Roact.Children] table Roact.Children
[Roact.Children] = t.optional(t.table),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function ButtonStack:init()
-- Initial state
self:setState({
Width = 0
})
end
function ButtonStack:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- ////////// Buttons
local Buttons = {}
-- Get the divided size for each button
local FullWidthSize = UDim2.new(1 / #props.Buttons)
local IsFirstButton = true
for ButtonIndex, ButtonProps in pairs(props.Buttons) do
Buttons['Button' .. ButtonIndex] = new(Button, Sift.Dictionary.join(ButtonProps, {
LayoutOrder = props.ButtonAlignment == Enum.HorizontalAlignment.Right and -ButtonIndex or ButtonIndex,
Size = UDim2.new(FullWidthSize.X.Scale, FullWidthSize.X.Offset - (IsFirstButton and 0 or props.Padding.Offset), props.ButtonHeight.Scale, props.ButtonHeight.Offset),
}))
-- Register first button
IsFirstButton = false
end
-- ////////// Button Container
local ButtonContainer = new('Frame', {
BackgroundTransparency = 1,
Size = UDim2.new(props.StackWidth.Scale, props.StackWidth.Offset, 1, 0),
}, {
Buttons = Roact.createFragment(Buttons),
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = props.HorizontalAlignment,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = props.VerticalAlignment,
Padding = props.Padding,
}),
})
-- ////////// Button Stack
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
LayoutOrder = props.LayoutOrder,
Position = props.Position,
Size = props.Size,
[Roact.Change.AbsoluteSize] = function (rbx)
self:setState({
Width = rbx.AbsoluteSize.X
})
end,
}, props.Native), {
ButtonContainer = ButtonContainer,
PropChildren = Roact.createFragment(props[Roact.Children] or {}),
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = props.HorizontalAlignment,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = props.VerticalAlignment,
}),
Padding = new('UIPadding', {
PaddingTop = props.PaddingTop,
PaddingBottom = props.PaddingBottom,
PaddingLeft = props.PaddingLeft,
PaddingRight = props.PaddingRight,
}),
})
end)
end
return ButtonStack
| 1,366 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/ButtonStack.luau | -- ButtonStack: A button list
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ButtonRoot = script.Parent
local Button = require(ButtonRoot.Button)
local ButtonStack = Roact.PureComponent:extend(script.Name)
ButtonStack.defaultProps = {
ButtonHeight = UDim.new(0, 30), --- @defaultProp,
Padding = UDim.new(0, 8), --- @defaultProp
ButtonAlignment = Enum.HorizontalAlignment.Left, --- @defaultProp
HorizontalAlignment = Enum.HorizontalAlignment.Right, --- @defaultProp
VerticalAlignment = Enum.VerticalAlignment.Center, --- @defaultProp
MinSlack = 50, --- @defaultProp
StackWidth = UDim.new(1, 0), --- @defaultProp
PaddingLeft = UDim.new(), --- @defaultProp
PaddingRight = UDim.new(), --- @defaultProp
PaddingTop = UDim.new(), --- @defaultProp
}
ButtonStack.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Stack's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional LayoutOrder number THe Stack's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Position UDim2 The Stack's position
Position = t.optional(t.UDim2),
--- @prop @optional FillWidth boolean Determines if buttons fill the entire Stack
FillWidth = t.optional(t.boolean),
--- @prop @optional Padding UDim The padding between each button
Padding = t.optional(t.UDim),
--- @prop @optional PaddingLeft UDim The left padding
PaddingLeft = t.optional(t.UDim),
--- @prop @optional PaddingRight UDim The right padding
PaddingRight = t.optional(t.UDim),
--- @prop @optional PaddingTop UDim The top padding
PaddingTop = t.optional(t.UDim),
--- @prop @optional PaddingBottom UDim The bottom padding
PaddingBottom = t.optional(t.UDim),
--- @prop @optional Size UDim2 The Stack's size
Size = t.optional(t.UDim2),
--- @prop @optional StackWidth UDim The space to fill
StackWidth = t.optional(t.UDim),
--- @prop Buttons table The props for the buttons to display
Buttons = t.table,
--- @prop @optional ButtonHeight UDim Each Button's height
ButtonHeight = t.optional(t.UDim),
--- @prop @optional ButtonAlignment Enum.HorizontalAlignment The aligmnent of buttons
ButtonAlignment = t.optional(t.enum(Enum.HorizontalAlignment)),
--- @prop @optional HorizontalAlignment Enum.HorizontalAlignment The Horizontal alignment of the buttons
HorizontalAlignment = t.optional(t.enum(Enum.HorizontalAlignment)),
--- @prop @optional VerticalAlignment Enum.VerticalAlignment The Vertical alignment of the buttons
VerticalAlignment = t.optional(t.enum(Enum.VerticalAlignment)),
--- @prop @optional MinSlack number The MinSlack width between the end of the buttons to the end of the stack before buttons fill the entire Stack
MinSlack = t.optional(t.number),
--- @prop @optional [Roact.Children] table Roact.Children
[Roact.Children] = t.optional(t.table),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function ButtonStack:init()
-- Initial state
self:setState({
Width = 0
})
end
function ButtonStack:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- ////////// Buttons
local Buttons = {}
-- Get the divided size for each button
local FullWidthSize = UDim2.new(1 / #props.Buttons)
local IsFirstButton = true
for ButtonIndex, ButtonProps in pairs(props.Buttons) do
Buttons['Button' .. ButtonIndex] = new(Button, Sift.Dictionary.join(ButtonProps, {
LayoutOrder = props.ButtonAlignment == Enum.HorizontalAlignment.Right and -ButtonIndex or ButtonIndex,
Size = UDim2.new(FullWidthSize.X.Scale, FullWidthSize.X.Offset - (IsFirstButton and 0 or props.Padding.Offset), props.ButtonHeight.Scale, props.ButtonHeight.Offset),
}))
-- Register first button
IsFirstButton = false
end
-- ////////// Button Container
local ButtonContainer = new('Frame', {
BackgroundTransparency = 1,
Size = UDim2.new(props.StackWidth.Scale, props.StackWidth.Offset, 1, 0),
}, {
Buttons = Roact.createFragment(Buttons),
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = props.HorizontalAlignment,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = props.VerticalAlignment,
Padding = props.Padding,
}),
})
-- ////////// Button Stack
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
LayoutOrder = props.LayoutOrder,
Position = props.Position,
Size = props.Size,
[Roact.Change.AbsoluteSize] = function (rbx)
self:setState({
Width = rbx.AbsoluteSize.X
})
end,
}, props.Native), {
ButtonContainer = ButtonContainer,
PropChildren = Roact.createFragment(props[Roact.Children] or {}),
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = props.HorizontalAlignment,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = props.VerticalAlignment,
}),
Padding = new('UIPadding', {
PaddingLeft = props.PaddingLeft,
PaddingRight = props.PaddingRight,
}),
})
end)
end
return ButtonStack
| 1,335 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/ButtonStack.story.luau | -- TitleBar: The top bar of a window component
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local FrameVisualizer = require(Winro.Utility.FrameVisualizer)
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ButtonStack = require(script.Parent.ButtonStack)
local ButtonStackStory = Roact.PureComponent:extend(script.Name)
function ButtonStackStory:render()
local ButtonStack = new(ButtonStack, Sift.Dictionary.join({
Size = UDim2.new(1, 0, 0, 30),
ButtonHeight = UDim.new(0, 30),
Buttons = {
[1] = {
Text = 'Primary',
Style = 'Accent',
[Roact.Event.Activated] = print,
},
[2] = {
Text = 'Secondary',
Style = 'Standard',
[Roact.Event.Activated] = print,
},
[3] = {
Text = 'Tertiary',
Style = 'Standard',
[Roact.Event.Activated] = print,
},
}
}, self.props.Props))
if self.props.Wireframe then
return new(FrameVisualizer, {
Size = UDim2.new(1, 0, 1, 0),
}, ButtonStack)
else
return ButtonStack
end
end
return {
controls = {
Wireframe = false,
},
stories = {
ButtonStack = function(props)
return new(ButtonStackStory, props.controls)
end
}
}
| 364 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/Descriptions/ButtonStateDescriptions.luau | return {
Accent = {
Disabled = {
Name = 'Accent/Disabled',
Fill = 'colors/Fill_Color/Accent/Disabled',
Stroke = 'colors/Fill_Color/Accent/Disabled',
Text = 'colors/Fill_Color/Text_On_Accent/Disabled',
},
Rest = {
Name = 'Accent/Rest',
Fill = 'colors/Fill_Color/Accent/Default',
Stroke = 'colors/Elevation/Accent_Control/Border',
Text = 'colors/Fill_Color/Text_On_Accent/Primary',
},
Hover = {
Name = 'Accent/Hover',
Fill = 'colors/Fill_Color/Accent/Secondary',
Stroke = 'colors/Elevation/Accent_Control/Border',
Text = 'colors/Fill_Color/Text_On_Accent/Primary',
},
Pressed = {
Name = 'Accent/Pressed',
Fill = 'colors/Fill_Color/Accent/Tertiary',
Stroke = 'colors/Stroke_Color/Control_Stroke/On_Accent_Default',
Text = 'colors/Fill_Color/Text_On_Accent/Secondary',
},
},
Standard = {
Disabled = {
Name = 'Standard/Disabled',
Fill = 'colors/Fill_Color/Control/Disabled',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Disabled',
},
Rest = {
Name = 'Standard/Rest',
Fill = 'colors/Fill_Color/Control/Default',
Stroke = 'colors/Elevation/Control/Border',
Text = 'colors/Fill_Color/Text/Primary',
},
Hover = {
Name = 'Standard/Hover',
Fill = 'colors/Fill_Color/Control/Secondary',
Stroke = 'colors/Elevation/Control/Border',
Text = 'colors/Fill_Color/Text/Primary',
},
Pressed = {
Name = 'Standard/Pressed',
Fill = 'colors/Fill_Color/Control/Tertiary',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Secondary',
},
},
Primary = {
Disabled = {
Name = 'Primary/Disabled',
Fill = 'colors/Fill_Color/Accent/Disabled',
Stroke = 'colors/Fill_Color/Accent/Disabled',
Text = 'colors/Fill_Color/Text_On_Accent/Disabled',
},
Rest = {
Name = 'Primary/Rest',
Fill = 'colors/Fill_Color/Subtle/Transparent',
Stroke = 'colors/Fill_Color/Accent/Secondary',
Text = 'colors/Fill_Color/Text/Primary',
},
Hover = {
Name = 'Primary/Hover',
Fill = 'colors/Fill_Color/Accent/Tertiary',
Stroke = 'colors/Fill_Color/Accent/Secondary',
Text = 'colors/Fill_Color/Text_On_Accent/Primary',
},
Pressed = {
Name = 'Primary/Pressed',
Fill = 'colors/Fill_Color/Accent/Tertiary',
Stroke = 'colors/Stroke_Color/Control_Stroke/On_Accent_Default',
Text = 'colors/Fill_Color/Text_On_Accent/Secondary',
},
},
Secondary = {
Disabled = {
Name = 'Secondary/Disabled',
Fill = 'colors/Fill_Color/Control/Disabled',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Disabled',
},
Rest = {
Name = 'Secondary/Rest',
Fill = 'colors/Fill_Color/Control/Default',
Stroke = 'colors/Elevation/Control/Border',
Text = 'colors/Fill_Color/Text/Primary',
},
Hover = {
Name = 'Secondary/Hover',
Fill = 'colors/Fill_Color/Control/Secondary',
Stroke = 'colors/Elevation/Control/Border',
Text = 'colors/Fill_Color/Text/Primary',
},
Pressed = {
Name = 'Standard/Pressed',
Fill = 'colors/Fill_Color/Control/Tertiary',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Secondary',
},
}
}
| 996 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Button/Validators/ButtonStyleValidator.luau | return function (Style)
return (
Style == 'Default'
or Style == 'Accent'
or Style == 'Standard'
or Style == 'Primary'
or Style == 'Secondary'
), 'Expected `Accent`, `Standard`, `Primary`, `Secondary` or `Default`'
end
| 65 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/Checkbox.luau | -- Checkbox: The basic checkbox component
-- https://www.figma.com/file/uNmIxgdbUT44MZjQCTIMe3/Windows-UI-3-(Community)?node-id=25616%3A1593
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local ApplyDescription = Theme.ApplyDescription
local RegisterStateAction = Theme.RegisterStateAction
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local Flipper = require(Packages.Flipper)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local CheckboxRoot = script.Parent
local Descriptions = require(CheckboxRoot.Descriptions.CheckboxStateDescriptions)
local GetSelectedStateFromValue = require(CheckboxRoot.Util.GetSelectedStateFromValue)
local CHECKBOX_COLOR_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/Input/Checkbox/Color"
local CHECKBOX_TRANSPARENCY_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/Input/Checkbox/Transparency"
local CHECKBOX_CHECKED = "images/Fluent/AcceptMedium/12px"
local CHECKBOX_INDETERMINATE = "images/Fluent/Dash12/12px"
local LABEL_FONT = "font/Body"
local CHECKBOX_LEFT_MARGIN = 4
local Checkbox = Roact.PureComponent:extend(script.Name)
Checkbox.StyleBindings = {
'Check',
'Fill',
'Stroke',
'Text',
}
Checkbox.defaultProps = {
Size = UDim2.fromOffset(20, 20) --- @defaultProp
}
Checkbox.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Checkbox's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional @style Font string|table The label's font style
Font = t.optional(StyleValidator),
--- @prop @optional Position UDim2 The Checkbox's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The Checkbox's size
Size = t.optional(t.UDim2),
--- @prop Selected boolean The Checkbox's selected status
Selected = t.optional(t.boolean),
--- @prop @optional Label string The Checkbox's label
Label = t.optional(t.string),
--- @prop @optional TextWrapped boolean For the `Label` prop
TextWrapped = t.optional(t.boolean),
--- @prop @optional @style TextColor string|table The label's text color style
TextColor = t.optional(StyleValidator),
--- @prop @optional Disabled boolean Determines if the Checkbox is disabled
Disabled = t.optional(t.boolean),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
})
function Checkbox:init()
-- Create Style Bindings
for _, StyleBinding in pairs(self.StyleBindings) do
self[StyleBinding], self['Set' .. StyleBinding] = Roact.createBinding({})
end
-- Custom Style binding
self.CheckObscureWidth, self.SetCheckObscureWidth = Roact.createBinding(0)
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial State
self:setState({
State = 'Rest'
})
end
function Checkbox:willUnmount()
-- Clear motors for each style binding
for _, StyleBinding in pairs(self.StyleBindings) do
-- Look for a motor
local Motor = self[StyleBinding .. 'Motor']
-- Remove motor if found
if Motor then
pcall(Motor.destroy, Motor)
self[StyleBinding .. 'Motor'] = nil
end
end
end
function Checkbox:ApplyDescription(Description, Theme)
Description = Sift.Dictionary.copy(Description)
-- Custom style binding
local CheckObscureWidth = self.CheckObscureWidth:getValue()
-- Animate
if CheckObscureWidth then
-- Remove exiting motor
local Existing = self.CheckObscureWidthMotor
if Existing then
pcall(Existing.destroy, Existing)
end
-- Create a new motor
local Motor = Flipper.SingleMotor.new(CheckObscureWidth)
self.CheckObscureWidthMotor = Motor
-- Bind
Motor:onStep(self.SetCheckObscureWidth)
Motor:onComplete(function()
Motor:destroy()
self.CheckObscureWidthMotor = nil
end)
-- Animate
Motor:setGoal(Flipper.Spring.new(Description.CheckObscureWidth, {
frequency = 2.5,
dampingRatio = 1,
}))
else
self.SetCheckObscureWidth(Description.CheckObscureWidth)
end
-- Prop overrides
local TextStyleOverride = self.props.TextColor
if TextStyleOverride then
Description.Text = TextStyleOverride
end
ApplyDescription(self, Description, Theme, Theme[CHECKBOX_COLOR_ANIMATION_SPRING_SETTINGS], Theme[CHECKBOX_TRANSPARENCY_ANIMATION_SPRING_SETTINGS])
end
function Checkbox:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
local SelectedState = GetSelectedStateFromValue(props.Selected)
-- Apply Description
if SelectedState == 'None' then
if props.Disabled then
self:ApplyDescription(Descriptions.NoFill.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.NoFill.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.NoFill.Hover, Theme)
else
self:ApplyDescription(Descriptions.NoFill.Pressed, Theme)
end
else
if props.Disabled then
self:ApplyDescription(Descriptions.Fill.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Fill.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Fill.Hover, Theme)
else
self:ApplyDescription(Descriptions.Fill.Pressed, Theme)
end
end
-- ////////// Checkbox Label
local LabelFont = Theme[props.Font or LABEL_FONT]
local Label = props.Label and new('TextLabel', {
AnchorPoint = Vector2.new(0, 0.5),
BackgroundTransparency = 1,
FontFace = LabelFont.Font,
Position = UDim2.new(0, props.Size.X.Offset + 20 + CHECKBOX_LEFT_MARGIN, 0.5, 0),
Size = UDim2.new(1, -30, 1, 0),
Text = props.Label,
TextSize = LabelFont.Size,
TextXAlignment = 'Left',
TextColor3 = self.Text:map(function(Style)
return Style.Color
end),
TextTransparency = self.Text:map(function(Style)
return Style.Transparency
end),
})
-- ////////// Check animation gradient
local Gradient = new('UIGradient', {
Transparency = NumberSequence.new({
[1] = NumberSequenceKeypoint.new(0.0, 0),
[2] = NumberSequenceKeypoint.new(0.001, 0),
[3] = NumberSequenceKeypoint.new(0.002, 1),
[4] = NumberSequenceKeypoint.new(1, 1)
}),
Offset = self.CheckObscureWidth:map(function(Width)
return Vector2.new(1 - Width, 0)
end)
})
-- ////////// Checkbox Icon
local CheckStyle = Theme[SelectedState == 'Selected' and CHECKBOX_CHECKED or CHECKBOX_INDETERMINATE]
local Check = new('ImageLabel', {
Visible = SelectedState ~= 'None',
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
ResampleMode = CheckStyle.ResampleMode,
Image = CheckStyle.Image,
ImageRectOffset = CheckStyle.ImageRectOffset,
ImageRectSize = CheckStyle.ImageRectSize,
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.fromOffset(CheckStyle.ImageRectSize.X, CheckStyle.ImageRectSize.Y),
ImageColor3 = self.Check:map(function(Style)
return Style.Color
end),
ImageTransparency = self.Check:map(function(Style)
return Style.Transparency
end),
}, {
ObscureGradient = Gradient
})
-- ////////// Checkbox Stroke
local Stroke = new('UIStroke', {
ApplyStrokeMode = Enum.ApplyStrokeMode.Border,
Thickness = 1,
Color = self.Stroke:map(function(Style)
return Style.Color
end),
Transparency = self.Stroke:map(function(Style)
return Style.Transparency
end),
})
-- ////////// Checkbox Base
local Checkbox = new('ImageButton', {
AnchorPoint = Vector2.new(0, 0.5),
AutoButtonColor = false,
BorderSizePixel = 0,
Position = UDim2.new(0, 1 + (props.Label and CHECKBOX_LEFT_MARGIN or 0), 0.5, 0),
Size = props.Size - UDim2.fromOffset(2, 2), -- Target size is 20px * 20px, but border adds 2px each axis
[Roact.Event.Activated] = self[Roact.Event.Activated],
[Roact.Event.MouseButton1Down] = self[Roact.Event.MouseButton1Down],
[Roact.Event.MouseButton1Up] = self[Roact.Event.MouseButton1Up],
[Roact.Event.MouseEnter] = self[Roact.Event.MouseEnter],
[Roact.Event.MouseLeave] = self[Roact.Event.MouseLeave],
BackgroundColor3 = self.Fill:map(function(Style)
return Style.Color
end),
BackgroundTransparency = self.Fill:map(function(Style)
return Style.Transparency
end),
}, {
Check = Check,
Stroke = Stroke,
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Inner'] - 1) -- Account for the 1px added by UIStroke
}),
})
-- ////////// Checkbox
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
Position = props.Position,
BackgroundTransparency = 1,
Size = props.Size
}, props.Native), {
Checkbox = Checkbox,
Label = Label
})
end)
end
return Checkbox
| 2,638 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/Checkbox.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Checkbox = require(script.Parent.Checkbox)
local BORDER_PADDING = UDim.new(0, 8)
local CheckboxStory = Roact.PureComponent:extend(script.Name)
function CheckboxStory:init()
self:setState({
Selected = nil
})
end
function CheckboxStory:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
local Checkbox = new(Checkbox, {
Label = state.Selected == nil and 'Indeterminate' or state.Selected == true and 'Selected' or 'Deselected',
Selected = state.Selected,
Disabled = self.props.Disabled,
[Roact.Event.Activated] = function(...)
print(...)
self:setState({
Selected = not state.Selected
})
end
})
if props.OnBackground then
return new('Frame', {
BackgroundTransparency = props.BackgroundTransparency,
BackgroundColor3 = Theme['colors/Background/Fill_Color/Solid_Background/Base'].Color,
AutomaticSize = 'XY',
Size = UDim2.new(1, 0, 0, 45)
}, {
Padding = new('UIPadding', {
PaddingBottom = BORDER_PADDING,
PaddingLeft = BORDER_PADDING,
PaddingRight = BORDER_PADDING,
PaddingTop = BORDER_PADDING,
}),
Checkbox = Checkbox
})
else
return Checkbox
end
end)
end
local Controls = {
OnBackground = true,
Disabled = false
}
return {
storyElement = CheckboxStory,
roact = Roact,
controls = Controls,
stories = {
Checkbox = function(props)
local controls = props.controls
return Roact.createElement(CheckboxStory, controls)
end
}
}
| 439 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/CheckboxGroup.luau | -- CheckboxGroup: A grouped collection of CheckBox elements
-- https://www.figma.com/file/uNmIxgdbUT44MZjQCTIMe3/Windows-UI-3-(Community)?node-id=25616%3A1593
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local CheckboxRoot = script.Parent
local Checkbox = require(CheckboxRoot.Checkbox)
local CheckboxGroup = Roact.PureComponent:extend(script.Name)
CheckboxGroup.defaultProps = {
HeaderFont = 'fonts/Body', --- @defaultProp
HeaderTextColor = 'colors/Fill_Color/Text/Primary', --- @defaultProp
HeaderHeight = 21, --- @defaultProp
FitContents = false, --- @defaultProp
Size = UDim2.new(1, 0, 1, 0), --- @defaultProp
}
CheckboxGroup.validateProps = t.strictInterface({
--- @prop @optional HeaderText string The CheckboxGroup's header text
HeaderText = t.string,
--- @prop Checkboxes table {CheckboxProps} The checkboxes to display
Checkboxes = t.table,
--- @prop @optional Size UDim2 The CheckboxGroup's size
Size = t.optional(t.UDim2),
--- @prop @optional FitContents boolean Determines if the CheckboxGroup will resize to fit its contents
FitContents = t.optional(t.boolean),
--- @prop @optional @style HeaderTextColor string The color of the header's text
HeaderTextColor = t.optional(t.string),
--- @prop @optional @style HeaderFont string The font of the header
HeaderFont = t.optional(t.string),
--- @prop @optional HeaderHeight number The height, in pixels of the header
HeaderHeight = t.optional(t.numberPositive),
--- @prop @optional Native table Native props
Native = t.optional(t.table)
})
function CheckboxGroup:init()
-- CheckboxGroup Checkbox Container height
self.ContainerHeight, self.SetContainerHeight = Roact.createBinding(0)
end
function CheckboxGroup:GetCheckboxes()
local props = self.props
local Checkboxes = {}
for Index, props in pairs(props.Checkboxes) do
Checkboxes[Index] = new(Checkbox, props)
end
return Checkboxes
end
function CheckboxGroup:render()
local props = self.props
return WithTheme(function(Theme)
-- ////////// CheckboxGroup Header Label
local HeaderTextColor = Theme[props.HeaderTextColor]
local HeaderFont = Theme[props.HeaderFont]
local Label = new('TextLabel', {
BackgroundTransparency = 1,
FontFace = HeaderFont.Font,
Position = UDim2.fromOffset(3, 1),
Size = UDim2.new(1, -3, 1, -1),
Text = props.HeaderText,
TextColor3 = HeaderTextColor.Color,
TextSize = HeaderFont.Size,
TextTransparency = HeaderTextColor.Transparency,
TextXAlignment = 'Left',
})
-- ////////// CheckboxGroup Header
local Header = new('Frame', {
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 0, props.HeaderHeight),
}, {
Label = Label,
})
-- ////////// CheckboxGroup Container
local CheckboxContainer = new('Frame', {
AutomaticSize = props.FitContents and 'Y' or 'None',
BackgroundTransparency = 1,
Position = UDim2.fromOffset(0, props.HeaderHeight),
[Roact.Change.AbsoluteSize] = function(rbx)
self.SetContainerHeight(rbx.AbsoluteSize.Y)
end,
Size = self.ContainerHeight:map(function(Height)
-- Do not auto-size if FitContents is not set
if not props.FitContents then
return props.Size
end
return UDim2.new(1, 0, 0, Height)
end),
}, {
Checkboxes = Roact.createFragment(self:GetCheckboxes()),
InitialPadding = new('Frame', {
BackgroundTransparency = 1,
LayoutOrder = -1,
Size = UDim2.new(1, 0, 0, 8)
}),
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Vertical,
Padding = UDim.new(0, 8),
SortOrder = Enum.SortOrder.LayoutOrder
}),
})
-- ////////// CheckboxGroup
return new('Frame', Sift.Dictionary.join({
BackgroundTransparency = 1,
Size = self.ContainerHeight:map(function(Height)
-- Do not auto-size if FitContents is not set
if not props.FitContents then
return props.Size
end
return UDim2.new(props.Size.X.Scale, props.Size.X.Offset, 0, Height + props.HeaderHeight)
end)
}, props.Native), {
Header = Header,
CheckboxContainer = CheckboxContainer
})
end)
end
return CheckboxGroup
| 1,148 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/CheckboxGroup.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Roact = require(Packages.Roact)
local new = Roact.createElement
local CheckboxRoot = script.Parent
local CheckboxGroup = require(CheckboxRoot.CheckboxGroup)
local CheckboxStoryElement = require(CheckboxRoot["Checkbox.story"]).storyElement
local CheckboxGroupStory = Roact.PureComponent:extend(script.Name)
function CheckboxGroupStory:GetCheckboxes()
local Checkboxes = {}
for Index = 1, self.props.Amount do
Checkboxes[Index] = {
Label = tostring(Index),
}
end
return Checkboxes
end
function CheckboxGroupStory:render()
return new(CheckboxGroup, {
HeaderText = self.props.HeaderText,
Checkboxes = self:GetCheckboxes()
})
end
return {
controls = {
HeaderText = 'Header text',
Amount = 10,
Disabled = false,
},
stories = {
CheckboxGroup = function (props)
return new(CheckboxGroupStory, props.controls)
end
}
}
| 231 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/Descriptions/CheckboxStateDescriptions.luau | local ClearColor = {
Color = Color3.new(),
Transparency = 1
}
return {
NoFill = {
Disabled = {
Name = 'NoFill/Disabled',
Check = ClearColor,
CheckObscureWidth = 1,
Fill = "colors/Fill_Color/Control_Alt/Disabled",
Stroke = "colors/Stroke_Color/Control_Strong_Stroke/Disabled",
Text = "colors/Fill_Color/Text/Disabled",
},
Rest = {
Name = 'NoFill/Rest',
Check = ClearColor,
CheckObscureWidth = 1,
Fill = "colors/Fill_Color/Control_Alt/Secondary",
Stroke = "colors/Stroke_Color/Control_Strong_Stroke/Default",
Text = "colors/Fill_Color/Text/Primary"
},
Hover = {
Name = 'NoFill/Hover',
Check = ClearColor,
CheckObscureWidth = 1,
Fill = "colors/Fill_Color/Control_Alt/Tertiary",
Stroke = "colors/Stroke_Color/Control_Strong_Stroke/Default",
Text = "colors/Fill_Color/Text/Primary"
},
Pressed = {
Name = 'NoFill/Pressed',
Check = ClearColor,
CheckObscureWidth = 1,
Fill = "colors/Fill_Color/Control_Alt/Quarternary",
Stroke = "colors/Stroke_Color/Control_Strong_Stroke/Disabled",
Text = "colors/Fill_Color/Text/Primary"
}
},
Fill = {
Disabled = {
Name = 'Fill/Disabled',
Check = "colors/Fill_Color/Text_On_Accent/Disabled",
CheckObscureWidth = 0,
Fill = "colors/Fill_Color/Accent/Disabled",
Stroke = "colors/Fill_Color/Accent/Disabled",
Text = "colors/Fill_Color/Text/Disabled"
},
Rest = {
Name = 'Fill/Rest',
Check = "colors/Fill_Color/Text_On_Accent/Primary",
CheckObscureWidth = 0,
Fill = "colors/Fill_Color/Accent/Default",
Stroke = "colors/Fill_Color/Accent/Default",
Text = "colors/Fill_Color/Text/Primary"
},
Hover = {
Name = 'Fill/Hover',
Check = "colors/Fill_Color/Text_On_Accent/Primary",
CheckObscureWidth = 0,
Fill = "colors/Fill_Color/Accent/Secondary",
Stroke = "colors/Fill_Color/Accent/Secondary",
Text = "colors/Fill_Color/Text/Primary"
},
Pressed = {
Name = 'Fill/Pressed',
Check = "colors/Fill_Color/Text_On_Accent/Secondary",
CheckObscureWidth = 0,
Fill = "colors/Fill_Color/Accent/Tertiary",
Stroke = "colors/Fill_Color/Accent/Tertiary",
Text = "colors/Fill_Color/Text/Primary"
}
}
}
| 702 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/Util/GetSelectedStateFromValue.luau | return function (Value)
if Value == nil then
return 'Indeterminate'
elseif Value == true then
return 'Selected'
elseif Value == false then
return 'None'
end
end
| 43 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Checkbox/Validators/ValidateCheckboxGroupCheckboxes.luau | local Winro = script.Parent.Parent
local Packages = Winro.Parent
local t = require(Packages.t)
return t.table(t.strictInterface({
Selected = t.string,
Label = t.optional(t.string),
OnClicked = t.callback
}))
| 50 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Dropdown/ComboBox.luau | -- ComboBox: A drop down option selector
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ContextMenu = require(Winro.App.Menu.ContextMenu)
local FocusFrame = require(Winro.App.Effect.FocusFrame)
local DropdownRoot = script.Parent
local DropdownButton = require(DropdownRoot.DropdownButton)
local ComboBox = Roact.PureComponent:extend(script.Name)
ComboBox.defaultProps = {
Size = UDim2.fromOffset(120, 32), --- @defaultProp
}
ComboBox.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 Anchorpoint
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional LayoutOrder number Layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Size UDim2 Size
Size = t.optional(t.UDim2),
--- @prop @optional Position UDim2 Position
Position = t.optional(t.UDim2),
--- @prop @optional DropdownButtonProps table The props for the dropdown button
DropdownButtonProps = t.optional(t.table),
--- @prop Options table The options to display
Options = t.table,
--- @prop @optional SelectedOption string The currently selected option
SelectedOption = t.optional(t.string),
--- @prop @optional OnOptionSelected function The callback to call when an option is selected
OnOptionSelected = t.optional(t.callback),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function ComboBox:render()
local props = self.props
local state = self.state
-- ////////// Context Menu
local Options = {}
for Index, Option in pairs(props.Options) do
Options[Index] = {
Text = Option,
Selected = (Option == props.SelectedOption),
OnClicked = function()
self:setState({
ContextMenuVisible = not state.ContextMenuVisible,
})
props.OnOptionSelected(Option)
end
}
end
local ContextMenu = state.ContextMenuVisible and new(FocusFrame, {
RelativeToParent = true,
Reason = 'COMBOBOX_DROPDOWN_CONTEXT_MENU',
[Roact.Event.FocusLost] = function()
self:setState({
ContextMenuVisible = not state.ContextMenuVisible,
})
end,
}, {
ContextMenu = new(ContextMenu, {
BackgroundTransparency = 0,
Options = Options,
Size = UDim2.new(1, 0, 0, props.Size),
}),
})
-- ////////// Dropdown Button
local Button = new(DropdownButton, Sift.Dictionary.join({
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.fromScale(1, 1),
Text = props.SelectedOption or '*',
[Roact.Event.Activated] = function ()
if props.DropdownButtonProps and props.DropdownButtonProps.Disabled then
return
end
self:setState({
ContextMenuVisible = not state.ContextMenuVisible
})
end,
}, props.DropdownButtonProps))
-- ////////// ComboBox wrapper
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
LayoutOrder = props.LayoutOrder,
Position = props.Position,
Size = props.Size,
}, props.Native), {
Button = Button,
ContextMenu = ContextMenu,
})
end
return ComboBox
| 803 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Dropdown/ComboBox.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local DropdownRoot = script.Parent
local ComboBox = require(DropdownRoot.ComboBox)
local BORDER_PADDING = UDim.new(0, 8)
local ComboBoxStory = Roact.PureComponent:extend(script.Name)
function ComboBoxStory:render()
local props = self.props
return WithTheme(function(Theme)
return new('Frame', {
Size = UDim2.fromOffset(120, 32) + UDim2.fromOffset(BORDER_PADDING.Offset * 2, BORDER_PADDING.Offset * 2),
BackgroundTransparency = props.BackgroundTransparency,
BackgroundColor3 = Theme['colors/Background/Fill_Color/Solid_Background/Base'].Color,
AutomaticSize = 'XY'
}, {
Padding = new('UIPadding', {
PaddingBottom = BORDER_PADDING,
PaddingLeft = BORDER_PADDING,
PaddingRight = BORDER_PADDING,
PaddingTop = BORDER_PADDING,
}),
ComboBox = new(ComboBox, {
DropdownButtonProps = {
Disabled = props.Disabled,
},
SelectedOption = self.state.SelectedOption,
OnOptionSelected = function(Option, ...)
print(Option, ...)
self:setState({
SelectedOption = Option
})
end,
Options = {
'Option A',
'Option B',
'Option C',
'Option D',
'Really really long option text',
}
})
})
end)
end
return {
controls = {
Disabled = false,
},
stories = {
DropdownButton = function (props)
return new(ComboBoxStory, Sift.Dictionary.join({
BackgroundTransparency = 0,
}, props.controls))
end,
NoBackground = function(props)
return new(ComboBoxStory, Sift.Dictionary.join({
BackgroundTransparency = 1,
}, props.controls))
end
}
}
| 474 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Dropdown/Descriptions/DropdownButtonDescriptions.luau | return {
Disabled = {
Name = 'Disabled',
Fill = 'colors/Fill_Color/Control/Disabled',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Disabled',
},
Rest = {
Name = 'Rest',
Fill = 'colors/Fill_Color/Control/Default',
Stroke = 'colors/Elevation/Control/Border',
Text = 'colors/Fill_Color/Text/Primary',
},
Hover = {
Name = 'Hover',
Fill = 'colors/Fill_Color/Control/Secondary',
Stroke = 'colors/Elevation/Control/Border',
Text = 'colors/Fill_Color/Text/Primary',
},
Pressed = {
Name = 'Pressed',
Fill = 'colors/Fill_Color/Control/Tertiary',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Secondary',
}
}
| 217 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Dropdown/DropdownButton.luau | -- DropdownButton: A button that is meant to be used as the button for dropdown components
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local ApplyDescription = Theme.ApplyDescription
local RegisterStateAction = Theme.RegisterStateAction
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local UIStroke = require(Winro.App.Effect.UIStroke)
local DROPDOWNBUTTON_CHEVRONDOWN_IMAGE = 'images/Fluent/ChevronDownMed/12px'
local DROPDOWNBUTTON_COLOR_ANIMATION_SPRING_SETTINGS = 'styles/AnimationSpringParams/Control/Input/Button/Color'
local DROPDOWNBUTTON_TRANSPARENCY_ANIMATION_SPRING_SETTINGS = 'styles/AnimationSpringParams/Control/Input/Button/Transparency'
local DROPDOWNBUTTON_LAYOUT_PADDING = 11
local DROPDOWNBUTTON_PADDING_HORIZONTAL = 11
local DROPDOWNBUTTON_PADDING_VERTICAL = 4
local DropdownRoot = script.Parent
local Descriptions = require(DropdownRoot.Descriptions.DropdownButtonDescriptions)
local DropdownButton = Roact.PureComponent:extend(script.Name)
DropdownButton.Descriptions = Descriptions
DropdownButton.StyleBindings = {
'Stroke',
'Fill',
'Text',
}
DropdownButton.defaultProps = {
Size = UDim2.fromOffset(120, 32), --- @defaultProp
}
DropdownButton.validateProps = t.strictInterface({
--- @prop @optional Text string The DropdownButton's text
Text = t.optional(t.string),
--- @prop @optional AnchorPoint Vector2 The DropdownButton's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional Disabled boolean Determines if the DropdownButton is shown as disabled
Disabled = t.optional(t.boolean),
--- @prop @optional LayoutOrder number The DropdownButton's Layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Position UDim2 The DropdownButton's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The DropdownButton's size
Size = t.optional(t.UDim2),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
--- @prop @optional [Roact.Children] table Roact.Children
[Roact.Children] = t.optional(t.table),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
})
function DropdownButton:init()
-- Create Style Bindings
for _, StyleBinding in pairs(self.StyleBindings) do
self[StyleBinding], self['Set' .. StyleBinding] = Roact.createBinding({})
end
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial State
self:setState({
State = 'Rest',
})
end
function DropdownButton:ApplyDescription(Description, Theme)
ApplyDescription(self, Description, Theme, Theme[DROPDOWNBUTTON_COLOR_ANIMATION_SPRING_SETTINGS], Theme[DROPDOWNBUTTON_TRANSPARENCY_ANIMATION_SPRING_SETTINGS])
end
function DropdownButton:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- Apply description
if props.Disabled then
self:ApplyDescription(self.Descriptions.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(self.Descriptions.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(self.Descriptions.Hover, Theme)
elseif state.State == 'Pressed' then
self:ApplyDescription(self.Descriptions.Pressed, Theme)
end
-- ////////// Chevron Icon
local ChevronImageIcon = Theme[DROPDOWNBUTTON_CHEVRONDOWN_IMAGE]
local Chevron = new('ImageButton', {
AnchorPoint = Vector2.new(1, 0.5),
BackgroundTransparency = 1,
Image = ChevronImageIcon.Image,
ImageRectOffset = ChevronImageIcon.ImageRectOffset,
ImageRectSize = ChevronImageIcon.ImageRectSize,
Position = UDim2.new(1, -DROPDOWNBUTTON_PADDING_HORIZONTAL, 0.5, 0),
Size = UDim2.fromOffset(ChevronImageIcon.ImageRectSize.X, ChevronImageIcon.ImageRectSize.Y),
ImageColor3 = self.Text:map(function(Style)
return Style.Color
end),
ImageTransparency = self.Text:map(function(Style)
return Style.Transparency
end),
})
-- ////////// Button Label
local LabelFontStyle = Theme['fonts/Body']
local Label = new('TextLabel', {
AnchorPoint = Vector2.new(0, 0.5),
BackgroundTransparency = 1,
FontFace = LabelFontStyle.Font,
LineHeight = LabelFontStyle.LineHeight,
Position = UDim2.new(0, DROPDOWNBUTTON_PADDING_HORIZONTAL, 0.5, 0),
Size = UDim2.new(0, 0),
Text = props.Text,
TextSize = LabelFontStyle.Size,
TextXAlignment = Enum.TextXAlignment.Left,
TextColor3 = self.Text:map(function(Style)
return Style.Color
end),
TextTransparency = self.Text:map(function(Style)
return Style.Transparency
end)
})
-- ////////// Button Fill
local Fill = new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5),
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.new(1, -2, 1, -2), -- Account for stroke thickness
BackgroundColor3 = self.Fill:map(function(Style)
return Style.Color
end),
BackgroundTransparency = self.Fill:map(function(Style)
return Style.Transparency
end),
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Inner']),
}),
Stroke = new(UIStroke, {
BorderMode = Enum.BorderMode.Outline,
}, {
Gradient = new('UIGradient', {
Rotation = 90,
Color = self.Stroke:map(function(Style)
return Style.ColorSequence or ColorSequence.new(Style.Color)
end),
Transparency = self.Stroke:map(function(Style)
return Style.TransparencySequence or NumberSequence.new(Style.Transparency)
end),
}),
}),
})
-- ////////// Dropdown Button
return new('ImageButton', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
Size = props.Size,
Position = props.Position,
LayoutOrder = props.LayoutOrder,
[Roact.Event.Activated] = self[Roact.Event.Activated],
[Roact.Event.MouseButton1Down] = self[Roact.Event.MouseButton1Down],
[Roact.Event.MouseButton1Up] = self[Roact.Event.MouseButton1Up],
[Roact.Event.MouseEnter] = self[Roact.Event.MouseEnter],
[Roact.Event.MouseLeave] = self[Roact.Event.MouseLeave],
}, props.Native), {
Label = Label,
Chevron = Chevron,
Fill = Fill,
ChildWrapper = props[Roact.Children] and new('Frame', {
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
ZIndex = 2,
}, props[Roact.Children])
})
end)
end
return DropdownButton
| 1,913 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Dropdown/DropdownButton.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local DropdownRoot = script.Parent
local DropdownButton = require(DropdownRoot.DropdownButton)
local BORDER_PADDING = UDim.new(0, 8)
local DropdownButtonStory = Roact.PureComponent:extend(script.Name)
function DropdownButtonStory:render()
local props = self.props
return WithTheme(function(Theme)
return new('Frame', {
Size = UDim2.fromOffset(120, 32) + UDim2.fromOffset(BORDER_PADDING.Offset * 2, BORDER_PADDING.Offset * 2),
BackgroundTransparency = props.BackgroundTransparency,
BackgroundColor3 = Theme['colors/Background/Fill_Color/Solid_Background/Base'].Color,
AutomaticSize = 'XY'
}, {
Padding = new('UIPadding', {
PaddingBottom = BORDER_PADDING,
PaddingLeft = BORDER_PADDING,
PaddingRight = BORDER_PADDING,
PaddingTop = BORDER_PADDING,
}),
Button = new(DropdownButton, {
AnchorPoint = Vector2.new(0, 0),
Disabled = props.Disabled,
Position = UDim2.fromScale(0, 0),
[Roact.Event.Activated] = print
})
})
end)
end
return {
controls = {
Disabled = false,
},
stories = {
DropdownButton = function (props)
return new(DropdownButtonStory, Sift.Dictionary.join({
BackgroundTransparency = 0,
}, props.controls))
end,
NoBackground = function(props)
return new(DropdownButtonStory, Sift.Dictionary.join({
BackgroundTransparency = 1,
}, props.controls))
end
}
}
| 427 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Hyperlink/Descriptions.luau | return {
Rest = {
Name = 'Rest',
Text = 'colors/Fill_Color/Accent_Text/Primary',
},
Hover = {
Name = 'Hover',
Text = 'colors/Fill_Color/Accent_Text/Secondary',
},
Pressed = {
Name = 'Pressed',
Text = 'colors/Fill_Color/Accent_Text/Tertiary',
},
Disabled = {
Name = 'Disabled',
Text = 'colors/Fill_Color/Accent_Text/Disabled',
},
}
| 111 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Hyperlink/HyperlinkButton.luau | -- Hyperlink: Hyperlink Compoent
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local RegisterStateAction = Theme.RegisterStateAction
local ApplyDescription = Theme.ApplyDescription
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local HyperlinkRoot = script.Parent
local Descriptions = require(HyperlinkRoot.Descriptions)
local HYPERLINK_TRANSPARENCY_ANIMATION_OPTIONS = 'styles/AnimationSpringParams/Control/Input/Button/Color'
local HYPERLINK_COLOR_ANIMATION_OPTIONS = 'styles/AnimationSpringParams/Control/Input/Button/Transparency'
local HyperlinkButton = Roact.PureComponent:extend(script.Name)
HyperlinkButton.StyleBindings = {
'Text',
}
HyperlinkButton.defaultProps = {
Size = UDim2.fromScale(1, 1), --- @defaultProp
Text = 'Hyperlink', --- @defaultProp
}
HyperlinkButton.validateProps = t.strictInterface({
--- @prop @optional AutomaticSize Enum.AutmaticSize Autmatic size
AutomaticSize = t.optional(t.enum(Enum.AutomaticSize)),
--- @prop @optional Disabled boolean Determines if the HyperlinkButton shows as disabled
Disabled = t.optional(t.boolean),
--- @prop @optional Text string The hyperlink's text
Text = t.optional(t.string),
--- @prop @optional TextXAlignment Enum.TextXAlignment Horizontal text alignment
TextXAlignment = t.optional(t.enum(Enum.TextXAlignment)),
--- @prop @optional TextYAlignment Enum.TextYAlignment Vertical text alignment
TextYAlignment = t.optional(t.enum(Enum.TextYAlignment)),
--- @prop @optional Size UDim2 The Hyperlink's size
Size = t.optional(t.UDim2),
--- @prop @optional AnchorPoint Vector2 The Hyperlink's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional Position UDim2 The Hyperlink's positon
Position = t.optional(t.UDim2),
--- @prop @optional LayoutOrder number The Hyperlink's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
})
function HyperlinkButton:init()
-- Create Style Bindings
for _, StyleBinding in pairs(self.StyleBindings) do
self[StyleBinding], self['Set' .. StyleBinding] = Roact.createBinding({})
end
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial State
self:setState({
State = 'Rest'
})
end
function HyperlinkButton:willUnmount()
-- Clear motors for each style binding
for _, StyleBinding in pairs(self.StyleBindings) do
-- Look for a motor
local Motor = self[StyleBinding .. 'Motor']
-- Remove motor if found
if Motor then
pcall(Motor.destroy, Motor)
self[StyleBinding .. 'Motor'] = nil
end
end
end
function HyperlinkButton:ApplyDescription(Description, Theme)
ApplyDescription(self, Description, Theme, Theme[HYPERLINK_COLOR_ANIMATION_OPTIONS], Theme[HYPERLINK_TRANSPARENCY_ANIMATION_OPTIONS])
end
function HyperlinkButton:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- Apply Description
if props.Disabled then
self:ApplyDescription(Descriptions.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Hover, Theme)
elseif state.State == 'Pressed' then
self:ApplyDescription(Descriptions.Pressed, Theme)
end
-- ////////// Hyperlink Button
local HyperlinkButtonFontStyle = Theme['fonts/Body']
return new('TextButton', Sift.Dictionary.join({
AutomaticSize = props.AutomaticSize,
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
FontFace = HyperlinkButtonFontStyle.Font,
LayoutOrder = props.LayoutOrder,
LineHeight = HyperlinkButtonFontStyle.LineHeight,
Position = props.Position,
Size = props.Size,
Text = props.Text,
TextSize = HyperlinkButtonFontStyle.Size,
TextXAlignment = props.TextXAlignment,
TextYalignment = props.TextYAlignment,
[Roact.Event.Activated] = self[Roact.Event.Activated],
[Roact.Event.MouseButton1Down] = self[Roact.Event.MouseButton1Down],
[Roact.Event.MouseButton1Up] = self[Roact.Event.MouseButton1Up],
[Roact.Event.MouseEnter] = self[Roact.Event.MouseEnter],
[Roact.Event.MouseLeave] = self[Roact.Event.MouseLeave],
TextColor3 = self.Text:map(function(Style)
return Style.Color
end),
TextTransparency = self.Text:map(function(Style)
return Style.Transparency
end),
}, props.Native))
end)
end
return HyperlinkButton
| 1,388 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Hyperlink/HyperlinkButton.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local HyperlinkButton = require(script.Parent.HyperlinkButton)
local HyperlinkButtonStory = Roact.PureComponent:extend(script.Name)
function HyperlinkButtonStory:render()
local props = self.props
return new(HyperlinkButton, Sift.Dictionary.join({
Disabled = props.Disabled,
Text = 'Hyperlink Story'
}, props.Props))
end
return {
controls = {
Disabled = false,
},
stories = {
HyperlinkButton = function(props)
return new(HyperlinkButtonStory, props.controls)
end
}
}
| 168 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Text/Descriptions/TextInputDescriptions.luau | local TRANSPARENT = {
Color = Color3.new(),
Transparency = 1,
}
return {
Rest = {
Focus = {
Button = 'colors/Fill_Color/Text/Secondary',
Highlight = 'colors/Fill_Color/Accent/Default',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Primary',
},
Rest = {
Button = TRANSPARENT,
Highlight = 'colors/Elevation/Text_Control/Border',
Stroke = 'colors/Stroke_Color/Control_Stroke/Default',
Text = 'colors/Fill_Color/Text/Primary',
},
},
}
| 150 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Text/TextInput.luau | -- TextInput: A string input component, a textbox
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local ApplyDescription = Theme.ApplyDescription
local RegisterStateAction = Theme.RegisterStateAction
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local TextRoot = script.Parent
local Descriptions = require(TextRoot.Descriptions.TextInputDescriptions)
local TEXTINPUT_COLOR_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/Input/Button/Color"
local TEXTINPUT_TRANSPARENCY_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/Input/Button/Transparency"
local TextInput = Roact.PureComponent:extend(script.Name)
TextInput.StyleBindings = {
'Button',
'Highlight',
'Stroke',
'Text',
}
TextInput.defaultProps = {
--- @prop @optional Text string Current text
Text = t.optional(t.string),
--- @prop @optional Native table The native props
Native = t.optional(t.table),
--- @prop @optional [Roact.Children] table Child contents
[Roact.Children] = t.optional(t.table),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
}
TextInput.validateProps = t.strictInterface({
})
function TextInput:init()
local props = self.props
-- Text value binding
self.Text, self.SetText = Roact.createBinding(props.Text)
-- Create Style Bindings
for _, StyleBinding in pairs(self.StyleBindings) do
self[StyleBinding], self['Set' .. StyleBinding] = Roact.createBinding({})
end
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial State
self:setState({
State = 'Rest',
})
end
function TextInput:willUnmount()
-- Clear motors for each style binding
for _, StyleBinding in pairs(self.StyleBindings) do
-- Look for a motor
local Motor = self[StyleBinding .. 'Motor']
-- Remove motor if found
if Motor then
pcall(Motor.destroy, Motor)
self[StyleBinding .. 'Motor'] = nil
end
end
end
function TextInput:ApplyDescription(Description, Theme)
return ApplyDescription(self, Description, Theme, Theme[TEXTINPUT_COLOR_ANIMATION_SPRING_SETTINGS], Theme[TEXTINPUT_TRANSPARENCY_ANIMATION_SPRING_SETTINGS])
end
function TextInput:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- Apply description
if state.State == 'Focused' then
end
end)
end
return TextInput
| 817 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Input/Text/TextInput.story.luau | local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local TextInput = require(script.Parent.TextInput)
local TextInputStory = Roact.PureComponent:extend(script.Name)
function TextInputStory:render()
local props = self.props
return new(TextInput, Sift.Dictionary.join({
}, props.Props))
end
return {
controls = {},
stories = {
TextInput = function(props)
return new(TextInputStory, props.controls)
end
}
}
| 130 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/List/Descriptions/ListItemDescriptions.luau |
return {
NoFill = {
Disabled = {
Name = 'NoFill/Disabled',
IndicatorHeight = 0,
Fill = "colors/Fill_Color/Subtle/Disabled",
Indicator = "colors/Fill_Color/Accent/Disabled",
Stroke = "colors/Fill_Color/Subtle/Disabled",
Text = "colors/Fill_Color/Text/Disabled"
},
Rest = {
Name = 'NoFill/Rest',
IndicatorHeight = 0,
Fill = "colors/Fill_Color/Subtle/Transparent",
Indicator = "colors/Fill_Color/Accent/Default",
Stroke = "colors/Fill_Color/Subtle/Transparent",
Text = "colors/Fill_Color/Text/Primary"
},
Hover = {
Name = 'NoFill/Hover',
IndicatorHeight = 0,
Fill = "colors/Fill_Color/Subtle/Secondary",
Indicator = "colors/Fill_Color/Accent/Default",
Stroke = "colors/Fill_Color/Subtle/Secondary",
Text = "colors/Fill_Color/Text/Primary"
},
Pressed = {
Name = 'NoFill/Pressed',
IndicatorHeight = 10,
Fill = "colors/Fill_Color/Subtle/Tertiary",
Indicator = "colors/Fill_Color/Accent/Default",
Stroke = "colors/Fill_Color/Subtle/Tertiary",
Text = "colors/Fill_Color/Text/Secondary"
}
},
Fill = {
Disabled = {
Name = 'Fill/Disabled',
IndicatorHeight = 16,
Fill = "colors/Fill_Color/Subtle/Secondary",
Indicator = "colors/Fill_Color/Accent/Disabled",
Stroke = "colors/Fill_Color/Subtle/Secondary",
Text = "colors/Fill_Color/Text/Disabled"
},
Rest = {
Name = 'Fill/Rest',
IndicatorHeight = 16,
Fill = "colors/Fill_Color/Subtle/Secondary",
Indicator = "colors/Fill_Color/Accent/Default",
Stroke = "colors/Fill_Color/Subtle/Secondary",
Text = "colors/Fill_Color/Text/Primary"
},
Hover = {
Name = 'Fill/Hover',
IndicatorHeight = 16,
Fill = "colors/Fill_Color/Subtle/Tertiary",
Indicator = "colors/Fill_Color/Accent/Default",
Stroke = "colors/Fill_Color/Subtle/Tertiary",
Text = "colors/Fill_Color/Text/Primary"
},
Pressed = {
Name = 'Fill/Pressed',
IndicatorHeight = 10,
Fill = "colors/Fill_Color/Subtle/Secondary",
Indicator = "colors/Fill_Color/Accent/Secondary",
Stroke = "colors/Fill_Color/Subtle/Secondary",
Text = "colors/Fill_Color/Text/Secondary"
}
}
}
| 661 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/List/Expander.luau | -- Expander: An expandable list collector
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local GetTextSize = require(Winro.Utility.GetTextSize)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local RoundedSurface = require(Winro.App.Surface.RoundedSurface)
local Expander = Roact.PureComponent:extend(script.Name)
Expander.defaultProps = {
Size = UDim2.new(1, 0, 0, 62), --- @defaultProp
}
function Expander:render()
local props = self.props
-- ////////// Expander
return WithTheme(function(Theme)
-- ////////// LeftContent/Icon
local IconImageStyle = props.Icon and Theme[props.Icon]
local IconStyle = Theme[IconImageStyle and IconImageStyle.Color or 'colors/Fill_Color/Text/Primary']
local IconImage = props.Icon and new('ImageLabel', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Image = IconImageStyle.Image,
ImageColor3 = IconStyle.Color,
ImageRectOffset = IconImageStyle.ImageRectOffset,
ImageRectSize = IconImageStyle.ImageRectSize,
ImageTransparency = IconStyle.Transparency,
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.fromOffset(IconImageStyle.ImageRectSize.X, IconImageStyle.ImageRectSize.Y),
}) or nil
local Icon = IconImage and new('Frame', {
BackgroundTransparency = 1,
LayoutOrder = 1,
Size = UDim2.fromOffset(16, 16),
}, IconImage)
-- ////////// LeftContent/Text/Heading
local HeadingTextStyle = Theme['colors/Fill_Color/Text/Primary']
local HeadingFontStyle = Theme['fonts/Body']
local GotHeadingTextSize, HeadingTextSize = GetTextSize(
props.Heading,
HeadingFontStyle.Font,
HeadingFontStyle.Size
)
local Heading = props.Heading and new('TextLabel', {
AutomaticSize = (not GotHeadingTextSize) and Enum.AutomaticSize.XY or Enum.AutomaticSize.None,
BackgroundTransparency = 1,
FontFace = HeadingFontStyle.Font,
LayoutOrder = 1,
LineHeight = HeadingFontStyle.LineHeight,
Size = UDim2.fromOffset(HeadingTextSize.X, HeadingTextSize.Y),
Text = props.Heading,
TextColor3 = HeadingTextStyle.Color,
TextTransparency = HeadingTextStyle.Transparency,
TextSize = HeadingFontStyle.Size,
}) or nil
-- ////////// LeftContent/Text/Caption
local CaptionTextStyle = Theme['colors/Fill_Color/Text/Secondary']
local CaptionFontStyle = Theme['fonts/Caption']
local GotCaptionTextSize, CaptionTextSize = GetTextSize(
props.Caption,
CaptionFontStyle.Font,
CaptionFontStyle.Size
)
local Caption = props.Caption and new('TextLabel', {
AutomaticSize = (not GotCaptionTextSize) and Enum.AutomaticSize.XY or Enum.AutomaticSize.None,
BackgroundTransparency = 1,
FontFace = CaptionFontStyle.Font,
LayoutOrder = 2,
LineHeight = CaptionFontStyle.LineHeight,
Size = UDim2.fromOffset(CaptionTextSize.X, CaptionTextSize.Y),
Text = props.Caption,
TextColor3 = CaptionTextStyle.Color,
TextTransparency = CaptionTextStyle.Transparency,
TextSize = CaptionFontStyle.Size,
}) or nil
-- ////////// LeftContent/Text
local Text = new('Frame', {
AutomaticSize = Enum.AutomaticSize.XY,
BackgroundTransparency = 1,
Size = UDim2.fromScale(0, 0),
LayoutOrder = 2,
}, {
Heading = Heading,
Caption = Caption,
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Vertical,
HorizontalAlignment = Enum.HorizontalAlignment.Left,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
})
-- ////////// LeftContent
local LeftContent = new('Frame', {
AutomaticSize = Enum.AutomaticSize.X,
BackgroundTransparency = 1,
Size = UDim2.fromScale(0, 1),
}, {
Icon = Icon,
Text = Text,
Layout = new('UIListLayout', {
Padding = UDim.new(0, 16),
FillDirection = Enum.FillDirection.Horizontal,
HorizontalAlignment = Enum.HorizontalAlignment.Left,
SortOrder = Enum.SortOrder.LayoutOrder,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
Padding = new('UIPadding', {
PaddingLeft = UDim.new(0, 15),
PaddingTop = UDim.new(0, 13),
PaddingBottom = UDim.new(0, 13),
}),
})
-- ////////// RightContent/
-- ////////// Expander
local ExpanderStyle = Theme['colors/Fill_Color/Subtle/Tertiary']
return new(RoundedSurface, {
BackgroundColor = ExpanderStyle,
BackgroundTransparency = 0,
CornerRadius = UDim.new(0, 3),
Size = props.Size,
LayoutOrder = 1,
ShowTopLeftCorner = true,
ShowTopRightCorner = true,
ShowBottomLeftCorner = not props.Expanded,
ShowBottomRightCorner = not props.Expanded,
}, LeftContent)
end)
end
return Expander
| 1,311 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/List/Expander.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Expander = require(script.Parent.Expander)
local ExpanderStory = Roact.PureComponent:extend(script.Name)
function ExpanderStory:render()
local props = self.props
local state = self.state
return new(Expander, Sift.Dictionary.join({
Expanded = state.Expanded,
Heading = props.Heading and 'Power button functionality' or nil,
Caption = props.Caption and 'Adjust what your power buttons control' or nil,
Icon = props.Icon and 'images/roblox/icons/logo/studiologo/1x',
[Roact.Event.Activated] = function(...)
print(...)
self:setState({
Expanded = not state.Expanded,
})
end,
}, props.Props))
end
return {
controls = {
Icon = true,
Heading = true,
Caption = true,
},
stories = {
Expander = function(props)
return new(ExpanderStory, props.controls)
end
}
}
| 263 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/List/ListDivider.luau | -- Simple divider, with theme
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local WithTheme = require(Winro.Theme).WithTheme
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ListDivider = Roact.PureComponent:extend(script.Name)
function ListDivider:render()
local props = self.props
return WithTheme(function(Theme)
local DividerStyle = Theme["colors/Stroke_Color/Divider_Stroke/Default"]
return new('Frame', {
BackgroundTransparency = 1,
LayoutOrder = props.LayoutOrder,
Position = props.Position,
Size = UDim2.new(
props.Size.X.Scale,
props.Size.X.Offset,
props.Size.Y.Scale,
props.Size.Y.Offset == 0 and 4 or props.Size.Y.Offset
),
}, {
Divider = new('Frame', {
AnchorPoint = Vector2.new(0, 1),
BorderSizePixel = 0,
BackgroundColor3 = DividerStyle.Color,
BackgroundTransparency = DividerStyle.Transparency,
Position = UDim2.new(0, 1, 0.5, 0),
Size = UDim2.new(1, -2, 0, 1)
})
})
end)
end
return ListDivider
| 295 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/List/ListItem.luau | -- ListItem: A list item
-- Assets/Lists & Collections/Lists & Collections/List View/List Item
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local ApplyDescription = Theme.ApplyDescription
local RegisterStateAction = Theme.RegisterStateAction
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local Flipper = require(Packages.Flipper)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ListRoot = script.Parent
local Descriptions = require(ListRoot.Descriptions.ListItemDescriptions)
local LISTITEM_COLOR_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/List/ListItem/Color"
local LISTITEM_TRANSPARENCY_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/List/ListItem/Transparency"
local LISTITEM_INDICATOR_SIZE_ANIMATION_SPRING_SETTINGS = "styles/AnimationSpringParams/Control/List/ListItem/Indicator"
local ListItem = Roact.PureComponent:extend(script.Name)
ListItem.StyleBindings = {
'Fill',
'Indicator',
'Stroke',
'Text',
}
ListItem.defaultProps = {
Width = UDim.new(0, 160), --- @defaultProp
Height = UDim.new(0, 40), --- @defaultProp
ShowIndicator = true, --- @defaultProp
Font = "fonts/Body", --- @defaultProp
}
ListItem.validateProps = t.strictInterface({
--- @prop @optional Selected boolean The ListItem's selected state
Selected = t.optional(t.boolean),
--- @prop @optional Size UDim2 The ListItem's size
Size = t.optional(t.UDim2),
--- @prop @optional ShowIndicator boolean Determines indicator visability
ShowIndicator = t.optional(t.boolean),
--- @prop @optional @style Font string|table The label's font style
Font = t.optional(StyleValidator),
--- @prop @optional AnchorPoint Vector2 The ListItem's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional Disabled boolean Determines if the item is shown as disabled
Disabled = t.optional(t.boolean),
--- @prop @optional LayoutOrder number The ListItem's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Position UDim2 The ListItem's position
Position = t.optional(t.UDim2),
--- @prop @optional Width UDim The ListItem's Width @depricated Use Size instead
Width = t.optional(t.UDim),
--- @prop @optional Height UDim The ListItem's Height @depricated Use Size instead
Height = t.optional(t.UDim),
--- @prop @optional Text string The ListItem's text
Text = t.optional(t.string),
--- @prop @optional @style Icon string|table The ListItem's icon
Icon = t.optional(StyleValidator),
--- @prop @optional Native table The native props
Native = t.optional(t.table),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
})
function ListItem:init()
-- Indicator size binding
self.IndicatorHeight, self.SetIndicatorHeight = Roact.createBinding(0)
-- Create Style Bindings
for _, StyleBinding in pairs(self.StyleBindings) do
self[StyleBinding], self['Set' .. StyleBinding] = Roact.createBinding({})
end
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial State
self:setState({
State = 'Rest'
})
end
function ListItem:willUnmount()
-- Clear motors for each style binding
for _, StyleBinding in pairs(self.StyleBindings) do
-- Look for a motor
local Motor = self[StyleBinding .. 'Motor']
-- Remove motor if found
if Motor then
pcall(Motor.Destroy, Motor)
self[StyleBinding .. 'Motor'] = nil
end
end
end
function ListItem:ApplyDescription(Description, Theme)
local props = self.props
Description = Sift.Dictionary.copy(Description)
-- Prop Overrides
local FillOverride = props.BackgroundColor
local TextOverride = props.TextColor
if FillOverride then
Description.Fill = FillOverride
end
if TextOverride then
Description.Text = TextOverride
end
-- Set Indicator Size
local InitialIndicatorHeight = self.IndicatorHeight:getValue()
-- Animate
if InitialIndicatorHeight then
-- Remove exiting motor
local Existing = self.IndicatorHeightMotor
if Existing then
pcall(Existing.destroy, Existing)
end
-- Create a new motor
local Motor = Flipper.SingleMotor.new(InitialIndicatorHeight)
self.IndicatorHeightMotor = Motor
-- Bind
Motor:onStep(self.SetIndicatorHeight)
Motor:onComplete(function()
Motor:destroy()
self.IndicatorHeightMotor = nil
end)
-- Animate
Motor:setGoal(Flipper.Spring.new(Description.IndicatorHeight,
Theme[LISTITEM_INDICATOR_SIZE_ANIMATION_SPRING_SETTINGS])
)
else
self.SetIndicatorHeight(Description.IndicatorHeight)
end
ApplyDescription(self, Description, Theme, LISTITEM_COLOR_ANIMATION_SPRING_SETTINGS, LISTITEM_TRANSPARENCY_ANIMATION_SPRING_SETTINGS)
end
function ListItem:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- Apply Description
if not props.Selected then
if props.Disabled then
self:ApplyDescription(Descriptions.NoFill.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.NoFill.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.NoFill.Hover, Theme)
else
self:ApplyDescription(Descriptions.NoFill.Pressed, Theme)
end
else
if props.Disabled then
self:ApplyDescription(Descriptions.Fill.Disabled, Theme)
elseif state.State == 'Rest' then
self:ApplyDescription(Descriptions.Fill.Rest, Theme)
elseif state.State == 'Hover' then
self:ApplyDescription(Descriptions.Fill.Hover, Theme)
else
self:ApplyDescription(Descriptions.Fill.Pressed, Theme)
end
end
-- ///////// ListItem Label
local LabelFontStyle = Theme[props.Font]
local Label = new('TextLabel', {
AnchorPoint = Vector2.new(0, 0.5),
BackgroundTransparency = 1,
FontFace = LabelFontStyle.Font,
Position = UDim2.new(0, 16 + (props.Icon and 28 or 0), 0.5, 0),
Size = UDim2.new(0, 10, 1, 0),
Text = props.Text,
TextSize = LabelFontStyle.Size,
TextXAlignment = 'Left',
TextColor3 = self.Text:map(function(Style)
return Style.Color
end),
TextTransparency = self.Text:map(function(Style)
return Style.Transparency
end),
})
-- ////////// ListItem Indicator
local Indicator = new('Frame', {
Visible = props.ShowIndicator,
AnchorPoint = Vector2.new(0, 0.5),
BorderSizePixel = 0,
Position = UDim2.new(0, 5, 0.5, 0),
BackgroundColor3 = self.Indicator:map(function(Style)
return Style.Color
end),
BackgroundTransparency = self.Indicator:map(function(Style)
return Style.Transparency
end),
Size = self.IndicatorHeight:map(function(Height)
return UDim2.fromOffset(3, Height)
end),
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(1, 0)
}),
})
-- ////////// ListItem Base
local Base = new('ImageButton', {
AnchorPoint = Vector2.new(0, 0.5),
AutoButtonColor = false,
Size = UDim2.new(1, -(4 * 2), 1, -(2 * 2)) - UDim2.fromOffset(2, 2), -- Account for stroke thickness
Position = UDim2.new(0, 4, 0.5, 0) + UDim2.fromOffset(1, 0), -- Accont for stroke thickness
BackgroundColor3 = self.Fill:map(function(Style)
return Style.Color
end),
BackgroundTransparency = self.Fill:map(function(Style)
return Style.Transparency
end),
[Roact.Event.Activated] = self[Roact.Event.Activated],
[Roact.Event.MouseButton1Down] = self[Roact.Event.MouseButton1Down],
[Roact.Event.MouseButton1Up] = self[Roact.Event.MouseButton1Up],
[Roact.Event.MouseEnter] = self[Roact.Event.MouseEnter],
[Roact.Event.MouseLeave] = self[Roact.Event.MouseLeave],
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Inner'] - 1) -- Account for 1px added by stroke
}),
Stroke = new('UIStroke', {
Thickness = 1,
Color = self.Stroke:map(function(Style)
return Style.Color
end),
Transparency = self.Stroke:map(function(Style)
return Style.Transparency
end)
})
})
-- ////////// ListItem Icon
local IconImage = props.Icon and Theme[props.Icon]
local IconImageSize = nil
if IconImage then
local IconImageRectSize = IconImage.ImageRectSize == Vector2.new() and Vector2.new(16, 16) or IconImage.ImageRectSize
IconImageSize = UDim2.fromOffset(
math.clamp(IconImageRectSize.X, 0, 9*4),
math.clamp(IconImageRectSize.Y, 0, 9*4)
)
else
IconImageSize = UDim2.fromOffset(16, 16)
end
local IconImage = IconImage and new('ImageLabel', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Image = IconImage.Image,
ImageRectOffset = IconImage.ImageRectOffset,
ImageRectSize = IconImage.ImageRectSize,
Position = UDim2.fromScale(0.5, 0.5),
ResampleMode = IconImage.ResampleMode,
Size = IconImageSize,
ImageColor3 = self.Text:map(function(Style)
return Style.Color
end),
ImageTransparency = self.Text:map(function(Style)
return Style.Transparency
end),
})
local Icon = new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Position = UDim2.new(0, 16 + 8, 0.5, 0),
Size = UDim2.new(0, 0, 1, 0),
}, IconImage)
return new('Frame', Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
Position = props.Position,
Size = props.Size or UDim2.new(props.Width.Scale, props.Width.Offset, props.Height.Scale, props.Height.Offset),
LayoutOrder = props.LayoutOrder
}), {
Text = Label,
Indicator = Indicator,
Base = Base,
Icon = Icon
})
end)
end
return ListItem
| 2,860 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/List/ListItem.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local FrameVisualizer = require(Winro.Utility.FrameVisualizer)
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ListRoot = script.Parent
local ListItem = require(ListRoot.ListItem)
local BORDER_PADDING = UDim.new(0, 8)
local ListItemStory = Roact.PureComponent:extend(script.Name)
function ListItemStory:render()
local props = self.props
return WithTheme(function(Theme)
local Element = new('Frame', {
BackgroundTransparency = props.BackgroundTransparency,
BackgroundColor3 = Theme['colors/Background/Fill_Color/Solid_Background/Base'].Color,
AutomaticSize = 'XY',
Size = UDim2.fromOffset(160+16, 40+16)
}, {
Padding = new('UIPadding', {
PaddingBottom = BORDER_PADDING,
PaddingLeft = BORDER_PADDING,
PaddingRight = BORDER_PADDING,
PaddingTop = BORDER_PADDING,
}),
ListItem = new(ListItem, {
Icon = props.Icon and 'images/roblox/icons/logo/studiologo_small/1x' or nil,
AnchorPoint = Vector2.new(0, 0),
Disabled = props.Disabled,
Position = UDim2.fromScale(0, 0),
Selected = self.state.Selected,
[Roact.Event.Activated] = function(...)
print(...)
self:setState({
Selected = not self.state.Selected
})
end
})
})
if props.FrameVisualizer then
return new(FrameVisualizer, {}, Element)
else
return Element
end
end)
end
return {
controls = {
Disabled = false,
FrameVisualizer = false,
Icon = true,
},
stories = {
Button = function (props)
return Roact.createFragment({
OnBackground = new(ListItemStory, Sift.Dictionary.join({
BackgroundTransparency = 0,
}, props.controls)),
NoBackground = new(ListItemStory, Sift.Dictionary.join({
BackgroundTransparency = 1,
}, props.controls))
})
end
}
}
| 519 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Menu/ContextMenu.luau | -- ContextMenu: A Context menu element
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local ListDivider = require(Winro.App.List.ListDivider)
local ListItem = require(Winro.App.List.ListItem)
local Acrylic = require(Winro.App.Surface.Acrylic)
local CONTEXTMENU_BACKGROUND_STYLE = "colors/Background/Fill_Color/Acrylic_Background/Default"
local CONTEXTMENU_BORDER_STYLE = "colors/Stroke_Color/Surface_Stroke/Flyout"
local ContextMenu = Roact.PureComponent:extend(script.Name)
ContextMenu.defaultProps = {
AnchorPoint = Vector2.new(), --- @defaultProp
Position = UDim2.new(), --- @defaultProp
Size = UDim2.fromOffset(150, 150), --- @defaultProp
FitContents = true, --- @defaultProp
}
ContextMenu.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Context Menu's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional BackgroundTransparency number Background Transparency
BackgroundTransparency = t.optional(t.number),
--- @prop @optional Position UDim2 The Context Menu's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The Context Menu's size
Size = t.optional(t.UDim2),
--- @prop @optional UseIcon boolean Determines the visibility of an icon on each option
UseIcon = t.optional(t.boolean),
--- @prop @optional FitContents boolean Determines if the Context Menu will resize to fit it's contents
FitContents = t.optional(t.boolean),
--- @prop Options array The options to display
Options = t.array(t.strictInterface({
Disabled = t.optional(t.boolean),
IsDivider = t.optional(t.boolean),
LayoutOrder = t.optional(t.numberPositive),
OnClicked = t.optional(t.callback),
Selected = t.optional(t.boolean),
Text = t.optional(t.string),
Icon = t.optional(StyleValidator)
}))
})
function ContextMenu:init()
-- Content size binding
self.ContentSize, self.SetContentSize = Roact.createBinding(self.props.Size)
end
function ContextMenu:GetOptions()
local props = self.props
-- Create a list of all options to display
local Children = {}
-- Go through each option, creating it
for LayoutOrder, OptionProps in pairs(props.Options) do
-- Create divider, if set
if OptionProps.IsDivider then
Children[LayoutOrder] = new(ListDivider, {
LayoutOrder = OptionProps.LayoutOrder or LayoutOrder,
Size = UDim2.fromScale(1, 0)
})
-- Create list items
else
Children[LayoutOrder] = new(ListItem, {
ShowIndicator = OptionProps.Selected,
Disabled = OptionProps.Disabled,
LayoutOrder = OptionProps.LayoutOrder or LayoutOrder,
[Roact.Event.Activated] = OptionProps.OnClicked,
Selected = OptionProps.Selected,
Width = UDim.new(1, 0),
Text = OptionProps.Text,
Icon = props.UseIcon and (OptionProps.Icon or {
Image = '',
ImageRectSize = Vector2.new(),
ImageRectOffset = Vector2.new()
}) or nil
})
end
end
return Roact.createFragment(Children)
end
function ContextMenu:render()
local props = self.props
return WithTheme(function(Theme)
-- Create a list items container
local Container = new('Frame', {
AutomaticSize = props.FitContents and 'Y' or 'None',
BackgroundTransparency = 1,
Position = UDim2.fromOffset(0, 2),
Size = UDim2.fromScale(1, props.FitContents and 0 or 1),
[Roact.Change.AbsoluteSize] = function(rbx)
if props.FitContents then
self.SetContentSize(UDim2.fromOffset(rbx.AbsoluteSize.X, rbx.AbsoluteSize.Y + 2 * 2)) -- Accont for Vertical padding
end
end
}, {
Layout = new('UIListLayout', {
SortOrder = Enum.SortOrder.LayoutOrder,
FillDirection = Enum.FillDirection.Vertical,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Bottom
}),
Contents = self:GetOptions()
})
local BaseStyle = Theme[CONTEXTMENU_BACKGROUND_STYLE]
local StrokeStyle = Theme[CONTEXTMENU_BORDER_STYLE]
local Base = new(Acrylic, {
BackgroundColor3 = BaseStyle.Color,
BackgroundTransparency = props.BackgroundTransparency or BaseStyle.Transparency,
BorderSizePixel = 0,
Size = self.ContentSize,
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer'] - 1), -- -1px to account for stroke
}),
Stroke = new('UIStroke', {
Color = StrokeStyle.Color,
Transparency = StrokeStyle.Transparency,
Thickness = 1
}),
})
return new('Frame', {
AutomaticSize = props.FitContents and 'Y' or 'None',
AnchorPoint = props.AnchorPoint,
BackgroundTransparency = 1,
Position = props.Position,
Size = self.ContentSize
}, {
Container = Container,
Base = Base,
})
end)
end
return ContextMenu
| 1,276 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Menu/ContextMenu.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local FrameVisualizer = require(Winro.Utility.FrameVisualizer)
local ContextMenu = require(script.Parent.ContextMenu)
local ContextMenuStory = Roact.PureComponent:extend(script.Name)
function ContextMenuStory:render()
local Element = new(ContextMenu, Sift.Dictionary.join({
Size = UDim2.new(0, 200, 0, 0),
FitContents = true,
UseIcon = self.props.Icon,
Options = {
{
Selected = true,
Text = 'Selected',
Icon = 'images/roblox/icons/actions/randomize/1x',
OnClicked = print
},
{
Selected = false,
Text = 'Deselected',
Icon = 'images/roblox/icons/controls/keys/command/1x',
OnClicked = print
},
{ IsDivider = true },
{
Disabled = true,
Text = 'Disabled',
Icon = 'images/roblox/icons/controls/keys/alt/1x',
OnClicked = print
},
{
Selected = true,
Disabled = true,
Text = 'DisabledSelected',
Icon = 'images/roblox/icons/graphic/blocktheft_2xl/1x',
OnClicked = print
},
{
Selected = false,
Text = 'No icon',
OnClicked = print
},
{ IsDivider = true },
{
Selected = true,
Text = 'No icon selected',
OnClicked = print
},
}
}, self.props.Props))
if self.props.Wireframe then
return new(FrameVisualizer, {}, Element)
else
return Element
end
end
return {
controls = {
Wireframe = false,
Icon = true,
},
stories = {
ContextMenu = function (props)
return new(ContextMenuStory, props.controls)
end
}
}
| 478 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Progress/RadialProgressBar.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local RadialProgressBar = require(script.Parent.RadialProgressBar)
local RadialProgressBarStory = Roact.PureComponent:extend(script.Name)
function RadialProgressBarStory:render()
local props = self.props
return new(RadialProgressBar, Sift.Dictionary.join({
--StartValue = props.Start,
Clockwise = props.Clockwise,
Value = props.End,
}, props.Props))
end
return {
controls = {
Clockwise = false,
End = 0.5,
},
stories = {
ClockwiseRadialProgressBar = function(props)
props.controls.Clockwise = true
return new(RadialProgressBarStory, props.controls)
end,
ConterClockwiseRadialProgressBar = function(props)
props.controls.Clockwise = false
return new(RadialProgressBarStory, props.controls)
end
},
}
| 229 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Surface/Acrylic.luau | -- Acrylic: The acrylic surface
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local WithTheme = require(Winro.Theme).WithTheme
local ACRYLIC_TEXTURE_STYLE = 'images/Texture/Effect/Acrylic'
local Acrylic = Roact.PureComponent:extend(script.Name)
function Acrylic:render()
-- Use the acrylic styling
return WithTheme(function(Theme)
-- Get the acrylic texture
local Texture = Theme[ACRYLIC_TEXTURE_STYLE]
return new('ImageLabel', Sift.Dictionary.join({
BackgroundTransparency = 0.5,
Image = Texture.Image,
ImageRectOffset = Texture.ImageRectOffset,
ImageRectSize = Texture.ImageRectSize,
ImageTransparency = Texture.ImageTransparency,
ScaleType = Texture.ScaleType,
TileSize = Texture.TileSize
}, self.props))
end)
end
return Acrylic
| 231 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Surface/RoundedSurface.luau | -- RoundedSurface: A rounded surface with individual corner visibility support
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local DEFAULT_CORNER_RADIUS = UDim.new(0, 5)
local RoundedSurface = Roact.PureComponent:extend(script.Name)
RoundedSurface.Corners = {
TopLeft = 'TopLeft',
TopRight = 'TopRight',
BottomLeft = 'BottomLeft',
BottomRight = 'BottomRight',
}
RoundedSurface.defaultProps = {
Size = UDim2.fromScale(1, 1), --- @defaultProp
BackgroundTransparency = 0, --- @defaultProp
CornerRadius = DEFAULT_CORNER_RADIUS, --- @defaultProp
ShowTopLeftCorner = false, --- @defaultProp
ShowTopRightCorner = false, --- @defaultProp
ShowBottomLeftCorner = false, --- @defaultProp
ShowBottomRightCorner = false, --- @defaultProp
}
RoundedSurface.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Frame's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional AutomaticSize Enum.AutomaticSize The Frame's autmatic size
AutomaticSize = t.optional(t.enum(Enum.AutomaticSize)),
--- @prop @optional @style BackgroundColor string|table Style
BackgroundColor = t.optional(StyleValidator),
--- @prop @optional BackgroundColor3 Color3 Background Color
BackgroundColor3 = t.optional(t.Color3),
--- @prop @optional BackgroundTransparency number positive Background Transparency
BackgroundTransparency = t.optional(t.number),
--- @prop @optional BorderSizePixel number Border thickness, in pixels
BorderSizePixel = t.optional(t.number),
--- @prop @optional LayoutOrder number The Surface's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional ShowTopLeftCorner boolean Determines the visibility status of the TopLeft Corner
ShowTopLeftCorner = t.optional(t.boolean),
--- @prop @optional ShowTopRightCorner boolean Determines the visibility status of the TopRight Corner
ShowTopRightCorner = t.optional(t.boolean),
--- @prop @optional ShowBottomLeftCorner boolean Determines the visibility status of the BottomLeft Corner
ShowBottomLeftCorner = t.optional(t.boolean),
--- @prop @optional ShowBottomRightCorner boolean Determines the visibility status of the BottomRight Corner
ShowBottomRightCorner = t.optional(t.boolean),
--- @prop @optional CornerRadius UDim The corner radius
CornerRadius = t.optional(t.UDim),
--- @prop @optional Position UDim2 The Frame's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The Frame's size
Size = t.optional(t.UDim2),
--- @prop @optional Native table {property:value} The native props for the Frame's main element
Native = t.optional(t.table),
--- @prop @optional [Roact.Change.AbsoluteSize] function Roact.Change.AbsoluteSize
[Roact.Change.AbsoluteSize] = t.optional(t.callback),
--- @prop @optional [Roact.Children] table The Frame's contents
[Roact.Children] = t.optional(t.table),
})
function RoundedSurface:CreateCornerFilling(Corner, Theme)
local props = self.props
local state = self.state
local Radius = self.props.CornerRadius
local AnchorPoint, Position = nil, nil
-- Calculate the size
local Size = UDim2.new(Radius.Scale, Radius.Offset, Radius.Scale, Radius.Offset)
if Corner == self.Corners.TopLeft then
AnchorPoint = Vector2.new(0, 0)
Position = UDim2.fromScale(0, 0)
elseif Corner == self.Corners.TopRight then
AnchorPoint = Vector2.new(1, 0)
Position = UDim2.fromScale(1, 0)
elseif Corner == self.Corners.BottomLeft then
AnchorPoint = Vector2.new(0, 1)
Position = UDim2.fromScale(0, 1)
elseif Corner == self.Corners.BottomRight then
AnchorPoint = Vector2.new(1, 1)
Position = UDim2.fromScale(1, 1)
end
local FillStyle = Theme[props.BackgroundColor or {
Color = props.BackgroundColor3,
Transparency = props.BackgroundTransparency,
}]
return new('Frame', {
AnchorPoint = AnchorPoint,
BackgroundColor3 = (not state.FallbackMode) and Color3.new(1, 1, 1) or FillStyle.Color,
BackgroundTransparency = state.FallbackMode and FillStyle.Transparency or nil,
BorderSizePixel = 0,
Position = Position,
Size = Size,
})
end
function RoundedSurface:init()
local props = self.props
-- Content size binding
self.Size, self.SetSize = Roact.createBinding(UDim2.fromScale(0, 0))
-- Update size and call prop
self[Roact.Change.AbsoluteSize] = function(rbx, ...)
local AbsoluteSize = rbx.AbsoluteSize
self.SetSize(UDim2.fromOffset(AbsoluteSize.X, AbsoluteSize.Y))
local PropCallback = props[Roact.Change.AbsoluteSize]
if PropCallback then
task.spawn(PropCallback, rbx, ...)
end
end
end
function RoundedSurface:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- ////////// Corner Fillings
-- Gather corner fillings
local CornerFillings = {}
for _, Corner in pairs(self.Corners) do
local CornerVisibility = props['Show' .. Corner .. 'Corner']
if not CornerVisibility then
CornerFillings[Corner .. 'CornerFilling'] = self:CreateCornerFilling(Corner, Theme)
end
end
-- ////////// Rounded frame
local FillStyle = Theme[props.BackgroundColor or {
Color = props.BackgroundColor3,
Transparency = props.BackgroundTransparency,
}]
local RoundedFrame = new('Frame', {
Size = self.Size,
BackgroundColor3 = state.FallbackMode and FillStyle.Color or Color3.new(1, 1, 1),
BorderSizePixel = props.BorderSizePixel,
BackgroundTransparency = state.FallbackMode and FillStyle.Transparency or 0,
}, {
CornerFillings = Roact.createFragment(CornerFillings),
Corners = new('UICorner', {
CornerRadius = props.CornerRadius,
}),
})
-- ////////// Rounded Filling
local RoundedFilling = new((not state.FallbackMode) and 'CanvasGroup' or 'Frame', {
GroupColor3 = (not state.FallbackMode) and FillStyle.Color or nil,
GroupTransparency = (not state.FallbackMode) and FillStyle.Transparency or nil,
BackgroundTransparency = 1,
Size = self.Size,
ZIndex = 1,
-- Determine fallback mode, as CanvasGroup instances only work under a ScreenGui with ZIndexBehavior set to Sibling
[Roact.Ref] = function (rbx: CanvasGroup | Frame)
if self.DeterminedFallback then
return
end
if rbx then
task.spawn(function()
task.wait(0.1)
local Gui = rbx:FindFirstAncestorWhichIsA('LayerCollector') or rbx:FindFirstAncestorWhichIsA('PluginGui')
self.DeterminedFallback = true
if not Gui then
self:setState({
FallbackMode = true
})
warn(
'[Winro Component Library]: The Component Winro.App.Surface.RoundedSurface must be the descendant of a ScreenGui in order to function correctly.'
.. '\nDue to not being a descendant of a ScreenGui, rounded corners are being rendered in Fallback mode and may not display correctly.'
)
return
end
if Gui.ZIndexBehavior ~= Enum.ZIndexBehavior.Sibling then
-- -- Automatically resolve on storybook
-- if Gui.Name:lower():find('storybook') then
-- Gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
-- self:setState({
-- FallbackMode = Roact.None,
-- })
-- return
-- end
self:setState({
FallbackMode = true,
})
warn(
'[Winro Component Library]: The Component Winro.App.Surface.RoundedSurface must be the descendant of a ScreenGui with ZIndexBehavior set to Enum.ZIndexBehavior.Sibling in order to function correctly.'
.. '\nDue to ZIndexBehavior not being set to Enum.ZIndexBahavior.Sibling, rounded corners are being rendered in Fallback mode and may not display correctly.'
.. '\nPlease set the ScreenGui\'s ZIndexBehaviour property to Enum.ZIndexBehavior.Sibling in order to resolve this issue.'
)
return
end
-- Disable fallback mode
self:setState({
FallbackMode = Roact.None,
})
end)
end
end
}, {
RoundedFrame = RoundedFrame
})
-- ////////// Content Wrapper
local ContentWrapper = new('Frame', {
AutomaticSize = props.AutomaticSize,
BackgroundTransparency = 1,
Size = props.Size,
ZIndex = 2,
[Roact.Change.AbsoluteSize] = self[Roact.Change.AbsoluteSize],
}, props[Roact.Children])
-- ////////// Rounded Surface
return new('Frame', Sift.Dictionary.join({
AutomaticSize = props.AutomaticSize,
BackgroundTransparency = 1,
LayoutOrder = props.LayoutOrder,
Size = props.Size,
Position = props.Position,
AnchorPoint = props.AnchorPoint,
}, props.Native), {
ContentWrapper = ContentWrapper,
RoundedFilling = RoundedFilling,
})
end)
end
return RoundedSurface
| 2,286 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Surface/RoundedSurface.story.luau | local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local SurfaceRoot = script.Parent
local RoundedSurface = require(SurfaceRoot.RoundedSurface)
local RoundedSurfaceStory = Roact.PureComponent:extend(script.Name)
function RoundedSurfaceStory:render()
return new(RoundedSurface, Sift.Dictionary.join({
Size = UDim2.fromOffset(50, 50),
BackgroundColor = {
Color = Color3.new(1, 1, 1),
Transparency = self.props.Alpha or 0.5
},
CornerRadius = UDim.new(0, self.props.Radius or 5),
ShowTopLeftCorner = self.props.TLeft,
ShowTopRightCorner =self.props.TRight,
ShowBottomLeftCorner =self.props.BLeft,
ShowBottomRightCorner = self.props.BRight,
}, self.props.Props))
end
return {
controls = {
Radius = 10,
Alpha = 0.5,
TLeft = false,
TRight = true,
BLeft = true,
BRight = false,
},
stories = {
RoundedSurface = function (props)
return new(RoundedSurfaceStory, props.controls)
end
}
}
| 301 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/Dialog.luau | -- Window: A component that is the base structure for a UI Window
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local HyperlinkButton = require(Winro.App.Input.Hyperlink.HyperlinkButton)
local ButtonStack = require(Winro.App.Input.Button.ButtonStack)
local WindowRoot = script.Parent
local Window = require(WindowRoot.Window)
local Dialog = Roact.PureComponent:extend(script.Name)
Dialog.defaultProps = {
AutomaticSize = Enum.AutomaticSize.Y, --- @defaultProp
Position = UDim2.fromScale(0.5, 0.5), --- @defaultProp
Size = UDim2.fromOffset(540, 0), --- @defaultProp
TitleBarProps = {}, --- @defaultProp
WindowProps = {}, --- @defaultProp
}
Dialog.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Window's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional AutomaticSize Enum.AutomaticSize Auto sizing
AutomaticSize = t.optional(t.EnumItem),
--- @prop @optional Butttons table The buttons to be displayed
Buttons = t.optional(t.table),
--- @prop @optional Position UDim2 The Window's position
Position = t.optional(t.UDim2),
--- @prop @optional RichText boolean Body text Rich Text
RichText = t.optional(t.boolean),
--- @prop @optional Size UDim2 The Window's size
Size = t.optional(t.UDim2),
--- @prop @optional DetailTitle string The detail section's tile text
DetailTitle = t.optional(t.string),
--- @prop @optional DetailBody string The detail section's body text
DetailBody = t.optional(t.string),
--- @prop @optional DetailContents table The contents to display in the detail section
DetailContents = t.optional(t.table),
--- @prop @optional BodyText string Body text
BodyText = t.optional(t.string),
--- @prop @optional TitleText string Title text
TitleText = t.optional(t.string),
--- @prop @optional TitleBarProps table The props to be provided to the Title Bar
TitleBarProps = t.optional(t.table),
--- @prop @optional WindowProps table The props to be provided to the Window
WindowProps = t.optional(t.table),
--- @prop @optional [Roact.Children] table The contents to display in the window area
[Roact.Children] = t.optional(t.table),
--- @prop @optional ButtonStackProps table ButtonStackProps
ButtonStackProps = t.optional(t.table),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function Dialog:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- ////////// Title
local TitleFontStyle = Theme['fonts/Subtitle']
local TitleTextStyle = Theme['colors/Fill_Color/Text/Primary']
local Title = props.TitleText and new('TextLabel', {
AutomaticSize = Enum.AutomaticSize.Y,
BackgroundTransparency = 1,
FontFace = TitleFontStyle.Font,
LayoutOrder = 1,
LineHeight = TitleFontStyle.LineHeight,
Size = UDim2.fromScale(1, 0),
Text = props.TitleText,
TextSize = TitleFontStyle.Size,
TextColor3 = TitleTextStyle.Color,
TextTransparency = TitleTextStyle.Transparency,
TextWrapped = true,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
})
-- ////////// Body
local BodyFontStyle = Theme['fonts/Body']
local BodyTextStyle = Theme['colors/Fill_Color/Text/Primary']
local Body = props.BodyText and new('TextLabel', {
AutomaticSize = Enum.AutomaticSize.Y,
BackgroundTransparency = 1,
FontFace = BodyFontStyle.Font,
LayoutOrder = 2,
LineHeight = BodyFontStyle.LineHeight,
RichText = props.RichText,
Size = UDim2.fromScale(1, 0),
Text = props.BodyText,
TextSize = BodyFontStyle.Size,
TextColor3 = BodyTextStyle.Color,
TextTransparency = BodyTextStyle.Transparency,
TextWrapped = true,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
})
-- ////////// Detail Hyperlink
-- Check if the detail container should be craeted
local DetailContainerEnabled = props.DetailTitle or props.DetailBody or props.DetailContents
local DetailHyperlink = DetailContainerEnabled and new(HyperlinkButton, {
AutomaticSize = Enum.AutomaticSize.XY,
LayoutOrder = state.DetailShown and 4 or 3,
Size = UDim2.fromScale(0, 0),
Text = props.DetailButtonText,
TextXAlignment = Enum.TextXAlignment.Left,
})
-- ////////// Buttons
local Buttons = props.Buttons and new(ButtonStack, Sift.Dictionary.join({
AnchorPoint = Vector2.new(0.5, 0.5),
Buttons = props.Buttons,
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.new(1, 0, 1, 0),
PaddingLeft = UDim.new(0, Theme['styles/Padding/Default/Outer/Left']),
PaddingRight = UDim.new(0, Theme['styles/Padding/Default/Outer/Right']),
}, props.ButtonStackProps))
-- ////////// Dialog
return new(Window, Sift.Dictionary.join({
AnchorPoint = props.AnchorPoint,
AutomaticSize = props.AutomaticSize,
ContentBackgroundColor = 'colors/Background/Fill_Color/Layer/Alt',
Position = props.Position,
Size = props.Size,
Native = props.Native,
FooterHeight = Buttons and 80 or 0,
FooterContents = Buttons,
TitleBarProps = Sift.Dictionary.join({
BackgroundColor = 'colors/Background/Fill_Color/Layer/Alt',
}, props.TitleBarProps),
}, props.WindowProps), {
Title = Title,
Body = Body,
DetailHyperlink = DetailHyperlink,
Layout = new('UIListLayout', {
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = UDim.new(0, 12),
}),
Padding = new('UIPadding', {
PaddingBottom = UDim.new(0, Theme['styles/Padding/Content/Outer/Bottom']),
PaddingLeft = UDim.new(0, Theme['styles/Padding/Content/Outer/Left']),
PaddingRight = UDim.new(0, Theme['styles/Padding/Content/Outer/Right']),
PaddingTop = UDim.new(0, Theme['styles/Padding/Content/Outer/Top']),
}),
})
end)
end
return Dialog
| 1,590 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/Dialog.story.luau | -- TitleBar: The top bar of a window component
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local FrameVisualizer = require(Winro.Utility.FrameVisualizer)
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Dialog = require(script.Parent.Dialog)
local DialogStory = Roact.PureComponent:extend(script.Name)
function DialogStory:render()
local props = self.props
local Dialog = new(Dialog, Sift.Dictionary.join({
TitleText = 'Title',
BodyText = props.BodyText,
Buttons = props.Buttons and {
[1] = {
Text = 'Accept',
Style = 'Accent',
[Roact.Event.Activated] = print,
},
[2] = {
Text = 'Cancel',
Style = 'Standard',
[Roact.Event.Activated] = print,
},
[3] = {
Disabled = true,
Text = 'Disabled',
Style = 'Standard',
[Roact.Event.Activated] = print,
},
},
-- ButtonStackProps = {
-- StackWidth = UDim.new(0, 300),
-- },
TitleBarProps = {
Icon = 'images/roblox/icons/logo/studiologo_small/1x',
Text = 'App name',
ReleaseText = 'Preview',
OnClose = print,
},
WindowProps = {
FooterHeight = 80,
}
}, self.props.Props))
if self.props.Wireframe then
return new(FrameVisualizer, {
Size = UDim2.new(1, 0, 1, 0),
}, Dialog)
else
return Dialog
end
end
return {
controls = {
Wireframe = false,
Buttons = true,
BodyText = [[This is body text. Windows 11 marks a visual evolution of the operating system. We have evolved our design language alongside with Fluent to create a design which is human, universal and truly feels like Windows.
The design principles below have guided us throughout the journey of making Windows the best-in-class implementation of Fluent.]]
},
stories = {
Dialog = function(props)
return new(DialogStory, props.controls)
end
}
}
| 524 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/TitleBar/CaptionClose.luau | -- CaptionClose: The TitleBar close button
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local RegisterStateAction = Theme.RegisterStateAction
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local RoundedSurface = require(Winro.App.Surface.RoundedSurface)
local CAPTIONCLOSE_TEXT_REST = 'colors/Fill_Color/Text/Primary'
local CAPTIONCLOSE_TEXT_PRIMARY = 'colors/Shell/Fill_Color/Caption_Close_Text/Primary'
local CAPTIONCLOSE_TEXT_SECONDARY = 'colors/Shell/Fill_Color/Caption_Close_Text/Secondary'
local CAPTIONCLOSE_FILL_REST = 'colors/Fill_Color/Subtle/Transparent'
local CAPTIONCLOSE_FILL_PRIMARY = 'colors/Shell/Fill_Color/Caption_Control_Close_Fill/Primary'
local CAPTIONCLOSE_FILL_SECONDARY = 'colors/Shell/Fill_Color/Caption_Control_Close_Fill/Secondary'
local CAPTIONCLOSE_ICON = 'images/roblox/icons/navigation/close/1x'
local CaptionClose = Roact.PureComponent:extend(script.Name)
CaptionClose.defaultProps = {
Width = 48, --- @defaultProp
}
CaptionClose.validateProps = t.strictInterface({
--- @prop @optional @style TextColor string|table X icon color
TextColor = t.optional(StyleValidator),
--- @prop @optional AlwaysShow boolean Determines if the caption close button is always shown
AlwaysShow = t.optional(t.boolean),
--- @prop @optional Width number positive The Button's width in pixels
Width = t.optional(t.numberPositive),
--- @prop @optional [Roact.Event.Activated] function Roact.Event.Activated
[Roact.Event.Activated] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Down] function Roact.Event.MouseButton1Down
[Roact.Event.MouseButton1Down] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseButton1Up] function Roact.Event.MouseButton1Up
[Roact.Event.MouseButton1Up] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseEnter] function Roact.Event.MouseEnter
[Roact.Event.MouseEnter] = t.optional(t.callback),
--- @prop @optional [Roact.Event.MouseLeave] function Roact.Event.MouseLeave
[Roact.Event.MouseLeave] = t.optional(t.callback),
})
function CaptionClose:init()
-- Actions
RegisterStateAction(self, Roact.Event.Activated, nil)
RegisterStateAction(self, Roact.Event.MouseButton1Down, 'Pressed')
RegisterStateAction(self, Roact.Event.MouseButton1Up, 'Hover')
RegisterStateAction(self, Roact.Event.MouseEnter, 'Hover')
RegisterStateAction(self, Roact.Event.MouseLeave, 'Rest')
-- Initial state
self:setState({
State = 'Rest'
})
end
function CaptionClose:render()
local props = self.props
local state = self.state
return WithTheme(function(Theme)
-- ////////// Button
local FillStyle = nil
local TextStyle = nil
if state.State == 'Rest' then
if props.AlwaysShow then
TextStyle = Theme[CAPTIONCLOSE_TEXT_PRIMARY]
FillStyle = Theme[CAPTIONCLOSE_FILL_PRIMARY]
else
TextStyle = Theme[props.TextColor or CAPTIONCLOSE_TEXT_REST]
FillStyle = Theme[CAPTIONCLOSE_FILL_REST]
end
elseif state.State == 'Hover' then
TextStyle = Theme[CAPTIONCLOSE_TEXT_PRIMARY]
FillStyle = Theme[CAPTIONCLOSE_FILL_PRIMARY]
else
TextStyle = Theme[CAPTIONCLOSE_TEXT_SECONDARY]
FillStyle = Theme[CAPTIONCLOSE_FILL_SECONDARY]
end
return new(RoundedSurface, {
AnchorPoint = Vector2.new(1, 0),
BackgroundColor = FillStyle,
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer']),
Position = UDim2.fromScale(1, 0),
Size = UDim2.new(0, props.Width, 1, 0),
ShowTopRightCorner = true,
}, {
Button = new('ImageButton', {
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
[Roact.Event.Activated] = self[Roact.Event.Activated],
[Roact.Event.MouseButton1Down] = self[Roact.Event.MouseButton1Down],
[Roact.Event.MouseButton1Up] = self[Roact.Event.MouseButton1Up],
[Roact.Event.MouseEnter] = self[Roact.Event.MouseEnter],
[Roact.Event.MouseLeave] = self[Roact.Event.MouseLeave],
}),
Icon = new('ImageLabel', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Position = UDim2.fromScale(0.5, 0.5),
Size = UDim2.fromOffset(18, 18),
ImageColor3 = TextStyle.Color,
ImageTransparency = TextStyle.Transparency,
Image = Theme[CAPTIONCLOSE_ICON].Image,
ImageRectSize = Theme[CAPTIONCLOSE_ICON].ImageRectSize,
ImageRectOffset = Theme[CAPTIONCLOSE_ICON].ImageRectOffset,
ScaleType = Enum.ScaleType.Fit,
--ResampleMode = Enum.ResamplerMode.Pixelated,
})
})
end)
end
return CaptionClose
| 1,249 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/TitleBar/TitleBar.luau | -- TitleBar: The top bar of a window component
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local GetTextSize = require(Winro.Utility.GetTextSize)
local RoundedSurface = require(Winro.App.Surface.RoundedSurface)
local TitleBarRoot = script.Parent
local CaptionClose = require(TitleBarRoot.CaptionClose)
local TITLEBAR_LABEL_FONT_STYLE = 'fonts/Caption'
local TITLEBAR_LABEL_TEXT_STYLE = 'colors/Fill_Color/Text/Primary'
local TITLEBAR_RELEASE_TEXT_STYLE = 'colors/Fill_Color/Text/Secondary'
local TitleBar = Roact.PureComponent:extend(script.Name)
TitleBar.defaultProps = {
Height = 32, --- @defaultProp
Text = 'TitleBar', --- @defaultProp
CaptionButtonWidth = 48, --- @defaultProp
BackgroundColor = {
Color = Color3.new(),
Transparency = 1,
}, --- @defaultProp
}
TitleBar.validateProps = t.strictInterface({
--- @prop @optional AlwaysShowClose boolean Always show the close button
AlwaysShowClose = t.optional(t.boolean),
--- @prop @optional CaptionButtonWidth number Caption Button's width
CaptionButtonWidth = t.optional(t.number),
--- @prop @optional Text string The TitleBar's text
Text = t.optional(t.string),
--- @prop @optional LayoutOrder number The TitleBar's layout order
LayoutOrder = t.optional(t.number),
--- @prop @optional Icon string|table The TitleBar's icon
Icon = t.optional(StyleValidator),
--- @prop @optional ReleaseText string The TitleBar's release text
ReleaseText = t.optional(t.string),
--- @prop @optional @style TextColor string|table The Label's text fill
TextColor = t.optional(StyleValidator),
--- @prop @optional @style BackgroundColor string|table The TitleBars's background fill
BackgroundColor = t.optional(StyleValidator),
--- @prop @optional Height number positive The TitleBar's height, in pixels
Height = t.optional(t.numberPositive),
--- @prop @optional OnClose function The function to call when the close button is pressed
OnClose = t.optional(t.callback),
--- @prop @optional Native table Native props
Native = t.optional(t.table)
})
function TitleBar:render()
local props = self.props
return WithTheme(function(Theme)
-- ////////// Label
local LabelFontStyle = Theme[TITLEBAR_LABEL_FONT_STYLE]
local LabelTextStyle = Theme[props.TextColor or TITLEBAR_LABEL_TEXT_STYLE]
local GotLabelTextSize, LabelTextSize = GetTextSize(props.Text, LabelFontStyle.Font, LabelFontStyle.Size)
local Label = new('TextLabel', {
AutomaticSize = (not GotLabelTextSize) and Enum.AutomaticSize.X or nil, -- Fallback
BackgroundTransparency = 1,
FontFace = LabelFontStyle.Font,
LayoutOrder = 1,
Size = UDim2.new(0, GotLabelTextSize and LabelTextSize.X or 0, 1, 0),
Text = props.Text,
TextColor3 = LabelTextStyle.Color,
TextSize = LabelFontStyle.Size,
TextTransparency = LabelTextStyle.Transparency,
})
-- ////////// Release Label
local ReleaseLabelTextStyle = Theme[TITLEBAR_RELEASE_TEXT_STYLE]
local GotReleaseLabelTextSize, ReleaseLabelTextSize = nil, nil
if props.ReleaseText then
GotReleaseLabelTextSize, ReleaseLabelTextSize = GetTextSize(props.ReleaseText, LabelFontStyle.Font, LabelFontStyle.Size)
end
local ReleaseLabel = props.ReleaseText and new('TextLabel', {
AutomaticSize = (not GotReleaseLabelTextSize) and Enum.AutomaticSize.X or nil, -- Fallback
BackgroundTransparency = 1,
FontFace = LabelFontStyle.Font,
LayoutOrder = 2,
Size = UDim2.new(0, GotReleaseLabelTextSize and ReleaseLabelTextSize.X or 0, 1, 0),
Text = props.ReleaseText,
TextColor3 = ReleaseLabelTextStyle.Color,
TextSize = LabelFontStyle.Size,
TextTransparency = ReleaseLabelTextStyle.Transparency,
}) or nil
-- ////////// Text Container
local TextContainerWidth = LabelTextSize.X
if GotReleaseLabelTextSize then
TextContainerWidth += ReleaseLabelTextSize.X + 8 -- Account for 8px layout padding
end
local TextContainer = new('Frame', {
BackgroundTransparency = 1,
LayoutOrder = 2,
Size = UDim2.new(0, TextContainerWidth, 1, 0),
}, {
Label = Label,
ReleaseLabel = ReleaseLabel,
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Horizontal,
Padding = UDim.new(0, 8),
}),
})
-- ////////// Icon
local IconImage = props.Icon and Theme[props.Icon]
local IconImageSize = nil
if IconImage then
local IconImageRectSize = IconImage.ImageRectSize == Vector2.new() and Vector2.new(16, 16) or IconImage.ImageRectSize
IconImageSize = UDim2.fromOffset(
math.clamp(IconImageRectSize.X, 0, 9*4),
math.clamp(IconImageRectSize.Y, 0, 9*4)
)
else
IconImageSize = UDim2.fromOffset(0, 0)
end
local IconImage = IconImage and new('ImageLabel', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Image = IconImage.Image,
ImageRectOffset = IconImage.ImageRectOffset,
ImageRectSize = IconImage.ImageRectSize,
Position = UDim2.fromScale(0.5, 0.5),
ResampleMode = IconImage.ResampleMode,
Size = IconImageSize,
ImageColor3 = IconImage.ImageColor3,
ImageTransparency = IconImage.ImageTransparency,
})
local Icon = IconImage and new('Frame', {
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Position = UDim2.new(0, 16 + 8, 0.5, 0),
Size = UDim2.new(0, 16, 1, 0),
}, IconImage)
-- ////////// Icon and Title
local TotalPartsSize = UDim2.new(0, TextContainerWidth + (IconImage and 16 * 2 or 0) + 12, 1, 0) -- Account for 12px left padding, Account for additional 16px padding if an icon is present
local IconAndTitle = new('Frame', {
BackgroundTransparency = 1,
LayoutOrder = 2,
Size = TotalPartsSize,
}, {
Icon = Icon,
TextConatainer = TextContainer,
Layout = new('UIListLayout', {
FillDirection = Enum.FillDirection.Horizontal,
Padding = UDim.new(0, 16),
}),
Padding = new('UIPadding', {
PaddingLeft = UDim.new(0, 12),
}),
})
-- ////////// TitleBar parts
local Parts = new('Frame', {
BackgroundTransparency = 1,
Size = TotalPartsSize + UDim2.fromOffset(4, 0), -- Account for 4px left padding
}, {
IconAndTitle = IconAndTitle,
Padding = new('UIPadding', {
PaddingLeft = UDim.new(0, 4),
}),
})
-- ////////// Caption buttons
local CaptionContainerWidth = 0
local CaptionButtons = {}
if props.OnClose then
CaptionButtons.Close = new(CaptionClose, {
AlwaysShow = props.AlwaysShowClose,
Width = props.CaptionButtonWidth,
[Roact.Event.Activated] = props.OnClose,
})
end
local CaptionButtonContainer = new('Frame', {
AnchorPoint = Vector2.new(1, 0),
BackgroundTransparency = 1,
Position = UDim2.fromScale(1, 0),
Size = UDim2.new(0, CaptionContainerWidth, 1, 0),
}, CaptionButtons)
-- ////////// TitleBar
return new(RoundedSurface, {
BackgroundColor = Theme[props.BackgroundColor],
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer']),
LayoutOrder = props.LayoutOrder,
Size = UDim2.new(1, 0, 0, props.Height),
ShowTopLeftCorner = true,
ShowTopRightCorner = true,
Native = props.Native,
}, {
Parts = Parts,
CaptionButtonContainer = CaptionButtonContainer,
})
end)
end
return TitleBar
| 2,070 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/TitleBar/TitleBar.story.luau | -- TitleBar: The top bar of a window component
local Winro = script.Parent.Parent.Parent.Parent
local Packages = Winro.Parent
local FrameVisualizer = require(Winro.Utility.FrameVisualizer)
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local TitleBar = require(script.Parent.TitleBar)
local TitleBarStory = Roact.PureComponent:extend(script.Name)
function TitleBarStory:render()
local TitleBar = new(TitleBar, Sift.Dictionary.join({
Icon = self.props.Icon and 'images/roblox/icons/logo/studiologo_small/1x' or nil,
ReleaseText = 'Story',
AlwaysShowClose = self.props.AlwaysShowClose,
BackgroundColor = 'colors/Background/Fill_Color/Solid_Background/Base',
Height = self.props.Size == 'Standard' and 32 or self.props.Size == 'Large' and 48 or 29,
OnClose = print,
CaptionButtonWidth = self.props.Size == 'Small' and 29 or 32
}, self.props.Props))
if self.props.Wireframe then
return new(FrameVisualizer, {
Size = UDim2.new(1, 0, 1, 0),
}, TitleBar)
else
return TitleBar
end
end
return {
controls = {
AlwaysShowClose = false,
Wireframe = false,
Icon = false,
Size = {'Standard', 'Large', 'Small'},
},
stories = {
TitleBar = function(props)
return new(TitleBarStory, props.controls)
end
}
}
| 366 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/Window.luau | -- Window: A component that is the base structure for a UI Window
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local Theme = require(Winro.Theme)
local WithTheme = Theme.WithTheme
local Validators = Winro.Validators
local StyleValidator = require(Validators.StyleValidator)
local Sift = require(Packages.Sift)
local t = require(Packages.t)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local UserInputService = game:GetService('UserInputService')
local DropShadow = require(Winro.App.Effect.DropShadow)
local RoundedSurface = require(Winro.App.Surface.RoundedSurface)
local WindowRoot = script.Parent
local TitleBar = require(WindowRoot.TitleBar.TitleBar)
local Window = Roact.PureComponent:extend(script.Name)
Window.defaultProps = {
AnchorPoint = Vector2.new(0.5, 0.5), --- @defaultProp
BackgroundColor = 'colors/Background/Fill_Color/Solid_Background/Base', --- @defaultProp
ContentBackgroundColor = {
Color = Color3.new(),
Transparency = 1,
}, --- @defaultProp
DropShadowEnabled = true, --- @defaultProp
Draggable = true, --- @defaultProp
FooterHeight = 0, --- @defaultProp
Position = UDim2.fromScale(0.5, 0.5), --- @defaultProp
Size = UDim2.fromOffset(300, 300), --- @defaultProp
TitleBarProps = {}, --- @defaultProp
}
Window.validateProps = t.strictInterface({
--- @prop @optional AnchorPoint Vector2 The Window's anchor point
AnchorPoint = t.optional(t.Vector2),
--- @prop @optional @style BackgroundColor string|table The Window's background color
BackgroundColor = t.optional(StyleValidator),
--- @prop @optional @style ContentBackgroundColor string|table The Content's background color
ContentBackgroundColor = t.optional(StyleValidator),
--- @prop @optional DropShadowEnabled boolean Determines if a drop shadow is shown
DropShadowEnabled = t.optional(t.boolean),
--- @prop @optional Draggable boolean Determines if the window can be dragged via the TopBar
Draggable = t.optional(t.boolean),
--- @prop @optional AutomaticSize Enum.AutomaticSize Auto sizing
AutomaticSize = t.optional(t.EnumItem),
--- @prop @optional FooterHeight number The Footer's height, in pixels
FooterHeight = t.optional(t.number),
--- @prop @optional FooterContents table The contents to display in the footer
FooterContents = t.optional(t.table),
--- @prop @optional Position UDim2 The Window's position
Position = t.optional(t.UDim2),
--- @prop @optional Size UDim2 The Window's size
Size = t.optional(t.UDim2),
--- @prop @optional TitleBarProps table The props to be provided to the Title Bar
TitleBarProps = t.optional(t.table),
--- @prop @optional [Roact.Children] table The contents to display in the window area
[Roact.Children] = t.optional(t.table),
--- @prop @optional Native table Native props
Native = t.optional(t.table),
})
function Window:init()
-- Size binding, for FitContents
self.Size, self.SetSize = Roact.createBinding(self.props.Size)
-- TitleBar ref, for dragging and for height sizing
self.TitleBarRef = Roact.createRef()
-- Window ref, for dragging
self.WindowRef = Roact.createRef()
-- Connection, for dragging
if self.props.Draggable then
self.DragConnection = UserInputService.InputChanged:Connect(function(Input)
-- Get the window
local Window = self.WindowRef:getValue()
-- Validate that this is drag input
if Window and Input == self.DragInput and self.Dragging then
local Delta = Input.Position - self.DragStart
-- Set the position
Window.Position = UDim2.new(self.StartPos.X.Scale, self.StartPos.X.Offset + Delta.X, self.StartPos.Y.Scale, self.StartPos.Y.Offset + Delta.Y)
end
end)
end
end
function Window:willUnmount()
if self.DragConnection then
self.DragConnection:Disconnect()
end
end
function Window:didMount()
local TitleBar = self.TitleBarRef:getValue()
local Window = self.WindowRef:getValue()
-- Sizing
if TitleBar then
TitleBar:GetPropertyChangedSignal('AbsoluteSize'):Connect(function()
local AbsoluteSize = TitleBar.AbsoluteSize
self.TitleBarHeight = AbsoluteSize.Y
end)
end
if TitleBar and Window and self.props.Draggable then
TitleBar.InputBegan:Connect(function(Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then
self.Dragging = true
self.DragStart = Input.Position
self.StartPos = Window.Position
local Connection = nil
Connection = Input.Changed:Connect(function()
if Input.UserInputState == Enum.UserInputState.End then
self.Dragging = nil
Connection:Disconnect()
end
end)
end
end)
TitleBar.InputChanged:Connect(function(Input)
if Input.UserInputType == Enum.UserInputType.MouseMovement or Input.UserInputType == Enum.UserInputType.Touch then
self.DragInput = Input
end
end)
end
end
function Window:render()
local props = self.props
return WithTheme(function(Theme)
-- ////////// Title Bar
local TitleBar = new(TitleBar, Sift.Dictionary.join({
LayoutOrder = 1,
Height = 32,--28,
CaptionButtonWidth = 45,
Native = {
[Roact.Ref] = self.TitleBarRef,
}
}, props.TitleBarProps))
-- ////////// Content Wrapper
local ContentWrapperFillStyle = Theme[props.ContentBackgroundColor]
local ContentWrapper = new(RoundedSurface, {
AutomaticSize = props.AutomaticSize,
BackgroundColor3 = ContentWrapperFillStyle.Color,
BackgroundTransparency = ContentWrapperFillStyle.Transparency,
BorderSizePixel = 0,
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer']),
ShowBottomLeftCorner = props.FooterHeight < Theme['styles/CornerRadius/Default/Outer'] / 2,
ShowBottomRightCorner = props.FooterHeight < Theme['styles/CornerRadius/Default/Outer'] / 2,
LayoutOrder = 2,
Size = props.Size,
[Roact.Change.AbsoluteSize] = function (rbx)
local AbsoluteSize = rbx.AbsoluteSize
self.SetSize(UDim2.fromOffset(AbsoluteSize.X, AbsoluteSize.Y))
end
}, self.props[Roact.Children])
-- ////////// Footer
local Footer = new('Frame', {
BackgroundTransparency = 1,
LayoutOrder = 3,
Size = UDim2.new(1, 0, 0, props.FooterHeight),
}, props.FooterContents)
-- ////////// Window
local WindowFillStyle = Theme[props.BackgroundColor]
local StrokeStyle = Theme['colors/Stroke_Color/Surface_Stroke/Default']
local Window = new('Frame', Sift.Dictionary.join({
AnchorPoint = props.DropShadowEnabled and Vector2.new(0.5, 0.5) or props.AnchorPoint,
Position = props.DropShadowEnabled and UDim2.fromScale(0.5, 0.5) or props.Position,
BackgroundColor3 = WindowFillStyle.Color,
BackgroundTransparency = WindowFillStyle.Transparency,
[Roact.Ref] = (not props.Draggable) and self.WindowRef or nil,
Size = self.Size:map(function(Size)
return Size + UDim2.fromOffset(0, (self.TitleBarHeight or 0) + props.FooterHeight)
end),
}, props.Native), {
TitleBar = TitleBar,
ContentWrapper = ContentWrapper,
Footer = Footer,
Stroke = new('UIStroke', {
Color = StrokeStyle.Color,
Transparency = StrokeStyle.Transparency,
}),
Corners = new('UICorner', {
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer']),
}),
Layout = new('UIListLayout', {
SortOrder = Enum.SortOrder.LayoutOrder,
})
})
if props.DropShadowEnabled then
-- ////////// Drop Shadow
return new(DropShadow, {
AnchorPoint = props.AnchorPoint,
Position = props.Position,
CornerRadius = UDim.new(0, Theme['styles/CornerRadius/Default/Outer']),
Size = self.Size:map(function(Size)
return Size + UDim2.fromOffset(0, (self.TitleBarHeight or 0) + props.FooterHeight) + UDim2.new(0, 50, 0, 50)
end),
Native = {
[Roact.Ref] = self.WindowRef,
},
}, Window)
else
return Window
end
end)
end
return Window
| 2,042 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/App/Window/Window.story.luau | -- TitleBar: The top bar of a window component
local Winro = script.Parent.Parent.Parent
local Packages = Winro.Parent
local FrameVisualizer = require(Winro.Utility.FrameVisualizer)
local Sift = require(Packages.Sift)
local Roact = require(Packages.Roact)
local new = Roact.createElement
local Flyout = require(Winro.App.Flyout.Flyout)
local Window = require(script.Parent.Window)
local WindowStory = Roact.PureComponent:extend(script.Name)
function WindowStory:render()
local props = self.props
local Window = new(Window, Sift.Dictionary.join({
AutomaticSize = Enum.AutomaticSize.XY,
Size = UDim2.fromOffset(400, 200),
ContentBackgroundColor = 'colors/Background/Fill_Color/Layer/Default',
FooterHeight = props.FooterHeight,
TitleBarProps = {
Icon = 'images/roblox/icons/logo/studiologo_small/1x',
-- BackgroundColor = 'colors/Background/Fill_Color/Layer/Alt',
Text = 'Window',
ReleaseText = 'Story',
OnClose = props.CanClose and print or nil,
},
FooterContents = {
Label = new('TextLabel', {
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
Text = '`FooterContents` goes here',
TextColor3 = Color3.new(1, 1, 1),
TextStrokeTransparency = 0,
})
}
}, self.props.Props), {
Label = new('TextLabel', {
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
Text = '\n\n\n\n\n\n\n\n\n`[Roact.Children]` goes here',
TextColor3 = Color3.new(1, 1, 1),
TextStrokeTransparency = 0,
ZIndex = 2,
}),
Flyout = new(Flyout, {
AnchorPoint = Vector2.new(0.5, 0),
Position = UDim2.new(0.5, 0, 0, 25),
RichText = true,
Text = '<b>Note:</b>\nWindow dragging will not work while inside a plugin widget window.'
}),
})
if self.props.Wireframe then
return new(FrameVisualizer, {
Size = UDim2.new(1, 0, 1, 0),
}, Window)
else
return Window
end
end
return {
controls = {
Wireframe = false,
CanClose = true,
FooterHeight = 80,
},
stories = {
Window = function(props)
return new(WindowStory, props.controls)
end
}
}
| 623 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/Theme/ApplyDescription.luau | local Packages = script.Parent.Parent.Parent
local Flipper = require(Packages.Flipper)
local function CollectKeypoints(Sequence)
if typeof(Sequence) == 'ColorSequence' then
-- Extract each keypoint
local Keypoints = {}
for Index, Keypoint in pairs(Sequence.Keypoints) do
local Color = Keypoint.Value
Keypoints[Index] = {
T = Keypoint.Time,
V = {
R = Color.R,
G = Color.G,
B = Color.B,
}
}
end
return Keypoints
else
-- Extract each keypoint
local Keypoints = {}
for Index, Keypoint in pairs(Sequence.Keypoints) do
Keypoints[Index] = {
T = Keypoint.Time,
V = Keypoint.Value
}
end
return Keypoints
end
end
local function SpringKeypoints(Keypoints, SpringOptions)
-- Get springed keypoints
local SpringedKeypoints = {}
for Index, Keypoint in pairs(Keypoints) do
SpringedKeypoints[Index] = {
T = Flipper.Spring.new(Keypoint.T, SpringOptions)
}
-- Color keypoints
if typeof(Keypoint.V) == 'table' then
local Color = Keypoint.V
SpringedKeypoints[Index].V = {
R = Flipper.Spring.new(Color.R, SpringOptions),
G = Flipper.Spring.new(Color.G, SpringOptions),
B = Flipper.Spring.new(Color.B, SpringOptions)
}
-- Number keypoints
else
SpringedKeypoints[Index].V = Flipper.Spring.new(Keypoint.V, SpringOptions)
end
end
return SpringedKeypoints
end
return function (self, Description, Theme, ColorAnimationSettings, TransparencyAnimationSettings)
--- todo: Add a way to determine if the theme wash changed
-- -- Skip if our current description is the same
-- if self.Description and (Description.Name == self.Description.Name) then
-- return
-- end
-- -- Register
-- self.Description = Description
-- Update each style binding
for _, StyleBinding in pairs(self.StyleBindings) do
-- Get the style key
local StyleKey = Description[StyleBinding]
-- Get the style
local Style = Theme[StyleKey]
-- Extract initial style, for animation
local InitialStyle = self[StyleBinding]:getValue()
-- If no initial, animation isn't noticeable
if not (InitialStyle and InitialStyle.Color) then
self['Set' .. StyleBinding](Style)
continue
end
local InitialColor = InitialStyle.Color
local R, G, B = InitialColor.R, InitialColor.G, InitialColor.B
-- Remove existing motor, if found
local ExistingMotor = self[StyleBinding .. 'Motor']
if ExistingMotor then
pcall(ExistingMotor.destroy, ExistingMotor)
end
-- Extract initial values for motor
local InitialValues = {
R = R,
G = G,
B = B,
T = InitialStyle.Transparency,
}
-- Color and Transparency sequences
if InitialStyle.ColorSequence then
InitialValues.CS = CollectKeypoints(InitialStyle.ColorSequence)
end
if InitialStyle.TransparencySequence then
InitialValues.TS = CollectKeypoints(InitialStyle.TransparencySequence)
end
-- Create animation motor
local Motor = Flipper.GroupMotor.new(InitialValues)
self[StyleBinding .. 'Motor'] = Motor
-- Bind motor
Motor:onStep(function(Values)
local CS, TS = nil, nil
-- Build ColorSequence
if Values.CS then
-- Build keypoints
local Keypoints = {}
for Index, KeypointData in pairs(Values.CS) do
local Color = KeypointData.V
Keypoints[Index] = ColorSequenceKeypoint.new(KeypointData.T, Color3.new(Color.R, Color.G, Color.B))
end
-- Create sequence
CS = ColorSequence.new(Keypoints)
end
-- Build TransparencySequence
if Values.TS then
-- Build keypoints
local Keypoints = {}
for Index, KeypointData in pairs(Values.TS) do
Keypoints[Index] = NumberSequenceKeypoint.new(KeypointData.T, KeypointData.V)
end
-- Create sequence
TS = NumberSequence.new(Keypoints)
end
-- Update style
self['Set' .. StyleBinding]({
Color = Color3.new(Values.R, Values.G, Values.B),
Transparency = Values.T,
ColorSequence = Style.ColorSequence, -- todo: fix CS
TransparencySequence = Style.TransparencySequence, -- todo: fix TS
})
end)
Motor:onComplete(function()
Motor:destroy()
self[StyleBinding .. 'Motor'] = nil
end)
-- Gather goals
local Color = Style.Color
local R, G, B = Color.R, Color.G, Color.B
local Goals = {
R = Flipper.Spring.new(R, ColorAnimationSettings),
G = Flipper.Spring.new(G, ColorAnimationSettings),
B = Flipper.Spring.new(B, ColorAnimationSettings),
T = Flipper.Spring.new(Style.Transparency, TransparencyAnimationSettings),
}
-- Color and Transparency sequences
if Style.ColorSequence then
--Goals.CS = SpringKeypoints(CollectKeypoints(Style.ColorSequence), ColorAnimationSettings)
end
if Style.TransparencySequence then
--Goals.TS = SpringKeypoints(CollectKeypoints(Style.TransparencySequence), TransparencyAnimationSettings)
end
-- Play animation
Motor:setGoal(Goals)
end
end
| 1,351 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/Theme/RegisterStateAction.luau | return function (self, Event, State)
self[Event] = function(...)
-- Set state
self:setState({
State = State
})
-- Custom callback
local Callback = self.props[Event]
if Callback then
Callback(...)
end
end
end
| 68 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/Theme/StyleContext.luau | local Theme = script.Parent
local Winro = Theme.Parent
local Roact = require(Winro.parent.Roact)
return Roact.createContext(nil)
| 33 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/Theme/StyleProvider.luau | local StarterGui = game:GetService("StarterGui")
local Theme = script.Parent
local Winro = Theme.Parent
local Packages = Winro.Parent
local Roact = require(Packages.Roact)
local StyleContext = require(Theme.StyleContext)
local StyleProvider = Roact.Component:extend("StyleProvider")
-- // UIBlox theme provider //
function StyleProvider:init()
-- This is typically considered an anti-pattern, but it's the simplest
-- way to preserve the behavior that these context solutions employed
self.UpdateConnection = StarterGui:GetAttributeChangedSignal('Theme'):Connect(function()
-- If provided as a prop, ignore override
if self.props.Theme then
return
end
self.ThemeObject:Update(require(Theme).Themes[StarterGui:GetAttribute('Theme')])
end)
self:setState({
Theme = self.props.Theme or require(Theme).Themes[StarterGui:GetAttribute('Theme')],
})
end
function StyleProvider:render()
local ThemeObject = {
Theme = self.state.Theme,
Update = function(_self, NewTheme)
if self.mounted then
_self.Theme = NewTheme
self:setState({ Theme = NewTheme })
end
end,
}
self.ThemeObject = ThemeObject
return Roact.createElement(StyleContext.Provider, {
value = ThemeObject,
}, Roact.createFragment(self.props[Roact.Children]))
end
function StyleProvider:didMount()
self.mounted = true
end
function StyleProvider:willUnmount()
self.UpdateConnection:Disconnect()
self.mounted = false
end
return StyleProvider
| 340 |
Epix-Incorporated/Adonis | Epix-Incorporated-Adonis-735143f/MainModule/Client/UI/Modern/Components/Packages/Winro/Theme/Themes/Color.DarkTheme.luau | local AccentColor = Color3.fromRGB(118, 185, 237) -- Color3.fromRGB(96, 205, 255)
return {
["colors/Fill_Color/Text/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Fill_Color/Text/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.21568627450980393,
},
["colors/Fill_Color/Text/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.4549019607843138,
},
["colors/Fill_Color/Text/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.6352941176470588,
},
["colors/Fill_Color/Accent_Text/Primary"] = {
Color = Color3.fromRGB(153, 235, 255),
Transparency = 0,
},
["colors/Fill_Color/Accent_Text/Secondary"] = {
Color = Color3.fromRGB(153, 235, 255),
Transparency = 0,
},
["colors/Fill_Color/Accent_Text/Tertiary"] = {
Color = AccentColor,
Transparency = 0,
},
["colors/Fill_Color/Accent_Text/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.6352941176470588,
},
["colors/Fill_Color/Text_On_Accent/Primary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0,
},
["colors/Fill_Color/Text_On_Accent/Secondary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.4980392156862745,
},
["colors/Fill_Color/Text_On_Accent/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.47058823529411764,
},
["colors/Fill_Color/Text_On_Accent/Selected_Text"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Fill_Color/Control/Transparent"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Fill_Color/Control/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Fill_Color/Control/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9176470588235294,
},
["colors/Fill_Color/Control/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9686274509803922,
},
["colors/Fill_Color/Control/Quarternary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Fill_Color/Control/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9568627450980393,
},
["colors/Fill_Color/Control/Input_Active"] = {
Color = Color3.fromRGB(30, 30, 30),
Transparency = 0.3019607843137255,
},
["colors/Fill_Color/Control_Strong/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.4549019607843138,
},
["colors/Fill_Color/Control_Strong/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.7529411764705882,
},
["colors/Fill_Color/Control_Alt/Transparent"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Fill_Color/Control_Alt/Secondary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8980392156862745,
},
["colors/Fill_Color/Control_Alt/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9568627450980393,
},
["colors/Fill_Color/Control_Alt/Quarternary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9294117647058824,
},
["colors/Fill_Color/Control_Alt/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Fill_Color/Subtle/Transparent"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Fill_Color/Subtle/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Fill_Color/Subtle/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9568627450980393,
},
["colors/Fill_Color/Subtle/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Fill_Color/Accent/Default"] = {
Color = AccentColor,
Transparency = 0,
},
["colors/Fill_Color/Accent/Secondary"] = {
Color = AccentColor,
Transparency = 0.10196078431372546,
},
["colors/Fill_Color/Accent/Tertiary"] = {
Color = AccentColor,
Transparency = 0.19999999999999996,
},
["colors/Fill_Color/Accent/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8431372549019608,
},
["colors/Fill_Color/Accent/Selected_Text_Background"] = {
Color = Color3.fromRGB(0, 120, 212),
Transparency = 0,
},
["colors/Fill_Color/Control_Solid/Default"] = {
Color = Color3.fromRGB(69, 69, 69),
Transparency = 0,
},
["colors/Fill_Color/System/Critical"] = {
Color = Color3.fromRGB(255, 153, 164),
Transparency = 0,
},
["colors/Fill_Color/System/Success"] = {
Color = Color3.fromRGB(108, 203, 95),
Transparency = 0,
},
["colors/Fill_Color/System/Attention"] = {
Color = AccentColor,
Transparency = 0,
},
["colors/Fill_Color/System/Caution"] = {
Color = Color3.fromRGB(252, 225, 0),
Transparency = 0,
},
["colors/Fill_Color/System/Attention_Background"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9686274509803922,
},
["colors/Fill_Color/System/Success_Background"] = {
Color = Color3.fromRGB(57, 61, 27),
Transparency = 0,
},
["colors/Fill_Color/System/Caution_Background"] = {
Color = Color3.fromRGB(67, 53, 25),
Transparency = 0,
},
["colors/Fill_Color/System/Critical_Background"] = {
Color = Color3.fromRGB(68, 39, 38),
Transparency = 0,
},
["colors/Fill_Color/System/Neutral"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.4549019607843138,
},
["colors/Fill_Color/System/Neutral_Background"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9686274509803922,
},
["colors/Fill_Color/System/Solid_Attention_Background"] = {
Color = Color3.fromRGB(46, 46, 46),
Transparency = 0,
},
["colors/Fill_Color/System/Solid_Neutral"] = {
Color = Color3.fromRGB(157, 157, 157),
Transparency = 0,
},
["colors/Fill_Color/System/Solid_Neutral_Background"] = {
Color = Color3.fromRGB(46, 46, 46),
Transparency = 0,
},
["colors/Fill_Color/Control_On_Image/Default"] = {
Color = Color3.fromRGB(28, 28, 28),
Transparency = 0.3019607843137255,
},
["colors/Fill_Color/Control_On_Image/Secondary"] = {
Color = Color3.fromRGB(26, 26, 26),
Transparency = 0,
},
["colors/Fill_Color/Control_On_Image/Tertiary"] = {
Color = Color3.fromRGB(19, 19, 19),
Transparency = 0,
},
["colors/Fill_Color/Control_On_Image/Disabled"] = {
Color = Color3.fromRGB(30, 30, 30),
Transparency = 1,
},
["colors/Stroke_Color/Control_Stroke/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9294117647058824,
},
["colors/Stroke_Color/Control_Stroke/On_Accent_Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9215686274509804,
},
["colors/Stroke_Color/Control_Stroke/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9058823529411765,
},
["colors/Stroke_Color/Control_Stroke/On_Accent_Secondary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8588235294117648,
},
["colors/Stroke_Color/Control_Stroke/On_Accent_Tertiary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.7843137254901961,
},
["colors/Stroke_Color/Control_Stroke/On_Accent_Disabled"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8,
},
["colors/Stroke_Color/Control_Stroke/For_Strong_Fill_When_On_Image"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.580392156862745,
},
["colors/Stroke_Color/Control_Strong_Stroke/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.39607843137254906,
},
["colors/Stroke_Color/Control_Strong_Stroke/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8431372549019608,
},
["colors/Stroke_Color/Divider_Stroke/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9176470588235294,
},
["colors/Stroke_Color/Surface_Stroke/Default"] = {
Color = Color3.fromRGB(117, 117, 117),
Transparency = 0.6,
},
["colors/Stroke_Color/Surface_Stroke/Flyout"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8,
},
["colors/Stroke_Color/Card_Stroke/Default"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8980392156862745,
},
["colors/Stroke_Color/Card_Stroke/Default_Solid"] = {
Color = Color3.fromRGB(28, 28, 28),
Transparency = 0,
},
["colors/Stroke_Color/Focus_Stroke/Outer"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Stroke_Color/Focus_Stroke/Inner"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.3019607843137255,
},
["colors/Background/Fill_Color/Card_Background/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9490196078431372,
},
["colors/Background/Fill_Color/Card_Background/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9686274509803922,
},
["colors/Background/Fill_Color/Card_Background/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9294117647058824,
},
["colors/Background/Fill_Color/Smoke/Default"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.6980392156862745,
},
["colors/Background/Fill_Color/Layer/Default"] = {
Color = Color3.fromRGB(58, 58, 58),
Transparency = 0.6980392156862745,
},
["colors/Background/Fill_Color/Layer/Alt"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9450980392156862,
},
["colors/Background/Fill_Color/Layer_On_Acrylic/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9647058823529412,
},
["colors/Background/Fill_Color/Layer_on_Accent_Acrylic/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9647058823529412,
},
["colors/Background/Fill_Color/Acrylic_Background/Default"] = {
Color = Color3.fromRGB(44, 44, 44),
Transparency = 0.039215686274509776,
},
["colors/Background/Fill_Color/Acrylic_Background/Base"] = {
Color = Color3.fromRGB(32, 32, 32),
Transparency = 0.039215686274509776,
},
["colors/Background/Fill_Color/Accent_Acrylic_Background/Base"] = {
Color = Color3.fromRGB(0, 63, 146),
Transparency = 0.19999999999999996,
},
["colors/Background/Fill_Color/Accent_Acrylic_Background/Default"] = {
Color = Color3.fromRGB(0, 120, 212),
Transparency = 0.19999999999999996,
},
["colors/Background/Fill_Color/Layer_On_Mica_Base_Alt/Default"] = {
Color = Color3.fromRGB(58, 58, 58),
Transparency = 0.5490196078431373,
},
["colors/Background/Fill_Color/Layer_On_Mica_Base_Alt/Transparent"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 1,
},
["colors/Background/Fill_Color/Layer_On_Mica_Base_Alt/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Background/Fill_Color/Layer_On_Mica_Base_Alt/Tertiary"] = {
Color = Color3.fromRGB(44, 44, 44),
Transparency = 0,
},
["colors/Background/Fill_Color/Mica_Background/Base"] = {
Color = Color3.fromRGB(32, 32, 32),
Transparency = 0,
},
["colors/Background/Fill_Color/Mica_Background/Base_Alt"] = {
Color = Color3.fromRGB(10, 10, 10),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Base"] = {
Color = Color3.fromRGB(32, 32, 32),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Base_Alt"] = {
Color = Color3.fromRGB(10, 10, 10),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Secondary"] = {
Color = Color3.fromRGB(28, 28, 28),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Tertiary"] = {
Color = Color3.fromRGB(40, 40, 40),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Quarternary"] = {
Color = Color3.fromRGB(44, 44, 44),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Quinary"] = {
Color = Color3.fromRGB(51, 51, 51),
Transparency = 0,
},
["colors/Background/Fill_Color/Solid_Background/Senary"] = {
Color = Color3.fromRGB(55, 55, 55),
Transparency = 0,
},
["colors/Shell/Fill_Color/Caption_Close_Text/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Shell/Fill_Color/Caption_Close_Text/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.3019607843137255,
},
["colors/Shell/Fill_Color/Caption_Control_Close_Fill/Primary"] = {
Color = Color3.fromRGB(196, 43, 28),
Transparency = 0,
},
["colors/Shell/Fill_Color/Caption_Control_Close_Fill/Secondary"] = {
Color = Color3.fromRGB(196, 43, 28),
Transparency = 0.10196078431372546,
},
["colors/Shell/Fill_Color/Keyboard_Button_Alt/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9137254901960784,
},
["colors/Shell/Fill_Color/Keyboard_Button_Alt/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8745098039215686,
},
["colors/Shell/Fill_Color/Keyboard_Button_Alt/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9333333333333333,
},
["colors/Shell/Fill_Color/Keyboard_Button_Alt/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9647058823529412,
},
["colors/Shell/Fill_Color/Keyboard_Button/Default"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8745098039215686,
},
["colors/Shell/Fill_Color/Keyboard_Button/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9137254901960784,
},
["colors/Shell/Fill_Color/Keyboard_Button/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9333333333333333,
},
["colors/Shell/Fill_Color/Keyboard_Button/Disabled"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9647058823529412,
},
["colors/Shell/Fill_Color/Taskbar_Item_Fill/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9176470588235294,
},
["colors/Shell/Fill_Color/Taskbar_Item_Fill/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Shell/Fill_Color/Taskbar_Item_Fill/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9568627450980393,
},
["colors/Shell/Fill_Color/Taskbar_Item_Fill/Transparent"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Shell/Fill_Color/Taskbar_Item_Indicator/Running"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.611764705882353,
},
["colors/Shell/Fill_Color/Subtle_Item_Fill/Transparent"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1,
},
["colors/Shell/Fill_Color/Subtle_Item_Fill/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Shell/Fill_Color/Subtle_Item_Fill/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9568627450980393,
},
["colors/Shell/Fill_Color/Shimmer_Fill/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Shell/Fill_Color/Shimmer_Fill/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9686274509803922,
},
["colors/Shell/Fill_Color/Illustration_On_Acrylic/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8392156862745098,
},
["colors/Shell/Stroke_Color/Keyboard_Button/Primary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8509803921568627,
},
["colors/Shell/Stroke_Color/Keyboard_Button/Secondary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.6980392156862745,
},
["colors/Shell/Stroke_Color/Taskbar_Item_Stroke/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8745098039215686,
},
["colors/Shell/Stroke_Color/Taskbar_Item_Stroke/Secondary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.8980392156862745,
},
["colors/Shell/Stroke_Color/Taskbar_Item_Stroke/Tertiary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9176470588235294,
},
["colors/Shell/Stroke_Color/Taskbar_Item_Stroke/Quarternary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9411764705882353,
},
["colors/Shell/Stroke_Color/Taskbar_Item_Stroke/Quinary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.9568627450980393,
},
["colors/Shell/Stroke_Color/Illustration_On_Acrylic_Strong/Primary"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.580392156862745,
},
["colors/Shell/Background/Fill_Color/Card_Background_On_Thin_Acrylic/Default"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.34901960784313724,
},
["colors/Shell/Background/Fill_Color/Card_Background_On_Thin_Acrylic/Secondary"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.4745098039215686,
},
["colors/Shell/Background/Fill_Color/Layer_On_Thin_Acrylic/Default"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0.8,
},
["colors/Shell/Background/Fill_Color/Acrylic/Thin_Acrylic"] = {
Color = Color3.fromRGB(84, 84, 84),
Transparency = 0.36078431372549025,
},
["colors/Contrast/Aquatic/Window_Text"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Contrast/Aquatic/Window"] = {
Color = Color3.fromRGB(32, 32, 32),
Transparency = 0,
},
["colors/Contrast/Aquatic/Highlight_Text"] = {
Color = Color3.fromRGB(38, 59, 80),
Transparency = 0,
},
["colors/Contrast/Aquatic/Highlight"] = {
Color = Color3.fromRGB(142, 227, 240),
Transparency = 0,
},
["colors/Contrast/Aquatic/Button_Text"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Contrast/Aquatic/Button"] = {
Color = Color3.fromRGB(32, 32, 32),
Transparency = 0,
},
["colors/Contrast/Aquatic/Hotlight"] = {
Color = Color3.fromRGB(117, 233, 252),
Transparency = 0,
},
["colors/Contrast/Aquatic/Gray_Text"] = {
Color = Color3.fromRGB(166, 166, 166),
Transparency = 0,
},
["colors/Contrast/Desert/Window_Text"] = {
Color = Color3.fromRGB(61, 61, 61),
Transparency = 0,
},
["colors/Contrast/Desert/WIndow"] = {
Color = Color3.fromRGB(255, 250, 239),
Transparency = 0,
},
["colors/Contrast/Desert/Highlight_Text"] = {
Color = Color3.fromRGB(255, 245, 227),
Transparency = 0,
},
["colors/Contrast/Desert/Highlight"] = {
Color = Color3.fromRGB(144, 57, 9),
Transparency = 0,
},
["colors/Contrast/Desert/Button_Text"] = {
Color = Color3.fromRGB(32, 32, 32),
Transparency = 0,
},
["colors/Contrast/Desert/Button"] = {
Color = Color3.fromRGB(255, 250, 239),
Transparency = 0,
},
["colors/Contrast/Desert/Hotlight"] = {
Color = Color3.fromRGB(28, 94, 117),
Transparency = 0,
},
["colors/Contrast/Desert/Gray_Text"] = {
Color = Color3.fromRGB(103, 103, 103),
Transparency = 0,
},
["colors/Contrast/Dusk/Window_Text"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Contrast/Dusk/Window"] = {
Color = Color3.fromRGB(45, 50, 54),
Transparency = 0,
},
["colors/Contrast/Dusk/Highlight_Text"] = {
Color = Color3.fromRGB(33, 45, 59),
Transparency = 0,
},
["colors/Contrast/Dusk/Highlight"] = {
Color = Color3.fromRGB(171, 207, 242),
Transparency = 0,
},
["colors/Contrast/Dusk/Button_Text"] = {
Color = Color3.fromRGB(182, 246, 240),
Transparency = 0,
},
["colors/Contrast/Dusk/Button"] = {
Color = Color3.fromRGB(45, 50, 54),
Transparency = 0,
},
["colors/Contrast/Dusk/Hotlight"] = {
Color = Color3.fromRGB(112, 235, 222),
Transparency = 0,
},
["colors/Contrast/Dusk/Gray_Text"] = {
Color = Color3.fromRGB(166, 166, 166),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Window_Text"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Window"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Highlight_Text"] = {
Color = Color3.fromRGB(43, 43, 43),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Highlight"] = {
Color = Color3.fromRGB(214, 180, 253),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Button_Text"] = {
Color = Color3.fromRGB(255, 238, 50),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Button"] = {
Color = Color3.fromRGB(0, 0, 0),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Hotlight"] = {
Color = Color3.fromRGB(128, 128, 255),
Transparency = 0,
},
["colors/Contrast/Night_Sky/Gray_Text"] = {
Color = Color3.fromRGB(166, 166, 166),
Transparency = 0,
},
-- Custom
["colors/Elevation/Accent_Control/Border"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.08,
ColorSequence = ColorSequence.new({
[1] = ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)),
[2] = ColorSequenceKeypoint.new(0.6, Color3.fromRGB(255, 255, 255)),
[3] = ColorSequenceKeypoint.new(1, Color3.fromRGB(0, 0, 0)),
}),
TransparencySequence = NumberSequence.new({
[1] = NumberSequenceKeypoint.new(0, 1 - 0.08),
[2] = NumberSequenceKeypoint.new(0.6, 1 - 0.08),
[3] = NumberSequenceKeypoint.new(1, 1 - 0.14),
}),
},
["colors/Elevation/Control/Border"] = {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 0.07,
ColorSequence = ColorSequence.new({
[1] = ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 255, 255)),
[2] = ColorSequenceKeypoint.new(0.1, Color3.fromRGB(255, 255, 255)),
[3] = ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 255, 255)),
}),
TransparencySequence = NumberSequence.new({
[1] = NumberSequenceKeypoint.new(0, 1 - 0.093),
[2] = NumberSequenceKeypoint.new(0.1, 1 - 0.0698),
[3] = NumberSequenceKeypoint.new(1, 1 - 0.0698),
}),
},
}
| 7,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.