From 9bf3ca79b016b82e73558b425eef9dab75feb28e Mon Sep 17 00:00:00 2001 From: "ProjectKoi-Kalo\\Kalo" Date: Sat, 30 Aug 2025 16:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MCP/openai_to_dashscope_proxy.py | 356 +++++ MCP/vector_cache/knowledge_cache.json | 2068 +++++++++++++++++++++++++ MCP/使用转发服务指南.md | 207 +++ 3 files changed, 2631 insertions(+) create mode 100644 MCP/openai_to_dashscope_proxy.py create mode 100644 MCP/使用转发服务指南.md diff --git a/MCP/openai_to_dashscope_proxy.py b/MCP/openai_to_dashscope_proxy.py new file mode 100644 index 00000000..92787c79 --- /dev/null +++ b/MCP/openai_to_dashscope_proxy.py @@ -0,0 +1,356 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +OpenAI兼容接口到阿里云百炼平台智能体应用的转发服务 +""" + +import os +import json +import logging +from http.server import HTTPServer, BaseHTTPRequestHandler +from urllib.parse import urlparse +import requests +import threading +import time +import uuid +from dotenv import load_dotenv + +# 尝试加载.env文件 +load_dotenv() + +# 配置日志 +logging.basicConfig( + level=logging.INFO, + format='%(asctime)s - %(levelname)s - %(message)s', + handlers=[ + logging.FileHandler("proxy.log", encoding='utf-8'), + logging.StreamHandler() + ] +) +logger = logging.getLogger(__name__) + +# 从环境变量获取配置 +DASHSCOPE_API_KEY = os.getenv("DASHSCOPE_API_KEY") +APP_ID = os.getenv("DASHSCOPE_APP_ID") + +# 检查必要配置 +if not DASHSCOPE_API_KEY: + raise ValueError("请设置环境变量 DASHSCOPE_API_KEY") + +if not APP_ID: + raise ValueError("请设置环境变量 DASHSCOPE_APP_ID") + +# 阿里云百炼平台智能体应用的URL +DASHSCOPE_APP_URL = f"https://dashscope.aliyuncs.com/api/v1/apps/{APP_ID}/completion" + +class OpenAIProxyHandler(BaseHTTPRequestHandler): + """处理OpenAI兼容请求并转发到阿里云百炼平台""" + + def log_message(self, format, *args): + """重写日志方法,使用我们的日志配置""" + logger.info("%s - - [%s] %s" % (self.address_string(), self.log_date_time_string(), format % args)) + + def do_POST(self): + """处理POST请求""" + try: + # 解析请求路径 + parsed_path = urlparse(self.path) + + # 只处理聊天完成接口 + if parsed_path.path == "/v1/chat/completions": + self.handle_chat_completions() + else: + self.send_error(404, "接口未找到") + + except Exception as e: + logger.error(f"处理POST请求时出错: {e}") + try: + self.send_error(500, "内部服务器错误") + except: + pass # 客户端可能已经断开连接 + + def do_GET(self): + """处理GET请求""" + try: + # 解析请求路径 + parsed_path = urlparse(self.path) + + # 处理模型列表请求 + if parsed_path.path == "/v1/models": + self.handle_list_models() + else: + self.send_error(404, "接口未找到") + + except Exception as e: + logger.error(f"处理GET请求时出错: {e}") + try: + self.send_error(500, "内部服务器错误") + except: + pass # 客户端可能已经断开连接 + + def handle_list_models(self): + """处理模型列表请求""" + try: + # 构造OpenAI兼容的模型列表响应 + models_response = { + "object": "list", + "data": [ + { + "id": "dashscope-app", + "object": "model", + "created": int(time.time()), + "owned_by": "dashscope" + } + ] + } + + # 发送响应 + self.send_response(200) + self.send_header('Content-Type', 'application/json') + self.send_header('Access-Control-Allow-Origin', '*') + self.end_headers() + + response_json = json.dumps(models_response, ensure_ascii=False) + self.wfile.write(response_json.encode('utf-8')) + + except Exception as e: + logger.error(f"处理模型列表请求时出错: {e}") + try: + self.send_error(500, "内部服务器错误") + except: + pass # 客户端可能已经断开连接 + + def handle_chat_completions(self): + """处理聊天完成请求""" + try: + # 读取请求内容 + content_length = int(self.headers.get('Content-Length', 0)) + post_data = self.rfile.read(content_length) + + # 解析JSON数据 + request_data = json.loads(post_data.decode('utf-8')) + + # 记录接收到的请求 + logger.info(f"收到OpenAI兼容请求: {json.dumps(request_data, ensure_ascii=False)}") + + # 提取用户消息 + messages = request_data.get('messages', []) + if not messages: + self.send_error(400, "缺少消息内容") + return + + # 获取最后一条用户消息作为提示词 + prompt = "" + conversation_history = [] + + for message in messages: + role = message.get('role') + content = message.get('content', '') + conversation_history.append(f"{role}: {content}") + + if role == 'user': + prompt = content + + if not prompt: + self.send_error(400, "未找到用户消息") + return + + # 记录提取的提示词和对话历史 + logger.info(f"提取的用户提示词: {prompt}") + logger.info(f"完整对话历史: {' | '.join(conversation_history)}") + + # 构造阿里云百炼平台请求 + dashscope_request = { + "input": { + "prompt": prompt + }, + "parameters": {}, + "debug": {} + } + + # 处理流式请求 + stream = request_data.get('stream', False) + + # 设置请求头 + headers = { + "Authorization": f"Bearer {DASHSCOPE_API_KEY}", + "Content-Type": "application/json" + } + + if stream: + headers["Accept"] = "text/event-stream" + headers["X-DashScope-SSE"] = "enable" + dashscope_request["parameters"]["stream"] = True + dashscope_request["parameters"]["incremental_output"] = True + + # 记录发送给阿里云百炼平台的请求 + logger.info(f"发送到阿里云百炼平台的请求: {json.dumps(dashscope_request, ensure_ascii=False)}") + + # 转发请求到阿里云百炼平台 + response = requests.post( + DASHSCOPE_APP_URL, + headers=headers, + json=dashscope_request, + stream=stream + ) + + # 记录阿里云百炼平台的响应状态 + logger.info(f"阿里云百炼平台响应状态: {response.status_code}") + + # 设置响应头 + self.send_response(response.status_code) + + # 复制响应头 + for key, value in response.headers.items(): + # 过滤掉一些不需要的头 + if key.lower() not in ['connection', 'transfer-encoding']: + self.send_header(key, value) + + self.end_headers() + + # 转发响应内容 + if stream: + logger.info("处理流式响应") + # 流式响应 + try: + for chunk in response.iter_content(chunk_size=1024): + if chunk: + self.wfile.write(chunk) + self.wfile.flush() + except ConnectionAbortedError: + logger.warning("客户端中断了连接") + else: + # 普通响应 + # 读取响应内容 + response_content = response.text + + # 记录响应内容 + logger.info(f"阿里云百炼平台响应内容: {response_content[:200]}...") # 只记录前200个字符 + + # 尝试解析并转换为OpenAI格式 + try: + dashscope_response = json.loads(response_content) + openai_response = self.convert_to_openai_format(dashscope_response, request_data) + response_json = json.dumps(openai_response, ensure_ascii=False) + logger.info(f"转换后的OpenAI格式响应: {response_json[:200]}...") # 只记录前200个字符 + self.wfile.write(response_json.encode('utf-8')) + except json.JSONDecodeError: + # 如果不是JSON格式,构造一个标准的OpenAI格式响应 + logger.warning("响应不是JSON格式,构造标准OpenAI格式响应") + openai_response = { + "id": f"chatcmpl-{uuid.uuid4().hex}", + "object": "chat.completion", + "created": int(time.time()), + "model": request_data.get("model", "dashscope-app"), + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": response_content, + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": -1, + "completion_tokens": -1, + "total_tokens": -1 + } + } + response_json = json.dumps(openai_response, ensure_ascii=False) + self.wfile.write(response_json.encode('utf-8')) + + except Exception as e: + logger.error(f"处理聊天完成请求时出错: {e}") + try: + self.send_error(500, "处理请求时出错") + except: + pass # 如果无法发送错误响应,则忽略 + + def convert_to_openai_format(self, dashscope_response, request_data): + """将阿里云百炼平台响应转换为OpenAI格式""" + try: + # 提取文本内容 + text_content = dashscope_response.get("output", {}).get("text", "") + finish_reason = dashscope_response.get("output", {}).get("finish_reason", "stop") + + # 构造OpenAI格式响应 + openai_response = { + "id": f"chatcmpl-{uuid.uuid4().hex}", + "object": "chat.completion", + "created": int(time.time()), + "model": request_data.get("model", "dashscope-app"), + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": text_content, + }, + "finish_reason": finish_reason + } + ], + "usage": { + "prompt_tokens": -1, + "completion_tokens": -1, + "total_tokens": -1 + } + } + + # 如果有使用情况信息,添加到响应中 + if "usage" in dashscope_response: + openai_response["usage"] = dashscope_response["usage"] + + return openai_response + except Exception as e: + logger.error(f"转换响应格式时出错: {e}") + # 如果转换失败,构造标准OpenAI格式响应 + openai_response = { + "id": f"chatcmpl-{uuid.uuid4().hex}", + "object": "chat.completion", + "created": int(time.time()), + "model": request_data.get("model", "dashscope-app"), + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": str(dashscope_response), + }, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": -1, + "completion_tokens": -1, + "total_tokens": -1 + } + } + return openai_response + + def do_OPTIONS(self): + """处理CORS预检请求""" + self.send_response(200) + self.send_header('Access-Control-Allow-Origin', '*') + self.send_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS') + self.send_header('Access-Control-Allow-Headers', '*') + self.end_headers() + +def run_server(port=8000): + """启动HTTP服务器""" + server_address = ('', port) + httpd = HTTPServer(server_address, OpenAIProxyHandler) + logger.info(f"OpenAI到阿里云百炼平台转发服务启动,监听端口 {port}") + logger.info(f"Base URL: http://localhost:{port}/v1") + logger.info(f"模型名称: dashscope-app") + try: + httpd.serve_forever() + except KeyboardInterrupt: + logger.info("服务已停止") + httpd.server_close() + +if __name__ == '__main__': + # 可以通过环境变量设置端口,默认为8000 + port = int(os.getenv("PROXY_PORT", 8000)) + run_server(port) \ No newline at end of file diff --git a/MCP/vector_cache/knowledge_cache.json b/MCP/vector_cache/knowledge_cache.json index b842bca5..22bcc7ef 100644 --- a/MCP/vector_cache/knowledge_cache.json +++ b/MCP/vector_cache/knowledge_cache.json @@ -45531,5 +45531,2073 @@ ], "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\Verse\\GenPlace.txt\n\npublic static class GenPlace\n{\n\tprivate enum PlaceSpotQuality : byte\n\t{\n\t\tUnusable,\n\t\tAwful,\n\t\tBad,\n\t\tOkay,\n\t\tPerfect\n\t}\n\n\tprivate static readonly int PlaceNearMaxRadialCells = GenRadial.NumCellsInRadius(12.9f);\n\n\tprivate static readonly int PlaceNearMiddleRadialCells = GenRadial.NumCellsInRadius(3f);\n\n\tprivate static List thingList = new List();\n\n\tprivate static List cellThings = new List(8);\n\n\tpublic static bool TryPlaceThing(Thing thing, IntVec3 center, Map map, ThingPlaceMode mode, Action placedAction = null, Predicate extraValidator = null, Rot4? rot = null, int squareRadius = 1)\n\t{\n\t\tThing lastResultingThing;\n\t\treturn TryPlaceThing(thing, center, map, mode, out lastResultingThing, placedAction, extraValidator, rot);\n\t}\n\n\tpublic static bool TryPlaceThing(Thing thing, IntVec3 center, Map map, ThingPlaceMode mode, out Thing lastResultingThing, Action placedAction = null, Predicate extraValidator = null, Rot4? rot = null, int squareRadius = 1)\n\t{\n\t\tRot4 valueOrDefault = rot.GetValueOrDefault();\n\t\tif (!rot.HasValue)\n\t\t{\n\t\t\tvalueOrDefault = thing.def.defaultPlacingRot;\n\t\t\trot = valueOrDefault;\n\t\t}\n\t\tlastResultingThing = null;\n\t\tif (map == null)\n\t\t{\n\t\t\tLog.Error(\"Tried to place thing \" + thing?.ToString() + \" in a null map.\");\n\t\t\tlastResultingThing = null;\n\t\t\treturn false;\n\t\t}\n\t\tif (thing.def.category == ThingCategory.Filth)\n\t\t{\n\t\t\tmode = ThingPlaceMode.Direct;\n\t\t}\n\t\tif (mode == ThingPlaceMode.Direct)\n\t\t{\n\t\t\treturn TryPlaceDirect(thing, center, rot.Value, map, out lastResultingThing, placedAction);\n\t\t}\n\t\tif (mode == ThingPlaceMode.Near)\n\t\t{\n\t\t\tint stackCount;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tstackCount = thing.stackCount;\n\t\t\t\tif (!TryFindPlaceSpotNear(center, rot.Value, map, thing, allowStacking: true, out var bestSpot, extraValidator))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (TryPlaceDirect(thing, bestSpot, rot.Value, map, out lastResultingThing, placedAction))\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (thing.stackCount != stackCount);\n\t\t\tstring[] obj = new string[7]\n\t\t\t{\n\t\t\t\t\"Failed to place \",\n\t\t\t\tthing?.ToString(),\n\t\t\t\t\" at \",\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t};\n\t\t\tIntVec3 intVec = center;\n\t\t\tobj[3] = intVec.ToString();\n\t\t\tobj[4] = \" in mode \";\n\t\t\tobj[5] = mode.ToString();\n\t\t\tobj[6] = \".\";\n\t\t\tLog.Error(string.Concat(obj));\n\t\t\tlastResultingThing = null;\n\t\t\treturn false;\n\t\t}\n\t\tif (mode == ThingPlaceMode.Radius)\n\t\t{\n\t\t\tint stackCount2;\n\t\t\tdo\n\t\t\t{\n\t\t\t\tstackCount2 = thing.stackCount;\n\t\t\t\tif (!TryFindPlaceSpotInRadius(center, rot.Value, map, thing, squareRadius, allowStacking: true, out var bestSpot2, 100, extraValidator))\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif (TryPlaceDirect(thing, bestSpot2, rot.Value, map, out lastResultingThing, placedAction))\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (thing.stackCount != stackCount2);\n\t\t\tstring[] obj2 = new string[7]\n\t\t\t{\n\t\t\t\t\"Failed to place \",\n\t\t\t\tthing?.ToString(),\n\t\t\t\t\" at \",\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull,\n\t\t\t\tnull\n\t\t\t};\n\t\t\tIntVec3 intVec = center;\n\t\t\tobj2[3] = intVec.ToString();\n\t\t\tobj2[4] = \" in mode \";\n\t\t\tobj2[5] = mode.ToString();\n\t\t\tobj2[6] = \".\";\n\t\t\tLog.Error(string.Concat(obj2));\n\t\t\tlastResultingThing = null;\n\t\t\treturn false;\n\t\t}\n\t\tthrow new InvalidOperationException();\n\t}\n\n\tprivate static bool TryFindPlaceSpotNear(IntVec3 center, Rot4 rot, Map map, Thing thing, bool allowStacking, out IntVec3 bestSpot, Predicate extraValidator = null)\n\t{\n\t\tPlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Unusable;\n\t\tbestSpot = center;\n\t\tfor (int i = 0; i < 9; i++)\n\t\t{\n\t\t\tIntVec3 intVec = center + GenRadial.RadialPattern[i];\n\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(intVec, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t{\n\t\t\t\tbestSpot = intVec;\n\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t}\n\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ((int)placeSpotQuality >= 3)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tfor (int j = 0; j < PlaceNearMiddleRadialCells; j++)\n\t\t{\n\t\t\tIntVec3 intVec = center + GenRadial.RadialPattern[j];\n\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(intVec, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t{\n\t\t\t\tbestSpot = intVec;\n\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t}\n\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ((int)placeSpotQuality >= 3)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tfor (int k = 0; k < PlaceNearMaxRadialCells; k++)\n\t\t{\n\t\t\tIntVec3 intVec = center + GenRadial.RadialPattern[k];\n\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(intVec, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t{\n\t\t\t\tbestSpot = intVec;\n\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t}\n\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ((int)placeSpotQuality > 0)\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t\tbestSpot = center;\n\t\treturn false;\n\t}\n\n\tprivate static bool TryFindPlaceSpotInRadius(IntVec3 center, Rot4 rot, Map map, Thing thing, int radius, bool allowStacking, out IntVec3 bestSpot, int attempts = 100, Predicate extraValidator = null)\n\t{\n\t\tPlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Unusable;\n\t\tbestSpot = center;\n\t\twhile (attempts-- > 0)\n\t\t{\n\t\t\tif (CellFinder.TryRandomClosewalkCellNear(center, map, radius, out var result))\n\t\t\t{\n\t\t\t\tPlaceSpotQuality placeSpotQuality2 = PlaceSpotQualityAt(result, rot, map, thing, center, allowStacking, extraValidator);\n\t\t\t\tif ((int)placeSpotQuality2 > (int)placeSpotQuality)\n\t\t\t\t{\n\t\t\t\t\tbestSpot = result;\n\t\t\t\t\tplaceSpotQuality = placeSpotQuality2;\n\t\t\t\t}\n\t\t\t\tif (placeSpotQuality == PlaceSpotQuality.Perfect)\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (int)placeSpotQuality > 0;\n\t}\n\n\tprivate static PlaceSpotQuality PlaceSpotQualityAt(IntVec3 c, Rot4 rot, Map map, Thing thing, IntVec3 center, bool allowStacking, Predicate extraValidator = null)\n\t{\n\t\tif (!GenSpawn.CanSpawnAt(thing.def, c, map, rot))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tif (extraValidator != null && !extraValidator(c))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tthingList.Clear();\n\t\tforeach (IntVec3 item in GenAdj.OccupiedRect(c, rot, thing.def.Size))\n\t\t{\n\t\t\tthingList.AddRange(item.GetThingList(map));\n\t\t}\n\t\tbool flag = false;\n\t\tfor (int i = 0; i < thingList.Count; i++)\n\t\t{\n\t\t\tThing thing2 = thingList[i];\n\t\t\tif (thing.def.saveCompressible && thing2.def.saveCompressible)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t\t}\n\t\t\tif (thing.def.category == ThingCategory.Item && thing2.def.category == ThingCategory.Item && allowStacking && thing2.stackCount < thing2.def.stackLimit && thing2.CanStackWith(thing))\n\t\t\t{\n\t\t\t\tflag = true;\n\t\t\t}\n\t\t}\n\t\tif (thing.def.category == ThingCategory.Item && !flag && c.GetItemCount(map) >= c.GetMaxItemsAllowedInCell(map))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tif (c.GetEdifice(map) is IHaulDestination haulDestination && !haulDestination.Accepts(thing))\n\t\t{\n\t\t\treturn PlaceSpotQuality.Unusable;\n\t\t}\n\t\tif (thing is Building)\n\t\t{\n\t\t\tforeach (IntVec3 item2 in GenAdj.OccupiedRect(c, rot, thing.def.size))\n\t\t\t{\n\t\t\t\tBuilding edifice = item2.GetEdifice(map);\n\t\t\t\tif (edifice != null && GenSpawn.SpawningWipes(thing.def, edifice.def))\n\t\t\t\t{\n\t\t\t\t\treturn PlaceSpotQuality.Awful;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (c.GetRoom(map) != center.GetRoom(map))\n\t\t{\n\t\t\tif (!map.reachability.CanReach(center, c, PathEndMode.OnCell, TraverseMode.PassDoors, Danger.Deadly))\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Awful;\n\t\t\t}\n\t\t\treturn PlaceSpotQuality.Bad;\n\t\t}\n\t\tif (allowStacking)\n\t\t{\n\t\t\tfor (int j = 0; j < thingList.Count; j++)\n\t\t\t{\n\t\t\t\tThing thing3 = thingList[j];\n\t\t\t\tif (thing3.def.category == ThingCategory.Item && thing3.CanStackWith(thing) && thing3.stackCount < thing3.def.stackLimit)\n\t\t\t\t{\n\t\t\t\t\treturn PlaceSpotQuality.Perfect;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbool flag2 = thing is Pawn pawn && pawn.Downed;\n\t\tPlaceSpotQuality placeSpotQuality = PlaceSpotQuality.Perfect;\n\t\tfor (int k = 0; k < thingList.Count; k++)\n\t\t{\n\t\t\tThing thing4 = thingList[k];\n\t\t\tif (thing4.def.Fillage == FillCategory.Full)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4.def.preventDroppingThingsOn)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4.def.IsDoor)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4 is Building_WorkTable)\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4 is Pawn pawn2 && (pawn2.Downed || flag2))\n\t\t\t{\n\t\t\t\treturn PlaceSpotQuality.Bad;\n\t\t\t}\n\t\t\tif (thing4.def.category == ThingCategory.Plant && thing4.def.selectable && (int)placeSpotQuality > 3)\n\t\t\t{\n\t\t\t\tplaceSpotQuality = PlaceSpotQuality.Okay;\n\t\t\t}\n\t\t}\n\t\treturn placeSpotQuality;\n\t}\n\n\tprivate static bool SplitAndSpawnOneStackOnCell(Thing thing, IntVec3 loc, Rot4 rot, Map map, out Thing resultingThing, Action placedAction)\n\t{\n\t\tThing thing2 = ((thing.stackCount <= thing.def.stackLimit) ? thing : thing.SplitOff(thing.def.stackLimit));\n\t\tresultingThing = GenSpawn.Spawn(thing2, loc, map, rot);\n\t\tplacedAction?.Invoke(thing2, thing2.stackCount);\n\t\treturn thing2 == thing;\n\t}\n\n\tprivate static bool TryPlaceDirect(Thing thing, IntVec3 loc, Rot4 rot, Map map, out Thing resultingThing, Action placedAction = null)\n\t{\n\t\tresultingThing = null;\n\t\tcellThings.Clear();\n\t\tcellThings.AddRange(loc.GetThingList(map));\n\t\tcellThings.Sort((Thing lhs, Thing rhs) => rhs.stackCount.CompareTo(lhs.stackCount));\n\t\tif (thing.def.stackLimit > 1)\n\t\t{\n\t\t\tfor (int i = 0; i < cellThings.Count; i++)\n\t\t\t{\n\t\t\t\tThing thing2 = cellThings[i];\n\t\t\t\tif (thing2.CanStackWith(thing))\n\t\t\t\t{\n\t\t\t\t\tint stackCount = thing.stackCount;\n\t\t\t\t\tif (thing2.TryAbsorbStack(thing, respectStackLimit: true))\n\t\t\t\t\t{\n\t\t\t\t\t\tresultingThing = thing2;\n\t\t\t\t\t\tplacedAction?.Invoke(thing2, stackCount);\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (placedAction != null && stackCount != thing.stackCount)\n\t\t\t\t\t{\n\t\t\t\t\t\tplacedAction(thing2, stackCount - thing.stackCount);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint num2;\n\t\tif (thing.def.category == ThingCategory.Item)\n\t\t{\n\t\t\tint num = cellThings.Count((Thing cellThing) => cellThing.def.category == ThingCategory.Item);\n\t\t\tnum2 = loc.GetMaxItemsAllowedInCell(map) - num;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tnum2 = thing.stackCount + 1;\n\t\t}\n\t\tif (num2 <= 0 && thing.def.stackLimit <= 1)\n\t\t{\n\t\t\tnum2 = 1;\n\t\t}\n\t\tfor (int j = 0; j < num2; j++)\n\t\t{\n\t\t\tif (SplitAndSpawnOneStackOnCell(thing, loc, rot, map, out resultingThing, placedAction))\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static Thing HaulPlaceBlockerIn(Thing haulThing, IntVec3 c, Map map, bool checkBlueprintsAndFrames)\n\t{\n\t\tList list = map.thingGrid.ThingsListAt(c);\n\t\tfor (int i = 0; i < list.Count; i++)\n\t\t{\n\t\t\tThing thing = list[i];\n\t\t\tif (checkBlueprintsAndFrames && (thing.def.IsBlueprint || thing.def.IsFrame))\n\t\t\t{\n\t\t\t\treturn thing;\n\t\t\t}\n\t\t\tif ((thing.def.category != ThingCategory.Plant || thing.def.passability != 0) && thing.def.category != ThingCategory.Filth && (haulThing == null || thing.def.category != ThingCategory.Item || !thing.CanStackWith(haulThing) || thing.def.stackLimit - thing.stackCount < haulThing.stackCount))\n\t\t\t{\n\t\t\t\tif (thing.def.EverHaulable)\n\t\t\t\t{\n\t\t\t\t\treturn thing;\n\t\t\t\t}\n\t\t\t\tif (haulThing != null && GenSpawn.SpawningWipes(haulThing.def, thing.def))\n\t\t\t\t{\n\t\t\t\t\treturn thing;\n\t\t\t\t}\n\t\t\t\tif (thing.def.passability != 0 && thing.def.surfaceType != SurfaceType.Item)\n\t\t\t\t{\n\t\t\t\t\treturn thing;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n}\n\n", "timestamp": "2025-08-29 15:32:32,527" + }, + "Verb_Shoot": { + "keywords": [ + "Verb_Shoot" + ], + "question": "Verb_Shoot", + "embedding": [ + -0.008597640320658684, + 0.009288402274250984, + 0.04917152598500252, + -0.017865922302007675, + 0.0564412921667099, + -0.05354411527514458, + 0.010669926181435585, + 0.024854019284248352, + -0.03728773817420006, + 0.143356591463089, + 0.02434433065354824, + -0.009556659497320652, + 0.011199734173715115, + 0.03573184460401535, + 0.037073131650686264, + -0.0036751222796738148, + 0.020119281485676765, + -0.07838471978902817, + 0.011300330050289631, + 0.01048214640468359, + -0.0414188951253891, + 0.02089722827076912, + -0.042196840047836304, + 0.0041110399179160595, + -0.11384831368923187, + -0.017128216102719307, + -0.01329884584993124, + -0.011930733919143677, + -0.022010494023561478, + 0.000698725925758481, + -0.01257455162703991, + -0.016672179102897644, + 0.024760130792856216, + -0.03248593583703041, + -0.03098369389772415, + 0.026235543191432953, + -0.027496352791786194, + 0.02433091774582863, + -0.05086154490709305, + -0.025497836992144585, + 0.017409885302186012, + 0.0016824749764055014, + -0.002457905560731888, + 0.0026557452511042356, + -0.00595866097137332, + 0.03339800983667374, + 0.02345908246934414, + -0.010690045543015003, + -0.005589807406067848, + 0.019690070301294327, + 0.028676683083176613, + 0.03433690965175629, + -0.05670955032110214, + -0.008550695143640041, + -0.0016858282033354044, + 0.04482576251029968, + -0.0507005900144577, + 0.02427726797759533, + -0.03846806660294533, + 0.021353265270590782, + -0.005837945267558098, + 0.006340926978737116, + -0.012125221081078053, + -0.03905823454260826, + 0.03339800983667374, + -0.014982159249484539, + -0.03549041226506233, + -0.008047712966799736, + -0.025873396545648575, + -0.07178559899330139, + -0.016470985487103462, + 0.02465282753109932, + 0.017315994948148727, + -0.015612563118338585, + 0.012259349226951599, + 0.061538178473711014, + -0.00863117165863514, + -0.022104384377598763, + -0.04450385272502899, + 0.022734789177775383, + -0.016296617686748505, + -0.04504036530852318, + -0.07033701241016388, + -0.05319538339972496, + 0.02615506760776043, + 0.06684967130422592, + -0.02335178107023239, + -0.02948145568370819, + -0.004852100275456905, + 0.037958379834890366, + -0.009623723104596138, + -0.03358578681945801, + 0.04807167127728462, + -0.020065629854798317, + -0.005680344067513943, + 0.02966923452913761, + -0.05917751416563988, + -0.018912125378847122, + -0.011307036504149437, + 0.04844723269343376, + 0.014070084318518639, + -0.10778570175170898, + -0.007417308632284403, + 0.03337118402123451, + -0.008611053228378296, + -0.05971403047442436, + 0.010978421196341515, + 0.012333120219409466, + -0.02714761719107628, + 0.004074154421687126, + 0.010254127904772758, + -0.016310030594468117, + -0.035758670419454575, + 0.01192402746528387, + 0.04396733641624451, + -0.03084956668317318, + 0.02091064117848873, + -0.017235517501831055, + 0.020172933116555214, + 0.01004622783511877, + 0.03640248626470566, + -0.00036193750565871596, + -0.030903218314051628, + -0.04769610986113548, + -0.004744797479361296, + -0.022064145654439926, + 0.01932792365550995, + 0.005623339209705591, + 0.00036906308378092945, + 0.027496352791786194, + -0.03562454134225845, + 0.019569355994462967, + -0.007155757863074541, + -0.009033557958900928, + -0.04600609093904495, + -0.017168454825878143, + -0.03559771552681923, + -0.018107354640960693, + -0.00914086028933525, + -0.02522958070039749, + 0.013278726488351822, + 0.004875572863966227, + 0.06658141314983368, + 0.03785107657313347, + 0.024183377623558044, + -0.01092477049678564, + 0.0029390917625278234, + 0.014834617264568806, + 0.015867406502366066, + 0.037958379834890366, + -0.003561113029718399, + 0.021071594208478928, + -0.02339201793074608, + 0.005965366959571838, + -0.015277241356670856, + 0.002851908328011632, + 0.02021317183971405, + -0.016229555010795593, + 0.04935930669307709, + 0.00532155018299818, + -0.020065629854798317, + 0.023874880746006966, + 0.05788988247513771, + -0.05907021090388298, + -0.0008445907151326537, + -0.027295159175992012, + -0.01301717571914196, + -0.010877825319766998, + -0.03023257479071617, + -0.03618788346648216, + 0.001390745397657156, + 0.01427127793431282, + -0.031520210206508636, + -0.0518004447221756, + 0.008456804789602757, + -0.0059720734134316444, + -0.03337118402123451, + 0.01964983157813549, + 0.02677205763757229, + 0.03817298635840416, + 0.031520210206508636, + -0.011642358265817165, + 0.022614073008298874, + 0.019676657393574715, + 0.016564875841140747, + -0.04780341312289238, + 0.026624517515301704, + -0.034014999866485596, + 0.022184861823916435, + 0.006934445817023516, + -0.008678116835653782, + 0.04788389056921005, + -0.011273504234850407, + -0.004986228886991739, + 0.01901942864060402, + -0.008852483704686165, + -0.03286149352788925, + 0.07881393283605576, + -0.014003020711243153, + -0.013204955495893955, + 0.0014536181697621942, + -0.015116287395358086, + -0.019623005762696266, + 0.01357380859553814, + 0.0641670972108841, + 0.014499296434223652, + -0.010582742281258106, + -0.01964983157813549, + 0.016618527472019196, + -0.014378580264747143, + 0.014968746341764927, + 0.004992935340851545, + -0.038548544049263, + -0.04898374527692795, + 0.015491846948862076, + 0.0061229681596159935, + 0.006253743544220924, + -0.04906422272324562, + 0.03503437712788582, + 0.013935956172645092, + -0.02296280674636364, + 0.06491822004318237, + -0.025256404653191566, + 0.02489425800740719, + 0.011870376765727997, + 0.018992602825164795, + 0.004147925414144993, + 0.004369237460196018, + -0.01683313213288784, + 0.02646356262266636, + -0.056333988904953, + -0.02284209243953228, + -0.06631315499544144, + -0.0031989659182727337, + 0.0036885349545627832, + -0.02064238302409649, + -0.02702690288424492, + -0.024813780561089516, + -0.0068807946518063545, + 0.015478434041142464, + 0.006424757651984692, + 0.04530862346291542, + 0.010368136689066887, + -0.01971689611673355, + -0.016162490472197533, + -0.027684131637215614, + -0.035517238080501556, + 0.003234174568206072, + -0.00477162329480052, + -0.03323705494403839, + -0.008832365274429321, + -0.00866470392793417, + -0.03975570201873779, + 0.029561931267380714, + 0.006052550859749317, + -0.0013463152572512627, + -0.030903218314051628, + 0.002394194481894374, + -0.0698004961013794, + -0.019690070301294327, + -0.05713875964283943, + 0.028113342821598053, + 0.021876366809010506, + -0.007504492066800594, + -0.04557688161730766, + -0.02345908246934414, + -0.005720582790672779, + 0.031198300421237946, + -0.014284689910709858, + 0.0640597939491272, + -0.007906878367066383, + -0.00876530073583126, + 0.016296617686748505, + 0.005821179132908583, + 0.03715360909700394, + -0.025564901530742645, + 0.016068600118160248, + 0.015679627656936646, + -0.05783623084425926, + 0.009556659497320652, + -0.021447155624628067, + 0.012688560411334038, + -0.03849489241838455, + -0.010408375412225723, + -0.028301123529672623, + -0.03849489241838455, + 0.06797634810209274, + 0.013365909457206726, + 0.03828028589487076, + 0.0007980648661032319, + -0.022131210193037987, + 0.009556659497320652, + 0.002545089228078723, + 0.03591962531208992, + -0.010260834358632565, + -0.0310373455286026, + 0.019918089732527733, + 0.05971403047442436, + -0.00857081450521946, + 0.00016284044249914587, + 0.043216217309236526, + 0.040265388786792755, + -0.01530406717211008, + 0.015733279287815094, + -0.015089461579918861, + 0.0022785086184740067, + -0.0004321454034652561, + 0.04281383380293846, + 0.023620037361979485, + -0.02183612808585167, + -0.019864438101649284, + -0.0064448765479028225, + 0.03130560368299484, + -0.03304927423596382, + 0.002474671695381403, + 0.016564875841140747, + -0.01659170165657997, + -0.027362223714590073, + -0.012929991818964481, + 0.05174679309129715, + -0.018670693039894104, + -0.07065892219543457, + -0.03629518672823906, + 0.0013748175697401166, + 0.0441819429397583, + -0.030125271528959274, + -0.007551437243819237, + -0.048286277800798416, + 0.012198991142213345, + -0.019260859116911888, + -0.06867381930351257, + -0.027496352791786194, + -0.00602237181738019, + 0.06143087521195412, + 0.0024595821741968393, + 0.015934471040964127, + 0.011937440373003483, + 0.01845608837902546, + -0.026986664161086082, + -0.01144787110388279, + -0.02552466280758381, + -0.033639438450336456, + -0.02083016373217106, + 0.0013329024659469724, + 0.01896577700972557, + -0.054724447429180145, + 0.029240023344755173, + -0.00825561210513115, + -0.020441191270947456, + 0.0059854863211512566, + 0.030313052237033844, + -0.021487392485141754, + -0.013137890957295895, + 0.0015047546476125717, + -0.008597640320658684, + 0.014217626303434372, + 0.013976194895803928, + -0.0030413647182285786, + -0.05987498536705971, + 0.003752246033400297, + -0.0040708016604185104, + 0.001961630070582032, + -0.030313052237033844, + 0.03524898365139961, + 0.019810786470770836, + 0.01029436569660902, + -0.028623031452298164, + 0.058855608105659485, + -0.02009245567023754, + -0.03774377331137657, + -0.004992935340851545, + -0.017409885302186012, + 0.01864386908710003, + 0.02183612808585167, + -0.005257838871330023, + 0.025041799992322922, + -0.04369908198714256, + -0.0091945119202137, + 0.05188092216849327, + -0.007732510566711426, + 0.05499270558357239, + -0.04166032746434212, + 0.01727575622498989, + -7.319436554098502e-05, + -0.022372642531991005, + -0.0022231806069612503, + 0.10317167639732361, + -0.007645327132195234, + 0.04404781386256218, + -0.012313000857830048, + 0.062289297580718994, + 0.006374459248036146, + -0.028810812160372734, + 0.020159520208835602, + 0.05515366047620773, + 0.015169939026236534, + 0.0070551615208387375, + -0.00636775279417634, + 0.028944941237568855, + -0.019314510747790337, + -0.0006161530036479235, + -0.004325645510107279, + -0.03498072549700737, + -0.008228786289691925, + 0.01621614210307598, + -0.0026004172395914793, + -0.0014133795630186796, + 0.057353366166353226, + 0.000695372698828578, + -0.011682596988976002, + -0.03361261263489723, + 0.025202754884958267, + 0.001553376205265522, + 0.027952389791607857, + -0.0014636777341365814, + -0.020883815363049507, + -0.014499296434223652, + -0.0009942278265953064, + 0.03358578681945801, + 0.06014323979616165, + -0.025390533730387688, + 0.024009009823203087, + -0.019247446209192276, + 0.031144648790359497, + -0.0047179716639220715, + 0.010113292373716831, + -0.013318965211510658, + 0.051961399614810944, + 0.025001561269164085, + 0.011602119542658329, + -0.07301957905292511, + -0.018630456179380417, + -0.06615220010280609, + 0.051156628876924515, + 0.009898686781525612, + -0.026557452976703644, + -0.01280257012695074, + -0.013600634410977364, + -0.03366626426577568, + 0.0006119615281932056, + -0.06320137530565262, + 0.00556968804448843, + -0.006552179343998432, + -0.023365193977952003, + -0.038897279649972916, + 0.0216483473777771, + 0.01429810281842947, + 0.004127806052565575, + 0.06577663868665695, + -0.02252018265426159, + -0.034631989896297455, + 0.00410098023712635, + -0.013500038534402847, + 0.022922568023204803, + 0.007028335705399513, + 0.010381549596786499, + 0.03530263528227806, + -0.03133242949843407, + -0.028515730053186417, + -0.027523178607225418, + 0.012366652488708496, + -0.0030061560682952404, + -0.03079591505229473, + 0.013801828026771545, + 0.004496659617871046, + 0.0011711098486557603, + 0.007933703251183033, + -0.0272817462682724, + 0.01360734086483717, + 0.016229555010795593, + -0.007947116158902645, + 0.023418843746185303, + 0.02234581671655178, + -0.024143138900399208, + 0.051344409584999084, + -0.00675672572106123, + -0.018362198024988174, + 0.08423272520303726, + 0.011877083219587803, + 0.019113318994641304, + 0.011649064719676971, + 0.02453211136162281, + -0.055904779583215714, + -0.006357693113386631, + -0.06862016767263412, + -0.09335347265005112, + -0.03621470928192139, + -0.001874446403235197, + 0.030125271528959274, + -0.05890925973653793, + -0.008637878112494946, + -0.030634960159659386, + 0.010965009219944477, + -0.007551437243819237, + -0.0015340952668339014, + -0.010864412412047386, + 0.030688611790537834, + 0.019314510747790337, + 0.00044891147990711033, + -0.032941970974206924, + 0.007303299382328987, + 0.023378605023026466, + -0.032459110021591187, + -0.0027865206357091665, + 0.0048990449868142605, + -0.014056671410799026, + -0.021447155624628067, + -0.03452468663454056, + -0.05901655927300453, + 0.03887045383453369, + 0.0129501111805439, + 0.015411370433866978, + 0.023740753531455994, + 0.034256432205438614, + -0.027308572083711624, + -0.0001704899623291567, + -0.02108500711619854, + -0.022479943931102753, + 0.015438196249306202, + 0.013909130357205868, + 0.037019480019807816, + -0.010683339089155197, + 0.024451633915305138, + 0.031064171344041824, + -0.010079760104417801, + 0.005029820371419191, + -0.00459725596010685, + -0.0061229681596159935, + 0.060733407735824585, + -0.05681685358285904, + -0.025242993608117104, + -0.014177387580275536, + 0.052980776876211166, + -0.01978396065533161, + 0.007182583678513765, + -0.02309693582355976, + 0.013178129680454731, + -0.008751887828111649, + 0.014284689910709858, + 0.0826231837272644, + 0.031573861837387085, + 0.06459631025791168, + 0.0025786212645471096, + 0.0018442674772813916, + 0.02077651210129261, + 0.11610167473554611, + 0.05569017305970192, + 0.008745181374251842, + 0.04005078598856926, + -0.007658740039914846, + 0.020159520208835602, + 0.027523178607225418, + 0.0003325968864373863, + -0.032566413283348083, + 0.040453169494867325, + 0.0029910665471106768, + -0.02771095745265484, + 0.026423323899507523, + -0.05255156382918358, + -0.007833107374608517, + 0.012473954819142818, + -0.017785444855690002, + 0.07189290225505829, + -0.009744439274072647, + -0.04109698534011841, + -0.027737783268094063, + -0.0031050757970660925, + 0.04093603417277336, + -0.026436736807227135, + 0.01995832845568657, + -0.012500780634582043, + 0.04938613250851631, + -0.011333862319588661, + 0.004707911983132362, + 0.038575369864702225, + -0.0366707444190979, + 0.008671410381793976, + 0.05155901238322258, + 0.02977653779089451, + -0.03785107657313347, + -0.018992602825164795, + 0.0027596948202699423, + 0.015505259856581688, + -0.03318340331315994, + 0.008939667604863644, + 0.006709780544042587, + -0.04576466232538223, + -0.01166918408125639, + 0.051022499799728394, + 0.007658740039914846, + 0.005552921909838915, + -0.009912099689245224, + 0.009234750643372536, + -0.0062738629058003426, + 0.021192310377955437, + 0.04766928777098656, + 0.006817083340138197, + 0.061860084533691406, + 0.06996145099401474, + 0.006384518928825855, + 0.009731026366353035, + -0.06202103942632675, + -0.03361261263489723, + -0.025014974176883698, + 0.03460516408085823, + -0.035329461097717285, + -0.008778713643550873, + -0.029400978237390518, + 0.01082417368888855, + 0.01089123822748661, + -0.0006023210007697344, + 0.07044431567192078, + 0.0025534722954034805, + 0.00035355446743778884, + 0.040265388786792755, + -0.04597926512360573, + -0.0050130547024309635, + 0.014941920526325703, + 0.012742212042212486, + -0.004228402394801378, + -0.039836179465055466, + -0.008557401597499847, + -0.038521718233823776, + -0.008691529743373394, + -0.008309263736009598, + -0.024491872638463974, + 0.0020555199589580297, + -0.0008919548708945513, + -0.0498153418302536, + -0.038012031465768814, + -0.04643530398607254, + 0.006153147201985121, + -0.013453093357384205, + -0.018818235024809837, + 0.01932792365550995, + -0.024143138900399208, + 0.018254894763231277, + 0.030500831082463264, + -0.026450149714946747, + 0.01032789796590805, + 0.01645757257938385, + 0.01934133656322956, + -0.006458289455622435, + 0.010736990720033646, + -0.03862902149558067, + -0.022037319839000702, + 0.007947116158902645, + -0.06298676878213882, + -0.021608108654618263, + 0.001457809703424573, + -0.03216402605175972, + -0.037073131650686264, + 0.006625950336456299, + -0.026986664161086082, + -0.005070059094578028, + -0.017181867733597755, + -0.003500755177810788, + 0.012225816957652569, + -0.021916605532169342, + 0.029427804052829742, + 0.007276473566889763, + -0.022238513454794884, + -0.024693066254258156, + -0.01263490878045559, + -0.034202780574560165, + 0.027630480006337166, + 0.00539532070979476, + -0.027764609083533287, + 0.004707911983132362, + 0.028381600975990295, + -0.0008580035646446049, + -0.046274349093437195, + 0.03978252783417702, + -0.041392069309949875, + 0.0045771365985274315, + 0.012279468588531017, + -0.07387800514698029, + -0.010629687458276749, + 0.03334435820579529, + 0.025806332007050514, + -0.05917751416563988, + -0.025001561269164085, + -0.04184810817241669, + -0.025645378977060318, + -0.04820580035448074, + 0.00640128506347537, + -0.030634960159659386, + 0.010093173012137413, + -0.025739267468452454, + 0.010636393912136555, + 0.024371156468987465, + -0.09732367098331451, + 0.030313052237033844, + -0.002164499368518591, + 0.043269868940114975, + 0.010126705281436443, + -0.04117746278643608, + -0.06802999973297119, + 0.020481429994106293, + 0.012936698272824287, + 0.04597926512360573, + -0.05729971453547478, + -0.09426554292440414, + 0.05287347361445427, + 0.0039634983986616135, + -0.01298364344984293, + 0.027737783268094063, + -0.019623005762696266, + -0.002580297878012061, + -0.03752916678786278, + -0.0281669944524765, + 0.021326439455151558, + 0.010187063366174698, + -0.045952439308166504, + -0.005076765548437834, + 0.03146655857563019, + 0.014003020711243153, + 0.0338003933429718, + -0.03211037442088127, + 0.015223590657114983, + -0.08439368009567261, + 0.026302607730031013, + -0.009549953043460846, + -0.04748150706291199, + -0.010663219727575779, + 0.010991834104061127, + 0.04724007472395897, + -0.011535055004060268, + -0.04579148441553116, + 0.02985701523721218, + -0.0808526873588562, + -0.04997629672288895, + 0.02466624043881893, + -0.03441738709807396, + -0.011836844496428967, + -0.02176906354725361, + 0.02716103009879589, + -0.016672179102897644, + -0.023700514808297157, + -0.003681828733533621, + -0.007504492066800594, + 0.01688678376376629, + 0.002369045512750745, + -0.003534287214279175, + 0.1016157865524292, + 0.01814759336411953, + -0.030259400606155396, + -0.005080118775367737, + -0.0005935188382863998, + 0.017624491825699806, + 0.04367225617170334, + -0.03130560368299484, + 0.003618117654696107, + -0.04335034638643265, + -0.011910615488886833, + 0.02646356262266636, + -0.016819719225168228, + 0.013446386903524399, + -0.03071543760597706, + -4.1888975829351693e-05, + -0.03554406389594078, + -0.027308572083711624, + 0.025953873991966248, + 0.042330969125032425, + 0.01876458339393139, + -0.005549568682909012, + -0.03634883835911751, + -0.029964318498969078, + -0.06245025247335434, + 0.015666214749217033, + -0.031761638820171356, + 0.05260521546006203, + 0.0026808944530785084, + 0.05837274342775345, + 0.0009372232016175985, + -0.008865896612405777, + 0.045523229986429214, + -0.035517238080501556, + -0.027496352791786194, + 0.017557427287101746, + -0.010354723781347275, + -0.018885299563407898, + 0.04673038795590401, + -0.043591778725385666, + 0.028006041422486305, + 0.027818260714411736, + 0.005673637613654137, + 0.004506719298660755, + -0.03404182568192482, + -0.0202668234705925, + -0.001775526674464345, + 0.008684823289513588, + 0.07092717289924622, + -0.0022751553915441036, + 0.03806568309664726, + -0.04222366586327553, + -0.016229555010795593, + -0.005623339209705591, + 0.04858136177062988, + -0.013251900672912598, + 0.01852315291762352, + 0.012896459549665451, + -0.09673351049423218, + -0.05056646093726158, + 0.002082345774397254, + -0.01940840110182762, + -0.015478434041142464, + 0.033076100051403046, + -0.02627578191459179, + 0.016068600118160248, + -0.06325502693653107, + -0.03329070657491684, + -0.005905009340494871, + 0.022868918254971504, + 0.042330969125032425, + -0.015169939026236534, + -0.047535158693790436, + -0.008550695143640041, + -0.03259323537349701, + 0.033639438450336456, + -0.021541044116020203, + 0.032190851867198944, + 0.0006626788526773453, + 0.03318340331315994, + -0.025323469191789627, + 0.010240714997053146, + -0.0023774285800755024, + -0.024317504838109016, + -0.003321358235552907, + -0.02128620073199272, + 0.0498153418302536, + 0.0020605497993528843, + 0.009623723104596138, + 0.01795981265604496, + 0.0016028361860662699, + -0.014016433618962765, + 0.0064113447442650795, + 0.00341021828353405, + 0.008362915366888046, + 0.020696034654974937, + 0.03066178597509861, + 0.0031587271951138973, + 0.04090920835733414, + -0.006676248274743557, + 0.03583914786577225, + 0.026611104607582092, + 0.00654212012887001, + -0.01273550558835268, + 0.016618527472019196, + -0.003819310339167714, + -0.018067115917801857, + -0.02840842679142952, + -0.04235779494047165, + -0.009744439274072647, + 0.02335178107023239, + 0.029642408713698387, + 0.02120572328567505, + 0.04018491134047508, + -0.021098420023918152, + 0.059231165796518326, + -0.011474696919322014, + -0.03709995746612549, + -0.003812603885307908, + 0.03659026697278023, + -0.0037656589411199093, + -0.021165484562516212, + 0.055475566536188126, + 0.0018492973176762462, + 0.03878997638821602, + -0.04807167127728462, + 0.05912386253476143, + 0.0536782443523407, + -0.01486144308000803, + 0.024451633915305138, + 0.021326439455151558, + 0.024478459730744362, + -0.04638165235519409, + 0.018429262563586235, + -0.036375660449266434, + 0.022010494023561478, + 0.0043491180986166, + -0.02622213028371334, + -0.0054791513830423355, + 0.014445644803345203, + 0.04276018217206001, + -0.011199734173715115, + 0.02883763797581196, + -0.05029820650815964, + -0.03436373546719551, + 0.03905823454260826, + 0.0059519545175135136, + -0.037770599126815796, + 0.03009844571352005, + 0.03948744386434555, + 0.019918089732527733, + 0.009610310196876526, + -0.0527929961681366, + 0.0053316098637878895, + -0.029991142451763153, + 0.010750402696430683, + 0.004496659617871046, + -0.020253410562872887, + 0.048474058508872986, + 0.013412854634225368, + -0.0498153418302536, + 0.006558885797858238, + 0.014700489118695259, + 0.010884531773626804, + -0.03211037442088127, + -0.0023321600165218115, + 0.00985174160450697, + 0.017315994948148727, + -0.0165112242102623, + -0.03900458291172981, + 0.011199734173715115, + 0.006015665363520384, + -0.01179660577327013, + 0.08922231197357178, + 0.010341310873627663, + 0.028006041422486305, + -0.011897202581167221, + -0.026047764346003532, + 0.021688586100935936, + 0.010971715673804283, + -0.012883046641945839, + -0.0055126831866800785, + -0.09415823966264725, + 0.0169001966714859, + -0.024263855069875717, + -0.036322012543678284, + 0.02345908246934414, + -0.006434816867113113, + 0.002566884970292449, + -0.016538050025701523, + 0.010555916465818882, + -0.02333836816251278, + 0.004238462075591087, + -0.018241481855511665, + -0.009362172335386276, + 0.018228068947792053, + -0.04149937257170677, + 0.014888268895447254, + -0.019596179947257042, + 0.01113937608897686, + 0.015572324395179749, + -0.04066777601838112, + 0.01726234331727028, + -0.005127063952386379, + 0.0329151451587677, + -0.00675672572106123, + -0.00333980075083673, + 0.00210414151661098, + -0.012655028142035007, + -0.02459917590022087, + 0.04930565506219864, + 0.0034286610316485167, + -0.02608800306916237, + 0.006143087521195412, + 0.022681137546896935, + -0.029374152421951294, + 0.048903267830610275, + 0.03130560368299484, + -0.011213146150112152, + -0.03591962531208992, + -0.013399441726505756, + 0.016927022486925125, + -0.025927048176527023, + 0.021862953901290894, + 0.04597926512360573, + 0.006518647540360689, + 0.007538024336099625, + 0.0330224484205246, + -0.021044768393039703, + -0.012467248365283012, + -0.01714162901043892, + -0.014257865026593208, + -0.06481091678142548, + -0.07248307019472122, + -0.057407017797231674, + -0.04149937257170677, + 0.008738474920392036, + 0.02446504682302475, + -0.022439705207943916, + 0.025175929069519043, + -0.010160237550735474, + -0.02347249537706375, + 0.02840842679142952, + 0.010301072150468826, + 0.0025786212645471096, + -0.023915119469165802, + 0.03897775709629059, + -0.042652878910303116, + 0.03978252783417702, + 0.0263964980840683, + 0.05332951247692108, + -0.015263828448951244, + 0.056924156844615936, + -0.016068600118160248, + 0.04538910090923309, + -0.07591675966978073, + 0.03642931208014488, + -0.009268282912671566, + -0.007719098124653101, + -0.003869608510285616, + 0.01183013804256916, + -0.023298129439353943, + -0.04917152598500252, + -0.02040095254778862, + -0.02746952697634697, + 0.0267854705452919, + 0.017181867733597755, + -0.02077651210129261, + 0.03412230312824249, + 0.004972815979272127, + 0.019475465640425682, + 0.0041143931448459625, + 0.010918064042925835, + 0.02991066686809063, + 0.006682954728603363, + -0.03487342223525047, + 0.0240224227309227, + -0.00026134110521525145, + -0.0024931144434958696, + -0.016430746763944626 + ], + "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\Verse\\Verb_Shoot.txt\n\npublic class Verb_Shoot : Verb_LaunchProjectile\n{\n\tprotected override int ShotsPerBurst => base.BurstShotCount;\n\n\tpublic override void WarmupComplete()\n\t{\n\t\tbase.WarmupComplete();\n\t\tif (currentTarget.Thing is Pawn { Downed: false, IsColonyMech: false } pawn && CasterIsPawn && CasterPawn.skills != null)\n\t\t{\n\t\t\tfloat num = (pawn.HostileTo(caster) ? 170f : 20f);\n\t\t\tfloat num2 = verbProps.AdjustedFullCycleTime(this, CasterPawn);\n\t\t\tCasterPawn.skills.Learn(SkillDefOf.Shooting, num * num2);\n\t\t}\n\t}\n\n\tprotected override bool TryCastShot()\n\t{\n\t\tbool num = base.TryCastShot();\n\t\tif (num && CasterIsPawn)\n\t\t{\n\t\t\tCasterPawn.records.Increment(RecordDefOf.ShotsFired);\n\t\t}\n\t\treturn num;\n\t}\n}\n\n", + "timestamp": "2025-08-29 22:42:55,793" + }, + "Verb_LaunchProjectile": { + "keywords": [ + "Verb_LaunchProjectile" + ], + "question": "Verb_LaunchProjectile", + "embedding": [ + 0.030375633388757706, + -0.0025238171219825745, + 0.03532307595014572, + -0.006571252830326557, + 0.013847308233380318, + -0.08407886326313019, + 0.008153604343533516, + 0.04355959594249725, + -0.009984711185097694, + 0.10884371399879456, + -0.0010511585278436542, + -0.04881107062101364, + 0.0016264022560790181, + 0.012444611638784409, + 0.00901042390614748, + 0.0020055794157087803, + -0.010806981474161148, + -0.07180699706077576, + -0.031398288905620575, + -0.043670155107975006, + -0.02846851758658886, + -0.004294462036341429, + 0.0026896530762314796, + 0.026547584682703018, + -0.04212235286831856, + 0.009148621000349522, + 0.01051676832139492, + 0.01818668469786644, + -0.005424220114946365, + -0.05754510313272476, + -0.010254194028675556, + 0.002278517931699753, + -0.027487322688102722, + -0.016846176236867905, + -0.04546670988202095, + 0.022774815559387207, + -0.027169469743967056, + 0.024253519251942635, + -0.0010356114944443107, + 0.048230644315481186, + 0.0019554831087589264, + -0.0024460814893245697, + -0.00555550679564476, + -0.031177174299955368, + -0.010330202989280224, + -0.004042253363877535, + 0.013038857840001583, + -0.05522339791059494, + -0.020287273451685905, + 0.015298373997211456, + 0.0013569187140092254, + 0.026312649250030518, + -0.00626721978187561, + -0.02830268256366253, + -0.03236566483974457, + 0.01583734154701233, + -0.029325338080525398, + 0.007407342549413443, + -0.029325338080525398, + 0.011518694460391998, + 0.006129023153334856, + 0.052100151777267456, + -0.01861509494483471, + 0.014455373398959637, + 0.013999325223267078, + -0.013646923005580902, + -0.038114648312330246, + -0.008022317662835121, + 0.002865853952243924, + -0.042011793702840805, + -0.03065202571451664, + -0.004284097347408533, + -0.014897603541612625, + 0.008892957121133804, + -0.02364545315504074, + 0.01539511140435934, + -0.028026288375258446, + -0.04231582581996918, + -0.03969008848071098, + 0.04770549759268761, + 0.009349006228148937, + -0.04613005369901657, + -0.06954057514667511, + -0.00458122044801712, + 0.02393566630780697, + 0.05301225185394287, + 0.041154973208904266, + -0.08092798292636871, + 0.032614417374134064, + 0.04817536473274231, + -0.0025704584550112486, + -0.0579320527613163, + -0.004715961869806051, + -0.027639338746666908, + 0.001197128789499402, + -0.01768917590379715, + -0.034604452550411224, + -0.0410720556974411, + -0.017578618600964546, + 0.004774695727974176, + 0.026271190494298935, + -0.12691983580589294, + -0.0187532901763916, + 0.08247578144073486, + 0.0016929095145314932, + -0.058871790766716, + 0.008699481375515461, + 0.038169924169778824, + -0.012783193960785866, + 0.03919257968664169, + 0.021517224609851837, + -0.024129142984747887, + -0.0022370589431375265, + 0.043034449219703674, + 0.018269602209329605, + -0.015381291508674622, + 0.012721005827188492, + -0.004446478560566902, + 0.03919257968664169, + 0.025137977674603462, + 0.019292257726192474, + 0.009632308967411518, + -0.017468061298131943, + -0.0257598627358675, + 0.021738339215517044, + -0.017882652580738068, + 0.011677620001137257, + 0.014510652981698513, + 0.03532307595014572, + 0.030956057831645012, + -0.01692909374833107, + -0.0019312987569719553, + -0.015270734205842018, + -0.02708655223250389, + -0.046406447887420654, + -0.06224378943443298, + -0.022512240335345268, + -0.003710581222549081, + 0.013881857506930828, + -0.043670155107975006, + -0.011567062698304653, + 0.021240832284092903, + 0.08170188218355179, + 0.051270972937345505, + 0.040850941091775894, + 0.0021904176101088524, + -0.05737926438450813, + -0.027238568291068077, + 0.008485277183353901, + 0.028496157377958298, + -0.005773166660219431, + -0.039496615529060364, + -0.03065202571451664, + -0.021600142121315002, + -0.015726784244179726, + -0.007030756678432226, + 0.03322248533368111, + -0.01920934021472931, + 0.06871139258146286, + 0.01018509641289711, + -0.03792117163538933, + -0.018988225609064102, + 0.08966201543807983, + -0.06854555755853653, + -0.006135933101177216, + -0.026437027379870415, + -0.019665388390421867, + 0.015215455554425716, + -0.029325338080525398, + -0.013950956054031849, + -0.03137064725160599, + -0.02400476485490799, + -0.01195401418954134, + -0.037976451218128204, + 0.0036414829082787037, + 0.012327144853770733, + -0.006350137759000063, + 0.052929334342479706, + -0.004339375998824835, + 0.002010761760175228, + 0.04024287685751915, + -0.013805849477648735, + -0.014552111737430096, + -0.012271866202354431, + 0.0217245202511549, + 0.00219905492849648, + 0.03833576291799545, + 0.004840339068323374, + 0.05154736712574959, + 0.013045767322182655, + -0.009169350378215313, + 0.07617401331663132, + -0.025082699954509735, + 0.014116792008280754, + 0.04615769535303116, + 0.008284891955554485, + -0.043172646313905716, + 0.03280789405107498, + -0.05525103583931923, + 0.023120306432247162, + -0.006426146253943443, + -0.007794293574988842, + -0.02013525739312172, + 0.019084962084889412, + -0.013066496700048447, + -0.014800865203142166, + -0.002895220648497343, + -0.0004940531798638403, + 0.02794337086379528, + 0.005628060083836317, + 0.002076405333355069, + -0.0031422472093254328, + -0.015298373997211456, + 0.010537497699260712, + -0.001647131866775453, + 0.005476044025272131, + -0.05657772347331047, + 0.005500228144228458, + 0.026671960949897766, + -0.015091078355908394, + -0.030541468411684036, + 0.020259635522961617, + -0.013646923005580902, + 0.04648936539888382, + 0.0636257529258728, + 0.007842661812901497, + 0.023852748796343803, + -0.02238786406815052, + -0.0007488533155992627, + 0.011781267821788788, + -0.010205825790762901, + -0.020674224942922592, + -0.022028552368283272, + 0.002368345856666565, + 0.024847764521837234, + -0.051409170031547546, + -0.04930857941508293, + -0.020909158512949944, + -0.0016894545406103134, + 0.03126009181141853, + 0.005932093132287264, + 0.04643408954143524, + -0.0010122907115146518, + 0.032559141516685486, + 0.024198239669203758, + -0.030071599408984184, + -0.0006771637708880007, + -0.00526529410853982, + -0.007379703223705292, + -0.02728002704679966, + -0.013619284145534039, + 0.0008792764274403453, + -0.03601405769586563, + 0.05071818456053734, + 0.022608978673815727, + -0.0059735518880188465, + -0.022995930165052414, + 0.008955145254731178, + -0.025179436430335045, + 0.010585866868495941, + -0.03615225479006767, + 0.006775092799216509, + -0.010710243135690689, + -0.007003117352724075, + 0.002420169534161687, + -0.0034359153360128403, + 0.015339832752943039, + 0.041984155774116516, + -0.030734943225979805, + -0.011463415808975697, + -0.008637293241918087, + 0.040353432297706604, + 0.03081786260008812, + 0.00871330127120018, + -0.03457681089639664, + -0.019264617934823036, + 0.0733548030257225, + -0.0035257430281490088, + -0.03148120641708374, + 0.030237436294555664, + -0.003541290294378996, + 0.0010114270262420177, + -0.030873140320181847, + -0.0322827473282814, + -0.012852292507886887, + -0.010454579256474972, + -0.009238448925316334, + 0.013011218048632145, + 0.005482953507453203, + -0.003261441830545664, + -0.011442686431109905, + 0.06329408288002014, + 0.0010813891422003508, + 0.021613962948322296, + -0.004360105376690626, + 0.01941663585603237, + 0.012099119834601879, + 0.018836209550499916, + 0.0009198717307299376, + -0.01799320988357067, + -0.00645724032074213, + 0.04339376091957092, + 0.0011401226511225104, + 0.008091416209936142, + -0.006253400351852179, + -0.046240612864494324, + -0.00484379380941391, + -0.03617989271879196, + -0.001695500686764717, + -0.02628501132130623, + -0.031923435628414154, + -0.01249989029020071, + 0.0011686257785186172, + -0.03767241910099983, + -0.02039783075451851, + 0.024778665974736214, + -0.0028399419970810413, + -0.017316045239567757, + -0.05234890803694725, + 0.0386950746178627, + -0.010426940396428108, + -0.007559359073638916, + -0.04648936539888382, + 0.01540893130004406, + 0.06141461059451103, + -0.05538923293352127, + 0.01223731692880392, + -0.03557182848453522, + 0.005607330705970526, + -0.016873816028237343, + -0.04441641643643379, + 0.0011418501380831003, + 0.022111469879746437, + 0.05519575998187065, + 0.016376307234168053, + -0.010171276517212391, + 0.03670503944158554, + 0.04947441443800926, + 0.01540893130004406, + -0.05005484074354172, + -0.008858407847583294, + -0.003498103702440858, + 0.008879137225449085, + 0.009272998198866844, + 0.035931140184402466, + -0.05876123160123825, + 0.016044635325670242, + -0.0115739731118083, + -0.001650586724281311, + -0.009673768654465675, + 0.04532851278781891, + -0.020784782245755196, + -0.04698687419295311, + 0.006688719615340233, + 0.010226555168628693, + 0.005310208071023226, + -0.02701745368540287, + 0.014206619933247566, + 0.004401564598083496, + 0.011214661411941051, + -0.029518812894821167, + -0.0029055853374302387, + -0.0389438271522522, + 0.05561034753918648, + 0.017039651051163673, + 0.01799320988357067, + -0.026146814227104187, + 0.02754260040819645, + -0.008962055668234825, + 0.0035015586763620377, + 0.0001689670461928472, + -0.04206707328557968, + 0.05522339791059494, + 0.013322160579264164, + -0.000862001848872751, + 0.002297519939020276, + -0.015450390055775642, + 0.012852292507886887, + 0.00845072790980339, + -0.0022318765986710787, + 0.016956733539700508, + -0.012907571159303188, + 0.018145225942134857, + -0.05809788778424263, + -0.027818994596600533, + -0.036981433629989624, + 0.08479748666286469, + -0.02844087965786457, + 0.03568238392472267, + -0.0398835651576519, + 0.03148120641708374, + -0.012361694127321243, + -0.020784782245755196, + -0.002584278117865324, + 0.04433349892497063, + 0.011366677470505238, + 0.0011349403066560626, + 0.0068718306720256805, + 0.049584973603487015, + -0.006467605009675026, + -0.021144093945622444, + 0.008561285212635994, + -0.005244564265012741, + 0.031757600605487823, + -0.0005804260727018118, + -0.006854556035250425, + 0.015519488602876663, + 0.034797925502061844, + 0.011214661411941051, + -0.02910422347486019, + -0.017274586483836174, + 0.010178185999393463, + 0.027155648916959763, + 0.027694616466760635, + -0.005804261192679405, + 0.017081111669540405, + -0.022678077220916748, + 0.016804717481136322, + 0.004508667159825563, + 0.0330013707280159, + -0.0017896471545100212, + 0.03902674466371536, + -0.03598641976714134, + -0.009431923739612103, + -0.06285185366868973, + -0.03676031902432442, + 0.016777077689766884, + 0.06495244801044464, + 0.03366471454501152, + 0.03333304077386856, + -0.056163135915994644, + -0.027501141652464867, + -0.06169100105762482, + 0.08203355222940445, + 0.013439628295600414, + -0.014483013190329075, + -0.03606933727860451, + -0.010261104442179203, + -0.01775827445089817, + -0.022360224276781082, + -0.0885564386844635, + 0.003092150902375579, + -0.01782737299799919, + -0.03402402624487877, + -0.036124613136053085, + 0.01457975059747696, + 0.006961658131331205, + -0.005234199576079845, + 0.04270277917385101, + -0.009231538511812687, + 0.012873021885752678, + 0.025483470410108566, + 0.013771300204098225, + 0.00867875199764967, + -0.00811905600130558, + 0.019319897517561913, + 0.03615225479006767, + -0.05624605342745781, + -0.03250386193394661, + -0.023134125396609306, + 0.050911661237478256, + -0.0067958221770823, + -0.04126553237438202, + 0.05373087152838707, + 0.024212060496211052, + -0.003548200009390712, + 0.0067958221770823, + 0.02417060174047947, + -0.017716815695166588, + -0.009293727576732635, + -0.017633898183703423, + -0.017772095277905464, + -0.010129817761480808, + -0.025538748130202293, + 0.02215292863547802, + -0.04870051518082619, + -0.07009336352348328, + 0.0538967102766037, + -0.00574552733451128, + -0.01597553677856922, + -0.04800952970981598, + 0.06688719987869263, + -0.02965700998902321, + 0.003993884194642305, + -0.09762214124202728, + -0.0795460119843483, + -0.06064070761203766, + 9.943683835444972e-05, + 0.027791354805231094, + -0.020287273451685905, + 0.013868037611246109, + -0.013197784312069416, + -0.009991620667278767, + 0.052984610199928284, + -0.010005440562963486, + 0.00879621971398592, + 0.0572134293615818, + 0.03217218816280365, + -0.013474177569150925, + -0.012264956720173359, + -0.007766654249280691, + 0.026644321158528328, + 0.02003852091729641, + -0.04159720242023468, + 0.009984711185097694, + -0.011594702489674091, + -0.022429322823882103, + -0.006467605009675026, + 0.022083831951022148, + 0.022000912576913834, + -0.013114865869283676, + 0.018241962417960167, + 0.0280124694108963, + 0.03219982981681824, + -0.023700732737779617, + 0.006961658131331205, + -0.032614417374134064, + 0.05842956155538559, + 0.03231038525700569, + -0.04394654929637909, + -0.0025514564476907253, + -0.003517105709761381, + 0.005299842916429043, + -0.00022564928804058582, + 0.013004308566451073, + -0.004892162978649139, + 0.024543732404708862, + -0.013494906947016716, + 0.04834120348095894, + -0.044167663902044296, + -0.023617815226316452, + -0.06522883474826813, + 0.07722431421279907, + 0.02844087965786457, + 0.030679665505886078, + -0.032724976539611816, + -0.0014234259724617004, + 0.0017248674994334579, + -0.03438333794474602, + 0.08629001677036285, + 0.05276349559426308, + 0.015367471612989902, + 0.01430335734039545, + 0.050773464143276215, + 0.024985961616039276, + 0.05472588911652565, + 0.024198239669203758, + 0.024626649916172028, + 0.032255109399557114, + -0.011200841516256332, + -0.026823977008461952, + 0.002064313041046262, + -0.0019503007642924786, + -0.04861759766936302, + 0.04074038565158844, + 0.00968758761882782, + 0.04355959594249725, + 0.04496920481324196, + -0.053979627788066864, + -0.020024700090289116, + -0.0011686257785186172, + -0.020162897184491158, + 0.02165542170405388, + -0.024446994066238403, + -0.00947338342666626, + 0.011415046639740467, + 0.010406211018562317, + 0.02046692930161953, + -0.044554613530635834, + -0.02205619215965271, + 0.02499978058040142, + -0.008754760026931763, + -0.01400623470544815, + -0.0052791135385632515, + 0.013957865536212921, + 0.004256458021700382, + -0.01716402918100357, + 0.04607477784156799, + 0.009328276850283146, + -0.01115938276052475, + 0.005728252697736025, + 0.012043841183185577, + -0.021379027515649796, + 0.031204812228679657, + 0.027818994596600533, + -0.007421162445098162, + -0.04358723759651184, + 0.020688043907284737, + 0.057987332344055176, + -0.016790898516774178, + 0.03032035380601883, + -0.03463209047913551, + -0.04325556382536888, + 0.011649981141090393, + -0.005873359274119139, + 0.019402815029025078, + 0.024612830951809883, + 0.03164704144001007, + 0.031757600605487823, + 0.016514504328370094, + 0.014469193294644356, + -0.05165792256593704, + -0.018822388723492622, + -0.03247622400522232, + 0.021448126062750816, + -0.044858645647764206, + 0.007960129529237747, + -0.0337199941277504, + 0.02844087965786457, + 0.003859142540022731, + 0.05677120015025139, + 0.04383599013090134, + -0.013239243067800999, + -0.004239183384925127, + 0.015864979475736618, + -0.04170776158571243, + -0.002706927713006735, + 0.02497214265167713, + -0.004484482575207949, + -0.008291801437735558, + -0.012175128795206547, + -0.002183507662266493, + -0.0036000236868858337, + 0.0017421420197933912, + -0.009328276850283146, + -0.01006762869656086, + 0.011428866535425186, + -0.020259635522961617, + -0.049059826880693436, + -0.03991120308637619, + -0.04021523520350456, + -0.004104441497474909, + -0.012382423505187035, + -0.0018051943043246865, + 0.03540599346160889, + 0.030182156711816788, + 0.03886090964078903, + 0.04002176225185394, + -0.0011470324825495481, + 0.013280701823532581, + 0.00836780946701765, + 0.022512240335345268, + 0.03045855090022087, + 0.019817406311631203, + -0.02880018949508667, + -0.039330776780843735, + -0.02804010920226574, + -0.05458769202232361, + -0.005531322676688433, + -0.04933621734380722, + 0.031425926834344864, + 0.010088358074426651, + -0.0008464547572657466, + -0.00935591571033001, + -0.03369235247373581, + -0.03944133594632149, + 0.05591437965631485, + 0.01818668469786644, + -0.012368603609502316, + 0.021420486271381378, + -0.03717491030693054, + -0.006692174822092056, + -0.002466810867190361, + 0.0458260215818882, + -0.023161765187978745, + 0.020784782245755196, + -0.023534895852208138, + -0.010261104442179203, + -0.00253763678483665, + -0.00229061022400856, + -0.0013128685532137752, + -0.024184420704841614, + 0.040850941091775894, + -0.029435895383358, + -0.0009630582062527537, + 0.002038401085883379, + 0.0031474295537918806, + -0.030375633388757706, + 0.02533145435154438, + 0.029933402314782143, + -0.03114953450858593, + -0.011477234773337841, + -0.031066616997122765, + -0.031729958951473236, + -0.04046399146318436, + 0.05331628397107124, + -0.02153104357421398, + 0.015201635658740997, + -0.03485320508480072, + 0.03590349853038788, + 0.0132945217192173, + -0.08921978622674942, + 0.03313956782221794, + -0.017343685030937195, + 0.002178325317800045, + 0.0062844944186508656, + -0.035627108067274094, + -0.08750614523887634, + 0.01303194835782051, + 0.04966789111495018, + 0.04828592389822006, + -0.038142286241054535, + -0.05315044894814491, + -0.0009673768072389066, + 0.04259222000837326, + -0.01934753730893135, + 0.01937517523765564, + -0.04665520414710045, + 0.0006788912578485906, + -0.01742660254240036, + -0.01164307165890932, + 0.029601730406284332, + 0.04513503983616829, + -0.02965700998902321, + 0.008146694861352444, + 0.0031940711196511984, + 0.02915950119495392, + 0.023590175434947014, + -0.046047136187553406, + -0.00011865481792483479, + -0.02364545315504074, + -0.016942914575338364, + 0.004000794142484665, + -0.023728372529149055, + -0.04720798879861832, + 0.015173996798694134, + 0.006560887675732374, + -0.0015935805859044194, + 0.03957953304052353, + 0.08794837445020676, + -0.03383054956793785, + -0.055665627121925354, + -0.028827829286456108, + -0.008823858574032784, + 0.05574854463338852, + -0.020840061828494072, + -0.01835251972079277, + -0.028496157377958298, + -0.0462958924472332, + -0.05409018322825432, + -0.03504668176174164, + 0.006809642072767019, + -0.011974743567407131, + -0.0031180628575384617, + 0.07197283953428268, + 0.02728002704679966, + -0.045881301164627075, + 0.038639795035123825, + 0.006339773070067167, + -0.0008434316841885448, + 0.01954101212322712, + -0.014192800037562847, + 0.06556051224470139, + -0.0006123840576037765, + -0.010337112471461296, + 0.015547127462923527, + 0.040989138185977936, + -0.006585072260349989, + -0.034272778779268265, + 0.05113277584314346, + -0.013121775351464748, + -0.03850159794092178, + 0.007386613171547651, + -0.015091078355908394, + -0.00901042390614748, + 0.015173996798694134, + -0.08369191735982895, + 0.02542819082736969, + -0.019126422703266144, + 0.0016687250463292003, + -0.028744911774992943, + 0.021254651248455048, + -0.004249548073858023, + 0.028883108869194984, + 0.035461269319057465, + -0.003910966217517853, + 0.038639795035123825, + -0.06738470494747162, + -0.032255109399557114, + -0.00042927346657961607, + 0.0491427443921566, + -0.03145356848835945, + 0.01334289088845253, + -0.05306752771139145, + 0.022760994732379913, + 0.004042253363877535, + 0.0024011675268411636, + -0.01332907099276781, + -0.0006270674639381468, + -0.041486646980047226, + -0.001315459725446999, + -0.007842661812901497, + 0.056992314755916595, + -0.05116041377186775, + -0.003092150902375579, + -0.0101505471393466, + -0.049059826880693436, + 0.0016238110838457942, + 0.004674503114074469, + -0.03233802691102028, + 0.019057324156165123, + 0.02077096328139305, + -0.08700864017009735, + -0.04145900905132294, + 0.01871183142066002, + 0.00867875199764967, + -0.025345273315906525, + 0.01650068536400795, + -0.030900780111551285, + -0.04278569668531418, + -0.03463209047913551, + -0.005096002947539091, + -0.006968568079173565, + 0.014082242734730244, + 0.08247578144073486, + -0.015519488602876663, + -0.035792943090200424, + 0.0030541468877345324, + -0.03266969695687294, + 0.030928419902920723, + 0.019900323823094368, + 0.05837428197264671, + 0.0074488017708063126, + -0.013018128462135792, + 0.01438627578318119, + -0.018241962417960167, + 0.00014758974430151284, + 0.0005696294829249382, + -0.033581797033548355, + 0.007759744301438332, + 0.06661080569028854, + -0.005586601328104734, + 0.05373087152838707, + 0.05909290537238121, + 0.013957865536212921, + -0.012700275518000126, + 0.014469193294644356, + 0.019665388390421867, + -0.019665388390421867, + 0.07070142775774002, + 0.004000794142484665, + 0.006339773070067167, + 0.04339376091957092, + -0.043006811290979385, + 0.01297666970640421, + 0.012361694127321243, + 0.0349084846675396, + -0.013315251097083092, + -0.0059424578212201595, + -0.06301768869161606, + -0.021144093945622444, + -0.004477572627365589, + -0.006215396337211132, + -0.00272420234978199, + 0.04143136739730835, + 0.000839544867631048, + 0.011553243733942509, + 0.01994178257882595, + 0.006053015124052763, + 0.005348212085664272, + -0.019734486937522888, + -0.027584059163928032, + 0.02846851758658886, + 0.039164941757917404, + -0.016707979142665863, + -0.021185552701354027, + 0.012562079355120659, + 0.023203223943710327, + 0.03330540284514427, + -0.0173298642039299, + 0.03717491030693054, + 0.09624017775058746, + -0.01987268403172493, + -0.004622679203748703, + 0.06843499839305878, + 0.021931814029812813, + -0.0548364482820034, + 0.027459682896733284, + 0.01291448064148426, + 0.011622341349720955, + 0.06252018362283707, + -0.021904176101088524, + -0.011760538443922997, + -0.016127554699778557, + 0.0527082197368145, + 0.017702996730804443, + 0.045052122324705124, + -0.04988900572061539, + -0.058484841138124466, + 0.0351295992732048, + 0.025511108338832855, + 0.0016445405781269073, + 0.02189035527408123, + 0.05281877517700195, + 0.03922022134065628, + -0.0030334172770380974, + -0.05157500505447388, + -0.004253003280609846, + -0.003358179470524192, + 0.0033409050665795803, + 0.013059587217867374, + -0.02678251825273037, + 0.0612487718462944, + 0.06146988645195961, + -0.0076699163764715195, + -0.021268470212817192, + -0.008671842515468597, + 0.004636499099433422, + -0.06943001598119736, + 0.04123789072036743, + 0.0008585469331592321, + 0.007352063897997141, + 0.0027432043571025133, + -0.04812008887529373, + -0.026796339079737663, + -0.027141829952597618, + 0.013197784312069416, + 0.09850659966468811, + 0.01093135867267847, + -0.003541290294378996, + 0.010461489669978619, + -0.016583602875471115, + -0.0009129618993028998, + -0.0214895848184824, + 0.009148621000349522, + -0.005800805985927582, + -0.06633441150188446, + 0.01232023537158966, + -0.023769831284880638, + -0.02744586206972599, + -0.016224291175603867, + -0.03700907528400421, + 0.05171320214867592, + -0.017578618600964546, + 0.017398962751030922, + 0.021600142121315002, + -0.0482030063867569, + -0.013335980474948883, + -0.014510652981698513, + -0.011166292242705822, + -0.023825109004974365, + -0.03582058101892471, + -0.019002044573426247, + 0.02466810867190361, + -0.027362944558262825, + 0.029021305963397026, + 0.006750908214598894, + -0.003613843349739909, + 0.02827504277229309, + -0.011947103776037693, + -0.01868419349193573, + 0.03283553197979927, + -0.025801321491599083, + -0.05038651451468468, + 0.019858865067362785, + -0.02400476485490799, + -0.015533308498561382, + 0.02661668322980404, + 0.01742660254240036, + -0.030707305297255516, + 0.04137608781456947, + 0.01994178257882595, + -0.033775269985198975, + -0.0044672079384326935, + 0.03145356848835945, + -0.02364545315504074, + -0.006674900185316801, + -0.014676488935947418, + 0.013764390721917152, + -0.008243432268500328, + 0.022595159709453583, + -0.002031491370871663, + -0.01580970175564289, + -0.02949117310345173, + -0.008595834486186504, + -0.0015849432675167918, + -0.033775269985198975, + -0.0175647996366024, + -0.011345948092639446, + 0.018905308097600937, + -0.02222202718257904, + 0.015450390055775642, + 0.002684470731765032, + 0.003226892789825797, + -0.0188776683062315, + -0.02426733821630478, + -0.00838162936270237, + 0.026837797835469246, + -0.008595834486186504, + 0.01927843876183033, + 0.011332128196954727, + -0.0482030063867569, + -0.002461628522723913, + 0.03590349853038788, + 0.03482556715607643, + -0.016044635325670242, + 0.0012273594038560987, + -0.04281333461403847, + 0.07258090376853943, + -0.023866567760705948, + -0.021074995398521423, + -0.0007017800817266107, + -0.04684867709875107, + 0.017371324822306633, + -0.010088358074426651, + 0.019858865067362785, + -0.051519725471735, + -0.0006797550013288856, + -0.032586779445409775, + -0.02651994489133358, + 0.012983579188585281, + -0.043670155107975006, + 0.056992314755916595, + -0.01716402918100357, + 0.02464047074317932, + 0.004743601195514202, + -0.07545538991689682, + 0.029684649780392647, + -0.02893838658928871, + -0.0443887785077095, + 0.031895797699689865, + -0.01190564502030611, + 0.004978535696864128, + 0.012555168941617012 + ], + "result": "--- 结果 1 (相似度: 1.000) ---\n文件路径: C:\\Steam\\steamapps\\common\\RimWorld\\Data\\dll1.6\\Verse\\Verb_LaunchProjectile.txt\n\npublic class Verb_LaunchProjectile : Verb\n{\n\tprivate List forcedMissTargetEvenDispersalCache = new List();\n\n\tpublic override float EffectiveRange => base.EffectiveRange * (base.EquipmentSource?.GetStatValue(StatDefOf.RangedWeapon_RangeMultiplier) ?? 1f);\n\n\tpublic virtual ThingDef Projectile\n\t{\n\t\tget\n\t\t{\n\t\t\tCompChangeableProjectile compChangeableProjectile = base.EquipmentSource?.GetComp();\n\t\t\tif (compChangeableProjectile != null && compChangeableProjectile.Loaded)\n\t\t\t{\n\t\t\t\treturn compChangeableProjectile.Projectile;\n\t\t\t}\n\t\t\treturn verbProps.defaultProjectile;\n\t\t}\n\t}\n\n\tpublic override void WarmupComplete()\n\t{\n\t\tbase.WarmupComplete();\n\t\tFind.BattleLog.Add(new BattleLogEntry_RangedFire(caster, currentTarget.HasThing ? currentTarget.Thing : null, base.EquipmentSource?.def, Projectile, ShotsPerBurst > 1));\n\t}\n\n\tprotected IntVec3 GetForcedMissTarget(float forcedMissRadius)\n\t{\n\t\tif (verbProps.forcedMissEvenDispersal)\n\t\t{\n\t\t\tif (forcedMissTargetEvenDispersalCache.Count <= 0)\n\t\t\t{\n\t\t\t\tforcedMissTargetEvenDispersalCache.AddRange(GenerateEvenDispersalForcedMissTargets(currentTarget.Cell, forcedMissRadius, burstShotsLeft));\n\t\t\t\tforcedMissTargetEvenDispersalCache.SortByDescending((IntVec3 p) => p.DistanceToSquared(Caster.Position));\n\t\t\t}\n\t\t\tif (forcedMissTargetEvenDispersalCache.Count > 0)\n\t\t\t{\n\t\t\t\treturn forcedMissTargetEvenDispersalCache.Pop();\n\t\t\t}\n\t\t}\n\t\tint maxExclusive = GenRadial.NumCellsInRadius(forcedMissRadius);\n\t\tint num = Rand.Range(0, maxExclusive);\n\t\treturn currentTarget.Cell + GenRadial.RadialPattern[num];\n\t}\n\n\tprivate static IEnumerable GenerateEvenDispersalForcedMissTargets(IntVec3 root, float radius, int count)\n\t{\n\t\tfloat randomRotationOffset = Rand.Range(0f, 360f);\n\t\tfloat goldenRatio = (1f + Mathf.Pow(5f, 0.5f)) / 2f;\n\t\tfor (int i = 0; i < count; i++)\n\t\t{\n\t\t\tfloat f = MathF.PI * 2f * (float)i / goldenRatio;\n\t\t\tfloat f2 = Mathf.Acos(1f - 2f * ((float)i + 0.5f) / (float)count);\n\t\t\tint num = (int)(Mathf.Cos(f) * Mathf.Sin(f2) * radius);\n\t\t\tint num2 = (int)(Mathf.Cos(f2) * radius);\n\t\t\tVector3 vect = new Vector3(num, 0f, num2).RotatedBy(randomRotationOffset);\n\t\t\tyield return root + vect.ToIntVec3();\n\t\t}\n\t}\n\n\tprotected override bool TryCastShot()\n\t{\n\t\tif (currentTarget.HasThing && currentTarget.Thing.Map != caster.Map)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tThingDef projectile = Projectile;\n\t\tif (projectile == null)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tShootLine resultingLine;\n\t\tbool flag = TryFindShootLineFromTo(caster.Position, currentTarget, out resultingLine);\n\t\tif (verbProps.stopBurstWithoutLos && !flag)\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (base.EquipmentSource != null)\n\t\t{\n\t\t\tbase.EquipmentSource.GetComp()?.Notify_ProjectileLaunched();\n\t\t\tbase.EquipmentSource.GetComp()?.UsedOnce();\n\t\t}\n\t\tlastShotTick = Find.TickManager.TicksGame;\n\t\tThing manningPawn = caster;\n\t\tThing equipmentSource = base.EquipmentSource;\n\t\tCompMannable compMannable = caster.TryGetComp();\n\t\tif (compMannable?.ManningPawn != null)\n\t\t{\n\t\t\tmanningPawn = compMannable.ManningPawn;\n\t\t\tequipmentSource = caster;\n\t\t}\n\t\tVector3 drawPos = caster.DrawPos;\n\t\tProjectile projectile2 = (Projectile)GenSpawn.Spawn(projectile, resultingLine.Source, caster.Map);\n\t\tif (equipmentSource.TryGetComp(out CompUniqueWeapon comp))\n\t\t{\n\t\t\tforeach (WeaponTraitDef item in comp.TraitsListForReading)\n\t\t\t{\n\t\t\t\tif (item.damageDefOverride != null)\n\t\t\t\t{\n\t\t\t\t\tprojectile2.damageDefOverride = item.damageDefOverride;\n\t\t\t\t}\n\t\t\t\tif (!item.extraDamages.NullOrEmpty())\n\t\t\t\t{\n\t\t\t\t\tProjectile projectile3 = projectile2;\n\t\t\t\t\tif (projectile3.extraDamages == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectile3.extraDamages = new List();\n\t\t\t\t\t}\n\t\t\t\t\tprojectile2.extraDamages.AddRange(item.extraDamages);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (verbProps.ForcedMissRadius > 0.5f)\n\t\t{\n\t\t\tfloat num = verbProps.ForcedMissRadius;\n\t\t\tif (manningPawn is Pawn pawn)\n\t\t\t{\n\t\t\t\tnum *= verbProps.GetForceMissFactorFor(equipmentSource, pawn);\n\t\t\t}\n\t\t\tfloat num2 = VerbUtility.CalculateAdjustedForcedMiss(num, currentTarget.Cell - caster.Position);\n\t\t\tif (num2 > 0.5f)\n\t\t\t{\n\t\t\t\tIntVec3 forcedMissTarget = GetForcedMissTarget(num2);\n\t\t\t\tif (forcedMissTarget != currentTarget.Cell)\n\t\t\t\t{\n\t\t\t\t\tThrowDebugText(\"ToRadius\");\n\t\t\t\t\tThrowDebugText(\"Rad\\nDest\", forcedMissTarget);\n\t\t\t\t\tProjectileHitFlags projectileHitFlags = ProjectileHitFlags.NonTargetWorld;\n\t\t\t\t\tif (Rand.Chance(0.5f))\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectileHitFlags = ProjectileHitFlags.All;\n\t\t\t\t\t}\n\t\t\t\t\tif (!canHitNonTargetPawnsNow)\n\t\t\t\t\t{\n\t\t\t\t\t\tprojectileHitFlags &= ~ProjectileHitFlags.NonTargetPawns;\n\t\t\t\t\t}\n\t\t\t\t\tprojectile2.Launch(manningPawn, drawPos, forcedMissTarget, currentTarget, projectileHitFlags, preventFriendlyFire, equipmentSource);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tShotReport shotReport = ShotReport.HitReportFor(caster, this, currentTarget);\n\t\tThing randomCoverToMissInto = shotReport.GetRandomCoverToMissInto();\n\t\tThingDef targetCoverDef = randomCoverToMissInto?.def;\n\t\tif (verbProps.canGoWild && !Rand.Chance(shotReport.AimOnTargetChance_IgnoringPosture))\n\t\t{\n\t\t\tbool flyOverhead = projectile2?.def?.projectile != null && projectile2.def.projectile.flyOverhead;\n\t\t\tresultingLine.ChangeDestToMissWild(shotReport.AimOnTargetChance_StandardTarget, flyOverhead, caster.Map);\n\t\t\tThrowDebugText(\"ToWild\" + (canHitNonTargetPawnsNow ? \"\\nchntp\" : \"\"));\n\t\t\tThrowDebugText(\"Wild\\nDest\", resultingLine.Dest);\n\t\t\tProjectileHitFlags projectileHitFlags2 = ProjectileHitFlags.NonTargetWorld;\n\t\t\tif (Rand.Chance(0.5f) && canHitNonTargetPawnsNow)\n\t\t\t{\n\t\t\t\tprojectileHitFlags2 |= ProjectileHitFlags.NonTargetPawns;\n\t\t\t}\n\t\t\tprojectile2.Launch(manningPawn, drawPos, resultingLine.Dest, currentTarget, projectileHitFlags2, preventFriendlyFire, equipmentSource, targetCoverDef);\n\t\t\treturn true;\n\t\t}\n\t\tif (currentTarget.Thing != null && currentTarget.Thing.def.CanBenefitFromCover && !Rand.Chance(shotReport.PassCoverChance))\n\t\t{\n\t\t\tThrowDebugText(\"ToCover\" + (canHitNonTargetPawnsNow ? \"\\nchntp\" : \"\"));\n\t\t\tThrowDebugText(\"Cover\\nDest\", randomCoverToMissInto.Position);\n\t\t\tProjectileHitFlags projectileHitFlags3 = ProjectileHitFlags.NonTargetWorld;\n\t\t\tif (canHitNonTargetPawnsNow)\n\t\t\t{\n\t\t\t\tprojectileHitFlags3 |= ProjectileHitFlags.NonTargetPawns;\n\t\t\t}\n\t\t\tprojectile2.Launch(manningPawn, drawPos, randomCoverToMissInto, currentTarget, projectileHitFlags3, preventFriendlyFire, equipmentSource, targetCoverDef);\n\t\t\treturn true;\n\t\t}\n\t\tProjectileHitFlags projectileHitFlags4 = ProjectileHitFlags.IntendedTarget;\n\t\tif (canHitNonTargetPawnsNow)\n\t\t{\n\t\t\tprojectileHitFlags4 |= ProjectileHitFlags.NonTargetPawns;\n\t\t}\n\t\tif (!currentTarget.HasThing || currentTarget.Thing.def.Fillage == FillCategory.Full)\n\t\t{\n\t\t\tprojectileHitFlags4 |= ProjectileHitFlags.NonTargetWorld;\n\t\t}\n\t\tThrowDebugText(\"ToHit\" + (canHitNonTargetPawnsNow ? \"\\nchntp\" : \"\"));\n\t\tif (currentTarget.Thing != null)\n\t\t{\n\t\t\tprojectile2.Launch(manningPawn, drawPos, currentTarget, currentTarget, projectileHitFlags4, preventFriendlyFire, equipmentSource, targetCoverDef);\n\t\t\tThrowDebugText(\"Hit\\nDest\", currentTarget.Cell);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tprojectile2.Launch(manningPawn, drawPos, resultingLine.Dest, currentTarget, projectileHitFlags4, preventFriendlyFire, equipmentSource, targetCoverDef);\n\t\t\tThrowDebugText(\"Hit\\nDest\", resultingLine.Dest);\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate void ThrowDebugText(string text)\n\t{\n\t\tif (DebugViewSettings.drawShooting)\n\t\t{\n\t\t\tMoteMaker.ThrowText(caster.DrawPos, caster.Map, text);\n\t\t}\n\t}\n\n\tprivate void ThrowDebugText(string text, IntVec3 c)\n\t{\n\t\tif (DebugViewSettings.drawShooting)\n\t\t{\n\t\t\tMoteMaker.ThrowText(c.ToVector3Shifted(), caster.Map, text);\n\t\t}\n\t}\n\n\tpublic override float HighlightFieldRadiusAroundTarget(out bool needLOSToCenter)\n\t{\n\t\tneedLOSToCenter = true;\n\t\tThingDef projectile = Projectile;\n\t\tif (projectile == null)\n\t\t{\n\t\t\treturn 0f;\n\t\t}\n\t\tfloat num = projectile.projectile.explosionRadius + projectile.projectile.explosionRadiusDisplayPadding;\n\t\tfloat forcedMissRadius = verbProps.ForcedMissRadius;\n\t\tif (forcedMissRadius > 0f && base.BurstShotCount > 1)\n\t\t{\n\t\t\tnum += forcedMissRadius;\n\t\t}\n\t\treturn num;\n\t}\n\n\tpublic override bool Available()\n\t{\n\t\tif (!base.Available())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t\tif (CasterIsPawn)\n\t\t{\n\t\t\tPawn casterPawn = CasterPawn;\n\t\t\tif (casterPawn.Faction != Faction.OfPlayer && !verbProps.ai_ProjectileLaunchingIgnoresMeleeThreats && casterPawn.mindState.MeleeThreatStillThreat && casterPawn.mindState.meleeThreat.Position.AdjacentTo8WayOrInside(casterPawn.Position))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn Projectile != null;\n\t}\n\n\tpublic override void Reset()\n\t{\n\t\tbase.Reset();\n\t\tforcedMissTargetEvenDispersalCache.Clear();\n\t}\n}\n\n", + "timestamp": "2025-08-29 22:43:12,140" } } \ No newline at end of file diff --git a/MCP/使用转发服务指南.md b/MCP/使用转发服务指南.md new file mode 100644 index 00000000..8fba0697 --- /dev/null +++ b/MCP/使用转发服务指南.md @@ -0,0 +1,207 @@ +# OpenAI兼容接口到阿里云百炼平台智能体应用转发服务使用指南 + +本文档介绍了如何使用Python编写的转发服务,将OpenAI兼容的API请求转换为阿里云百炼平台智能体应用的请求。 + +## 工作原理 + +该转发服务作为一个代理服务器运行,接收OpenAI兼容的API请求,并将其转换为阿里云百炼平台智能体应用的请求格式,然后将响应转换回OpenAI格式返回给客户端。 + +``` +客户端 -> OpenAI兼容请求 -> 转发服务 -> 阿里云百炼平台 -> 转发服务 -> OpenAI兼容响应 -> 客户端 +``` + +## 配置要求 + +### 环境变量设置 + +需要设置以下环境变量: + +1. `DASHSCOPE_API_KEY` - 阿里云百炼平台的API Key +2. `DASHSCOPE_APP_ID` - 智能体应用的APP ID +3. `PROXY_PORT` (可选) - 转发服务监听的端口,默认为8000 + +您可以在项目目录下的 [.env](file://c:\Steam\steamapps\common\RimWorld\Mods\3516260226\MCP\.env) 文件中配置这些变量: + +```env +DASHSCOPE_API_KEY="sk-xxxxxxxx" +DASHSCOPE_APP_ID="app-xxxxxxxx" +PROXY_PORT=8000 +``` + +在Windows系统中设置环境变量的示例: +```cmd +set DASHSCOPE_API_KEY=your_api_key_here +set DASHSCOPE_APP_ID=your_app_id_here +set PROXY_PORT=8000 +``` + +在Linux/macOS系统中设置环境变量的示例: +```bash +export DASHSCOPE_API_KEY=your_api_key_here +export DASHSCOPE_APP_ID=your_app_id_here +export PROXY_PORT=8000 +``` + +## 启动服务 + +运行转发服务: + +```bash +python openai_to_dashscope_proxy.py +``` + +服务启动后,将显示以下信息: +``` +OpenAI到阿里云百炼平台转发服务启动,监听端口 8000 +Base URL: http://localhost:8000/v1 +模型名称: dashscope-app +``` + +## 在Kilo Code中配置 + +在Kilo Code中按以下步骤配置: + +1. 打开Kilo Code设置面板 +2. 选择"API Provider"为"OpenAI Compatible" +3. 设置Base URL为: `http://localhost:8000/v1` (如果使用默认端口) +4. API Key可以任意填写(服务不会验证) +5. 模型名称填写: `dashscope-app` + +## 支持的功能 + +### 1. 基本文本对话 + +发送聊天完成请求: +```json +{ + "model": "dashscope-app", + "messages": [ + { + "role": "user", + "content": "你好,你是谁?" + } + ] +} +``` + +### 2. 流式输出 + +启用流式输出: +```json +{ + "model": "dashscope-app", + "messages": [ + { + "role": "user", + "content": "讲一个有趣的故事" + } + ], + "stream": true +} +``` + +## 技术细节 + +### 请求转换 + +OpenAI兼容请求格式: +```json +{ + "model": "dashscope-app", + "messages": [ + {"role": "user", "content": "提示词"} + ] +} +``` + +转换为阿里云百炼平台请求格式: +```json +{ + "input": { + "prompt": "提示词" + }, + "parameters": {}, + "debug": {} +} +``` + +### 响应转换 + +阿里云百炼平台响应格式: +```json +{ + "output": { + "text": "响应内容", + "finish_reason": "stop" + } +} +``` + +转换为OpenAI兼容响应格式: +```json +{ + "id": "chatcmpl-request_id", + "object": "chat.completion", + "created": 1234567890, + "model": "dashscope-app", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "响应内容" + }, + "finish_reason": "stop" + } + ] +} +``` + +## 故障排除 + +### 1. 环境变量未设置 + +错误信息: +``` +ValueError: 请设置环境变量 DASHSCOPE_API_KEY +``` + +解决方案: +确保已正确设置环境变量 `DASHSCOPE_API_KEY` 和 `DASHSCOPE_APP_ID`。 + +### 2. 网络连接问题 + +错误信息: +``` +requests.exceptions.ConnectionError +``` + +解决方案: +检查网络连接,确保可以访问阿里云百炼平台。 + +### 3. API Key或APP ID错误 + +错误信息: +``` +401 Unauthorized +``` + +解决方案: +检查API Key和APP ID是否正确。 + +### 4. 端口被占用 + +错误信息: +``` +OSError: [Errno 98] Address already in use +``` + +解决方案: +更改端口号,通过设置 `PROXY_PORT` 环境变量或修改代码中的默认端口。 + +## 最佳实践 + +1. **安全性**:在生产环境中,建议将转发服务部署在安全的网络环境中 +2. **监控**:启用日志记录以便监控服务运行状态 +3. **错误处理**:确保正确处理各种错误情况 +4. **性能**:对于高并发场景,考虑使用异步框架如FastAPI替代内置的HTTP服务器 \ No newline at end of file