195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
...
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
...
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
|
end
a.suit[name] = img
end
end
end
minetest.register_tool(id, {
short_description = def.name;
description = starlit.ui.tooltip {
title = def.name;
desc = def.desc;
color = lib.color(.1, .7, 1);
};
groups = {
................................................................................
};
starlit_suit_canisters = {
suitSlot = true;
itemClass = 'canister';
};
}
minetest.register_allow_player_inventory_action(function(luser, act, inv, p)
local user = starlit.activeUsers[luser:get_player_name()]
local function grp(i,g)
return minetest.get_item_group(i:get_name(), g) ~= 0
end
local function checkBaseRestrictions(list)
local restrictions = slotProps[list]
if not restrictions then return nil, true end
if restrictions.suitSlot then
if user:naked() then return restrictions, false end
end
................................................................................
return true
end
local function itemCanLeave(item, list)
local rst, ok = checkBaseRestrictions(list)
if not ok then return false end
if rst == nil then return true end
if minetest.get_item_group(item:get_name(), 'specialInventory') then
end
if rst.maintenanceNode then return false end
return true
end
................................................................................
if not itemFits(p.stack, p.listname) then return 0 end
elseif act == 'take' then
if not itemCanLeave(p.stack, p.listname) then return 0 end
end
return true
end)
minetest.register_on_player_inventory_action(function(luser, act, inv, p)
local user = starlit.activeUsers[luser:get_player_name()]
local function slotChange(slot,a,item)
local s = slotProps[slot]
if slot == 'starlit_suit' then
user:updateSuit()
if user:naked() then
starlit.type.suit.purgeInventories(user.entity)
|
|
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
...
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
...
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
|
end
a.suit[name] = img
end
end
end
core.register_tool(id, {
short_description = def.name;
description = starlit.ui.tooltip {
title = def.name;
desc = def.desc;
color = lib.color(.1, .7, 1);
};
groups = {
................................................................................
};
starlit_suit_canisters = {
suitSlot = true;
itemClass = 'canister';
};
}
core.register_allow_player_inventory_action(function(luser, act, inv, p)
local user = starlit.activeUsers[luser:get_player_name()]
local function grp(i,g)
return core.get_item_group(i:get_name(), g) ~= 0
end
local function checkBaseRestrictions(list)
local restrictions = slotProps[list]
if not restrictions then return nil, true end
if restrictions.suitSlot then
if user:naked() then return restrictions, false end
end
................................................................................
return true
end
local function itemCanLeave(item, list)
local rst, ok = checkBaseRestrictions(list)
if not ok then return false end
if rst == nil then return true end
if core.get_item_group(item:get_name(), 'specialInventory') then
end
if rst.maintenanceNode then return false end
return true
end
................................................................................
if not itemFits(p.stack, p.listname) then return 0 end
elseif act == 'take' then
if not itemCanLeave(p.stack, p.listname) then return 0 end
end
return true
end)
core.register_on_player_inventory_action(function(luser, act, inv, p)
local user = starlit.activeUsers[luser:get_player_name()]
local function slotChange(slot,a,item)
local s = slotProps[slot]
if slot == 'starlit_suit' then
user:updateSuit()
if user:naked() then
starlit.type.suit.purgeInventories(user.entity)
|