diff --git a/Assets/Items/Pijama.inv b/Assets/Items/Pijama.inv new file mode 100644 index 0000000..7476fb6 --- /dev/null +++ b/Assets/Items/Pijama.inv @@ -0,0 +1,16 @@ +{ + "Slot": "Body", + "HoldType": "None", + "ImageTexture": null, + "ImageUrl": "https://cdn.sbox.game/asset/pukes.pyjamatop/thumb.png.9405387bc9d8e406", + "ClothUrl": "pukes/pyjamatop", + "Name": "Pijama", + "Description": "Test clothing", + "Prefab": null, + "WeaponDefinition": { + "Position": "0,0,0", + "Rotation": "0,0,0,0" + }, + "__references": [], + "__version": 0 +} \ No newline at end of file diff --git a/Assets/Items/pistol.inv b/Assets/Items/pistol.inv new file mode 100644 index 0000000..80ef13a --- /dev/null +++ b/Assets/Items/pistol.inv @@ -0,0 +1,47 @@ +{ + "Slot": "RightHand", + "HoldType": "Pistol", + "ImageTexture": { + "$compiler": "texture", + "$source": "imagefile", + "data": { + "FilePath": "textures/box_box_parallax_example_texture.png", + "MaxSize": 4096, + "ConvertHeightToNormals": false, + "NormalScale": 1, + "Rotate": 0, + "FlipVertical": false, + "FlipHorizontal": false, + "Padding": { + "Size": "0,0", + "EdgeSize": "0,0" + }, + "Sharpen": 0, + "InvertColor": false, + "Blur": 0, + "Brightness": 1, + "Contrast": 1, + "Saturation": 1, + "Hue": 0, + "Colorize": false, + "TargetColor": "0,1,0,1", + "CacheToDisk": true + }, + "compiled": "textures/generated/imagefile/40617d16d6d5e270.vtex" + }, + "ImageUrl": "https://files.koptilnya.xyz/?r=/download&path=L9Ch0L3QuNC80L7QuiDRjdC60YDQsNC90LAgMjAyNC0wNC0wNSAwMjA3MTIucG5n", + "Name": "Пистун", + "Description": "Стреляй-убивао", + "Count": 1, + "MaxCount": 1, + "Prefab": { + "_type": "gameobject", + "prefab": "prefabs/weapon/pistol_1.prefab" + }, + "WeaponDefinition": { + "Position": "-1.108,0.38,-2.367", + "Rotation": "0.002790701,0.01173679,0.006057173,0.9999089" + }, + "__references": [], + "__version": 0 +} \ No newline at end of file diff --git a/Assets/Items/pistol_ammo.inv b/Assets/Items/pistol_ammo.inv new file mode 100644 index 0000000..edbcf09 --- /dev/null +++ b/Assets/Items/pistol_ammo.inv @@ -0,0 +1,45 @@ +{ + "Slot": "Body", + "HoldType": "None", + "ImageTexture": { + "$compiler": "texture", + "$source": "imagefile", + "data": { + "FilePath": "textures/pistol/fabric080_1k-png_color.png", + "MaxSize": 4096, + "ConvertHeightToNormals": false, + "NormalScale": 1, + "Rotate": 0, + "FlipVertical": false, + "FlipHorizontal": false, + "Padding": { + "Size": "0,0", + "EdgeSize": "0,0" + }, + "Sharpen": 0, + "InvertColor": false, + "Blur": 0, + "Brightness": 1, + "Contrast": 1, + "Saturation": 1, + "Hue": 0, + "Colorize": false, + "TargetColor": "0,1,0,1", + "CacheToDisk": true + }, + "compiled": "textures/generated/imagefile/99bb31e0375ff700.vtex" + }, + "ImageUrl": null, + "Name": "Pistol Ammo", + "Description": "ammo для пистолетоу", + "Prefab": { + "_type": "gameobject", + "prefab": "prefabs/weapon/ammobox.prefab" + }, + "WeaponDefinition": { + "Position": "0,0,0", + "Rotation": "0,0,0,0" + }, + "__references": [], + "__version": 0 +} \ No newline at end of file diff --git a/Assets/pistol.inv.meta b/Assets/pistol.inv.meta new file mode 100644 index 0000000..d8e44ba --- /dev/null +++ b/Assets/pistol.inv.meta @@ -0,0 +1,21 @@ +{ + "publish": { + "Enabled": false, + "ProjectConfig": { + "Title": "Pistol", + "Type": "inv", + "Org": "local", + "Ident": "pistol", + "Schema": 0, + "IncludeSourceFiles": true, + "Resources": null, + "PackageReferences": null, + "EditorReferences": null, + "Mounts": null, + "IsStandaloneOnly": false, + "Metadata": { + "SingleAssetSource": "pistol.inv" + } + } + } +} \ No newline at end of file diff --git a/Assets/prefabs/Player.prefab b/Assets/prefabs/Player.prefab index ad64357..11dd5d7 100644 --- a/Assets/prefabs/Player.prefab +++ b/Assets/prefabs/Player.prefab @@ -14,23 +14,6 @@ "NetworkOrphaned": 0, "OwnerTransfer": 1, "Components": [ - { - "__type": "Sandbox.PlayerDresser", - "__guid": "f6cb17cb-229f-491d-9606-168d8e0e071a", - "__enabled": true, - "BodyRenderer": { - "_type": "component", - "component_id": "559de9a6-0eab-4676-99e4-9e6c3cdc2a95", - "go": "4ee14eb8-86a4-4742-8298-7492b7deccea", - "component_type": "SkinnedModelRenderer" - }, - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null - }, { "__type": "Sandbox.Citizen.CitizenAnimationHelper", "__guid": "6d063f1b-f607-4ef8-bfec-90830c6bf256", @@ -126,12 +109,23 @@ "go": "0802fa96-3b6e-49e1-a830-a4f57e1b0e2a" }, "CamOffsetX": 72, - "DuckSpeed": 100, - "Gun": { - "_type": "gameobject", - "go": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb" + "CurrentClothing": { + "DisplayName": null, + "Height": 0.5, + "Age": 0.5, + "Tint": 0.5, + "PrefersHuman": false }, + "DuckSpeed": 100, "InteractDistance": 350, + "Inventory": { + "Items": [], + "EquippedItems": {} + }, + "InventoryUI": { + "_type": "gameobject", + "go": "f421a41f-0db1-40fe-8694-8fc5109ed8ed" + }, "JumpStrength": 350, "OnComponentDestroy": null, "OnComponentDisabled": null, @@ -139,8 +133,17 @@ "OnComponentFixedUpdate": null, "OnComponentStart": null, "OnComponentUpdate": null, + "Renderer": { + "_type": "component", + "component_id": "559de9a6-0eab-4676-99e4-9e6c3cdc2a95", + "go": "4ee14eb8-86a4-4742-8298-7492b7deccea", + "component_type": "SkinnedModelRenderer" + }, "RunSpeed": 350, - "WalkSpeed": 200 + "WalkSpeed": 200, + "WorkshopItems": [ + "pukes/pyjamatop" + ] }, { "__type": "Sandbox.AudioListener", @@ -276,7 +279,7 @@ "BoneMergeTarget": null, "CreateAttachments": true, "CreateBoneObjects": false, - "MaterialGroup": null, + "MaterialGroup": "default", "MaterialOverride": null, "Model": "models/my_citizen/my_citizen.vmdl", "Morphs": {}, @@ -288,10 +291,7 @@ "OnComponentUpdate": null, "Parameters": { "bools": {}, - "ints": { - "holdtype_handedness": 1, - "holdtype": 1 - }, + "ints": {}, "floats": {}, "vectors": {}, "rotations": {} @@ -1979,8 +1979,8 @@ "__version": 1, "Flags": 8, "Name": "aim_matrix_01", - "Position": "6.521095,0.7812442,11.81102", - "Rotation": "0.000008474321,-0.01491692,0.0004032233,0.9998887", + "Position": "5.864844,0.005568608,11.81102", + "Rotation": "-0.0001240181,-0.01503032,-0.008244861,0.999853", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -1996,8 +1996,8 @@ "__version": 1, "Flags": 8, "Name": "aim_matrix_02a", - "Position": "6.521095,0.7812442,9.842515", - "Rotation": "-0.00000000000000000000001630708,0.0000000000000002001841,-0.0000005326291,1", + "Position": "5.864844,0.005568608,9.842515", + "Rotation": "-0.00000000000000000000001185265,0.0000000000000001455021,-0.0000003871369,1", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2013,8 +2013,8 @@ "__version": 1, "Flags": 8, "Name": "aim_matrix_02b", - "Position": "10.4581,0.7812396,9.842514", - "Rotation": "-0.00000000000000000000001630724,0.0000000000000002001838,-0.0000005326291,1", + "Position": "9.801846,0.005565077,9.842513", + "Rotation": "-0.00000000000000000000001185278,0.0000000000000001455018,-0.0000003871369,1", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2030,9 +2030,9 @@ "__version": 1, "Flags": 8, "Name": "ankle_R", - "Position": "9.750278,-4.98767,3.805855", - "Rotation": "0.6955599,0.1290264,-0.4102752,0.5755199", - "Scale": "1.000001,1.000001,1.000001", + "Position": "0.4100251,-4.377188,3.807455", + "Rotation": "0.6728532,0.2185255,-0.3316621,0.6241117", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2047,9 +2047,9 @@ "__version": 1, "Flags": 8, "Name": "ankle_L", - "Position": "-8.846665,5.432388,3.808193", - "Rotation": "0.6385094,0.3045362,-0.2475574,0.6620263", - "Scale": "1.000002,1.000002,1.000002", + "Position": "0.4083929,4.427738,3.805784", + "Rotation": "0.6245901,0.3321031,-0.2183217,0.6722577", + "Scale": "1.000003,1.000003,1.000003", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2064,9 +2064,9 @@ "__version": 1, "Flags": 8, "Name": "arm_lower_R", - "Position": "15.81711,-4.641375,49.2971", - "Rotation": "0.3864554,-0.09203731,0.1329395,0.9080245", - "Scale": "1.000006,1.000006,1.000006", + "Position": "-2.777774,-8.907755,40.58329", + "Rotation": "0.5056845,0.3672242,-0.5358468,0.5677128", + "Scale": "1.000005,1.000005,1.000005", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2081,8 +2081,8 @@ "__version": 1, "Flags": 8, "Name": "arm_lower_L", - "Position": "-11.06713,5.844989,40.25357", - "Rotation": "0.4718966,0.686001,-0.1886521,0.520698", + "Position": "-2.554454,9.938415,41.12941", + "Rotation": "0.5901422,0.539196,-0.3564052,0.4837099", "Scale": "1.000006,1.000006,1.000006", "Tags": "", "Enabled": true, @@ -2098,9 +2098,9 @@ "__version": 1, "Flags": 8, "Name": "hand_R", - "Position": "23.12087,-3.329065,51.37707", - "Rotation": "0.6109737,-0.1565929,-0.08194675,0.77167", - "Scale": "1.000007,1.000007,1.000007", + "Position": "-1.575329,-10.73443,33.19328", + "Rotation": "0.4779791,0.3452799,-0.5928894,0.5484523", + "Scale": "1.000006,1.000006,1.000006", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2115,9 +2115,9 @@ "__version": 1, "Flags": 8, "Name": "hand_L", - "Position": "-11.16251,9.320543,33.37574", - "Rotation": "0.4744557,0.7153177,-0.1494002,0.4908076", - "Scale": "1.000007,1.000007,1.000007", + "Position": "-1.286812,12.18568,33.86737", + "Rotation": "0.5707431,0.5958003,-0.3323785,0.4569452", + "Scale": "1.000008,1.000008,1.000008", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2132,9 +2132,9 @@ "__version": 1, "Flags": 8, "Name": "hold_R", - "Position": "28.17966,-2.975645,53.73025", - "Rotation": "0.01359697,-0.03031687,-0.01605641,0.9993189", - "Scale": "1.000007,1.000007,1.000007", + "Position": "-0.01371813,-9.381454,27.16162", + "Rotation": "0.3082592,0.7160788,0.06766287,0.6225988", + "Scale": "1.000008,1.000008,1.000008", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2142,67 +2142,15 @@ "NetworkOrphaned": 0, "OwnerTransfer": 1, "Components": [], - "Children": [ - { - "__guid": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb", - "__version": 1, - "__Prefab": "prefabs/pistol_1.prefab", - "__PrefabInstancePatch": { - "AddedObjects": [], - "RemovedObjects": [], - "PropertyOverrides": [ - { - "Target": { - "Type": "GameObject", - "IdValue": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb" - }, - "Property": "Position", - "Value": "-1.108371,0.3799473,-2.366713" - }, - { - "Target": { - "Type": "GameObject", - "IdValue": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb" - }, - "Property": "Rotation", - "Value": "0.002786796,0.01173242,0.006054041,0.9999089" - }, - { - "Target": { - "Type": "GameObject", - "IdValue": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb" - }, - "Property": "NetworkMode", - "Value": 1 - } - ], - "MovedObjects": [] - }, - "__PrefabIdToInstanceId": { - "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb", - "6017d24d-39d0-4acf-bf9f-010c345fd13d": "207382bf-35ed-4d37-ba9f-5bad7ebf3424", - "c8d294ad-32d0-413a-a5cf-c51acaa19920": "669224d1-a24b-4f0d-ac31-98f1ecc25f88", - "be95c906-5f2f-4239-8fd6-a42a148dea6e": "83be1c07-33e7-49f4-98bb-e7c59fef713e", - "eda01dbe-7e56-4e66-af99-673e197e7dc0": "73d7c880-2bf9-42d4-adf6-757371dc174b", - "1e1e54b4-ebf1-4211-9ca9-0eaa37f7bf7e": "6fea4bf9-3966-49b7-ab16-6144630e9727", - "d81748e9-bc3d-4d68-97b5-5602bf5e0e15": "6c02048c-f45d-4d59-aaaf-5a72101067d4", - "47bb3ba1-b0de-4af4-b639-235a5ad2c312": "c098a1ea-e927-4810-8c5f-a00d4762d5d6", - "862e0738-e57f-456a-b0c8-ff03a165faf9": "6f9e7ca1-9f67-450e-9d5e-1a19e52e2aa6", - "a9d8c3d0-cbcb-4ebe-994c-5f4c36f08996": "64d3d0db-d8d0-4f12-90ea-c88f825938e8", - "e1b93001-f96d-474d-bd6f-aaa2acb0d33e": "721c8f1e-f278-4524-a83c-ccfb183c3bdd", - "0e9f41d3-8000-4c3c-9cdd-076056da9d0a": "ca6df154-4513-428d-b990-b6b7b9ba4e72", - "3803bdb5-aa92-46f7-91a6-1dfad9549cf4": "8f9e36c4-d81e-4bc0-9e1f-fd9bc209a6f4" - } - } - ] + "Children": [] }, { "__guid": "04a81a8d-8001-4c7c-8297-9e92685ff9e5", "__version": 1, "Flags": 8, "Name": "hold_L", - "Position": "-9.111555,10.18083,27.40032", - "Rotation": "-0.3745605,0.6190745,0.1380219,0.6763144", + "Position": "0.2557262,11.16746,27.76514", + "Rotation": "-0.2797161,0.7211201,-0.05373439,0.6315516", "Scale": "1.000008,1.000008,1.000008", "Tags": "", "Enabled": true, @@ -2218,8 +2166,8 @@ "__version": 1, "Flags": 8, "Name": "IK_right_hand", - "Position": "23.489,-2.846533,50.76522", - "Rotation": "0.6119095,-0.1352019,-0.07849886,0.7753226", + "Position": "-1.684358,-11.3081,33.23968", + "Rotation": "0.4603033,0.3490921,-0.6097354,0.5426587", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2235,8 +2183,8 @@ "__version": 1, "Flags": 8, "Name": "IK_left_hand", - "Position": "-11.30903,8.606324,33.70538", - "Rotation": "0.4658453,0.7256626,-0.1452944,0.4850685", + "Position": "-1.501041,11.36666,33.23686", + "Rotation": "0.5482481,0.6048241,-0.3533375,0.4569075", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2252,8 +2200,8 @@ "__version": 1, "Flags": 8, "Name": "leg_lower_R", - "Position": "10.7868,-4.101147,16.24689", - "Rotation": "0.4759734,0.4853146,-0.5530634,0.4817052", + "Position": "2.368746,-4.429564,16.1687", + "Rotation": "0.4852337,0.5078025,-0.5660278,0.4316219", "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, @@ -2269,9 +2217,9 @@ "__version": 1, "Flags": 8, "Name": "leg_lower_L", - "Position": "-2.487264,5.5949,14.58643", - "Rotation": "0.3104573,0.6688872,-0.5537581,0.3867275", - "Scale": "1.000001,1.000001,1.000001", + "Position": "2.750974,4.852622,16.09278", + "Rotation": "0.4170566,0.5649363,-0.5238643,0.4821586", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2286,8 +2234,8 @@ "__version": 1, "Flags": 8, "Name": "middle_of_both_hands", - "Position": "8.204354,3.544147,40.57894", - "Rotation": "-0.06242018,0.3097756,0.1365476,0.938881", + "Position": "-1.104477,0.8691149,28.74636", + "Rotation": "0.01755048,0.7529662,0.006575623,0.6577923", "Scale": "1.000007,1.000007,1.000007", "Tags": "", "Enabled": true, @@ -2303,7 +2251,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_upper_R_twist1", - "Position": "10.87258,-3.85075,49.68863", + "Position": "-1.929822,-7.920132,45.43435", "Rotation": "0,0,0,1", "Scale": "1.000005,1.000005,1.000005", "Tags": "", @@ -2320,7 +2268,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_lower_R_twist1", - "Position": "19.46899,-3.98522,50.33709", + "Position": "-2.176551,-9.821091,36.88829", "Rotation": "0,0,0,1", "Scale": "1.000006,1.000006,1.000006", "Tags": "", @@ -2337,9 +2285,9 @@ "__version": 1, "Flags": 8, "Name": "driver_elbow_R_position", - "Position": "15.83493,-4.756836,49.15965", - "Rotation": "0.2941123,0.2333845,-0.6200089,0.6889257", - "Scale": "1.000006,1.000006,1.000006", + "Position": "-2.800889,-8.908604,40.57903", + "Rotation": "-0.03809046,-0.6245987,0.7799343,0.01131491", + "Scale": "1.000005,1.000005,1.000005", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2354,8 +2302,8 @@ "__version": 1, "Flags": 8, "Name": "driver_elbow_L_position", - "Position": "-11.33838,5.651012,40.27713", - "Rotation": "-0.2908338,0.7727236,-0.521594,0.2150669", + "Position": "-2.577524,9.940108,41.12513", + "Rotation": "-0.04260791,0.7959635,-0.5976314,0.08639171", "Scale": "1.000006,1.000006,1.000006", "Tags": "", "Enabled": true, @@ -2371,7 +2319,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_upper_L_twist1", - "Position": "-8.456603,5.507178,44.53117", + "Position": "-1.744466,8.632482,45.91122", "Rotation": "0,0,0,1", "Scale": "1.000005,1.000005,1.000005", "Tags": "", @@ -2388,7 +2336,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_lower_L_twist1", - "Position": "-11.11482,7.582767,36.81466", + "Position": "-1.920633,11.06205,37.49839", "Rotation": "0,0,0,1", "Scale": "1.000007,1.000007,1.000007", "Tags": "", @@ -2405,7 +2353,7 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_upper_R_twist1", - "Position": "7.312469,-3.393645,22.55375", + "Position": "1.46347,-4.2318,23.34433", "Rotation": "0,0,0,1", "Scale": "1.000001,1.000001,1.000001", "Tags": "", @@ -2422,9 +2370,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_upper_L_twist1", - "Position": "-1.865389,5.07972,21.77642", + "Position": "1.678381,4.836231,23.24801", "Rotation": "0,0,0,1", - "Scale": "1,1,1", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2439,8 +2387,8 @@ "__version": 1, "Flags": 8, "Name": "driver_kneecap_R_position", - "Position": "11.62974,-4.143325,16.40622", - "Rotation": "0.5284637,0.415709,-0.4732679,0.5691482", + "Position": "2.787574,-4.476758,16.13843", + "Rotation": "0.5176088,0.4734412,-0.5328195,0.4733266", "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, @@ -2456,9 +2404,9 @@ "__version": 1, "Flags": 8, "Name": "driver_kneecap_L_position", - "Position": "-1.866105,5.720947,14.36645", - "Rotation": "0.7133921,0.1790648,-0.03514626,0.6765887", - "Scale": "1.000001,1.000001,1.000001", + "Position": "3.249787,4.906153,16.05798", + "Rotation": "0.6995426,0.04320066,0.0288072,0.712702", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2473,9 +2421,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_lower_R_twist1", - "Position": "10.26854,-4.544409,10.02637", + "Position": "1.389388,-4.403374,9.988078", "Rotation": "0,0,0,1", - "Scale": "1.000001,1.000001,1.000001", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2490,9 +2438,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_lower_L_twist1", - "Position": "-5.66694,5.513638,9.197291", + "Position": "1.579678,4.640162,9.949263", "Rotation": "0,0,0,1", - "Scale": "1.000001,1.000001,1.000001", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2507,7 +2455,7 @@ "__version": 1, "Flags": 8, "Name": "forward_reference_modelspace", - "Position": "-0.4101132,0.6259325,41.79749", + "Position": "-0.6776385,0.2271925,43.41444", "Rotation": "0,0,0,1", "Scale": "1.000002,1.000002,1.000002", "Tags": "", @@ -2524,9 +2472,9 @@ "__version": 1, "Flags": 8, "Name": "eyes", - "Position": "4.840357,1.15762,61.61248", - "Rotation": "-0.0006980001,-0.01288387,0.02934477,0.9994861", - "Scale": "1.000005,1.000005,1.000005", + "Position": "5.072767,-0.3072115,63.30234", + "Rotation": "0.0140758,-0.01898375,-0.01293489,0.999637", + "Scale": "1.000004,1.000004,1.000004", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2541,9 +2489,9 @@ "__version": 1, "Flags": 8, "Name": "eye_R_forward", - "Position": "5.036598,-2.183075,61.61969", - "Rotation": "-0.0006980001,-0.01288387,0.02934477,0.9994861", - "Scale": "1.000005,1.000005,1.000005", + "Position": "4.988014,-3.651226,63.20652", + "Rotation": "0.0140758,-0.01898375,-0.01293489,0.999637", + "Scale": "1.000004,1.000004,1.000004", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2558,9 +2506,9 @@ "__version": 1, "Flags": 8, "Name": "eye_L_forward", - "Position": "4.644114,4.498316,61.60529", - "Rotation": "-0.0006980001,-0.01288387,0.02934477,0.9994861", - "Scale": "1.000005,1.000005,1.000005", + "Position": "5.157518,3.036803,63.39816", + "Rotation": "0.0140758,-0.01898375,-0.01293489,0.999637", + "Scale": "1.000004,1.000004,1.000004", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2575,9 +2523,9 @@ "__version": 1, "Flags": 8, "Name": "forward_reference", - "Position": "-0.2859829,0.8413471,54.58834", - "Rotation": "-0.0006980001,-0.01288387,0.02934477,0.9994861", - "Scale": "1.000005,1.000005,1.000005", + "Position": "0.027397,0.02358127,56.22047", + "Rotation": "0.0140758,-0.01898375,-0.01293489,0.999637", + "Scale": "1.000004,1.000004,1.000004", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2592,9 +2540,9 @@ "__version": 1, "Flags": 8, "Name": "foot_R", - "Position": "11.13021,-5.90912,0.1873594", - "Rotation": "0.0004745126,0.00006318838,-0.2162294,0.9763424", - "Scale": "1.000001,1.000001,1.000001", + "Position": "1.982162,-4.910528,0.1892754", + "Rotation": "0.0004858672,-0.00001408905,-0.08710641,0.9961989", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2609,9 +2557,9 @@ "__version": 1, "Flags": 8, "Name": "foot_L", - "Position": "-7.239389,5.83229,1.05917", - "Rotation": "-0.04344003,0.999056,0.0003300906,0.00009305868", - "Scale": "1.000002,1.000002,1.000002", + "Position": "1.978726,4.96698,1.053321", + "Rotation": "-0.08723081,0.996188,0.000407666,0.00001469322", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2626,9 +2574,9 @@ "__version": 1, "Flags": 8, "Name": "hat", - "Position": "-0.3823162,0.8688108,69.74839", - "Rotation": "-0.0006980001,-0.01288387,0.02934477,0.9994861", - "Scale": "1.000005,1.000005,1.000005", + "Position": "-0.2584102,-0.4028735,71.37216", + "Rotation": "0.0140758,-0.01898375,-0.01293489,0.999637", + "Scale": "1.000004,1.000004,1.000004", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2717,6 +2665,52 @@ "Children": [] } ] + }, + { + "__guid": "f421a41f-0db1-40fe-8694-8fc5109ed8ed", + "__version": 1, + "Flags": 0, + "Name": "InventoryUI", + "Position": "0,0,0", + "Rotation": "0,0,0,1", + "Scale": "1,1,1", + "Tags": "", + "Enabled": true, + "NetworkMode": 2, + "NetworkInterpolation": true, + "NetworkOrphaned": 0, + "OwnerTransfer": 1, + "Components": [ + { + "__type": "Sandbox.ScreenPanel", + "__guid": "ef34b64a-0d09-42d4-9447-c039845f4639", + "__enabled": true, + "AutoScreenScale": true, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Opacity": 1, + "Scale": 1, + "ScaleStrategy": "ConsistentHeight", + "TargetCamera": null, + "ZIndex": 100 + }, + { + "__type": "Sasalka.Ui.Inventory", + "__guid": "490f3332-7b0d-4c33-bd4e-91185a4e5a27", + "__enabled": true, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null + } + ], + "Children": [] } ], "__properties": { diff --git a/Assets/prefabs/weapon/ammobox.prefab b/Assets/prefabs/weapon/ammobox.prefab new file mode 100644 index 0000000..58aa99b --- /dev/null +++ b/Assets/prefabs/weapon/ammobox.prefab @@ -0,0 +1,73 @@ +{ + "RootObject": { + "__guid": "e5e018f2-9cad-4ece-b160-ab2aa3aeb7ec", + "__version": 1, + "Flags": 0, + "Name": "ammobox", + "Position": "0,0,0", + "Rotation": "0,0,0,1", + "Scale": "1,1,1", + "Tags": "", + "Enabled": true, + "NetworkMode": 2, + "NetworkInterpolation": true, + "NetworkOrphaned": 0, + "OwnerTransfer": 1, + "Components": [ + { + "__type": "Sandbox.ModelRenderer", + "__guid": "ee9d15a8-ffe9-43f1-b6b4-2f04ce55c908", + "__enabled": true, + "BodyGroups": 18446744073709551615, + "CreateAttachments": false, + "MaterialGroup": null, + "MaterialOverride": null, + "Model": "tree_podstavka.vmdl", + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "RenderOptions": { + "GameLayer": true, + "OverlayLayer": false, + "BloomLayer": false, + "AfterUILayer": false + }, + "RenderType": "On", + "Tint": "1,1,1,1" + }, + { + "__type": "Sandbox.BoxCollider", + "__guid": "5830c995-d747-4c8c-abd7-b0366fa2a2aa", + "__enabled": true, + "Center": "0,0,0", + "Friction": null, + "IsTrigger": false, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "OnObjectTriggerEnter": null, + "OnObjectTriggerExit": null, + "OnTriggerEnter": null, + "OnTriggerExit": null, + "Scale": "26.40003,31.00006,2.89996", + "Static": false, + "Surface": null, + "SurfaceVelocity": "0,0,0" + } + ], + "Children": [] + }, + "ResourceVersion": 2, + "ShowInMenu": false, + "MenuPath": null, + "MenuIcon": null, + "DontBreakAsTemplate": false, + "__references": [], + "__version": 2 +} \ No newline at end of file diff --git a/Assets/prefabs/pistol_1.prefab b/Assets/prefabs/weapon/pistol_1.prefab similarity index 97% rename from Assets/prefabs/pistol_1.prefab rename to Assets/prefabs/weapon/pistol_1.prefab index fbe415d..6d301ab 100644 --- a/Assets/prefabs/pistol_1.prefab +++ b/Assets/prefabs/weapon/pistol_1.prefab @@ -58,41 +58,6 @@ "Tint": "1,1,1,1", "UseAnimGraph": true }, - { - "__type": "Sandbox.Weapons.Weapon", - "__guid": "c8d294ad-32d0-413a-a5cf-c51acaa19920", - "__enabled": true, - "bloodParticle": { - "_type": "gameobject", - "prefab": "prefabs/impacts/impact.flesh.mist.prefab" - }, - "BulletOut": { - "_type": "gameobject", - "go": "d81748e9-bc3d-4d68-97b5-5602bf5e0e15" - }, - "GunRenderer": { - "_type": "component", - "component_id": "6017d24d-39d0-4acf-bf9f-010c345fd13d", - "go": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb", - "component_type": "SkinnedModelRenderer" - }, - "ImpactDecal": null, - "ImpactSound": null, - "MuzzleLight": { - "_type": "gameobject", - "go": "eda01dbe-7e56-4e66-af99-673e197e7dc0" - }, - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null, - "particlePrefab": { - "_type": "gameobject", - "prefab": "prefabs/impacts/impact.metal.prefab" - } - }, { "__type": "Sandbox.SoundPointComponent", "__guid": "be95c906-5f2f-4239-8fd6-a42a148dea6e", @@ -141,6 +106,36 @@ "Id": "fa65adf3-a336-4d2b-9e2f-37f15349175a" }, "Volume": 1 + }, + { + "__type": "Sandbox.Weapons.Weapon", + "__guid": "fc38d078-995b-443a-b409-e877618fcf09", + "__enabled": true, + "bloodParticle": { + "_type": "gameobject", + "prefab": "prefabs/impacts/impact.flesh.mist.prefab" + }, + "Cooldown": 0.5, + "GunRenderer": { + "_type": "component", + "component_id": "6017d24d-39d0-4acf-bf9f-010c345fd13d", + "go": "dec3b7f3-79ae-4bb4-b868-8de9d0306ebb", + "component_type": "SkinnedModelRenderer" + }, + "MuzzleLight": { + "_type": "gameobject", + "go": "eda01dbe-7e56-4e66-af99-673e197e7dc0" + }, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "particlePrefab": { + "_type": "gameobject", + "prefab": "prefabs/impacts/impact.metal.prefab" + } } ], "Children": [ diff --git a/Assets/scenes/minimal.scene b/Assets/scenes/minimal.scene index 16c9591..236410e 100644 --- a/Assets/scenes/minimal.scene +++ b/Assets/scenes/minimal.scene @@ -359,7 +359,7 @@ "SpawnPoints": [ { "_type": "gameobject", - "go": "95b4b1e1-e8ec-490c-b0ea-57be0e9a447b" + "go": "dfd41c18-fa6d-44af-90d1-b25e35aae024" } ], "StartServer": true @@ -4314,7 +4314,7 @@ "Rotation": "0,0,0,1", "Scale": "1,1,1", "Tags": "", - "Enabled": true, + "Enabled": false, "NetworkMode": 1, "NetworkInterpolation": false, "NetworkOrphaned": 1, @@ -4871,11 +4871,11 @@ ] }, { - "__guid": "04e55800-8978-49f0-92b7-0294e5884f45", + "__guid": "dfd41c18-fa6d-44af-90d1-b25e35aae024", "__version": 1, "Flags": 0, - "Name": "SpawnPoints", - "Position": "0,74.84104,-87.16756", + "Name": "Spawn", + "Position": "58.50891,-57.9568,-743.6452", "Rotation": "0,0,0,1", "Scale": "1,1,1", "Tags": "", @@ -4885,25 +4885,7 @@ "NetworkOrphaned": 0, "OwnerTransfer": 1, "Components": [], - "Children": [ - { - "__guid": "95b4b1e1-e8ec-490c-b0ea-57be0e9a447b", - "__version": 1, - "Flags": 0, - "Name": "SpawnPoint", - "Position": "0,0,-91.94828", - "Rotation": "0,0,0,1", - "Scale": "1,1,1", - "Tags": "", - "Enabled": true, - "NetworkMode": 2, - "NetworkInterpolation": true, - "NetworkOrphaned": 0, - "OwnerTransfer": 1, - "Components": [], - "Children": [] - } - ] + "Children": [] } ], "SceneProperties": { diff --git a/Code/Inventory/AttachmentSlotResolver.cs b/Code/Inventory/AttachmentSlotResolver.cs new file mode 100644 index 0000000..a5a534b --- /dev/null +++ b/Code/Inventory/AttachmentSlotResolver.cs @@ -0,0 +1,22 @@ +namespace Sasalka; + +public class AttachmentSlotResolver +{ + private readonly Func _attachmentGetter; + + public AttachmentSlotResolver( Func attachmentGetter ) + { + _attachmentGetter = attachmentGetter; + } + + public GameObject GetSlotObject( Inventar.InventorySlot slot ) + { + return slot switch + { + Inventar.InventorySlot.LeftHand => _attachmentGetter.Invoke( "hold_L" ), + Inventar.InventorySlot.RightHand => _attachmentGetter.Invoke( "hold_R" ), + Inventar.InventorySlot.Body => _attachmentGetter.Invoke( "forward_reference_modelspace" ), + _ => _attachmentGetter.Invoke( "forward_reference_modelspace" ) + }; + } +} diff --git a/Code/Inventory/Inventar.cs b/Code/Inventory/Inventar.cs new file mode 100644 index 0000000..c07dada --- /dev/null +++ b/Code/Inventory/Inventar.cs @@ -0,0 +1,69 @@ +namespace Sasalka; + +public class Inventar +{ + [Flags] + public enum InventorySlot + { + None = 0, + LeftHand = 1 << 0, // 1 + RightHand = 1 << 1, // 2 + Head = 1 << 2, // 4 + Body = 1 << 3, // 8 + Hands = 1 << 4, // 16 + Bottom = 1 << 5, // 32 + Feet = 1 << 6 // 64 + } + + public List Items { get; private set; } = new(); + public static bool IsInventoryOpen = false; + + // public Dictionary EquippedItems { get; private set; } = new(); + public Dictionary EquippedItems { get; private set; } = new(); + + public event Action OnChanged; + public event Action OnEquipped; + public event Action OnUnEquipped; + + // public class EquippedItem + // { + // public InventoryItem Item { get; set; } + // public GameObject SpawnedObject { get; set; } + // } + + public void AddItem( InventoryItem item ) + { + Items.Add( item ); + OnChanged?.Invoke(); + } + + public void RemoveItem( InventoryItem item ) + { + UnEquipItem( item ); + Items.Remove( item ); + OnChanged?.Invoke(); + } + + public void EquipItem( InventoryItem item ) + { + if ( EquippedItems.ContainsValue( item ) ) + { + UnEquipItem( item ); + } + else + { + EquippedItems.Add( item.Definition.Slot, item ); + OnEquipped?.Invoke( item ); + } + } + + public void UnEquipItem( InventoryItem item ) + { + foreach ( var kvp in EquippedItems.Where( kvp => kvp.Value == item ).ToList() ) + { + EquippedItems.Remove( kvp.Key ); + } + + OnUnEquipped?.Invoke( item ); + } +} diff --git a/Code/Inventory/InventoryItem.cs b/Code/Inventory/InventoryItem.cs new file mode 100644 index 0000000..e1d1a44 --- /dev/null +++ b/Code/Inventory/InventoryItem.cs @@ -0,0 +1,15 @@ +using Sandbox; + +namespace Sasalka; + +public class InventoryItem : Component +{ + public InventoryItemDefinition Definition { get; set; } + + public int Count { get; set; } = 1; + public int MaxCount { get; set; } = 1; + + // public GameObject SpawnedObject { get; set; } +} +// public int Count { get; set; } = 1; +// public int MaxCount { get; set; } = 1; diff --git a/Code/Inventory/InventoryItemCountable.cs b/Code/Inventory/InventoryItemCountable.cs new file mode 100644 index 0000000..f8bad3a --- /dev/null +++ b/Code/Inventory/InventoryItemCountable.cs @@ -0,0 +1,9 @@ +using Sandbox; + +namespace Sasalka; + +public class InventoryItemCountable : InventoryItem +{ + // public int Count { get; set; } = 1; + // public int MaxCount { get; set; } = 1; +} diff --git a/Code/Inventory/InventoryItemDefinition.cs b/Code/Inventory/InventoryItemDefinition.cs new file mode 100644 index 0000000..1892581 --- /dev/null +++ b/Code/Inventory/InventoryItemDefinition.cs @@ -0,0 +1,30 @@ +using Sandbox.Citizen; + +namespace Sasalka; + +[GameResource( "Inventory Item Definition", "inv", "", Category = "Sasalka", Icon = "inventory_2" )] +public class InventoryItemDefinition : GameResource +{ + public Inventar.InventorySlot Slot { get; set; } + + public CitizenAnimationHelper.HoldTypes HoldType { get; set; } = CitizenAnimationHelper.HoldTypes.None; + + public Texture ImageTexture { get; set; } + + public string ImageUrl { get; set; } + public string ClothUrl { get; set; } + + public string Name { get; set; } + + public string Description { get; set; } + [ResourceType( "prefab" )] public GameObject Prefab { get; set; } + + [InlineEditor, Space] public WeaponDefinition WeaponDefinition { get; set; } +} + +public struct WeaponDefinition +{ + // public CitizenAnimationHelper.Hand Hand { get; set; } + public Vector3 Position { get; set; } + public Rotation Rotation { get; set; } +} diff --git a/Code/Inventory/Ui/Inventory.razor b/Code/Inventory/Ui/Inventory.razor new file mode 100644 index 0000000..1c4fe44 --- /dev/null +++ b/Code/Inventory/Ui/Inventory.razor @@ -0,0 +1,43 @@ +@using Sasalka +@inherits PanelComponent +@namespace Sasalka.Ui + + +
+ @foreach ( var item in PlayerInventory.Items ) + { + + } +
+
+ +@code { + Dedugan Player => Dedugan.Local; + Inventar PlayerInventory => Player?.Inventory; + + + void UseItem( Sasalka.InventoryItem item ) + { + Player?.Inventory?.EquipItem( item ); + } + + protected override void OnUpdate() + { + if ( Input.Pressed( "Score" ) ) + { + Inventar.IsInventoryOpen = !Inventar.IsInventoryOpen; + } + } + + protected override int BuildHash() + { + if ( !Inventar.IsInventoryOpen || PlayerInventory == null ) + return -1; + + var hash = new HashCode(); + hash.Add( Inventar.IsInventoryOpen ); + + return hash.ToHashCode(); + } + +} diff --git a/Code/Inventory/Ui/Inventory.razor.scss b/Code/Inventory/Ui/Inventory.razor.scss new file mode 100644 index 0000000..4c8b7cd --- /dev/null +++ b/Code/Inventory/Ui/Inventory.razor.scss @@ -0,0 +1,34 @@ +Inventory { + background: linear-gradient(135deg, #0a1a2b 0%, #08111f 100%); + border: 3px solid #2a3d54; + border-radius: 14px; + font-family: 'Orbitron', 'Poppins', sans-serif; + position: absolute; + width: 30%; + height: 96vh; + right: 20px; + top: 20px; + padding: 24px; + display: flex; + flex-direction: column; + gap: 20px; + transition: all 0.2s ease; + z-index: 100; + overflow: hidden; + + pointer-events: all; + + &.hidden { + opacity: 0; + } +} + +.inventory-panel { + display: flex; + flex-direction: column; + gap: 12px; +} + +.hidden { + opacity: 0; +} \ No newline at end of file diff --git a/Code/Inventory/Ui/InventoryItem.razor b/Code/Inventory/Ui/InventoryItem.razor new file mode 100644 index 0000000..5ef6c41 --- /dev/null +++ b/Code/Inventory/Ui/InventoryItem.razor @@ -0,0 +1,38 @@ +@using Sandbox.UI +@using Sasalka +@inherits Sandbox.UI.Panel +@namespace Sasalka.Ui + + + + @if ( Item.Definition.ImageTexture.IsValid() ) + { + @Item.Definition.Name + } + else if ( Item.Definition.ImageUrl.Length > 0 ) + { + @Item.Definition.Name + } + +
@Item?.Definition.Name
+ +
@Item?.Count / @Item?.MaxCount
+
+ +@code { + public Sasalka.InventoryItem Item { get; set; } + public Action OnItemClick { get; set; } + public bool Equipped { get; set; } + + protected override int BuildHash() + { + base.BuildHash(); + + var hash = new HashCode(); + + hash.Add( Item.Count ); + + return hash.ToHashCode(); + } + +} diff --git a/Code/Inventory/Ui/InventoryItem.razor.scss b/Code/Inventory/Ui/InventoryItem.razor.scss new file mode 100644 index 0000000..b2622eb --- /dev/null +++ b/Code/Inventory/Ui/InventoryItem.razor.scss @@ -0,0 +1,41 @@ +InventoryItem { + width: 100%; + //height: 64px; + background: #2a3d53; + display: flex; + gap: 24px; + align-items: center; + justify-content: flex-start; + border: 1px solid #666; + cursor: pointer; + transition: background 0.2s; + border-radius: 12px; + padding: 12px 24px; + position: relative; + + &:hover { + background: #444; + } + + img { + width: 32px; + height: 32px; + } + + &.name { + font-size: 20px; + } + + &.equipped { + border: 2px solid #4caf50; + background: #2e3e2e; + } + + .equipped-checkbox { + position: absolute; + top: 6px; + left: 6px; + pointer-events: none; + accent-color: #4caf50; + } +} diff --git a/Code/Inventory/Usable/AmmoUseableBase.cs b/Code/Inventory/Usable/AmmoUseableBase.cs new file mode 100644 index 0000000..940b9b0 --- /dev/null +++ b/Code/Inventory/Usable/AmmoUseableBase.cs @@ -0,0 +1,39 @@ +namespace Sasalka; + +public abstract class AmmoUseableBase : UseableBase +{ + protected InventoryItem AmmoItem => FindAmmoItem(); + + private InventoryItem FindAmmoItem() + { + // var ammoDefinition = new InventoryItemDefinition(); + + return Dedugan.Local.Inventory.Items.FirstOrDefault( i => i.Definition.Name == "Pistol Ammo" ); + } + + public override bool CanUse() + { + var ammo = AmmoItem; + return base.CanUse() && ammo != null && ammo.Count > 0; + } + + public override void Use() + { + if ( !CanUse() ) + return; + + OnUse(); + + var ammo = AmmoItem; + if ( ammo != null ) + { + ammo.Count--; + Log.Info( $"[AmmoUseableBase] Ammo left: {ammo.Count}" ); + + if ( ammo.Count <= 0 ) + { + Dedugan.Local.Inventory.RemoveItem( ammo ); + } + } + } +} diff --git a/Code/Inventory/Usable/IUseContext.cs b/Code/Inventory/Usable/IUseContext.cs new file mode 100644 index 0000000..9c743d6 --- /dev/null +++ b/Code/Inventory/Usable/IUseContext.cs @@ -0,0 +1,6 @@ +namespace Sasalka; + +public interface IUseContext +{ + public IEnumerable GetUsables(); +} diff --git a/Code/Inventory/Usable/IUseable.cs b/Code/Inventory/Usable/IUseable.cs new file mode 100644 index 0000000..14c92b1 --- /dev/null +++ b/Code/Inventory/Usable/IUseable.cs @@ -0,0 +1,8 @@ +namespace Sasalka; + +public interface IUseable +{ + public void Use(); + bool CanUse(); + float Cooldown { get; } +} diff --git a/Code/Inventory/Usable/UseSystem.cs b/Code/Inventory/Usable/UseSystem.cs new file mode 100644 index 0000000..61d4b4d --- /dev/null +++ b/Code/Inventory/Usable/UseSystem.cs @@ -0,0 +1,15 @@ +namespace Sasalka; + +public static class UseSystem +{ + public static void TryUse( IUseContext context ) + { + foreach ( var useable in context.GetUsables() ) + { + if ( useable.CanUse() ) + { + useable.Use(); + } + } + } +} diff --git a/Code/Inventory/Usable/UseableBase.cs b/Code/Inventory/Usable/UseableBase.cs new file mode 100644 index 0000000..78bd32a --- /dev/null +++ b/Code/Inventory/Usable/UseableBase.cs @@ -0,0 +1,31 @@ +using Sandbox; + +namespace Sasalka; + +public abstract class UseableBase : Component, IUseable +{ + [Property] public float Cooldown { get; set; } = 0.5f; + + private TimeSince _timeSinceUsed; + + protected override void OnStart() + { + _timeSinceUsed = Cooldown; + } + + public virtual bool CanUse() + { + return _timeSinceUsed >= Cooldown && !Inventar.IsInventoryOpen; + } + + public virtual void Use() + { + if ( !CanUse() ) + return; + + OnUse(); + _timeSinceUsed = 0; + } + + protected abstract void OnUse(); +} diff --git a/Code/NetworkManager.cs b/Code/NetworkManager.cs index d3b92e0..672646c 100644 --- a/Code/NetworkManager.cs +++ b/Code/NetworkManager.cs @@ -73,6 +73,7 @@ public sealed class NetworkManager : Component, Component.INetworkListener /// public void OnDisconnected( Connection channel ) { + Dedugan.InternalPlayers.Remove( Dedugan.GetByID( channel.Id ) ); } /// diff --git a/Code/Player/Dedugan.Camera.cs b/Code/Player/Dedugan.Camera.cs index 4a5b621..c715c74 100644 --- a/Code/Player/Dedugan.Camera.cs +++ b/Code/Player/Dedugan.Camera.cs @@ -39,7 +39,7 @@ public sealed partial class Dedugan Camera.LocalRotation.Backward * MathF.Min( 0f, EyeAngles.pitch ) * 0.8f + Camera.LocalRotation.Right * -anotherPivot; - if ( AnimationHelper.HoldType == CitizenAnimationHelper.HoldTypes.Pistol ) + if ( InAds ) { pivotOffset = CameraPivot.LocalRotation.Backward * CamOffsetX * 0.5f + CameraPivot.LocalRotation.Up * 8f; } diff --git a/Code/Player/Dedugan.Inventory.cs b/Code/Player/Dedugan.Inventory.cs new file mode 100644 index 0000000..11ff47b --- /dev/null +++ b/Code/Player/Dedugan.Inventory.cs @@ -0,0 +1,206 @@ +using Sandbox.Citizen; +using Sandbox.Weapons; +using Sasalka; + +public sealed partial class Dedugan : Component +{ + [Property, InlineEditor] public Inventar Inventory { get; private set; } = new(); + + private Dictionary _useableCache = new(); + [Sync] private bool InAds { get; set; } = false; + private AttachmentSlotResolver _resolver; + + void InventoryStart() + { + if ( !Network.IsOwner ) return; + + _resolver = new AttachmentSlotResolver( Renderer.GetAttachmentObject ); + + Inventory.AddItem( new InventoryItem + { + Definition = ResourceLibrary.Get( "Items/Pijama.inv" ) + } ); + + Inventory.AddItem( new InventoryItem + { + Definition = ResourceLibrary.Get( "Items/pistol.inv" ) + } ); + + var ammo = new InventoryItem + { + Definition = ResourceLibrary.Get( "Items/pistol_ammo.inv" ) + }; + ammo.Count = 30; + ammo.MaxCount = 130; + + Inventory.AddItem( ammo ); + + Inventory.OnEquipped += OnItemEquipped; + Inventory.OnUnEquipped += OnItemUnEquipped; + } + + private void OnItemEquipped( InventoryItem item ) + { + var go = item.Definition.Prefab.Clone(); + + AnimationHelper.HoldType = item.Definition.HoldType; + + // switch ( item.Definition.Slot ) + // { + // case Inventar.InventorySlot.LeftHand | Inventar.InventorySlot.RightHand: + // go.Parent = Renderer.GetAttachmentObject( "hold_R" ); + // AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Both; + // break; + // case Inventar.InventorySlot.RightHand: + // go.Parent = Renderer.GetAttachmentObject( "hold_R" ); + // AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Right; + // break; + // case Inventar.InventorySlot.LeftHand: + // go.Parent = Renderer.GetAttachmentObject( "hold_L" ); + // AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Left; + // break; + // default: + // go.Parent = Renderer.GetAttachmentObject( "forward_reference_modelspace" ); + // break; + // } + switch ( item.Definition.Slot ) + { + case Inventar.InventorySlot.LeftHand | Inventar.InventorySlot.RightHand: + go.Parent = Renderer.GetAttachmentObject( "hold_R" ); + break; + case Inventar.InventorySlot.RightHand: + go.Parent = Renderer.GetAttachmentObject( "hold_R" ); + break; + case Inventar.InventorySlot.LeftHand: + go.Parent = Renderer.GetAttachmentObject( "hold_L" ); + break; + default: + go.Parent = Renderer.GetAttachmentObject( "forward_reference_modelspace" ); + break; + } + + go.LocalPosition = item.Definition.WeaponDefinition.Position; + go.LocalRotation = item.Definition.WeaponDefinition.Rotation; + + go.NetworkSpawn(); + + var hand = item.Definition.Slot switch + { + Inventar.InventorySlot.LeftHand => CitizenAnimationHelper.Hand.Left, + Inventar.InventorySlot.RightHand => CitizenAnimationHelper.Hand.Right, + Inventar.InventorySlot.LeftHand | Inventar.InventorySlot.RightHand => CitizenAnimationHelper.Hand.Both, + _ => CitizenAnimationHelper.Hand.Both + }; + + AnimationHelper.HoldType = item.Definition.HoldType; + AnimationHelper.Handedness = hand; + + RpcSetHoldAnimation( item.Definition.HoldType, hand ); + + InAds = true; + // item.SpawnedObject = go; + } + + private void OnItemUnEquipped( InventoryItem item ) + { + switch ( item.Definition.Slot ) + { + case Inventar.InventorySlot.LeftHand | Inventar.InventorySlot.RightHand: + case Inventar.InventorySlot.RightHand: + case Inventar.InventorySlot.LeftHand: + var attachmentName = !item.Definition.Slot.HasFlag( Inventar.InventorySlot.RightHand ) + ? "hold_L" + : "hold_R"; + + Renderer.GetAttachmentObject( attachmentName ).Children.ForEach( child => child.Destroy() ); + // AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Both; + // AnimationHelper.HoldType = CitizenAnimationHelper.HoldTypes.None; + + RpcSetHoldAnimation( CitizenAnimationHelper.HoldTypes.None, CitizenAnimationHelper.Hand.Both ); + break; + default: + Renderer.GetAttachmentObject( "forward_reference_modelspace" ).Children + .ForEach( child => child.Destroy() ); + break; + } + + // item.SpawnedObject = null; + item.Destroy(); + + InAds = false; + } + + [Rpc.Broadcast] + public void RpcSetHoldAnimation( CitizenAnimationHelper.HoldTypes HoldType, CitizenAnimationHelper.Hand hand ) + { + AnimationHelper.HoldType = HoldType; + AnimationHelper.Handedness = hand; + } + + + // AnimationHelper.HoldType = CitizenAnimationHelper.HoldTypes.None; + // AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Both; + + + void InventoryUpdate() + { + if ( !Network.IsOwner ) return; + + // InAds = Input.Down( "Attack2" ); + + if ( Input.Pressed( "Attack1" ) ) + { + UseSystem.TryUse( this ); + Attack(); + } + } + + public IEnumerable + GetUsables() //Допустим, у джетпака слот Body. Просто дописываешь в GetUsables() Inventar.InventorySlot.Body: + { + foreach ( var slot in new[] { Inventar.InventorySlot.LeftHand, Inventar.InventorySlot.RightHand } ) + { + if ( !Inventory.EquippedItems.TryGetValue( slot, out var item ) ) + continue; + + var holder = _resolver.GetSlotObject( slot ); + var heldObject = holder?.Children.FirstOrDefault(); + + if ( heldObject == null ) + continue; + + if ( _useableCache.TryGetValue( slot, out var cached ) && cached.obj == heldObject ) + { + if ( cached.useable != null ) + yield return cached.useable; + } + else + { + var useable = heldObject.Components.Get(); + _useableCache[slot] = (heldObject, useable); + + if ( useable != null ) + yield return useable; + } + } + } + + [Rpc.Broadcast] + void Attack() + { + Renderer.Set( "b_attack", true ); + } +} + + +// if ( !Network.IsOwner ) return; +// +// InAds = Input.Down( "Attack2" ); +// +// if ( Input.Pressed( "Attack1" ) && _weapon != null ) +// { +// _weapon.Attack(); +// Attack(); +// } +// } +// diff --git a/Code/Player/Dedugan.Player.cs b/Code/Player/Dedugan.Player.cs index b59ff1f..03f8c5b 100644 --- a/Code/Player/Dedugan.Player.cs +++ b/Code/Player/Dedugan.Player.cs @@ -1,12 +1,17 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Sandbox; + partial class Dedugan { + [Property] public List WorkshopItems { get; set; } + [Property] public ClothingContainer CurrentClothing { get; set; } public static IReadOnlyList All => InternalPlayers; public static List InternalPlayers = new List(); - + public List Clothings { get; set; } public static Dedugan Local { get; set; } private Guid _guid; @@ -47,4 +52,87 @@ partial class Dedugan public static Dedugan GetByID( Guid id ) => InternalPlayers.FirstOrDefault( x => x.ConnectionID == id ); + public void OnNetworkSpawn( Connection owner ) + { + CurrentClothing = ClothingContainer.CreateFromJson( owner.GetUserData( "avatar" ) ); + + var allowedCategories = new[] + { + Clothing.ClothingCategory.Skin, Clothing.ClothingCategory.Facial, Clothing.ClothingCategory.Eyes, + Clothing.ClothingCategory.Eyebrows, Clothing.ClothingCategory.Eyelashes, + Clothing.ClothingCategory.MakeupLips, Clothing.ClothingCategory.MakeupEyeshadow, + Clothing.ClothingCategory.MakeupEyeliner, Clothing.ClothingCategory.MakeupHighlighter, + Clothing.ClothingCategory.MakeupBlush, Clothing.ClothingCategory.MakeupSpecial, + Clothing.ClothingCategory.ComplexionFreckles, Clothing.ClothingCategory.ComplexionScars, + Clothing.ClothingCategory.ComplexionAcne, Clothing.ClothingCategory.FacialHairMustache, + Clothing.ClothingCategory.FacialHairBeard, Clothing.ClothingCategory.FacialHairStubble, + Clothing.ClothingCategory.FacialHairSideburns, Clothing.ClothingCategory.FacialHairGoatee, + Clothing.ClothingCategory.PierceNose, Clothing.ClothingCategory.PierceEyebrow, + Clothing.ClothingCategory.PierceSpecial, Clothing.ClothingCategory.Hair, + Clothing.ClothingCategory.HairShort, Clothing.ClothingCategory.HairMedium, + Clothing.ClothingCategory.HairLong, Clothing.ClothingCategory.HairUpdo, + Clothing.ClothingCategory.HairSpecial, + }; + + CurrentClothing.Clothing.RemoveAll( entry => !allowedCategories.Contains( entry.Clothing.Category ) ); + CurrentClothing.Apply( Renderer ); + + WearWorkshop( WorkshopItems ); + } + + CancellationTokenSource _cts; + + public async void WearWorkshop( List workshopItems ) + { + _cts = new CancellationTokenSource(); + var token = _cts.Token; + + // var clothing = new ClothingContainer(); + // clothing.AddRange( Clothings ); + + if ( workshopItems != null && workshopItems.Count > 0 ) + { + var tasks = workshopItems.Select( x => InstallWorkshopClothing( x, token ) ); + + foreach ( var task in tasks ) + { + var c = await task; + + if ( c is null ) + continue; + + CurrentClothing.Add( c ); + } + } + + CurrentClothing.Normalize(); + CurrentClothing.Apply( Renderer ); + Renderer.PostAnimationUpdate(); + + // foreach ( var clothing in CurrentClothing.Clothing ) + // { + // Log.Info( clothing.Clothing.Title ); + // } + } + + + async Task InstallWorkshopClothing( string ident, CancellationToken ct ) + { + if ( string.IsNullOrEmpty( ident ) ) return default; + + var package = await Package.FetchAsync( ident, false ); + if ( package is null ) return default; + if ( package.TypeName != "clothing" ) return default; + if ( ct.IsCancellationRequested ) return default; + + var primaryAsset = package.GetMeta( "PrimaryAsset" ); + if ( string.IsNullOrWhiteSpace( primaryAsset ) ) return default; + + var fs = await package.MountAsync(); + if ( fs is null ) return default; + if ( ct.IsCancellationRequested ) return default; + + // try to load it + return ResourceLibrary.Get( primaryAsset ); + } } diff --git a/Code/Player/Dedugan.Weapons.cs b/Code/Player/Dedugan.Weapons.cs deleted file mode 100644 index 9397709..0000000 --- a/Code/Player/Dedugan.Weapons.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Sandbox.Citizen; -using Sandbox.Weapons; - -public sealed partial class Dedugan -{ - [Property] public GameObject Gun { get; set; } - [Sync] private bool InAds { get; set; } = false; - - private Weapon _weapon { get; set; } - - void WeaponStart() - { - _weapon = Gun.Components.Get(FindMode.EverythingInSelfAndDescendants ); - - Log.Info( $"_weapon: {_weapon}, Network.IsOwner: {Network.IsOwner}" ); - } - - [Rpc.Broadcast] - void Attack() - { - Renderer.Set( "b_attack", true ); - } - - void WeaponUpdate() - { - if ( InAds ) - { - AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Right; - AnimationHelper.HoldType = CitizenAnimationHelper.HoldTypes.Pistol; - - Gun.Enabled = true; - } - else - { - AnimationHelper.Handedness = CitizenAnimationHelper.Hand.Both; - AnimationHelper.HoldType = CitizenAnimationHelper.HoldTypes.None; - - Gun.Enabled = false; - } - - if ( !Network.IsOwner ) return; - - InAds = Input.Down( "Attack2" ); - - if ( Input.Pressed( "Attack1" ) && InAds ) - { - _weapon.Attack(); - Attack(); - } - } -} diff --git a/Code/Player/Dedugan.cs b/Code/Player/Dedugan.cs index 5b1b30b..f3f46a4 100644 --- a/Code/Player/Dedugan.cs +++ b/Code/Player/Dedugan.cs @@ -1,17 +1,17 @@ using System; using Sandbox; using Sandbox.Citizen; +using Sasalka; using ShrimpleCharacterController; -public sealed partial class Dedugan : Component +public sealed partial class Dedugan : Component, IUseContext, Component.INetworkSpawn { [RequireComponent] public ShrimpleCharacterController.ShrimpleCharacterController Controller { get; set; } [RequireComponent] public CitizenAnimationHelper AnimationHelper { get; set; } - // [Property] public SkinnedModelRenderer Anim {get; set;} - - public SkinnedModelRenderer Renderer { get; set; } + [Property] public SkinnedModelRenderer Renderer { get; set; } [Property] public GameObject Camera { get; set; } [Property] public GameObject CameraPivot { get; set; } + [Property] public GameObject InventoryUI { get; set; } [Property] [Range( 1f, 200f, 1f )] public float CamOffsetX { get; set; } [Property] [Range( 50f, 1200f, 10f )] public float WalkSpeed { get; set; } = 100f; @@ -38,21 +38,23 @@ public sealed partial class Dedugan : Component protected override void OnStart() { - WeaponStart(); + InventoryStart(); RagdollController = Components.Get(); - Renderer = Components.Get( FindMode.EverythingInSelfAndDescendants ); + // Renderer = Components.Get( FindMode.EverythingInSelfAndDescendants ); var cameraComponent = Camera.GetComponent(); - var listener = Components.Get(true); + var listener = Components.Get( true ); cameraComponent.Enabled = false; + InventoryUI.Enabled = false; listener.Enabled = false; if ( !Network.IsOwner ) return; - + cameraComponent.Enabled = true; listener.Enabled = true; - + InventoryUI.Enabled = true; + if ( Renderer is null ) return; @@ -62,7 +64,7 @@ public sealed partial class Dedugan : Component protected override void OnUpdate() { UpdateCustomAnimations(); - WeaponUpdate(); + InventoryUpdate(); if ( Network.IsOwner ) { EyeAngles += Input.AnalogLook; diff --git a/Code/Player/PlayerDresser.cs b/Code/Player/PlayerDresser.cs index 0eca20e..783a745 100644 --- a/Code/Player/PlayerDresser.cs +++ b/Code/Player/PlayerDresser.cs @@ -1,25 +1,34 @@ -using System; - namespace Sandbox; public class PlayerDresser : Component, Component.INetworkSpawn { - [Property] - public SkinnedModelRenderer BodyRenderer { get; set; } + [Property] public SkinnedModelRenderer BodyRenderer { get; set; } + + [Property] public ClothingContainer currentClothing { get; set; } - // public void OnNetworkSpawn( Connection owner ) - // { - // Log.Info( $"Hello {owner.Name}" ); - // var clothing = new ClothingContainer(); - // clothing.Deserialize( owner.GetUserData( "avatar" ) ); - // clothing.Apply( BodyRenderer ); - // } - public void OnNetworkSpawn( Connection owner ) { - Log.Info( $"Hello {owner.Name}" ); - var clothing = ClothingContainer.CreateFromJson( owner.GetUserData( "avatar" ) ); - clothing.Height = 1; - clothing.Apply( BodyRenderer ); + currentClothing = ClothingContainer.CreateFromJson( owner.GetUserData( "avatar" ) ); + + var allowedCategories = new[] + { + Clothing.ClothingCategory.Skin, Clothing.ClothingCategory.Facial, Clothing.ClothingCategory.Eyes, + Clothing.ClothingCategory.Eyebrows, Clothing.ClothingCategory.Eyelashes, + Clothing.ClothingCategory.MakeupLips, Clothing.ClothingCategory.MakeupEyeshadow, + Clothing.ClothingCategory.MakeupEyeliner, Clothing.ClothingCategory.MakeupHighlighter, + Clothing.ClothingCategory.MakeupBlush, Clothing.ClothingCategory.MakeupSpecial, + Clothing.ClothingCategory.ComplexionFreckles, Clothing.ClothingCategory.ComplexionScars, + Clothing.ClothingCategory.ComplexionAcne, Clothing.ClothingCategory.FacialHairMustache, + Clothing.ClothingCategory.FacialHairBeard, Clothing.ClothingCategory.FacialHairStubble, + Clothing.ClothingCategory.FacialHairSideburns, Clothing.ClothingCategory.FacialHairGoatee, + Clothing.ClothingCategory.PierceNose, Clothing.ClothingCategory.PierceEyebrow, + Clothing.ClothingCategory.PierceSpecial, Clothing.ClothingCategory.Hair, + Clothing.ClothingCategory.HairShort, Clothing.ClothingCategory.HairMedium, + Clothing.ClothingCategory.HairLong, Clothing.ClothingCategory.HairUpdo, + Clothing.ClothingCategory.HairSpecial, + }; + + currentClothing.Clothing.RemoveAll( entry => !allowedCategories.Contains( entry.Clothing.Category ) ); + currentClothing.Apply( BodyRenderer ); } } diff --git a/Code/UI/Scoreboard.razor b/Code/UI/Scoreboard.razor index b7bce76..b0630ad 100644 --- a/Code/UI/Scoreboard.razor +++ b/Code/UI/Scoreboard.razor @@ -2,94 +2,105 @@ @using Sandbox.UI; @inherits PanelComponent - - @*
*@ - @*
*@ - @*
*@ - @*
*@ - - - -
-
- - - -
- -
- @if (Dedugan.All is not null) - { - foreach (var ded in Dedugan.All) - { -
-
- -
- - - -
- } - } -
-
+ + @*
*@ + @*
*@ + @*
*@ + @*
*@ + + + +
+
+ + + +
+ +
+ @if ( Dedugan.All is not null ) + { + foreach ( var ded in Dedugan.All ) + { +
+
+ +
+ + + +
+ } + } +
+
@code { - public static bool Visible => Input.Down("Score"); - private NetworkManager _networkManager; - - private NetworkManager NetworkManager - { - get - { - if (_networkManager == null || !_networkManager.IsValid) - { - _networkManager = Scene.Directory.FindByName("Network Manager") - .FirstOrDefault()? - .GetComponent(); - } - return _networkManager; - } - } + public static bool Visible = false; + private NetworkManager _networkManager; - protected override void OnEnabled() - { - // Кэшируем NetworkManager при включении компонента - _networkManager = Scene.Directory.FindByName("Network Manager") - .FirstOrDefault()? - .GetComponent(); - } + private NetworkManager NetworkManager + { + get + { + if ( _networkManager == null || !_networkManager.IsValid ) + { + _networkManager = Scene.Directory.FindByName( "Network Manager" ) + .FirstOrDefault()? + .GetComponent(); + } - private string GetPlayerStatus(Connection conn) - { - var playerObj = Dedugan.GetByID( conn.Id ).GameObject; - return playerObj?.IsValid == true ? "In Game" : "Connecting"; - } + return _networkManager; + } + } - private void OpenProfile(Connection connection) - { - Log.Info($"Opening profile: {connection.SteamId}"); - Game.Overlay.ShowPlayer(connection.SteamId); - } - - protected override int BuildHash() - { - if (!Visible || Dedugan.All == null) - return -1; - - var hash = new System.HashCode(); - hash.Add(Visible); - - foreach (var ded in Dedugan.All) - { - hash.Add(ded.Id); - hash.Add(ded.Connection.Ping); - hash.Add(ded.Name); - } - - return hash.ToHashCode(); - } + protected override void OnUpdate() + { + if ( Input.Pressed( "Score" ) ) + { + Visible = !Visible; + } + } + + protected override void OnEnabled() + { + // Кэшируем NetworkManager при включении компонента + _networkManager = Scene.Directory.FindByName( "Network Manager" ) + .FirstOrDefault()? + .GetComponent(); + } + + private string GetPlayerStatus( Connection conn ) + { + var playerObj = Dedugan.GetByID( conn.Id ).GameObject; + return playerObj?.IsValid == true ? "In Game" : "Connecting"; + } + + private void OpenProfile( Connection connection ) + { + Log.Info( $"Opening profile: {connection.SteamId}" ); + Game.Overlay.ShowPlayer( connection.SteamId ); + } + + protected override int BuildHash() + { + base.BuildHash(); + + if ( !Visible || Dedugan.All == null ) + return -1; + + var hash = new System.HashCode(); + hash.Add( Visible ); + + foreach ( var ded in Dedugan.All ) + { + hash.Add( ded.Id ); + hash.Add( ded.Connection.Ping ); + hash.Add( ded.Name ); + } + + return hash.ToHashCode(); + } } diff --git a/Code/UI/Scoreboard.razor.scss b/Code/UI/Scoreboard.razor.scss index 9ad6689..d0ab49f 100644 --- a/Code/UI/Scoreboard.razor.scss +++ b/Code/UI/Scoreboard.razor.scss @@ -1,191 +1,191 @@ Scoreboard { - background: linear-gradient(135deg, #0a1a2b 0%, #08111f 100%); - border: 3px solid #2a3d54; - border-radius: 16px; - //box-shadow: - // 0 0 15px rgba(0, 150, 255, 0.2), - // inset 0 0 10px rgba(0, 100, 200, 0.1); - font-family: 'Orbitron', 'Poppins', sans-serif; + background: linear-gradient(135deg, #0a1a2b 0%, #08111f 100%); + border: 3px solid #2a3d54; + border-radius: 14px; + //box-shadow: + // 0 0 15px rgba(0, 150, 255, 0.2), + // inset 0 0 10px rgba(0, 100, 200, 0.1); + font-family: 'Orbitron', 'Poppins', sans-serif; + position: absolute; + width: 30%; + height: 96vh; + top: 20px; + left: 20px; + padding: 30px; + display: flex; + flex-direction: column; + gap: 20px; + transition: all 0.2s ease; + z-index: 100; + overflow: hidden; + + &.hidden { + opacity: 0; + } + + .decoration { position: absolute; - width: 60%; - height: 70vh; - top: 15vh; - left: 20%; - padding: 30px; + width: 60px; + height: 60px; + border: 2px solid rgba(0, 180, 255, 0.25); + opacity: 0.8; + box-shadow: 0 0 8px rgba(100, 200, 255, 0.1); + + &.top-left { + top: 10px; + left: 10px; + border-right: none; + border-bottom: none; + border-radius: 12px 0 0 0; + } + + &.top-right { + top: 10px; + right: 10px; + border-left: none; + border-bottom: none; + border-radius: 0 12px 0 0; + } + + &.bottom-left { + bottom: 10px; + left: 10px; + border-right: none; + border-top: none; + border-radius: 0 0 0 12px; + } + + &.bottom-right { + bottom: 10px; + right: 10px; + border-left: none; + border-top: none; + border-radius: 0 0 12px 0; + } + } + + .title { + font-size: 24px; + color: #a0e0ff; + text-align: center; + //text-shadow: + // 0 0 10px rgba(100, 200, 255, 0.7), + // 0 0 20px rgba(80, 180, 255, 0.4); + letter-spacing: 4px; + margin-bottom: 15px; + font-weight: 600; + text-transform: uppercase; + } + + .content { display: flex; flex-direction: column; - gap: 20px; - transition: all 0.2s ease; - z-index: 100; + background-color: rgba(10, 25, 40, 0.6); + border-radius: 12px; + border: 1px solid #253a50; overflow: hidden; + flex-grow: 1; + //box-shadow: inset 0 0 20px rgba(0, 30, 60, 0.5); - &.hidden { - opacity: 0; - } + .header { + display: flex; + padding: 15px 20px 15px 85px; + background: linear-gradient(90deg, #0f2a42 0%, #0a1d30 100%); + border-bottom: 2px solid #1e3a5c; + text-shadow: 0 0 5px rgba(100, 200, 255, 0.5); - .decoration { - position: absolute; - width: 60px; - height: 60px; - border: 2px solid rgba(0, 180, 255, 0.25); - opacity: 0.8; - box-shadow: 0 0 8px rgba(100, 200, 255, 0.1); - - &.top-left { - top: 10px; - left: 10px; - border-right: none; - border-bottom: none; - border-radius: 12px 0 0 0; - } - - &.top-right { - top: 10px; - right: 10px; - border-left: none; - border-bottom: none; - border-radius: 0 12px 0 0; - } - - &.bottom-left { - bottom: 10px; - left: 10px; - border-right: none; - border-top: none; - border-radius: 0 0 0 12px; - } - - &.bottom-right { - bottom: 10px; - right: 10px; - border-left: none; - border-top: none; - border-radius: 0 0 12px 0; - } - } - - .title { - font-size: 42px; - color: #a0e0ff; - text-align: center; - //text-shadow: - // 0 0 10px rgba(100, 200, 255, 0.7), - // 0 0 20px rgba(80, 180, 255, 0.4); - letter-spacing: 4px; - margin-bottom: 15px; + .column { + font-size: 18px; + color: #6eb4ff; font-weight: 600; - text-transform: uppercase; + letter-spacing: 1px; + + &.nick { + flex: 1; + text-align: left; + } + + &.status { + flex: 1; + text-align: left; + } + + &.ping { + flex: 1; + text-align: right; + padding-right: 20px; + } + } } - .content { + .player-list { + pointer-events: all; + flex-grow: 1; + height: 100%; + flex-direction: column; + overflow-x: hidden; + overflow-y: scroll; + + .player { + flex-shrink: 0; display: flex; - flex-direction: column; - background-color: rgba(10, 25, 40, 0.6); - border-radius: 12px; - border: 1px solid #253a50; - overflow: hidden; - flex-grow: 1; - //box-shadow: inset 0 0 20px rgba(0, 30, 60, 0.5); + align-items: center; + padding: 16px 0 16px 24px; + transition: all 0.2s ease; + width: 100%; + //background: rgba(15, 30, 50, 0.4); + border-bottom: 1px solid rgba(40, 80, 120, 0.2); + cursor: pointer; - .header { - display: flex; - padding: 15px 20px 15px 85px; - background: linear-gradient(90deg, #0f2a42 0%, #0a1d30 100%); - border-bottom: 2px solid #1e3a5c; - text-shadow: 0 0 5px rgba(100, 200, 255, 0.5); - - .column { - font-size: 18px; - color: #6eb4ff; - font-weight: 600; - letter-spacing: 1px; - - &.nick { - flex: 3; - text-align: left; - } - - &.status { - flex: 1; - text-align: center; - } - - &.ping { - flex: 1; - text-align: right; - padding-right: 20px; - } - } + &:hover { + //background: rgba(25, 60, 90, 0.4); + box-shadow: 0 0 15px rgba(0, 150, 255, 0.1); } - .player-list { - pointer-events: all; - flex-grow: 1; + .avatar { + width: 45px; + height: 45px; + border-radius: 4px; + overflow: hidden; + margin-right: 20px; + border: 2px solid #2a4a6b; + box-shadow: 0 0 8px rgba(100, 180, 255, 0.2); + background: #0c1a2a; + + img { + width: 100%; height: 100%; - flex-direction: column; - overflow-x: hidden; - overflow-y: scroll; - - .player { - flex-shrink: 0; - display: flex; - align-items: center; - padding: 15px 25px; - transition: all 0.2s ease; - width: 100%; - //background: rgba(15, 30, 50, 0.4); - border-bottom: 1px solid rgba(40, 80, 120, 0.2); - cursor: pointer; - - &:hover { - //background: rgba(25, 60, 90, 0.4); - box-shadow: 0 0 15px rgba(0, 150, 255, 0.1); - } - - .avatar { - width: 45px; - height: 45px; - border-radius: 4px; - overflow: hidden; - margin-right: 20px; - border: 2px solid #2a4a6b; - box-shadow: 0 0 8px rgba(100, 180, 255, 0.2); - background: #0c1a2a; - - img { - width: 100%; - height: 100%; - object-fit: cover; - } - } - - .column { - font-size: 17px; - color: #c0e8ff; - text-shadow: 0 0 5px rgba(100, 180, 255, 0.3); - - &.nick { - flex: 3; - text-align: left; - font-weight: 500; - letter-spacing: 0.5px; - } - - &.status { - flex: 1; - text-align: center; - color: #6ecbff; - } - - &.ping { - flex: 1; - text-align: right; - padding-right: 20px; - font-family: 'Courier New', monospace; - color: #88d6ff; - } - } - } + object-fit: cover; + } } + + .column { + font-size: 17px; + color: #c0e8ff; + text-shadow: 0 0 5px rgba(100, 180, 255, 0.3); + + &.nick { + flex: 3; + text-align: left; + font-weight: 500; + letter-spacing: 0.5px; + } + + &.status { + flex: 1; + text-align: center; + color: #6ecbff; + } + + &.ping { + flex: 1; + text-align: right; + padding-right: 20px; + font-family: 'Courier New', monospace; + color: #88d6ff; + } + } + } } + } } \ No newline at end of file diff --git a/Code/Weapons/Weapon.cs b/Code/Weapons/Weapon.cs index bba8112..d607172 100644 --- a/Code/Weapons/Weapon.cs +++ b/Code/Weapons/Weapon.cs @@ -1,23 +1,20 @@ using System.Threading.Tasks; +using Sasalka; namespace Sandbox.Weapons; -public sealed class Weapon : Component +public sealed class Weapon : AmmoUseableBase { [Property] public SkinnedModelRenderer GunRenderer { get; private set; } - [Property] public GameObject BulletOut { get; private set; } [Property] public GameObject MuzzleLight { get; private set; } - [Property] public GameObject particlePrefab { get; set; } [Property] public GameObject bloodParticle { get; set; } - [Property] public DecalDefinition ImpactDecal { get; set; } - [Property] public SoundEvent ImpactSound { get; set; } - private SoundPointComponent _sound; protected override void OnStart() { + base.OnStart(); _sound = GameObject.GetComponent( true ); } @@ -36,32 +33,30 @@ public sealed class Weapon : Component .UseHitboxes() .Run(); - Log.Info( Dedugan.Local.GameObject ); - - if (tr.Hit && tr.Hitbox != null) + if ( tr.Hit && tr.Hitbox != null ) { var components = tr.GameObject.Components; var boneIndex = tr.Hitbox.Bone.Index; - + // Log.Info($"{tr.GameObject.Name} attacked"); var dedugan = components.Get(); var enemy = components.Get(); - if (dedugan.IsValid() || enemy.IsValid()) + if ( dedugan.IsValid() || enemy.IsValid() ) { - CreateHitEffects(tr.EndPosition, tr.Normal, true); + CreateHitEffects( tr.EndPosition, tr.Normal, true ); } - if (dedugan.IsValid()) + if ( dedugan.IsValid() ) { - dedugan.ReportHit(dir, boneIndex); + dedugan.ReportHit( dir, boneIndex ); } - - if (enemy.IsValid()) + + if ( enemy.IsValid() ) { - enemy.ReportHit(dir, boneIndex); - Log.Info(boneIndex); + enemy.ReportHit( dir, boneIndex ); + Log.Info( boneIndex ); } } else if ( tr.Hitbox == null ) @@ -100,4 +95,9 @@ public sealed class Weapon : Component await GameTask.DelaySeconds( 0.05f ); MuzzleLight.Enabled = false; } + + protected override void OnUse() + { + Attack(); + } } diff --git a/ProjectSettings/Input.config b/ProjectSettings/Input.config index 1ee538c..7ae14c1 100644 --- a/ProjectSettings/Input.config +++ b/ProjectSettings/Input.config @@ -230,6 +230,13 @@ "Title": null, "KeyboardCode": "T", "GamepadCode": "None" + }, + { + "Name": "Inventory", + "GroupName": "Other", + "Title": null, + "KeyboardCode": "I", + "GamepadCode": "None" } ], "__guid": "9e933411-852b-4ab7-86fd-7b0253220965", diff --git a/sasalka.sln.DotSettings.user b/sasalka.sln.DotSettings.user index fe21ef3..cc5e309 100644 --- a/sasalka.sln.DotSettings.user +++ b/sasalka.sln.DotSettings.user @@ -6,18 +6,25 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded ForceIncluded ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded @@ -36,6 +43,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded @@ -45,6 +53,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded \ No newline at end of file