-
-
Save Andrey2470T/44bf7cb5c01821fef9cf1f72bc286286 to your computer and use it in GitHub Desktop.
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
minetest.register_craftitem("medicine:toxic_apple", { | |
description = "Toxic Apple", | |
inventory_image = "toxic_apple.png", | |
on_use = function (itemstack, user, pointed_thing) | |
itemstack:take_item() | |
local player_pos = user:get_pos() | |
diseases.create_disease(user, "poisoning_disease", | |
time = { -- line:460 | |
st_time = 0, | |
expired_time = 0 | |
}, | |
disease_def = { | |
physics_override = { | |
speed = 0.4, | |
jump = 0.4 | |
}, | |
texture_change = "character_with_green_face.png", | |
healthbar_texture = "poisonous_heart.png", | |
particlespawner = { | |
particlespawner_id = "poisonous_particlespawner", | |
number = 4, | |
def = { | |
{1, 1, 1, 1}, | |
{2, 2, 2, 2}, | |
{{{player_pos.x + 0.2, player_pos.y + 1.5, player_pos.z + 0.2}, | |
{player_pos.x - 0.2, player_pos.y + 1.5, player_pos.z - 0.2}, | |
{player_pos.x - 0.2, player_pos.y + 1.5, player_pos.z + 0.2}, | |
{player_pos.x + 0.2, player_pos.y + 1.5, player_pos.z - 0.2} | |
}, | |
{{player_pos.x + 0.5, player_pos.y + 1.5, player_pos.z + 0.5}, | |
{player_pos.x - 0.5, player_pos.y + 1.5, player_pos.z - 0.5}, | |
{player_pos.x - 0.5, player_pos.y + 1.5, player_pos.z + 0.5}, | |
{player_pos.x + 0.5, player_pos.y + 1.5, player_pos.z - 0.5} | |
} | |
}, | |
{{{0, 0.2, 0}, | |
{0, 0.2, 0}, | |
{0, 0.2, 0}, | |
{0, 0.2, 0} | |
}, | |
{{0, 0.4, 0}, | |
{0, 0.4, 0}, | |
{0, 0.4, 0}, | |
{0, 0.4, 0} | |
} | |
}, | |
{{{0, 0.2, 0}, | |
{0, 0.2, 0}, | |
{0, 0.2, 0}, | |
{0, 0.2, 0} | |
}, | |
{{0, 0.4, 0}, | |
{0, 0.4, 0}, | |
{0, 0.4, 0}, | |
{0, 0.4, 0} | |
} | |
}, | |
{{2, 2, 2, 2}, | |
{2, 2, 2, 2} | |
}, | |
{{10, 10, 10, 10}, | |
{12, 12, 12, 12} | |
}, | |
{true, true, true, true}, | |
{true, true, true, true}, | |
{"poisonous_effect.png", "poisonous_effect.png", "poisonous_effect.png", "poisonous_effect.png"}, | |
{user:get_player_name(), user:get_player_name(), user:get_player_name(), user:get_player_name()} | |
} | |
}, | |
damage_params = { | |
time = 20, | |
interval = {min = 2, max = 5}, | |
amount = {min = 1, max = 3} | |
} | |
}) | |
return itemstack | |
end | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got an error after function call:
"Failed to load and run script from /home/user/opt/minetest/bin/../mods/medicine/init.lua:
/home/user/opt/minetest/bin/../mods/medicine/diseases.lua:460: ')' expected (to close '(' at line 459) near '=' stack traceback:
[C]:in function 'dofile'"