master
Jitnaught 2019-07-09 15:10:57 -06:00
commit 3ca6084179
5 changed files with 71 additions and 0 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Jitnaught
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
README.md Normal file
View File

@ -0,0 +1,3 @@
A Minetest mod that adds the Accelerated Back Hopping glitch from Half-Life 2.
It is not a perfect recreation, due to the differences between the HL2 and Minetest. To do the recreated glitch in Minetest, hold jump (space button) + left, right, and/or down (A/S/D buttons) (e.g. Space + S). You will gain speed on each jump.

1
description.txt Normal file
View File

@ -0,0 +1 @@
Adds Accelerated Back Hopping glitch from Half-Life 2.

44
init.lua Normal file
View File

@ -0,0 +1,44 @@
function player_moving_abh(player_controls, player_speed)
return ((player_controls.down or player_controls.left or player_controls.right) and player_speed > 3.9 and not player_controls.up)
end
minetest.register_globalstep(function(dtime)
local player_con, player_speed, node_pos, node
for _,player in ipairs(minetest.get_connected_players()) do
if player:get_attribute('was_on_ground') == nil then
player:set_attribute('was_on_ground', "1")
player:set_attribute('abh', "0")
end
local was_on_ground = (player:get_attribute('was_on_ground') == "1")
local abh = (player:get_attribute('abh') == "1")
player_con = player:get_player_control()
player_speed = vector.length(player:get_player_velocity())
node_pos = player:get_pos()
node_pos.y = node_pos.y - 0.3
node = minetest.get_node_or_nil(node_pos)
if node == nil or node.name == "air" then
if was_on_ground and abh and player_moving_abh(player_con, player_speed) then
player:set_physics_override({ speed = player:get_physics_override().speed + 1.0 })
end
was_on_ground = false
else
abh = player_con.jump and player_moving_abh(player_con, player_speed)
if not abh then
player:set_physics_override({ speed = 1.0 })
end
was_on_ground = true
end
player:set_attribute('was_on_ground', was_on_ground and "1" or "0")
player:set_attribute('abh', abh and "1" or "0")
end
end)

2
mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = abh