-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wea_wands: Add move speed adjustment tool
It alters the current player's movement speed up or down in x0.5 increments. Min = x0.5. left/primary click: increase speed right/secondary click: decrease speed min speed = 0.5 documentation incoming!
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
worldeditadditions_farwand/edit/worldeditadditions_movement.piskel
This file contains 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 @@ | ||
{"modelVersion":2,"piskel":{"name":"New Piskel","description":"","fps":12,"height":16,"width":16,"layers":["{\"name\":\"Layer 1\",\"opacity\":1,\"frameCount\":1,\"chunks\":[{\"layout\":[[0]],\"base64PNG\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABNElEQVQ4T2NkoBAwouu/eGDD//VbtzI0dM9GkWsoTf0f6O3NoO8QgCKOYQDMQJAGmCHIbHQLGZ2MNf8jC+47ex1uqIoQL1juzrvPcDF09WADlmvdZWDXFmMIWs2LYsGj+0/AfDlFGRTxdaGfGX5efcUQeU2ZAe4CmCEgCRAASSIbAJIHAZBFMM0gPthpMFeANIFMhwGTro9g5pkyfrgYyJUgw0BqQd6FGwDTCFIAY6MbgCwHYqMYALIC2RvYvIDufLgBMG8ghxTIFcguQA9gWGyhpAPkGGF30WfQdTsENvPyLjuGn3suwgMPOaox4hcWRXz5rigGfJq4GyWqUVwASxwwzSBbxRf/YkROSC9j2cCJCjm9gMMA2dmw+IWZjp4SsanFSMogW5D9iByw6MkYnpAoydEAgo7FIqjtR/0AAAAASUVORK5CYII=\"}]}"]}} |
This file contains 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
This file contains 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,46 @@ | ||
local function adjust_speed_relative(player, offset) | ||
local overrides = player:get_physics_override() | ||
|
||
local src_speed = overrides.speed or 1 | ||
local src_climb_speed = overrides.climb_speed or 1 | ||
|
||
player:set_physics_override({ | ||
speed = math.max(src_speed + offset, 0.5), | ||
climb_speed = math.max(src_climb_speed + offset, 0.5) | ||
}) | ||
|
||
-- Completely paranoid is me | ||
local overrides_after = player:get_physics_override() | ||
worldedit.player_notify(player:get_player_name(), "Movement speed is now x" .. tostring(overrides_after.speed)) | ||
end | ||
|
||
|
||
local function use_primary(player) | ||
adjust_speed_relative(player, 0.5) | ||
end | ||
|
||
local function use_secondary(player) | ||
adjust_speed_relative(player, -0.5) | ||
end | ||
|
||
|
||
minetest.register_tool(":worldeditadditions:movetool", { | ||
description = "WorldEditAdditions movement speed adjustment tool", | ||
inventory_image = "worldeditadditions_movement.png", | ||
|
||
|
||
on_use = function(itemstack, player, pointed_thing) | ||
-- Left click | ||
use_primary(player) | ||
end, | ||
|
||
on_secondary_use = function(itemstack, player, pointed_thing) | ||
-- Right click when pointed at nothing | ||
use_secondary(player) | ||
end, | ||
|
||
on_place = function(itemstack, player, pointed_thing) | ||
-- Right click when pointed at something | ||
use_secondary(player) | ||
end | ||
}) |
Binary file added
BIN
+199 Bytes
worldeditadditions_farwand/textures/worldeditadditions_movement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.