Skip to content
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

Add sound effect #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion control-teleportation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ function Teleportation_ActivatePortal(player, destination_position)
player.teleport(valid_position, player.surface)
global.Teleportation.player_settings[player.name].used_portal_on_tick = game.tick
Teleportation_DischargeEquipment(player, energy_required)
if player.mod_settings["Teleportation-sound-enabled"].value then
player.surface.create_entity({name = "teleport-sound-effect", position = player.position})
end
return true
else
return false
Expand Down Expand Up @@ -497,6 +500,9 @@ function Teleportation_Teleport(player, surface_name, destination_position)
surface_name = surface_name or "nauvis"
--player.teleport({destination_position.x-0.3, destination_position.y + 0.1}, surface_name)
player.teleport({destination_position.x, destination_position.y+0.1}, surface_name)
if player.mod_settings["Teleportation-sound-enabled"].value then
player.surface.create_entity({name = "teleport-sound-effect", position = player.position})
end
end

--Destroys enemies' projectiles neighboring to the player to prevent them from homing behavior after player's teleportation.
Expand Down Expand Up @@ -867,4 +873,4 @@ function Teleportation_RefreshBeaconsAndMakeTheirEntitiesUnoperable()
end
end
end
end
end
30 changes: 29 additions & 1 deletion data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,32 @@ require("prototypes.entity")
require("prototypes.technology")
require("prototypes.equipment")
require("prototypes.style")
require("prototypes.hotkey")
require("prototypes.hotkey")

data:extend({
{
type = "explosion",
name = "teleport-sound-effect",
flags = {"not-on-map"},
animations =
{
{
filename = "__Teleportation__/graphics/null.png",
priority = "low",
width = 32,
height = 32,
frame_count = 1,
line_length = 1,
animation_speed = 1
},
},
light = {intensity = 0, size = 0},
sound =
{
{
filename = "__Teleportation__/sound/teleport.ogg",
volume = 0.4
},
},
}
})
2 changes: 2 additions & 0 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ teleportation-hotkey-adjust-teleprovider=Open menu for linking Teleprovider
Teleportation-all-beacons-for-all=Common beacons
Teleportation-telelogistics-enabled=Enable telelogistics
Teleportation-straight-jump-ignores-collisions=Jump ignores collisions
Teleportation-sound-enabled=Enable teleportation sound effect
Teleportation-page-size=Page size

[mod-setting-description]
Teleportation-all-beacons-for-all=Everyone is allowed to use beacons of the opposite forces as well as his own.
Teleportation-telelogistics-enabled=You (and everyone in the world) can research Telelogistics technology and use Teleproviders to send items to the beacons and then put items out using inserters or loaders.
Teleportation-straight-jump-ignores-collisions=You can jump everywhere, despite the fact there is water, tree or building.\nNOTE: you can stuck or die in the destination point.
Teleportation-sound-enabled=Enable sound effect when using beacons or personal teleporter.
Teleportation-page-size=Maximal amount of rows shown on the page of the beacons list.
[item-name]
teleportation-equipment=Personal Teleporter
Expand Down
9 changes: 8 additions & 1 deletion settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ data:extend({
default_value = false,
per_user = true,
},
{
type = "bool-setting",
name = "Teleportation-sound-enabled",
setting_type = "runtime-per-user",
default_value = true,
per_user = true,
},
{
type = "int-setting",
name = "Teleportation-page-size",
Expand Down Expand Up @@ -95,4 +102,4 @@ Using in CONTROL.lua and in other code for reading:
GET: settings.global["setting-name"].value - current value of per-world setting
GET: set = settings.get_player_settings(LuaPlayer) - current values for per-player settings; then use set["setting-name"].value
GET: settings.player - default values
]]
]]
Binary file added sound/teleport.ogg
Binary file not shown.