master
runs 2021-01-02 00:03:06 +01:00
parent 3f464faadd
commit 9d106b8fb0
4 changed files with 22 additions and 2 deletions

View File

@ -9,6 +9,7 @@ assert(loadfile(modpath.. "/settings.lua"))(modpath)
local _contexts = {}
--Aunction for copy a table in deep (children too)
local function deepCopy(original)
local copy = {}
for k, v in pairs(original) do
@ -126,7 +127,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "pickp:form" then
return
end
minetest.chat_send_all("TEST")
if not player then
return
end
@ -171,7 +171,7 @@ local function stealth(clicker, clicked)
end
--1) CHECK THE DISTANCE
if not(check_distance(clicker, clicked)) then
disable_stealth(clicker, true, "Failed Robbery!")
disable_stealth(clicker, true, "The victim has walked away!")
return
end
--2) CHECK THE ANGLE
@ -198,6 +198,16 @@ local function stealth(clicker, clicked)
end
--DETECTED!
disable_stealth(clicker, true, "Failed Robbery!")
--DETECTION WARNING
local msg = ""
if math.random(0,1) <= pickp.settings["warning_failed_thief_ratio"] then
msg = S("Someone has tried to steal from you!")
else
msg = clicked_name.." "..S("tried to steal from you!")
end
if not (msg == "") then
minetest.chat_send_player(clicked_name, msg)
end
end
local function pickpocketing(clicker, clicked)

View File

@ -1,4 +1,8 @@
# textdomain: pickp
Failed robbery!=¡Robo fallido!
Aborted robbery!=¡Robo abortado!
Too far to steal!=¡Demasiado lejos para robarle!
The player has moved his items!=El jugador a cambiado sus objetos de sitio
Someone has tried to steal from you!=¡Alguien ha intentado robarte!
tried to steal from you!=intentó robarte!
The victim has walked away!=¡La victima se ha alejado!

View File

@ -32,3 +32,7 @@ zone_2_3_limit = 90
zone1_stealth_ratio = 0.2
zone2_stealth_ratio = 0.4
zone3_stealth_ratio = 0.9
#Detection Warning (0-1)
##Chance to info the victim of the thief's name
warning_failed_thief_ratio = 0.5

View File

@ -14,3 +14,5 @@ pickp.settings.zone_2_3_limit = tonumber(settings:get("zone_2_3_limit"))
pickp.settings.zone1_stealth_ratio = tonumber(settings:get("zone1_stealth_ratio"))
pickp.settings.zone2_stealth_ratio = tonumber(settings:get("zone2_stealth_ratio"))
pickp.settings.zone3_stealth_ratio = tonumber(settings:get("zone3_stealth_ratio"))
pickp.settings.warning_failed_thief_ratio = tonumber(settings:get("warning_failed_thief_ratio"))