addons
parent
3f464faadd
commit
9d106b8fb0
14
init.lua
14
init.lua
|
@ -9,6 +9,7 @@ assert(loadfile(modpath.. "/settings.lua"))(modpath)
|
||||||
|
|
||||||
local _contexts = {}
|
local _contexts = {}
|
||||||
|
|
||||||
|
--Aunction for copy a table in deep (children too)
|
||||||
local function deepCopy(original)
|
local function deepCopy(original)
|
||||||
local copy = {}
|
local copy = {}
|
||||||
for k, v in pairs(original) do
|
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
|
if formname ~= "pickp:form" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
minetest.chat_send_all("TEST")
|
|
||||||
if not player then
|
if not player then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -171,7 +171,7 @@ local function stealth(clicker, clicked)
|
||||||
end
|
end
|
||||||
--1) CHECK THE DISTANCE
|
--1) CHECK THE DISTANCE
|
||||||
if not(check_distance(clicker, clicked)) then
|
if not(check_distance(clicker, clicked)) then
|
||||||
disable_stealth(clicker, true, "Failed Robbery!")
|
disable_stealth(clicker, true, "The victim has walked away!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
--2) CHECK THE ANGLE
|
--2) CHECK THE ANGLE
|
||||||
|
@ -198,6 +198,16 @@ local function stealth(clicker, clicked)
|
||||||
end
|
end
|
||||||
--DETECTED!
|
--DETECTED!
|
||||||
disable_stealth(clicker, true, "Failed Robbery!")
|
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
|
end
|
||||||
|
|
||||||
local function pickpocketing(clicker, clicked)
|
local function pickpocketing(clicker, clicked)
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
# textdomain: pickp
|
# textdomain: pickp
|
||||||
Failed robbery!=¡Robo fallido!
|
Failed robbery!=¡Robo fallido!
|
||||||
|
Aborted robbery!=¡Robo abortado!
|
||||||
Too far to steal!=¡Demasiado lejos para robarle!
|
Too far to steal!=¡Demasiado lejos para robarle!
|
||||||
The player has moved his items!=El jugador a cambiado sus objetos de sitio
|
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!
|
||||||
|
|
|
@ -32,3 +32,7 @@ zone_2_3_limit = 90
|
||||||
zone1_stealth_ratio = 0.2
|
zone1_stealth_ratio = 0.2
|
||||||
zone2_stealth_ratio = 0.4
|
zone2_stealth_ratio = 0.4
|
||||||
zone3_stealth_ratio = 0.9
|
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
|
||||||
|
|
|
@ -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.zone1_stealth_ratio = tonumber(settings:get("zone1_stealth_ratio"))
|
||||||
pickp.settings.zone2_stealth_ratio = tonumber(settings:get("zone2_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.zone3_stealth_ratio = tonumber(settings:get("zone3_stealth_ratio"))
|
||||||
|
pickp.settings.warning_failed_thief_ratio = tonumber(settings:get("warning_failed_thief_ratio"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue