Grających: 0
Pobierz
Policyjny pościg pod kolejką nadziemną w Mafia II

Wiki

Interiors

Mafia II streams its interiors in at their doors, the way GTA loads IPLs: gas stations, Joe's Diner and the other diners, the bars (Lone Star, Hill of Tara, Illia's, Freddy's), clothes and gun shops, Harry's, Giuseppe's, the barbers, Bruski's scrapyard, the car showroom, Vito's and Joe's apartments, the Falcone mansion and more - 49 places with 355 doors.

In MafiaM they are free by default: every door opens normally and nobody runs them - no shopkeepers behind the counters, no shop menus, no tills to rob. Use them as your mode likes: a shop of your own (with your own menu), a police station, a house.

world.setInteriors("free")     -- the default
world.setInteriors("closed")   -- all shut
world.setInteriors("game")     -- as in single player: shopkeepers, buying, robberies

Or in m2o_server.ini: [world] interiors=free.

Locking doors

A door is found by where it is. The client knows the doors around the player; the server locks one for everybody:

-- client: the door in front of the player
local x, y, z = player.getPosition()
local dx, dy, dz, locked = world.getNearestDoor(x, y, z, 2)
if dx then events.emitServer("toggleDoor", dx, dy, dz, not locked) end

-- server
events.onClient("toggleDoor", function(player, x, y, z, lock)
    if ownsHouseAt(player, x, y, z) then world.setDoorLocked(x, y, z, lock) end
end)

Passages

Some of the game's interiors aren't joined to the street: the game fades the screen at their door and moves you. world.addPassage does that for any two places - a door into an interior, an elevator, a showroom out of town:

world.addPassage{ from = {x, y, z}, to = {x, y, z, heading}, text = "Freddy's Bar" }          -- [E] at the door
world.addPassage{ from = {x, y, z}, to = {x, y, z, heading}, key = false }                    -- just walk in
events.on("playerPassage", function(player, id) ... end)                                        -- who went through

A locked door can't be opened or kicked in. world.resetDoor(x, y, z) gives it back to the interiors mode; a resource's locks are undone when it stops.