carve
What a knife takes off a corpse: the carve tables of templates/carves.
Source: src/Moongate.Server.Ultima/Modules/CarveModule.cs
Functions
Section titled “Functions”corpse
Section titled “corpse”carve.corpse(corpse, carver) -> stringCarves the corpse for the mobile: rolls the carve table the corpse kept, asks on_carving of the corpse's script, puts what is left into the corpse and marks it carved, once. Gives 'carved' (it gave items), 'nothing_useful' (no table or an empty roll: it is carved all the same), 'already_carved', 'not_carvable' (no corpse, a player's or a pet's corpse, a corpse not lying on the ground, an unknown serial) or 'cancelled' (on_carving answered false). What does not fit the corpse is laid on the ground at its tile. Range and what the carver is told are the script's.
A butcher’s knife that carves the corpse a player picks, within 2 tiles, and tells it how it went:
local geo = require("common.geo")
function butcher_knife.on_use(serial, user) target.pick(user, function(picked) if picked.kind ~= "object" then return end
local here = mobile.location(user)
if not geo.within(here, item.location(picked.serial), 2) then mobile.message(user, "That is too far away.")
return end
local result = carve.corpse(picked.serial, user)
if result == "nothing_useful" or result == "already_carved" then mobile.message(user, "There is nothing useful to carve.") elseif result ~= "carved" then mobile.message(user, "You cannot carve that.") end end)
return trueend| Parameter | Type | Default |
|---|---|---|
corpse | integer | |
carver | integer |
Returns string.
Made with ❤️ by Tom
