-
Notifications
You must be signed in to change notification settings - Fork 4
add ze_lotr_minas_tirith #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
22fd621
ze_lotr_minas_tirith
Suancaiyuzy1 eef7661
update
Suancaiyuzy1 45e158b
update
Suancaiyuzy1 7277c65
update
Suancaiyuzy1 dd471fd
ze_lotr_minas_tirith
Suancaiyuzy1 b258d13
Merge branch 'fyscs:master' into ze_lotr_minas_tirith
Suancaiyuzy1 6ffff9f
delete
Suancaiyuzy1 9d016a3
new version
Suancaiyuzy1 f102596
Merge branch 'fyscs:master' into ze_lotr_minas_tirith
Suancaiyuzy1 52fd41f
0108 new ver
Suancaiyuzy1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { Instance } from "cs_script/point_script"; | ||
|
|
||
| let remaining = 0; // 总时间 | ||
| let delay = 0; // 每次触发的延迟 | ||
| let isCounting = false; // 添加一个标志来控制倒计时,防止重复启动 | ||
|
|
||
| function tickCountdown() { | ||
| if (!isCounting) return; | ||
|
|
||
| if (remaining < 0) { | ||
| Instance.Msg("Countdown finished!"); | ||
| isCounting = false; | ||
| return; | ||
| } | ||
|
|
||
| const text = "TIME UNTIL GHOST ARMY ARRIVAL:" + remaining + " SECONDS"; | ||
| Instance.EntFireAtName({ | ||
| name: "counter", | ||
| input: "SetMessage", | ||
| value: text, | ||
| delay: 0 | ||
| }); | ||
|
|
||
| Instance.EntFireAtName({ | ||
| name: "countdown", | ||
| input: "CountPlayersInZone", | ||
| delay: 0.1 | ||
| }); | ||
|
|
||
| remaining--; | ||
|
|
||
| Instance.Msg("Countdown " + remaining); | ||
|
|
||
| Instance.SetNextThink(Instance.GetGameTime() + 1.0); | ||
| } | ||
|
|
||
| Instance.OnScriptInput("globalHUD", () => { | ||
| if (isCounting) { | ||
| Instance.Msg("Countdown is already running."); | ||
| return; | ||
| } | ||
|
|
||
| remaining = 150; | ||
| isCounting = true; | ||
|
|
||
| Instance.SetThink(tickCountdown); | ||
| tickCountdown(); // 立即显示首帧 | ||
| Instance.SetNextThink(Instance.GetGameTime() + 1.0); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { Instance } from "cs_script/point_script"; | ||
|
|
||
| // @ts-ignore | ||
| // 数组存储多个玩家 | ||
| let markedPlayers = []; | ||
|
|
||
| // 输入:标记玩家(范围在1-6人) | ||
| Instance.OnScriptInput("LaunchNAZGUL", (inputData) => { | ||
| let player = inputData.activator; | ||
|
|
||
| if (!player || !player.IsValid()) return; | ||
|
|
||
| // @ts-ignore | ||
| // 查重:如果数组里已经有这个人,就不再重复添加 | ||
| if (markedPlayers.includes(player)) { | ||
| Instance.Msg("LaunchNAZGUL: 玩家已在列表 -> " + player.GetEntityName()); | ||
| return; | ||
| } | ||
|
|
||
| // @ts-ignore | ||
| // 如果数组里没有这个人,添加到数组 | ||
| markedPlayers.push(player); | ||
| Instance.Msg("LaunchNAZGUL: 新增标记玩家 -> " + player.GetEntityName() + " (当前总数: " + markedPlayers.length + ")"); | ||
| }); | ||
|
|
||
| Instance.OnPlayerDamage((event) => { | ||
| // 获取被攻击者 | ||
| let victim = event.player; | ||
|
|
||
| // @ts-ignore | ||
| // 1. 检查被攻击者是否在我们的标记名单里 | ||
| // 如果名单为空,或者被攻击者不在名单里,直接跳过 | ||
| if (markedPlayers.length === 0 || !markedPlayers.includes(victim)) { | ||
| return; | ||
| } | ||
|
|
||
| // 2. 获取攻击者 | ||
| let attacker = event.attacker; | ||
| if (!attacker || !attacker.IsValid()) return; | ||
|
|
||
| // 3. 计算击退向量 | ||
| let attackerPos = attacker.GetAbsOrigin(); | ||
| let playerPos = victim.GetAbsOrigin(); | ||
|
|
||
| let dirX = playerPos.x - attackerPos.x; | ||
| let dirY = playerPos.y - attackerPos.y; | ||
| let dirZ = playerPos.z - attackerPos.z; | ||
|
|
||
| let len = Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ); | ||
|
|
||
| if (len > 0) { | ||
| const force = 110; | ||
|
|
||
| let pushX = (dirX / len) * force; | ||
| let pushY = (dirY / len) * force; | ||
| let pushZ = (dirZ / len) * force + 5; | ||
|
|
||
| // 优化2:动量保留 (当前速度 + 击退速度) | ||
| let currentVel = victim.GetAbsVelocity(); | ||
|
|
||
| let finalVelocity = { | ||
| x: currentVel.x + pushX, | ||
| y: currentVel.y + pushY, | ||
| z: currentVel.z + pushZ + 10 // 额外提升Z轴速度 | ||
| }; | ||
|
|
||
| // 应用速度 | ||
| victim.Teleport({ velocity: finalVelocity }); | ||
| } | ||
| }); | ||
|
|
||
| // 回合开始时清空名单 | ||
| Instance.OnRoundStart(() => { | ||
| // @ts-ignore | ||
| markedPlayers = []; | ||
| Instance.Msg("LaunchNAZGUL: 回合开始,清空标记名单。"); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { Instance } from "cs_script/point_script"; | ||
|
|
||
| // @ts-ignore | ||
| let TNT_Phys = null; | ||
|
|
||
| function Get_TNT_Phys() { | ||
| // @ts-ignore | ||
| if (!TNT_Phys || !TNT_Phys.IsValid()) { | ||
| TNT_Phys = Instance.FindEntityByName("item_tnt_s1"); | ||
| } | ||
| return TNT_Phys; | ||
| } | ||
|
|
||
| //计算发射方向向量 | ||
| // @ts-ignore | ||
| function calculateLaunchDirection(AbsAngles, pitchOffset) { | ||
| let yawRad = AbsAngles.yaw * Math.PI / 180; | ||
| let pitchRad = (AbsAngles.pitch + pitchOffset) * Math.PI / 180; | ||
|
|
||
| let x = Math.cos(pitchRad) * Math.cos(yawRad); | ||
| let y = Math.cos(pitchRad) * Math.sin(yawRad); | ||
| let z = Math.sin(pitchRad); | ||
|
|
||
| return { x, y, z }; | ||
| } | ||
|
|
||
| Instance.OnScriptInput("LaunchTNT", (inputData) => { | ||
| Instance.Msg("LaunchTNT is running."); | ||
|
|
||
| // 获取玩家 (Entity) | ||
| let player = inputData.activator; | ||
|
|
||
| if (!player || !player.IsValid()) { | ||
| return; | ||
| } | ||
|
|
||
| // 注意:在CS2中,玩家Pawn的classname通常是 "cs_player_pawn" 而不是 "player" | ||
| // 为了兼容性,这里主要检查 IsValid 和 IsAlive | ||
| if (player.IsAlive && !player.IsAlive()) { | ||
| Instance.Msg("LaunchTNT: Player not alive."); | ||
| return; | ||
| } | ||
|
|
||
| let tnt = Get_TNT_Phys(); | ||
| if (!tnt || !tnt.IsValid()) { | ||
| Instance.Msg("LaunchTNT: TNT entity not found or invalid."); | ||
| return; | ||
| } | ||
|
|
||
| let AbsAngles = player.GetAbsAngles(); | ||
| // 获取角度 | ||
| let launchDirection = calculateLaunchDirection(AbsAngles, 60); | ||
| // 设置速度 | ||
| let launchSpeed = 720; | ||
| // 设置跳投的额外速度 | ||
| let launchBoost = 530; | ||
|
|
||
| // 获取玩家当前的绝对速度向量 {x, y, z} | ||
| let playerVel = player.GetAbsVelocity(); // | ||
|
|
||
| // 检查 Z 轴速度。使用 Math.abs 处理向上(正)或向下(负)的速度 | ||
| if (playerVel && Math.abs(playerVel.z) > 10) { | ||
| launchSpeed += launchBoost; | ||
| Instance.Msg("Boost applied! Z-Speed: " + playerVel.z); | ||
| } | ||
| // --- 修改结束 --- | ||
|
|
||
| let launchVelocity = { | ||
| x: launchDirection.x * launchSpeed, | ||
| y: launchDirection.y * launchSpeed, | ||
| z: launchDirection.z * launchSpeed | ||
| }; | ||
|
|
||
| // 设置TNT速度 | ||
| tnt.Teleport({ velocity: launchVelocity }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O(n)时间复杂度, 且并不会自动去重, 这在每个TakeDamage这种高密度事件中是不可接受的
应该使用Set