Merge pull request #6710 from Cerebulon/precisionplacement

Ports precision placement of items
This commit is contained in:
Atermonera
2020-02-21 23:34:56 -08:00
committed by GitHub
43 changed files with 187 additions and 57 deletions
+13
View File
@@ -4,6 +4,7 @@
w_class = ITEMSIZE_NORMAL
var/image/blood_overlay = null //this saves our blood splatter overlay, which will be processed not to go over the edges of the sprite
var/randpixel = 6
var/abstract = 0
var/r_speed = 1.0
var/health = null
@@ -282,6 +283,8 @@
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
pixel_x = 0
pixel_y = 0
return
// called when this item is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called.
@@ -711,6 +714,16 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
/obj/item/proc/in_inactive_hand(mob/user)
return
//Used for selecting a random pixel placement, usually on initialize. Checks for pixel_x/y to not interfere with mapped in items.
/obj/item/proc/randpixel_xy()
if(!pixel_x && !pixel_y)
pixel_x = rand(-randpixel, randpixel)
pixel_y = rand(-randpixel, randpixel)
return TRUE
else
return FALSE
// My best guess as to why this is here would be that it does so little. Still, keep it under all the procs, for sanity's sake.
/obj/item/device
icon = 'icons/obj/device.dmi'
@@ -296,6 +296,7 @@
desc = "A desk lamp with an adjustable mount."
icon_state = "lamp"
force = 10
center_of_mass = list("x" = 13,"y" = 11)
brightness_on = 10 //TFF 27/11/19 - post refactor fix for intensity levels.
w_class = ITEMSIZE_LARGE
power_use = 0
@@ -306,6 +307,7 @@
/obj/item/device/flashlight/lamp/green
desc = "A classic green-shaded desk lamp."
icon_state = "lampgreen"
center_of_mass = list("x" = 15,"y" = 11)
brightness_on = 5
flashlight_colour = "#FFC58F"
+2
View File
@@ -13,6 +13,8 @@
gender = PLURAL
origin_tech = list(TECH_MATERIAL = 1)
icon = 'icons/obj/stacks.dmi'
randpixel = 7
center_of_mass = null
var/list/datum/stack_recipe/recipes
var/singular_name
var/amount = 1
@@ -14,13 +14,13 @@
name = "tile"
singular_name = "tile"
desc = "A non-descript floor tile"
randpixel = 7
w_class = ITEMSIZE_NORMAL
max_amount = 60
/obj/item/stack/tile/New()
..()
pixel_x = rand(-7, 7)
pixel_y = rand(-7, 7)
randpixel_xy()
/*
* Grass
@@ -359,14 +359,14 @@ CIGARETTE PACKETS ARE IN FANCY.DM
desc = "A manky old cigarette butt."
icon = 'icons/obj/clothing/masks.dmi'
icon_state = "cigbutt"
randpixel = 10
w_class = ITEMSIZE_TINY
slot_flags = SLOT_EARS
throwforce = 1
/obj/item/weapon/cigbutt/Initialize()
. = ..()
pixel_x = rand(-10,10)
pixel_y = rand(-10,10)
randpixel_xy()
transform = turn(transform,rand(0,360))
/obj/item/weapon/cigbutt/cigarbutt
@@ -70,10 +70,10 @@
origin_tech = list(TECH_MAGNET = 2, TECH_ILLEGAL = 2)
var/uses = 10
/obj/item/weapon/card/emag/resolve_attackby(atom/A, mob/user)
/obj/item/weapon/card/emag/resolve_attackby(atom/A, mob/user, var/click_parameters)
var/used_uses = A.emag_act(uses, user, src)
if(used_uses < 0)
return ..(A, user)
return ..(A, user, click_parameters)
uses -= used_uses
A.add_fingerprint(user)
@@ -4,6 +4,7 @@ var/global/list/ashtray_cache = list()
name = "ashtray"
icon = 'icons/obj/objects.dmi'
icon_state = "blank"
randpixel = 5
force_divisor = 0.1
thrown_force_divisor = 0.1
var/image/base_image
@@ -15,8 +16,7 @@ var/global/list/ashtray_cache = list()
qdel(src)
return
max_butts = round(material.hardness/5) //This is arbitrary but whatever.
src.pixel_y = rand(-5, 5)
src.pixel_x = rand(-6, 6)
randpixel_xy()
update_icon()
return
@@ -5,6 +5,7 @@
icon = 'icons/obj/shards.dmi'
desc = "Made of nothing. How does this even exist?" // set based on material, if this desc is visible it's a bug (shards default to being made of glass)
icon_state = "large"
randpixel = 8
sharp = 1
edge = 1
w_class = ITEMSIZE_SMALL
@@ -28,8 +29,7 @@
return
icon_state = "[material.shard_icon][pick("large", "medium", "small")]"
pixel_x = rand(-8, 8)
pixel_y = rand(-8, 8)
randpixel_xy()
update_icon()
if(material.shard_type)
@@ -24,6 +24,7 @@
desc = "It's just an ordinary box."
icon_state = "box"
item_state = "syringe_kit"
center_of_mass = list("x" = 13,"y" = 10)
var/foldable = /obj/item/stack/material/cardboard // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
max_w_class = ITEMSIZE_SMALL
max_storage_space = INVENTORY_BOX_SPACE
@@ -47,6 +47,7 @@
icon_state = "eggbox"
icon_type = "egg"
name = "egg box"
center_of_mass = list("x" = 16,"y" = 7)
storage_slots = 12
can_hold = list(
/obj/item/weapon/reagent_containers/food/snacks/egg,
@@ -7,6 +7,7 @@
icon_state = "donutbox"
name = "donut box"
desc = "A box that holds tasty donuts, if you're lucky."
center_of_mass = list("x" = 16,"y" = 9)
max_storage_space = ITEMSIZE_COST_SMALL * 6
can_hold = list(/obj/item/weapon/reagent_containers/food/snacks/donut)
foldable = /obj/item/stack/material/cardboard
@@ -4,6 +4,7 @@
icon = 'icons/obj/storage.dmi'
icon_state = "red"
item_state_slots = list(slot_r_hand_str = "toolbox_red", slot_l_hand_str = "toolbox_red")
center_of_mass = list("x" = 16,"y" = 11)
force = 10
throwforce = 10
throw_speed = 1
@@ -6,6 +6,7 @@
desc = "You can be totally screwwy with this."
icon = 'icons/obj/tools.dmi'
icon_state = "screwdriver"
center_of_mass = list("x" = 13,"y" = 7)
slot_flags = SLOT_BELT | SLOT_EARS
force = 6
w_class = ITEMSIZE_TINY
@@ -6,6 +6,7 @@
desc = "This cuts wires."
icon = 'icons/obj/tools.dmi'
icon_state = "cutters"
center_of_mass = list("x" = 18,"y" = 10)
slot_flags = SLOT_BELT
force = 6
throw_speed = 2
+2
View File
@@ -6,6 +6,8 @@
icon = 'icons/obj/items.dmi'
icon_state = "beartrap0"
desc = "A mechanically activated leg trap. Low-tech, but reliable. Looks like it could really hurt if you set it off."
randpixel = 0
center_of_mass = null
throwforce = 0
w_class = ITEMSIZE_NORMAL
origin_tech = list(TECH_MATERIAL = 1)
@@ -231,6 +231,7 @@
desc = "A collapsed roller bed that can be carried around."
icon = 'icons/obj/rollerbed.dmi'
icon_state = "folded_rollerbed"
center_of_mass = list("x" = 17,"y" = 7)
slot_flags = SLOT_BACK
w_class = ITEMSIZE_LARGE
var/rollertype = /obj/item/roller
@@ -6,6 +6,8 @@ var/global/list/stool_cache = list() //haha stool
desc = "Apply butt."
icon = 'icons/obj/furniture.dmi'
icon_state = "stool_preview" //set for the map
randpixel = 0
center_of_mass = null
force = 10
throwforce = 10
w_class = ITEMSIZE_HUGE