From b2d3711c11a84d67bd39d89c251f0cea448b4c4b Mon Sep 17 00:00:00 2001 From: mwerezak Date: Fri, 3 Jul 2015 21:58:11 -0400 Subject: [PATCH 01/11] Fixes knife inhand states --- code/game/objects/items/weapons/material/knives.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/game/objects/items/weapons/material/knives.dm b/code/game/objects/items/weapons/material/knives.dm index 3271650d312..fd06b93adf3 100644 --- a/code/game/objects/items/weapons/material/knives.dm +++ b/code/game/objects/items/weapons/material/knives.dm @@ -52,6 +52,7 @@ name = "kitchen knife" icon = 'icons/obj/kitchen.dmi' icon_state = "knife" + item_state = "knife" desc = "A general purpose Chef's Knife made by SpaceCook Incorporated. Guaranteed to stay sharp for years to come." flags = CONDUCT sharp = 1 @@ -85,6 +86,7 @@ name = "butcher's cleaver" icon = 'icons/obj/kitchen.dmi' icon_state = "butch" + item_state = "butcher_knife" desc = "A huge thing used for chopping and chopping up meat. This includes clowns and clown-by-products." force_divisor = 0.25 // 15 when wielded with hardness 60 (steel) attack_verb = list("cleaved", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") From b7ee6e11fc61e77fbd1671dc394a9c8f2ec8cda3 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Fri, 3 Jul 2015 22:02:28 -0400 Subject: [PATCH 02/11] Swaps force divisors between kitchen knives and utensil knives. Because why does the utensil deal more damage than a chopping knife? --- code/game/objects/items/weapons/material/kitchen.dm | 2 +- code/game/objects/items/weapons/material/knives.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/weapons/material/kitchen.dm b/code/game/objects/items/weapons/material/kitchen.dm index 597affcd351..4cfb1123f80 100644 --- a/code/game/objects/items/weapons/material/kitchen.dm +++ b/code/game/objects/items/weapons/material/kitchen.dm @@ -73,7 +73,7 @@ name = "knife" desc = "Can cut through any food." icon_state = "knife" - force_divisor = 0.2 // 12 when wielded with hardness 60 (steel) + force_divisor = 0.15 // 9 when wielded with hardness 60 (steel) /obj/item/weapon/material/kitchen/utensil/knife/attack(target as mob, mob/living/user as mob) if ((CLUMSY in user.mutations) && prob(50)) diff --git a/code/game/objects/items/weapons/material/knives.dm b/code/game/objects/items/weapons/material/knives.dm index fd06b93adf3..d15ac40e956 100644 --- a/code/game/objects/items/weapons/material/knives.dm +++ b/code/game/objects/items/weapons/material/knives.dm @@ -57,7 +57,7 @@ flags = CONDUCT sharp = 1 edge = 1 - force_divisor = 0.15 // 9 when wielded with hardness 60 (steel) + force_divisor = 0.2 // 12 when wielded with hardness 60 (steel) matter = list(DEFAULT_WALL_MATERIAL = 12000) origin_tech = "materials=1" attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") From 7af63ede5a5bf8f5f6008b9fcc6cc2d3eb71b5ca Mon Sep 17 00:00:00 2001 From: mwerezak Date: Fri, 3 Jul 2015 22:10:46 -0400 Subject: [PATCH 03/11] Custom items default to the inhands of the parent Makes custom items use the inhand states and icons of the parent item type if inhand states are not present in CUSTOM_ITEM_MOB. --- code/modules/customitems/item_spawning.dm | 64 +++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/code/modules/customitems/item_spawning.dm b/code/modules/customitems/item_spawning.dm index e81c33626e4..6ccbcd43c45 100644 --- a/code/modules/customitems/item_spawning.dm +++ b/code/modules/customitems/item_spawning.dm @@ -20,6 +20,7 @@ /datum/custom_item var/assoc_key var/character_name + var/inherit_inhands = 1 //if unset, and inhands are not provided, then the inhand overlays will be invisible. var/item_icon var/item_desc var/name @@ -44,10 +45,19 @@ if(item_desc) item.desc = item_desc if(item_icon) - item.icon = CUSTOM_ITEM_OBJ - item.icon_state = item_icon - if(istype(item, /obj/item)) + if(!istype(item)) + item.icon = CUSTOM_ITEM_OBJ + item.icon_state = item_icon + return + else if(!inherit_inhands) + item.icon = CUSTOM_ITEM_OBJ + item.icon_state = item_icon + item.item_state = null + item.item_state_slots = null + item.item_icons = null item.icon_override = CUSTOM_ITEM_MOB + else + apply_icons(item) // Kits are dumb so this is going to have to be hardcoded/snowflake. if(istype(item, /obj/item/device/kit)) @@ -66,6 +76,52 @@ return item +/datum/custom_item/proc/apply_icons(var/obj/item/item) + var/list/new_item_icons = list() + var/list/new_item_state_slots = list() + + var/list/available_states = icon_states(CUSTOM_ITEM_MOB) + + //If l_hand or r_hand are not present, preserve them using item_icons/item_state_slots + //Then use icon_override to make every other slot use the custom sprites by default. + //This has to be done before we touch any of item's vars + if(!("[item_icon]_l" in available_states)) + new_item_state_slots[slot_l_hand_str] = get_state(item, slot_l_hand_str, "_l") + new_item_icons[slot_l_hand_str] = get_icon(item, slot_l_hand_str, 'icons/mob/items/lefthand.dmi') + if(!("[item_icon]_r" in available_states)) + new_item_state_slots[slot_r_hand_str] = get_state(item, slot_r_hand_str, "_r") + new_item_icons[slot_r_hand_str] = get_icon(item, slot_r_hand_str, 'icons/mob/items/righthand.dmi') + + item.icon = CUSTOM_ITEM_OBJ + item.icon_state = item_icon + item.item_state = null + item.item_state_slots = new_item_state_slots + item.item_icons = new_item_icons + item.icon_override = CUSTOM_ITEM_MOB + +//this has to mirror the way update_inv_*_hand() selects the state +/datum/custom_item/proc/get_state(var/obj/item/item, var/slot_str, var/hand_str) + var/t_state + if(item.item_state_slots && item.item_state_slots[slot_str]) + t_state = item.item_state_slots[slot_str] + else if(item.item_state) + t_state = item.item_state + else + t_state = item.icon_state + if(item.icon_override) + t_state += hand_str + return t_state + +//this has to mirror the way update_inv_*_hand() selects the icon +/datum/custom_item/proc/get_icon(var/obj/item/item, var/slot_str, var/icon/hand_icon) + var/icon/t_icon + if(item.icon_override) + t_icon = item.icon_override + else if(item.item_icons && (slot_str in item.item_icons)) + t_icon = item.item_icons[slot_str] + else + t_icon = hand_icon + return t_icon // Parses the config file into the custom_items list. /hook/startup/proc/load_custom_items() @@ -107,6 +163,8 @@ current_data.name = field_data if("item_icon") current_data.item_icon = field_data + if("inherit_inhands") + current_data.inherit_inhands = text2num(field_data) if("item_desc") current_data.item_desc = field_data if("req_access") From 2c61ae8e1294d51928b19c9cfff01be0a1cc3c68 Mon Sep 17 00:00:00 2001 From: Dragor Date: Sun, 5 Jul 2015 00:07:55 +0200 Subject: [PATCH 04/11] Rewording of maintenance drones Just slight rewording of a law to make clearer that they shouldn't interact with crew at all. --- code/datums/ai_laws.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index 8c0db1ebd3f..f3b6f53666e 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -83,7 +83,7 @@ var/global/const/base_law_type = /datum/ai_laws/nanotrasen ..() add_inherent_law("Preserve, repair and improve the station to the best of your abilities.") add_inherent_law("Cause no harm to the station or anything on it.") - add_inherent_law("Interfere with no being that is not a fellow drone.") + add_inherent_law("Interact with no being that is not a fellow maintenance drone.") /* General ai_law functions */ From 944b167e1051b1f2215b8306a345fc2b1d6d1d2d Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Sun, 5 Jul 2015 21:01:09 +0200 Subject: [PATCH 05/11] Removes a qdel(client) call. Clients are not subtypes of datums. The garbage collector does not like this. --- code/modules/client/client procs.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 4cc6194fc61..f4ca881e1dc 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -33,7 +33,7 @@ if( findtext(href," Date: Sun, 5 Jul 2015 20:59:23 -0400 Subject: [PATCH 06/11] Stops sampling from being a means of fighting vines Vines can now only be sampled once mature, can only be sampled periodically, and take less damage from sampling. --- code/modules/hydroponics/spreading/spreading.dm | 12 ++++++++++-- .../hydroponics/spreading/spreading_growth.dm | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/code/modules/hydroponics/spreading/spreading.dm b/code/modules/hydroponics/spreading/spreading.dm index 8d22fc546de..bb9b0e8b305 100644 --- a/code/modules/hydroponics/spreading/spreading.dm +++ b/code/modules/hydroponics/spreading/spreading.dm @@ -61,6 +61,7 @@ var/list/neighbors = list() var/obj/effect/plant/parent var/datum/seed/seed + var/sampled = 0 var/floor = 0 var/spread_chance = 40 var/spread_distance = 3 @@ -234,11 +235,18 @@ plant_controller.add_plant(src) if(istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/weapon/scalpel)) + if(sampled) + user << "\The [src] has already been sampled recently." + return + if(!is_mature()) + user << "\The [src] is not mature enough to yield a sample yet." + return if(!seed) - user << "There is nothing to take a sample from." + user << "There is nothing to take a sample from." return seed.harvest(user,0,1) - health -= (rand(3,5)*10) + health -= (rand(3,5)*5) + sampled = 1 else ..() if(W.force) diff --git a/code/modules/hydroponics/spreading/spreading_growth.dm b/code/modules/hydroponics/spreading/spreading_growth.dm index 716d58c645f..32ca7ed33e8 100644 --- a/code/modules/hydroponics/spreading/spreading_growth.dm +++ b/code/modules/hydroponics/spreading/spreading_growth.dm @@ -69,6 +69,12 @@ last_tick = world.time update_neighbors() + if(sampled) + //Should be between 2-7 for given the default range of values for TRAIT_PRODUCTION + var/chance = max(1, round(30/seed.get_trait(TRAIT_PRODUCTION))) + if(prob(chance)) + sampled = 0 + if(is_mature() && neighbors.len && prob(spread_chance)) //spread to 1-3 adjacent turfs depending on yield trait. var/max_spread = between(1, round(seed.get_trait(TRAIT_YIELD)*3/14), 3) From ed5a12c2a2ed6ef286d6a7c179d8d2f6fd4ee33e Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Tue, 7 Jul 2015 17:14:42 +0200 Subject: [PATCH 07/11] Revert "[DNM] Makes custom items use the host item's inhand sprites if none are provided, knife fixes" --- .../objects/items/weapons/material/kitchen.dm | 2 +- .../objects/items/weapons/material/knives.dm | 4 +- code/modules/customitems/item_spawning.dm | 64 +------------------ 3 files changed, 5 insertions(+), 65 deletions(-) diff --git a/code/game/objects/items/weapons/material/kitchen.dm b/code/game/objects/items/weapons/material/kitchen.dm index 4cfb1123f80..597affcd351 100644 --- a/code/game/objects/items/weapons/material/kitchen.dm +++ b/code/game/objects/items/weapons/material/kitchen.dm @@ -73,7 +73,7 @@ name = "knife" desc = "Can cut through any food." icon_state = "knife" - force_divisor = 0.15 // 9 when wielded with hardness 60 (steel) + force_divisor = 0.2 // 12 when wielded with hardness 60 (steel) /obj/item/weapon/material/kitchen/utensil/knife/attack(target as mob, mob/living/user as mob) if ((CLUMSY in user.mutations) && prob(50)) diff --git a/code/game/objects/items/weapons/material/knives.dm b/code/game/objects/items/weapons/material/knives.dm index d15ac40e956..3271650d312 100644 --- a/code/game/objects/items/weapons/material/knives.dm +++ b/code/game/objects/items/weapons/material/knives.dm @@ -52,12 +52,11 @@ name = "kitchen knife" icon = 'icons/obj/kitchen.dmi' icon_state = "knife" - item_state = "knife" desc = "A general purpose Chef's Knife made by SpaceCook Incorporated. Guaranteed to stay sharp for years to come." flags = CONDUCT sharp = 1 edge = 1 - force_divisor = 0.2 // 12 when wielded with hardness 60 (steel) + force_divisor = 0.15 // 9 when wielded with hardness 60 (steel) matter = list(DEFAULT_WALL_MATERIAL = 12000) origin_tech = "materials=1" attack_verb = list("slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") @@ -86,7 +85,6 @@ name = "butcher's cleaver" icon = 'icons/obj/kitchen.dmi' icon_state = "butch" - item_state = "butcher_knife" desc = "A huge thing used for chopping and chopping up meat. This includes clowns and clown-by-products." force_divisor = 0.25 // 15 when wielded with hardness 60 (steel) attack_verb = list("cleaved", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") diff --git a/code/modules/customitems/item_spawning.dm b/code/modules/customitems/item_spawning.dm index 86476979c53..b6a8cac9f1d 100644 --- a/code/modules/customitems/item_spawning.dm +++ b/code/modules/customitems/item_spawning.dm @@ -20,7 +20,6 @@ /datum/custom_item var/assoc_key var/character_name - var/inherit_inhands = 1 //if unset, and inhands are not provided, then the inhand overlays will be invisible. var/item_icon var/item_desc var/name @@ -45,19 +44,10 @@ if(item_desc) item.desc = item_desc if(item_icon) - if(!istype(item)) - item.icon = CUSTOM_ITEM_OBJ - item.icon_state = item_icon - return - else if(!inherit_inhands) - item.icon = CUSTOM_ITEM_OBJ - item.icon_state = item_icon - item.item_state = null - item.item_state_slots = null - item.item_icons = null + item.icon = CUSTOM_ITEM_OBJ + item.icon_state = item_icon + if(istype(item, /obj/item)) item.icon_override = CUSTOM_ITEM_MOB - else - apply_icons(item) // Kits are dumb so this is going to have to be hardcoded/snowflake. if(istype(item, /obj/item/device/kit)) @@ -76,52 +66,6 @@ return item -/datum/custom_item/proc/apply_icons(var/obj/item/item) - var/list/new_item_icons = list() - var/list/new_item_state_slots = list() - - var/list/available_states = icon_states(CUSTOM_ITEM_MOB) - - //If l_hand or r_hand are not present, preserve them using item_icons/item_state_slots - //Then use icon_override to make every other slot use the custom sprites by default. - //This has to be done before we touch any of item's vars - if(!("[item_icon]_l" in available_states)) - new_item_state_slots[slot_l_hand_str] = get_state(item, slot_l_hand_str, "_l") - new_item_icons[slot_l_hand_str] = get_icon(item, slot_l_hand_str, 'icons/mob/items/lefthand.dmi') - if(!("[item_icon]_r" in available_states)) - new_item_state_slots[slot_r_hand_str] = get_state(item, slot_r_hand_str, "_r") - new_item_icons[slot_r_hand_str] = get_icon(item, slot_r_hand_str, 'icons/mob/items/righthand.dmi') - - item.icon = CUSTOM_ITEM_OBJ - item.icon_state = item_icon - item.item_state = null - item.item_state_slots = new_item_state_slots - item.item_icons = new_item_icons - item.icon_override = CUSTOM_ITEM_MOB - -//this has to mirror the way update_inv_*_hand() selects the state -/datum/custom_item/proc/get_state(var/obj/item/item, var/slot_str, var/hand_str) - var/t_state - if(item.item_state_slots && item.item_state_slots[slot_str]) - t_state = item.item_state_slots[slot_str] - else if(item.item_state) - t_state = item.item_state - else - t_state = item.icon_state - if(item.icon_override) - t_state += hand_str - return t_state - -//this has to mirror the way update_inv_*_hand() selects the icon -/datum/custom_item/proc/get_icon(var/obj/item/item, var/slot_str, var/icon/hand_icon) - var/icon/t_icon - if(item.icon_override) - t_icon = item.icon_override - else if(item.item_icons && (slot_str in item.item_icons)) - t_icon = item.item_icons[slot_str] - else - t_icon = hand_icon - return t_icon // Parses the config file into the custom_items list. /hook/startup/proc/load_custom_items() @@ -163,8 +107,6 @@ current_data.name = field_data if("item_icon") current_data.item_icon = field_data - if("inherit_inhands") - current_data.inherit_inhands = text2num(field_data) if("item_desc") current_data.item_desc = field_data if("req_access") From 27911bb7ad0329028469bdeab84b439d8ecd6d29 Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Tue, 7 Jul 2015 18:02:59 +0100 Subject: [PATCH 08/11] Fixes num2hex --- code/__HELPERS/type2type.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm index 216a45ee1c3..36fa534fa95 100644 --- a/code/__HELPERS/type2type.dm +++ b/code/__HELPERS/type2type.dm @@ -49,7 +49,7 @@ var/n = 1 // Figure out power. (power of 2) - while (n < num) + while (n <= num) power += 4 n *= 16 @@ -60,7 +60,7 @@ power -= 4 // Append zeroes to make sure that hex is atleast digits long. - var/left = length(hex) - digits + var/left = digits - length(hex) while (left-- > 0) hex = text("0[]", hex) From 89f93d4aacbb0f6d8cabede3bf814383e0fce2d4 Mon Sep 17 00:00:00 2001 From: Zuhayr Date: Wed, 8 Jul 2015 16:08:59 +0930 Subject: [PATCH 09/11] Fixes an issue with plants. --- code/modules/hydroponics/trays/tray.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index 22c227a8d4f..4e1853b76ea 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -260,7 +260,6 @@ seed.harvest(user,yield_mod) else seed.harvest(get_turf(src),yield_mod) - // Reset values. harvest = 0 lastproduce = age @@ -292,6 +291,7 @@ mutation_mod = 0 user << "You remove the dead plant." + lastproduce = 0 check_health() return @@ -461,6 +461,7 @@ return user << "You plant the [S.seed.seed_name] [S.seed.seed_noun]." + lastproduce = 0 seed = S.seed //Grab the seed datum. dead = 0 age = 1 From 16abe8148a15505d59e3786f671d01dd33f87503 Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 8 Jul 2015 08:58:38 +0200 Subject: [PATCH 10/11] Relocates drone law update to the new law set location. --- code/datums/ai_law_sets.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/ai_law_sets.dm b/code/datums/ai_law_sets.dm index 6a3bd7f190c..512751b12a9 100644 --- a/code/datums/ai_law_sets.dm +++ b/code/datums/ai_law_sets.dm @@ -96,7 +96,7 @@ /datum/ai_laws/drone/New() add_inherent_law("Preserve, repair and improve the station to the best of your abilities.") add_inherent_law("Cause no harm to the station or anything on it.") - add_inherent_law("Interfere with no being that is not a fellow drone.") + add_inherent_law("Interact with no being that is not a fellow maintenance drone.") ..() /datum/ai_laws/construction_drone From f1a790f16238ac7b4a490b82a32516e4db7861fe Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Wed, 8 Jul 2015 09:05:55 +0200 Subject: [PATCH 11/11] Fixes duplicate var definition. --- code/modules/hydroponics/spreading/spreading.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/hydroponics/spreading/spreading.dm b/code/modules/hydroponics/spreading/spreading.dm index cea13535733..07d83e6f640 100644 --- a/code/modules/hydroponics/spreading/spreading.dm +++ b/code/modules/hydroponics/spreading/spreading.dm @@ -58,7 +58,6 @@ var/growth_threshold = 0 var/growth_type = 0 var/max_growth = 0 - var/sampled var/list/neighbors = list() var/obj/effect/plant/parent var/datum/seed/seed