From 86c4908f4316ce1b6a1a78244100edd55e21aeca Mon Sep 17 00:00:00 2001 From: Oscar Date: Wed, 30 Oct 2024 19:48:58 +0300 Subject: [PATCH] upd --- Assets/prefabs/player.prefab | 336 ++++++++++++++++---------------- Code/Inventory.cs | 25 ++- Code/Kal.cs | 36 ++-- Code/swb_base/Weapon.cs | 31 +-- Code/swb_base/WeaponRegistry.cs | 12 +- Code/swb_shared/IInventory.cs | 1 + 6 files changed, 236 insertions(+), 205 deletions(-) diff --git a/Assets/prefabs/player.prefab b/Assets/prefabs/player.prefab index 07a6355..aa3fde0 100644 --- a/Assets/prefabs/player.prefab +++ b/Assets/prefabs/player.prefab @@ -164,112 +164,112 @@ "__guid": "55f02b37-0d7a-485b-9ff9-577329327b72", "Flags": 4, "Name": "pelvis", - "Position": "0.9498934,0.2170715,30.67575", - "Rotation": "-0.4681589,-0.514821,-0.5301685,0.4844668", + "Position": "0.9601229,0.2006859,30.68394", + "Rotation": "-0.4679865,-0.5143605,-0.5303345,0.4849406", "Enabled": true, "Children": [ { "__guid": "e6791e79-6d2f-4889-938a-469e36e7a394", "Flags": 4, "Name": "spine_0", - "Position": "3.921829,-0.002458572,-0.0001277924", - "Rotation": "-0.0005621016,0.00272873,-0.03208181,-0.9994812", + "Position": "3.921837,-0.002458572,-0.000125885", + "Rotation": "-0.0006037354,0.003223747,-0.03211008,-0.9994788", "Enabled": true, "Children": [ { "__guid": "62632f4c-5251-47ee-99e9-5eca787ebd13", "Flags": 4, "Name": "spine_1", - "Position": "5.610458,0,0.00002670288", - "Rotation": "-0.0002571642,0.004780471,-0.0541603,-0.9985197", + "Position": "5.610455,0.000001907349,0.00002288818", + "Rotation": "-0.000330925,0.005484343,-0.05428788,-0.9985093", "Enabled": true, "Children": [ { "__guid": "9efd1d11-91e3-43b0-8203-122dddd4da0c", "Flags": 4, "Name": "spine_2", - "Position": "5.610504,0.00001335144,-0.00001144409", - "Rotation": "-0.0003281981,0.001365393,-0.01217191,-0.9999217", + "Position": "5.610485,0.00001907349,0", + "Rotation": "-0.0003576577,0.001462981,-0.01217195,-0.9999219", "Enabled": true, "Children": [ { "__guid": "7b3a4b1c-3851-444c-9b10-c59019d02a34", "Flags": 4, "Name": "neck_0", - "Position": "5.820351,-0.09348869,-0.003257751", - "Rotation": "0.00004458427,-0.0002156198,0.006331474,-0.9999733", + "Position": "5.820316,-0.09348869,-0.003223419", + "Rotation": "0.00004456937,-0.0002155602,0.006430596,-0.9999731", "Enabled": true, "Children": [ { "__guid": "a660f880-88bb-4972-bb01-5a6a2e2d2a84", "Flags": 4, "Name": "head", - "Position": "4.511509,-0.0007648468,-0.0007514954", - "Rotation": "-0.0000004172325,0,0.01174361,-0.9999189", + "Position": "4.511467,-0.0007686615,-0.0007019043", + "Rotation": "-0.0000003427267,-0.00000001490116,0.01276127,-0.9999071", "Enabled": true, "Children": [ { "__guid": "ae84828d-d4dc-461b-bbf5-55906713444d", "Flags": 4, "Name": "ear_R", - "Position": "5.622513,-0.4153175,-5.930378", - "Rotation": "0.04622601,-0.6934857,0.1379035,-0.7056092", + "Position": "5.622528,-0.4153099,-5.930397", + "Rotation": "0.04622599,-0.6934856,0.1379035,-0.7056092", "Enabled": true }, { "__guid": "9f92ced9-922e-41be-ad20-28a016d36589", "Flags": 4, "Name": "ear_L", - "Position": "5.622925,-0.415432,5.927505", - "Rotation": "0.7056087,-0.1379606,0.6934718,-0.04625592", + "Position": "5.622856,-0.4154301,5.927582", + "Rotation": "0.7056093,-0.1379609,0.6934724,-0.04625598", "Enabled": true }, { "__guid": "46ddc438-4d04-414e-8c83-da033150c6c5", "Flags": 4, "Name": "face_lid_lower_R", - "Position": "6.91008,5.140553,-3.235741", - "Rotation": "-0.1292286,0.981794,-0.1379475,-0.01812777", + "Position": "6.909866,5.140568,-3.235508", + "Rotation": "-0.1292285,0.9817938,-0.1379477,-0.01812655", "Enabled": true }, { "__guid": "34031d1b-74e3-4053-b701-3e66ec71138b", "Flags": 4, "Name": "face_lid_lower_L", - "Position": "6.910255,5.140377,3.233379", - "Rotation": "-0.1292285,0.9817878,0.1379906,0.01812781", + "Position": "6.91,5.140396,3.233624", + "Rotation": "-0.1292284,0.9817876,0.1379908,0.01812653", "Enabled": true }, { "__guid": "58f01ec1-49fe-4a7b-82ba-5eed960160b6", "Flags": 4, "Name": "face_lid_upper_L", - "Position": "6.91029,5.140385,3.233345", - "Rotation": "0.9817877,0.1292284,0.01812828,-0.1379905", + "Position": "6.909996,5.140396,3.233624", + "Rotation": "0.9817876,0.1292284,0.01812822,-0.1379905", "Enabled": true }, { "__guid": "0bf32bb9-e057-419e-a942-c23ea0582433", "Flags": 4, "Name": "face_lid_upper_R", - "Position": "6.91008,5.140553,-3.235741", - "Rotation": "0.9817939,0.1292285,-0.01812819,0.1379474", + "Position": "6.909874,5.140568,-3.235504", + "Rotation": "0.9817938,0.1292285,-0.01812828,0.1379474", "Enabled": true }, { "__guid": "18358843-3c89-48fd-8be0-5fa0b7955c1f", "Flags": 4, "Name": "eye_L", - "Position": "6.911369,5.140463,3.232056", - "Rotation": "0.7070774,0.7070562,-0.0000001192093,-0.0000006472692", + "Position": "6.91124,5.140471,3.232185", + "Rotation": "0.716259,0.6977432,-0.003143728,0.003081775", "Enabled": true }, { "__guid": "0ca9dfc6-8ca1-41f9-9d24-f753227f780d", "Flags": 4, "Name": "eye_R", - "Position": "6.911068,5.140486,-3.236935", - "Rotation": "0.7070774,0.7070563,-0.0000002086163,-0.0000009257346", + "Position": "6.910957,5.14048,-3.236824", + "Rotation": "0.7162591,0.6977434,-0.003143787,0.003081516", "Enabled": true } ] @@ -280,88 +280,88 @@ "__guid": "dd94729b-774e-416d-b6c9-d70e663a7549", "Flags": 4, "Name": "clavicle_L", - "Position": "4.038406,0.2751923,1.10368", - "Rotation": "-0.08322743,0.6583217,0.08369048,-0.7434165", + "Position": "4.038364,0.2752037,1.103714", + "Rotation": "-0.08357042,0.655539,0.08340743,-0.7458655", "Enabled": true, "Children": [ { "__guid": "d26a150a-98eb-418d-966c-53a3e640bfa9", "Flags": 4, "Name": "arm_upper_L", - "Position": "6.218311,0.00004720688,-0.001358032", - "Rotation": "-0.06634165,0.6711065,-0.01204745,-0.7382727", + "Position": "6.218317,0.00004386902,-0.00125885", + "Rotation": "-0.06563161,0.6737999,-0.01387687,-0.7358479", "Enabled": true, "Children": [ { "__guid": "7e697fb9-910c-4642-ac8d-4607ac28caed", "Flags": 4, "Name": "arm_upper_L_twist1", - "Position": "5.020214,-0.0004844666,-0.003196716", - "Rotation": "0.008961678,0.00000001490116,-0.00000001490116,-0.9999482", + "Position": "5.020382,-0.0004463196,-0.002986908", + "Rotation": "0.008895427,0,-0.00000002980232,-0.9999496", "Enabled": true }, { "__guid": "6efdeca4-2f83-42fe-8f96-b2712ec06baf", "Flags": 4, "Name": "arm_lower_L", - "Position": "10.04381,-0.0001144409,-0.001579285", - "Rotation": "0.0000003874302,-0.00000005960464,-0.1214664,-0.9925776", + "Position": "10.0439,-0.0001068115,-0.001476288", + "Rotation": "0.0000002384186,-0.00000005960464,-0.1234711,-0.9923311", "Enabled": true, "Children": [ { "__guid": "ba1a0dca-a8c0-4181-ab02-44b9e7fb259b", "Flags": 4, "Name": "arm_lower_L_twist0", - "Position": "-0.001251221,-0.0002689362,-0.002170563", - "Rotation": "-0.0000001043081,-0.0000003278255,0.00000004470348,-0.9999753", + "Position": "-0.001277924,-0.0002613068,-0.002212524", + "Rotation": "-0.0000001341105,-0.0000002980232,0,-0.9999747", "Enabled": true }, { "__guid": "79070cab-d818-4c61-ad7d-daf4e8177a65", "Flags": 4, "Name": "hand_L", - "Position": "7.705168,-0.000005722046,-0.001974106", - "Rotation": "0.0267171,-0.04907531,0.04178061,-0.9975384", + "Position": "7.705137,0.000009536743,-0.00201416", + "Rotation": "0.02671704,-0.04907532,0.04178059,-0.997538", "Enabled": true, "Children": [ { "__guid": "a1b8756b-e6e3-4cac-a998-748f1c9ff1f5", "Flags": 4, "Name": "hold_L", - "Position": "5.359367,0.6213875,3.391457", - "Rotation": "0.6959142,0.1704009,0.3928553,-0.5764222", + "Position": "5.359381,0.6214085,3.391497", + "Rotation": "0.6959143,0.1704009,0.3928555,-0.5764223", "Enabled": true }, { "__guid": "7fd1f7c4-d1c3-436e-b8d5-a8fe9c55de6d", "Flags": 4, "Name": "hand_R_to_L_ikrule", - "Position": "-6.664104,-3.735872,20.39766", - "Rotation": "-0.1744881,0.308711,-0.002506047,-0.9349738", + "Position": "-6.687654,-3.687215,20.41584", + "Rotation": "-0.1723536,0.3095922,-0.002805486,-0.9350787", "Enabled": true }, { "__guid": "95097fea-f7a1-40cb-acc9-7f56044b1243", "Flags": 4, "Name": "finger_thumb_0_L", - "Position": "1.12656,1.647884,0.8638954", - "Rotation": "-0.5683939,-0.1216718,-0.411675,-0.7018412", + "Position": "1.126522,1.64789,0.8638382", + "Rotation": "-0.5683935,-0.1216716,-0.4116746,-0.7018406", "Enabled": true, "Children": [ { "__guid": "cc2772c4-9801-4b63-b85b-1549777e767a", "Flags": 4, "Name": "finger_thumb_1_L", - "Position": "1.90469,-0.001134872,-0.004007339", - "Rotation": "-0.000000005587935,0.1627174,-0.00000002235174,-0.9866279", + "Position": "1.904743,-0.001089096,-0.003890991", + "Rotation": "0.00000001117587,0.1627175,-0.00000002607703,-0.9866291", "Enabled": true, "Children": [ { "__guid": "ef0b2fb4-a3c3-4ad2-9f39-a7b6983eba24", "Flags": 4, "Name": "finger_thumb_2_L", - "Position": "2.133718,-0.001477242,-0.004419327", - "Rotation": "-0.00000001490116,0.0841634,-0.00000006332994,-0.9963977", + "Position": "2.133778,-0.001428604,-0.004331589", + "Rotation": "-0.00000000372529,0.08416346,-0.00000005587935,-0.9963989", "Enabled": true } ] @@ -372,32 +372,32 @@ "__guid": "07b60cdd-5110-4cee-96dd-5106b51c1fd9", "Flags": 4, "Name": "finger_index_meta_L", - "Position": "2.073862,1.2036,0.3747482", - "Rotation": "-0.06033975,-0.04579456,-0.1048825,-0.9915607", + "Position": "2.073868,1.203621,0.3747864", + "Rotation": "-0.06033978,-0.04579464,-0.1048826,-0.9915609", "Enabled": true, "Children": [ { "__guid": "836eff99-8079-4fc6-a0fa-276e306ae544", "Flags": 4, "Name": "finger_index_0_L", - "Position": "3.066603,-0.0003318787,-0.003740311", - "Rotation": "0.003366575,0.2652252,0.06858283,-0.9616925", + "Position": "3.066648,-0.0003051758,-0.00361824", + "Rotation": "0.00336656,0.2652255,0.06858298,-0.9616936", "Enabled": true, "Children": [ { "__guid": "c0b06cd5-7ca6-4d93-831a-4a6841bca328", "Flags": 4, "Name": "finger_index_1_L", - "Position": "2.280365,-0.0008735657,-0.003376007", - "Rotation": "-0.00000002980232,0.2334994,-0.00000005960464,-0.9723014", + "Position": "2.280432,-0.0008239746,-0.003284454", + "Rotation": "-0.00000004470348,0.2334996,-0.0000001490116,-0.9723028", "Enabled": true, "Children": [ { "__guid": "250e6957-c1d3-4c72-aee1-c337f79511b0", "Flags": 4, "Name": "finger_index_2_L", - "Position": "1.590473,-0.001146317,-0.002437592", - "Rotation": "-0.00000004470348,0.01372541,-0.0000003874302,-0.9998423", + "Position": "1.590528,-0.001089096,-0.002384186", + "Rotation": "-0.0000001341105,0.0137254,-0.0000002980232,-0.999844", "Enabled": true } ] @@ -410,32 +410,32 @@ "__guid": "9186496c-cad2-4b94-b5d0-47f2ee6a92d8", "Flags": 4, "Name": "finger_middle_meta_L", - "Position": "2.099216,-0.1595154,0.2831421", - "Rotation": "-0.008934811,-0.03483181,0.01933673,-0.9991317", + "Position": "2.099222,-0.1594925,0.2831802", + "Rotation": "-0.008934796,-0.03483181,0.01933666,-0.999132", "Enabled": true, "Children": [ { "__guid": "50923b14-9231-4087-8d73-a340a8a61028", "Flags": 4, "Name": "finger_middle_0_L", - "Position": "2.997475,-0.0006752014,-0.003637314", - "Rotation": "-0.0008631647,0.2334588,-0.001295015,-0.9723204", + "Position": "2.997519,-0.0006370544,-0.00352478", + "Rotation": "-0.0008631647,0.2334592,-0.00129506,-0.9723218", "Enabled": true, "Children": [ { "__guid": "731dc303-c26e-4eb5-a263-13238cfd353d", "Flags": 4, "Name": "finger_middle_1_L", - "Position": "2.557945,-0.0009613037,-0.003372192", - "Rotation": "-0.0000001192093,0.2322482,-0.0000002086163,-0.9726026", + "Position": "2.558006,-0.0009098053,-0.003267288", + "Rotation": "-0.0000001192093,0.2322486,-0.0000002980232,-0.9726039", "Enabled": true, "Children": [ { "__guid": "c5954938-4384-4036-8b7e-f9e163f89603", "Flags": 4, "Name": "finger_middle_2_L", - "Position": "1.679678,-0.001264572,-0.00245285", - "Rotation": "-0.00000008940697,0.04821068,-0.0000002682209,-0.9987776", + "Position": "1.679743,-0.001203537,-0.002380371", + "Rotation": "-0.00000005960464,0.04821077,-0.0000003278255,-0.9987796", "Enabled": true } ] @@ -448,32 +448,32 @@ "__guid": "7ae4b8db-9914-4634-9b2d-96c8ee88536e", "Flags": 4, "Name": "finger_ring_meta_L", - "Position": "2.103422,-1.444895,0.2206383", - "Rotation": "0.06374948,0.02917722,0.1306502,-0.9889116", + "Position": "2.103466,-1.444866,0.2207355", + "Rotation": "0.06374957,0.02917726,0.1306503,-0.9889128", "Enabled": true, "Children": [ { "__guid": "6837225a-451f-40f8-8594-b5c63104c45a", "Flags": 4, "Name": "finger_ring_0_L", - "Position": "2.822359,-0.0009937286,-0.00349617", - "Rotation": "-0.004488662,0.1855496,-0.0561959,-0.9809709", + "Position": "2.822409,-0.0009403229,-0.00336647", + "Rotation": "-0.004488602,0.1855498,-0.05619593,-0.9809726", "Enabled": true, "Children": [ { "__guid": "15bb7037-51de-48d4-b0e9-711193db9d36", "Flags": 4, "Name": "finger_ring_1_L", - "Position": "2.194767,-0.001087189,-0.003385544", - "Rotation": "0.00004313886,0.2565899,0.00004309416,-0.966463", + "Position": "2.194847,-0.001022339,-0.003246307", + "Rotation": "0.00004312396,0.2565906,0.00004318357,-0.966466", "Enabled": true, "Children": [ { "__guid": "45867c49-3f20-4c44-87b8-7616f0e28ae8", "Flags": 4, "Name": "finger_ring_2_L", - "Position": "1.532309,-0.001394272,-0.00234127", - "Rotation": "0.0000001788139,-0.05036835,0.0000001788139,0.998665", + "Position": "1.532415,-0.001311302,-0.002231598", + "Rotation": "0.0000001639128,-0.0503686,0.0000002384186,0.9986694", "Enabled": true } ] @@ -488,16 +488,16 @@ "__guid": "ce073101-82d3-4a55-858f-df5608f6f8a1", "Flags": 4, "Name": "arm_lower_L_twist1", - "Position": "3.850601,-0.0003395081,-0.004226685", - "Rotation": "0.01740371,0.00000001490116,0,-0.9998307", + "Position": "3.850746,-0.0002994537,-0.004013062", + "Rotation": "0.01740351,-0.00000002980232,0.00000001490116,-0.9998315", "Enabled": true }, { "__guid": "855af04e-f003-477d-abd8-8e4b9c7b7222", "Flags": 4, "Name": "arm_elbow_helper_L", - "Position": "0.00050354,0.008630753,-0.002735138", - "Rotation": "0.002234429,0.002276609,0.7474117,-0.6643494", + "Position": "0.0005111694,0.008066177,-0.002613068", + "Rotation": "0.002239883,0.002267463,0.7481272,-0.6635435", "Enabled": true } ] @@ -506,8 +506,8 @@ "__guid": "254f75ef-591b-48ab-977b-8f05045341c5", "Flags": 4, "Name": "arm_upper_L_twist0", - "Position": "-0.002223969,-0.0006904602,-0.003311157", - "Rotation": "0.05821951,-0.00000004470348,0.00000002980232,-0.9982922", + "Position": "-0.002067566,-0.0006351471,-0.00308609", + "Rotation": "0.05778895,0.00000001490116,-0.00000004470348,-0.9983179", "Enabled": true } ] @@ -518,40 +518,40 @@ "__guid": "c3c4078b-1077-4888-bc65-2aeda8abd4a1", "Flags": 4, "Name": "clavicle_R", - "Position": "4.037285,0.2748642,-1.108433", - "Rotation": "0.08335777,-0.6586776,0.08373019,-0.743082", + "Position": "4.037251,0.2748699,-1.108402", + "Rotation": "0.08370083,-0.6558961,0.08344656,-0.7455323", "Enabled": true, "Children": [ { "__guid": "15c9abaf-ac95-4941-81a9-cd94d872e53e", "Flags": 4, "Name": "arm_upper_R", - "Position": "6.218296,0.00008368492,-0.000003814697", - "Rotation": "0.06760296,-0.6713889,-0.007281214,-0.7379629", + "Position": "6.218304,0.00007843971,-0.00001525879", + "Rotation": "0.06699729,-0.6743205,-0.008623719,-0.7353269", "Enabled": true, "Children": [ { "__guid": "9c96d6fd-271a-4a7b-a036-6db96dd70497", "Flags": 4, "Name": "arm_lower_R", - "Position": "10.04372,0.0002269745,-0.0008583069", - "Rotation": "0.0000002682209,-0.00000005960464,-0.1214664,-0.9925756", + "Position": "10.04379,0.0002222061,-0.0008239746", + "Rotation": "0.0000002086163,-0.00000005960464,-0.123471,-0.9923289", "Enabled": true, "Children": [ { "__guid": "b6383140-1e6d-4b46-a1b1-5ed35a1fadd5", "Flags": 4, "Name": "arm_lower_R_twist0", - "Position": "-0.001461029,0.0004501343,-0.0009346008", - "Rotation": "-0.0000001043081,0.0000001192093,-0.00000002980232,-0.9999704", + "Position": "-0.001396179,0.0004405975,-0.0008811951", + "Rotation": "-0.00000007450581,0.0000001192093,0,-0.9999719", "Enabled": true, "Children": [ { "__guid": "cfb6423d-393d-449a-bd98-470519e4bd81", "Flags": 4, "Name": "arm_elbow_helper_R", - "Position": "-0.0003585815,0.009586334,-0.001064301", - "Rotation": "0.001489639,0.001306791,0.7473603,-0.6644111", + "Position": "-0.0003700256,0.008993149,-0.001026154", + "Rotation": "0.001491636,0.001302308,0.7480763,-0.6636051", "Enabled": true } ] @@ -560,48 +560,48 @@ "__guid": "a860ea26-f03d-48f9-9039-daf136730a1a", "Flags": 4, "Name": "hand_R", - "Position": "7.704939,0.0006952286,-0.0009613037", - "Rotation": "-0.02671681,0.04907507,0.04178044,-0.9975334", + "Position": "7.705017,0.0006699562,-0.0009098053", + "Rotation": "-0.02671677,0.04907513,0.04178041,-0.9975349", "Enabled": true, "Children": [ { "__guid": "98a9377b-d445-40a7-ae54-25fca52d42c1", "Flags": 4, "Name": "hold_R", - "Position": "5.359365,0.6226668,-3.395111", - "Rotation": "0.5764186,-0.3928533,-0.1704003,-0.6959097", + "Position": "5.359375,0.6226747,-3.395109", + "Rotation": "0.5764189,-0.3928535,-0.1704004,-0.69591", "Enabled": true }, { "__guid": "6de045f3-a8e5-491b-94ab-f61b6b1aa4ed", "Flags": 4, "Name": "hand_L_to_R_ikrule", - "Position": "-6.532598,-3.95226,-20.4858", - "Rotation": "0.1706123,-0.3072287,0.001134008,-0.9361715", + "Position": "-6.5686,-3.906249,-20.50057", + "Rotation": "0.168538,-0.3083053,0.001119822,-0.9361943", "Enabled": true }, { "__guid": "ccb0ff52-c63f-43c2-9907-7318b9c5166f", "Flags": 4, "Name": "finger_thumb_0_R", - "Position": "1.126326,1.648983,-0.867506", - "Rotation": "-0.5683905,-0.1216715,0.4116719,0.7018359", + "Position": "1.126333,1.648996,-0.8675003", + "Rotation": "-0.5683908,-0.1216716,0.4116722,0.7018363", "Enabled": true, "Children": [ { "__guid": "8505adbd-ae44-4f6c-9898-dbeecee80322", "Flags": 4, "Name": "finger_thumb_1_R", - "Position": "1.904339,0.0004377365,-0.0005264282", - "Rotation": "0.00000001117587,0.1627162,-0.00000008940697,0.9866164", + "Position": "1.904392,0.0004277229,-0.000497818", + "Rotation": "0.00000001303852,0.1627164,-0.00000008940697,0.9866176", "Enabled": true, "Children": [ { "__guid": "48a98f90-49f0-44a5-b01f-1bddad0d1132", "Flags": 4, "Name": "finger_thumb_2_R", - "Position": "2.133007,0.0006222725,-0.001390457", - "Rotation": "0.00000001117587,0.08416254,-0.00000008009374,0.9963803", + "Position": "2.13308,0.0006089211,-0.001338959", + "Rotation": "0.000000007450581,0.08416264,-0.00000007078052,0.9963819", "Enabled": true } ] @@ -612,32 +612,32 @@ "__guid": "8e12d685-e2e7-409f-8d07-7162f53e18d6", "Flags": 4, "Name": "finger_index_meta_R", - "Position": "2.073565,1.204744,-0.3784142", - "Rotation": "0.06033975,0.04579416,-0.1048823,-0.9915534", + "Position": "2.073637,1.204731,-0.3783741", + "Rotation": "0.06033982,0.04579422,-0.1048824,-0.9915552", "Enabled": true, "Children": [ { "__guid": "8bfd5924-6872-43f9-a225-7002c3c60d6f", "Flags": 4, "Name": "finger_index_0_R", - "Position": "3.066177,0.001466513,-0.0006980896", - "Rotation": "-0.00336647,-0.2651788,0.06858253,-0.9616928", + "Position": "3.066259,0.001426458,-0.0006713867", + "Rotation": "-0.00336653,-0.2651793,0.06858268,-0.9616948", "Enabled": true, "Children": [ { "__guid": "5be460fd-9370-4863-b5de-82ff3070ae60", "Flags": 4, "Name": "finger_index_1_R", - "Position": "2.27968,0.001564503,-0.002193451", - "Rotation": "0.00000002980232,-0.2334953,0.0000003129244,-0.972284", + "Position": "2.279652,0.001600742,-0.002197266", + "Rotation": "-0.00000005960464,-0.2334953,0.0000002533197,-0.972284", "Enabled": true, "Children": [ { "__guid": "215cd42e-5881-4300-8d82-74b3e573bcbb", "Flags": 4, "Name": "finger_index_2_R", - "Position": "1.589418,0.001976013,-0.004562378", - "Rotation": "-0.0000001639128,-0.01372503,0.0000003576279,-0.9998149", + "Position": "1.589426,0.001995087,-0.004524231", + "Rotation": "-0.00000008940697,-0.013725,0.0000003501773,-0.9998148", "Enabled": true } ] @@ -650,32 +650,32 @@ "__guid": "590202fa-d1f2-4d0a-9c4e-63cad36df0ec", "Flags": 4, "Name": "finger_middle_meta_R", - "Position": "2.098953,-0.1583447,-0.2866611", - "Rotation": "0.008934066,0.03483152,0.01933625,-0.9991243", + "Position": "2.099026,-0.1583614,-0.2866211", + "Rotation": "0.008934155,0.03483155,0.01933616,-0.9991261", "Enabled": true, "Children": [ { "__guid": "5b7b506d-b804-48e3-8390-a37e4aee254d", "Flags": 4, "Name": "finger_middle_0_R", - "Position": "2.997021,0.0009996891,-0.0007915497", - "Rotation": "0.0008631945,-0.2334558,-0.001294464,-0.9723083", + "Position": "2.997103,0.000982523,-0.0007553101", + "Rotation": "0.0008632243,-0.2334563,-0.001294464,-0.9723103", "Enabled": true, "Children": [ { "__guid": "3a2205b5-6ea2-414c-a342-5e11746a7f92", "Flags": 4, "Name": "finger_middle_1_R", - "Position": "2.557173,0.001381397,-0.002202988", - "Rotation": "-0.00000002980232,-0.2322431,0.0000002682209,-0.9725822", + "Position": "2.55722,0.001386642,-0.002159119", + "Rotation": "-0.00000005960464,-0.2322435,0.0000002384186,-0.9725834", "Enabled": true, "Children": [ { "__guid": "a1465f74-c03d-4c07-9562-5fb1e9f5266c", "Flags": 4, "Name": "finger_middle_2_R", - "Position": "1.678555,0.001659393,-0.004465103", - "Rotation": "-0.0000001490116,-0.04820894,0.0000002682209,-0.9987438", + "Position": "1.678604,0.001672745,-0.004384995", + "Rotation": "-0.0000001341105,-0.04820901,0.0000002831221,-0.9987452", "Enabled": true } ] @@ -688,32 +688,32 @@ "__guid": "1fc09b08-cbeb-438b-8b80-8b1e5d07c5d5", "Flags": 4, "Name": "finger_ring_meta_R", - "Position": "2.103191,-1.443681,-0.2240009", - "Rotation": "-0.06374952,-0.02917714,0.1306495,-0.9889044", + "Position": "2.103268,-1.443704,-0.2239685", + "Rotation": "-0.06374958,-0.0291772,0.1306497,-0.988906", "Enabled": true, "Children": [ { "__guid": "629acca2-ec4d-49b2-9826-1d36149c4afc", "Flags": 4, "Name": "finger_ring_0_R", - "Position": "2.821962,0.0005807877,-0.001054764", - "Rotation": "0.004488856,-0.1855043,-0.05619496,-0.9809674", + "Position": "2.822037,0.0005836487,-0.001012802", + "Rotation": "0.004488885,-0.1855047,-0.05619507,-0.9809695", "Enabled": true, "Children": [ { "__guid": "64c370c9-18ee-4737-a78d-4b765073f922", "Flags": 4, "Name": "finger_ring_1_R", - "Position": "2.19412,0.001083851,-0.002325058", - "Rotation": "-0.00004324317,-0.2565852,0.00004341453,-0.9664454", + "Position": "2.194201,0.001078129,-0.002256393", + "Rotation": "-0.00004327297,-0.2565863,0.00004342943,-0.9664491", "Enabled": true, "Children": [ { "__guid": "0662b27e-6b7f-42b2-9ad9-070074c10bf2", "Flags": 4, "Name": "finger_ring_2_R", - "Position": "1.53142,0.001292229,-0.004867554", - "Rotation": "-0.0000001788139,-0.05036679,0.0000002756715,-0.9986374", + "Position": "1.53159,0.001264572,-0.00462532", + "Rotation": "-0.0000002384186,-0.05036721,0.0000001862645,-0.9986455", "Enabled": true } ] @@ -728,8 +728,8 @@ "__guid": "f5cb25ae-c6a0-4e26-becd-9b5a5915faac", "Flags": 4, "Name": "arm_lower_R_twist1", - "Position": "3.85017,0.001062393,-0.001922607", - "Rotation": "-0.01740347,-0.00000002980232,0.00000002980232,-0.9998287", + "Position": "3.850315,0.001026154,-0.001831055", + "Rotation": "-0.01740347,0.00000002980232,0.00000002980232,-0.9998298", "Enabled": true } ] @@ -738,16 +738,16 @@ "__guid": "05ad9f39-b8f6-4dce-af85-d6451bb4886f", "Flags": 4, "Name": "arm_upper_R_twist1", - "Position": "5.019962,0.0001468658,-0.001689911", - "Rotation": "-0.009134978,0,0.00000002980232,-0.999946", + "Position": "5.020088,0.0001497269,-0.001617432", + "Rotation": "-0.009085834,0,0,-0.9999471", "Enabled": true }, { "__guid": "859eff5e-e24e-4094-adc6-193925b607ef", "Flags": 4, "Name": "arm_upper_R_twist0", - "Position": "-0.002380371,-0.00003528595,-0.001647949", - "Rotation": "-0.0593434,-0.00000005960464,-0.00000005960464,-0.9982253", + "Position": "-0.002277374,-0.00001907349,-0.001579285", + "Rotation": "-0.05902484,0,0,-0.9982448", "Enabled": true } ] @@ -758,8 +758,8 @@ "__guid": "b3a3a804-a9dd-4e63-b317-6dc98ef9d8a4", "Flags": 4, "Name": "neck_clothing", - "Position": "5.820351,-0.09348488,-0.00327301", - "Rotation": "0.00001524389,-0.0002190322,0.01049453,-0.9999422", + "Position": "5.820316,-0.09348679,-0.003234863", + "Rotation": "0.00001531839,-0.000219509,0.01094961,-0.9999375", "Enabled": true } ] @@ -772,32 +772,32 @@ "__guid": "c7082eb0-7445-455f-bea9-8c19435161a2", "Flags": 4, "Name": "leg_upper_R", - "Position": "-0.288168,-0.4264555,-4.427376", - "Rotation": "0.04860693,0.9969949,-0.0541029,0.02667363", + "Position": "-0.2881622,-0.4264526,-4.427376", + "Rotation": "0.04849876,0.9969915,-0.0541071,0.02698413", "Enabled": true, "Children": [ { "__guid": "b32f3291-da30-407d-be75-11bb1f67ae52", "Flags": 4, "Name": "leg_lower_R", - "Position": "14.47041,-0.000002384186,0.000001907349", - "Rotation": "0.006699666,-0.0001024902,0.207234,-0.9782685", + "Position": "14.47041,-0.000002384186,0.000005722046", + "Rotation": "0.00680989,-0.0001039356,0.2067474,-0.9783709", "Enabled": true, "Children": [ { "__guid": "482b21bc-f0ce-409d-823e-b8d6d2269469", "Flags": 4, "Name": "ankle_R", - "Position": "12.51555,-0.000002622604,0.000001907349", - "Rotation": "-0.03726895,0.006852925,-0.4778947,-0.8775996", + "Position": "12.51556,-0.000007390976,0.000008583069", + "Rotation": "-0.03729802,0.007164627,-0.4778649,-0.8776122", "Enabled": true, "Children": [ { "__guid": "96edbe5f-7adf-4361-a639-6c8fe09bc4ea", "Flags": 4, "Name": "ball_R", - "Position": "4.429122,-0.00001358986,-0.0000004768372", - "Rotation": "0.0000002868474,-0.0000005215406,-0.3905389,-0.9205851", + "Position": "4.429123,-0.00001549721,-0.0000004768372", + "Rotation": "0.0000002253801,-0.0000004917383,-0.3905393,-0.9205861", "Enabled": true } ] @@ -806,23 +806,23 @@ "__guid": "523f8614-bc95-4442-abb0-e1ae05fb1654", "Flags": 4, "Name": "leg_lower_R_twist0", - "Rotation": "0.00000005960464,0.0000001490116,-0.0000001341105,-0.9999999", + "Rotation": "0.00000008940697,0.0000001490116,-0.0000001490116,-1", "Enabled": true }, { "__guid": "1cb339a4-fa36-4cad-bd3d-542c1fa102f1", "Flags": 4, "Name": "leg_lower_R_twist1", - "Position": "6.257796,-0.00001811981,-0.000004768372", - "Rotation": "-0.02546191,0,-0.00000001490116,-0.9996758", + "Position": "6.257812,-0.0000231266,0.000003814697", + "Rotation": "-0.0254817,-0.00000002980232,0.00000001490116,-0.9996754", "Enabled": true }, { "__guid": "4d69aeee-db99-4768-b4bb-1cf7d03259c2", "Flags": 4, "Name": "leg_knee_helper_R", - "Position": "-0.01046753,0.06085324,0.0004358292", - "Rotation": "-0.002286247,0.002573729,-0.7560278,-0.6545307", + "Position": "-0.01040268,0.06071472,0.0004434586", + "Rotation": "-0.002328592,0.002612472,-0.7558582,-0.6547264", "Enabled": true } ] @@ -831,22 +831,22 @@ "__guid": "bbe8f2e8-e480-4ab3-9dc0-20f8fa200059", "Flags": 4, "Name": "leg_upper_R_twist1", - "Position": "7.235819,-0.00001955032,-0.000003814697", - "Rotation": "0.005421802,0,0,-0.9999854", + "Position": "7.235821,-0.00002193451,-0.000005722046", + "Rotation": "0.005421817,0,0.00000002980232,-0.9999854", "Enabled": true }, { "__guid": "37ec1971-f2bf-4e61-bcbb-5e385e417200", "Flags": 4, "Name": "leg_upper_R_twist0", - "Rotation": "0.03523198,0,0,-0.9993791", + "Rotation": "0.03523389,0,0,-0.9993792", "Enabled": true }, { "__guid": "d46108e1-4cc8-4a5d-a4fc-11efb1ce3820", "Flags": 4, "Name": "leg_glute_helper_R", - "Rotation": "-0.0000003278255,-0.0000002011657,0.707096,-0.7071167", + "Rotation": "-0.0000003576279,-0.0000003390014,0.7070962,-0.7071168", "Enabled": true } ] @@ -855,32 +855,32 @@ "__guid": "afc7ee64-84d0-478b-b845-dbffc38db7dc", "Flags": 4, "Name": "leg_upper_L", - "Position": "-0.2881508,-0.4264402,4.427393", - "Rotation": "0.01967284,0.9982586,0.05401273,0.01323268", + "Position": "-0.288147,-0.4264393,4.427391", + "Rotation": "0.01814348,0.9982816,0.0540196,0.01366283", "Enabled": true, "Children": [ { "__guid": "69d94113-1d92-4570-a461-9b8f626ac512", "Flags": 4, "Name": "leg_lower_L", - "Position": "14.47036,0.00001049042,0.000004768372", - "Rotation": "0.006715566,-0.00007283688,0.1493678,-0.9887589", + "Position": "14.47037,0.000005722046,0.000004768372", + "Rotation": "0.006750882,-0.00007177889,0.145883,-0.9892789", "Enabled": true, "Children": [ { "__guid": "66e60c1d-f2bd-4378-b9b6-3fdd3fc5d9fe", "Flags": 4, "Name": "ankle_L", - "Position": "12.51554,-0.0000004768372,-0.0000004768372", - "Rotation": "0.02488759,-0.01157352,-0.4505113,-0.8923488", + "Position": "12.51554,0.000001907349,0.0000009536743", + "Rotation": "0.02489313,-0.01129571,-0.4489435,-0.893142", "Enabled": true, "Children": [ { "__guid": "862b07fd-7c61-474d-a24b-03bf3b697f20", "Flags": 4, "Name": "ball_L", - "Position": "4.429137,-0.000005245209,-0.00000667572", - "Rotation": "-0.0000001192093,0.0000003278255,0.39071,0.9205089", + "Position": "4.429138,-0.000006198883,-0.00000667572", + "Rotation": "-0.0000001257285,0.0000003278255,0.3907111,0.9205114", "Enabled": true } ] @@ -889,23 +889,23 @@ "__guid": "1b62659b-781f-49ab-a38c-bc4918c2f243", "Flags": 4, "Name": "leg_lower_L_twist0", - "Rotation": "-0.0000001192093,-0.0000002831221,-0.00000005960464,-0.9999982", + "Rotation": "-0.00000005960464,-0.0000003129244,-0.0000001192093,-0.9999985", "Enabled": true }, { "__guid": "f215b579-d99b-4a73-a82b-41c25c97acae", "Flags": 4, "Name": "leg_lower_L_twist1", - "Position": "6.2578,-0.00002384186,0.000003814697", - "Rotation": "0.01672888,0.00000002980232,0.00000002980232,-0.9998602", + "Position": "6.257803,-0.00002098083,0.000003814697", + "Rotation": "0.01671788,0,0,-0.9998603", "Enabled": true }, { "__guid": "bcb4f9d6-b22f-43f6-8bee-be2026635707", "Flags": 4, "Name": "leg_knee_helper_L", - "Position": "-0.004272461,0.04432109,0.0003070831", - "Rotation": "0.002554005,-0.002648711,0.7602049,0.6496727", + "Position": "-0.003961563,0.04331017,0.0003032684", + "Rotation": "0.002569206,-0.002658367,0.759002,0.6510779", "Enabled": true } ] @@ -914,22 +914,22 @@ "__guid": "872c631e-66d0-491e-a5d3-18703c10bb82", "Flags": 4, "Name": "leg_upper_L_twist1", - "Position": "7.235794,-0.00002479553,-0.000001907349", - "Rotation": "-0.005405545,0.00000001490116,0.00000004470348,-0.9999855", + "Position": "7.235762,-0.00002574921,-0.00003623962", + "Rotation": "-0.00540629,-0.00000002980232,0.00000002980232,-0.9999852", "Enabled": true }, { "__guid": "ab710057-1eb5-4c83-a428-d79899eec4df", "Flags": 4, "Name": "leg_upper_L_twist0", - "Rotation": "-0.03512859,-0.00000001490116,0.00000002980232,-0.9993828", + "Rotation": "-0.03513213,0,0.00000001490116,-0.9993827", "Enabled": true }, { "__guid": "1319a98f-6a9e-4434-b355-6311d621c89c", "Flags": 4, "Name": "leg_glute_helper_L", - "Rotation": "-0.0000002682209,-0.0000002533197,0.7070959,-0.707117", + "Rotation": "-0.0000002384186,-0.0000002174638,0.7070959,-0.7071169", "Enabled": true } ] diff --git a/Code/Inventory.cs b/Code/Inventory.cs index 2ecd8a8..8e38d49 100644 --- a/Code/Inventory.cs +++ b/Code/Inventory.cs @@ -1,15 +1,17 @@ -using SWB.Shared; +using SWB.Base; +using SWB.Shared; +namespace Sandbox; public class Inventory : Component, IInventory { [Sync] public NetList Items { get; set; } = new(); [Sync] public new GameObject Active { get; set; } - Kal player; + Kal _player; protected override void OnAwake() { - player = Components.Get(); + _player = Components.Get(); } public void Add( GameObject gameObject, bool makeActive = false ) @@ -30,11 +32,24 @@ public class Inventory : Component, IInventory } } + public void Disarm() + { + foreach ( var item in Items ) + { + if ( item.Enabled && item.IsValid ) + { + IInventoryItem iItem = item.GetComponent(); + iItem.OnCarryStop(); + } + } + Active = null; + } + public GameObject AddClone( GameObject gamePrefab, bool makeActive = true ) { - var gameObject = gamePrefab.Clone( player.GameObject, player.WorldPosition, player.WorldRotation, Vector3.One ); + var gameObject = gamePrefab.Clone( _player.GameObject, _player.WorldPosition, _player.WorldRotation, Vector3.One ); gameObject.Name = gamePrefab.Name; - gameObject.NetworkSpawn( player.Network.Owner ); + gameObject.NetworkSpawn( _player.Network.Owner ); Add( gameObject, makeActive ); return gameObject; diff --git a/Code/Kal.cs b/Code/Kal.cs index 3e29f5c..5ee9ac5 100644 --- a/Code/Kal.cs +++ b/Code/Kal.cs @@ -74,24 +74,26 @@ public sealed class Kal : Component, IPlayerBase var cameraComponent = Camera.Components.Create(); cameraComponent.ZFar = 32768f; + + AddWeapon(); + } + + void AddWeapon() + { + var weaponRegistry = Scene.Components.GetInChildren(); + var weaponGo = weaponRegistry.Get( "Pistol" ); + var weapon = weaponGo.Components.Get( true ); + weaponGo.NetworkSpawn(); + weaponGo.SetParent(GameObject); - var weaponRegistery = Scene.Components.GetInChildren(); - var weaponGO = weaponRegistery.Get( "Pistol" ); - var weapon = weaponGO.Components.Get( true ); - weaponGO.SetParent(GameObject); - // weaponGO.Enabled = true; - - Inventory = Components.Create(); - Inventory.Add(weaponGO); - - Inventory.SetActive("Pistol"); - Log.Info(Inventory.Items[0].Name); + Inventory = Components.Create(); + Inventory.Add(weaponGo, false); } protected override void OnFixedUpdate() { base.OnFixedUpdate(); - + if ( Network.IsOwner ) { var multiplier = RagdollController.Enabled ? 0f : 1f; @@ -101,6 +103,16 @@ public sealed class Kal : Component, IPlayerBase var wishSpeed = isDucking ? DuckSpeed : isRunning ? RunSpeed : WalkSpeed; + if ( Input.Pressed( "Slot1" ) ) + { + Inventory.SetActive("Pistol"); + } + + if ( Input.Pressed( "Slot2" ) ) + { + Inventory.Disarm(); + } + CharacterController.WishVelocity = wishDirection * wishSpeed; CharacterController.Move(); diff --git a/Code/swb_base/Weapon.cs b/Code/swb_base/Weapon.cs index 7a9f7f9..9274fe6 100644 --- a/Code/swb_base/Weapon.cs +++ b/Code/swb_base/Weapon.cs @@ -30,20 +30,24 @@ public partial class Weapon : Component, IInventoryItem protected override void OnEnabled() { + if ( Owner.IsValid ) Owner.AnimationHelper.HoldType = HoldType; + if ( IsProxy ) return; CreateUI(); } protected override void OnDisabled() { + if ( Owner.IsValid ) Owner.AnimationHelper.HoldType = AnimationHelper.HoldTypes.None; + if ( IsProxy ) return; - + IsReloading = false; IsScoping = false; IsAiming = false; IsCustomizing = false; - DestroyUI(); + } [Broadcast] @@ -97,24 +101,23 @@ public partial class Weapon : Component, IInventoryItem CreateModels(); // Attachments (load for clients joining late) - if ( IsProxy ) - { - // Log.Info( "Checking -> " + Network.Owner.DisplayName + "'s " + DisplayName + " for attachments" ); - Attachments.ForEach( att => - { - // Log.Info( "[" + att.Name + "] equipped ->" + att.Equipped ); - if ( att is not null && att.Equipped ) - att.Equip(); - } ); - } + // if ( IsProxy ) + // { + // // Log.Info( "Checking -> " + Network.Owner.DisplayName + "'s " + DisplayName + " for attachments" ); + // Attachments.ForEach( att => + // { + // // Log.Info( "[" + att.Name + "] equipped ->" + att.Equipped ); + // if ( att is not null && att.Equipped ) + // att.Equip(); + // } ); + // } } protected override void OnUpdate() { if ( Owner is null ) return; - // UpdateModels(); - Owner.AnimationHelper.HoldType = HoldType; + // UpdateModels() if ( !IsProxy ) { diff --git a/Code/swb_base/WeaponRegistry.cs b/Code/swb_base/WeaponRegistry.cs index faaaea6..24da754 100644 --- a/Code/swb_base/WeaponRegistry.cs +++ b/Code/swb_base/WeaponRegistry.cs @@ -26,14 +26,14 @@ public class WeaponRegistry : Component { WeaponPrefabs.ForEach( weaponPrefab => { - var weaponGO = weaponPrefab.Clone(); - weaponGO.SetParent( this.GameObject ); - weaponGO.Enabled = false; + var weaponGo = weaponPrefab.Clone(); + weaponGo.SetParent( this.GameObject ); + weaponGo.Enabled = false; - var weapon = weaponGO.Components.Get( true ); - Weapons.TryAdd( weapon.ClassName, weaponGO ); + var weapon = weaponGo.Components.Get( true ); + Weapons.TryAdd( weapon.ClassName, weaponGo ); - weaponGO.Name = weapon.ClassName; + weaponGo.Name = weapon.ClassName; } ); } diff --git a/Code/swb_shared/IInventory.cs b/Code/swb_shared/IInventory.cs index 5bf0dc3..f610261 100644 --- a/Code/swb_shared/IInventory.cs +++ b/Code/swb_shared/IInventory.cs @@ -11,6 +11,7 @@ public interface IInventory public void SetActive( GameObject gameObject ); public void SetActive( string name ); public void Clear(); + public void Disarm(); } public interface IInventoryItem : IValid