Skip to content

Commit 6040eeb

Browse files
authored
Improve modsuit code (#976)
* i cant spell * ports * re-add digi support * fix * fix
1 parent 17761ca commit 6040eeb

32 files changed

+1204
-683
lines changed

code/__DEFINES/dcs/signals/signals_mod.dm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
//MODsuit signals
22
/// Called when a module is selected to be the active one from on_select(obj/item/mod/module/module)
33
#define COMSIG_MOD_MODULE_SELECTED "mod_module_selected"
4+
/// Called when a MOD user deploys one or more of its parts.
5+
#define COMSIG_MOD_DEPLOYED "mod_deployed"
6+
/// Called when a MOD user retracts one or more of its parts.
7+
#define COMSIG_MOD_RETRACTED "mod_retracted"
8+
/// Called when a MOD deploys a part.
9+
#define COMSIG_MOD_PART_DEPLOYED "mod_part_deployed"
10+
/// Called when a MOD retracts a part.
11+
#define COMSIG_MOD_PART_RETRACTED "mod_part_retracted"
412
/// Called when a MOD activation is called from toggle_activate(mob/user)
513
#define COMSIG_MOD_ACTIVATE "mod_activate"
614
/// Cancels the suit's activation

code/__DEFINES/mod.dm

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,17 @@
1717
#define MODULE_ACTIVE 3
1818

1919
//Defines used by the theme for clothing flags and similar
20-
#define CONTROL_LAYER "control_layer"
21-
#define HELMET_FLAGS "helmet_flags"
22-
#define CHESTPLATE_FLAGS "chestplate_flags"
23-
#define GAUNTLETS_FLAGS "gauntlets_flags"
24-
#define BOOTS_FLAGS "boots_flags"
25-
2620
#define UNSEALED_LAYER "unsealed_layer"
21+
#define SEALED_LAYER "sealed_layer"
2722
#define UNSEALED_CLOTHING "unsealed_clothing"
2823
#define SEALED_CLOTHING "sealed_clothing"
2924
#define UNSEALED_INVISIBILITY "unsealed_invisibility"
3025
#define SEALED_INVISIBILITY "sealed_invisibility"
3126
#define UNSEALED_COVER "unsealed_cover"
3227
#define SEALED_COVER "sealed_cover"
3328
#define CAN_OVERSLOT "can_overslot"
29+
#define UNSEALED_MESSAGE "unsealed_message"
30+
#define SEALED_MESSAGE "sealed_message"
3431

3532
//Defines used to override MOD clothing's icon and worn icon files in the skin.
3633
#define MOD_ICON_OVERRIDE "mod_icon_override"
@@ -42,6 +39,16 @@
4239
#define MODLINK_FREQ_CHARLIE "CHRL"
4340
#define MODLINK_FREQ_CENTCOM "CC"
4441

42+
//Default text for different messages for the user.
43+
#define HELMET_UNSEAL_MESSAGE "hisses open"
44+
#define HELMET_SEAL_MESSAGE "hisses closed"
45+
#define CHESTPLATE_UNSEAL_MESSAGE "releases your chest"
46+
#define CHESTPLATE_SEAL_MESSAGE "cinches tightly around your chest"
47+
#define GAUNTLET_UNSEAL_MESSAGE "become loose around your fingers"
48+
#define GAUNTLET_SEAL_MESSAGE "tighten around your fingers and wrists"
49+
#define BOOT_UNSEAL_MESSAGE "relax their grip on your legs"
50+
#define BOOT_SEAL_MESSAGE "seal around your feet"
51+
4552
/// Global list of all /datum/mod_theme
4653
GLOBAL_LIST_EMPTY(mod_themes)
4754
/// Global list of all ids associated to a /datum/mod_link instance

code/__HELPERS/mobs.dm

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,49 @@ GLOBAL_LIST_EMPTY(species_list)
783783
else
784784
return zone
785785

786+
///Returns a list of strings for a given slot flag.
787+
/proc/parse_slot_flags(slot_flags)
788+
var/list/slot_strings = list()
789+
if(slot_flags & ITEM_SLOT_BACK)
790+
slot_strings += "back"
791+
if(slot_flags & ITEM_SLOT_MASK)
792+
slot_strings += "mask"
793+
if(slot_flags & ITEM_SLOT_NECK)
794+
slot_strings += "neck"
795+
if(slot_flags & ITEM_SLOT_HANDCUFFED)
796+
slot_strings += "handcuff"
797+
if(slot_flags & ITEM_SLOT_LEGCUFFED)
798+
slot_strings += "legcuff"
799+
if(slot_flags & ITEM_SLOT_BELT)
800+
slot_strings += "belt"
801+
if(slot_flags & ITEM_SLOT_ID)
802+
slot_strings += "id"
803+
if(slot_flags & ITEM_SLOT_EARS)
804+
slot_strings += "ear"
805+
if(slot_flags & ITEM_SLOT_EYES)
806+
slot_strings += "glasses"
807+
if(slot_flags & ITEM_SLOT_GLOVES)
808+
slot_strings += "glove"
809+
if(slot_flags & ITEM_SLOT_HEAD)
810+
slot_strings += "head"
811+
if(slot_flags & ITEM_SLOT_FEET)
812+
slot_strings += "shoe"
813+
if(slot_flags & ITEM_SLOT_OCLOTHING)
814+
slot_strings += "oversuit"
815+
if(slot_flags & ITEM_SLOT_ICLOTHING)
816+
slot_strings += "undersuit"
817+
if(slot_flags & ITEM_SLOT_SUITSTORE)
818+
slot_strings += "suit storage"
819+
if(slot_flags & (ITEM_SLOT_LPOCKET|ITEM_SLOT_RPOCKET))
820+
slot_strings += "pocket"
821+
if(slot_flags & ITEM_SLOT_HANDS)
822+
slot_strings += "hand"
823+
if(slot_flags & ITEM_SLOT_DEX_STORAGE)
824+
slot_strings += "dextrous storage"
825+
if(slot_flags & ITEM_SLOT_BACKPACK)
826+
slot_strings += "backpack"
827+
return slot_strings
828+
786829
///Returns the direction that the initiator and the target are facing
787830
/proc/check_target_facings(mob/living/initiator, mob/living/target)
788831
/*This can be used to add additional effects on interactions between mobs depending on how the mobs are facing each other, such as adding a crit damage to blows to the back of a guy's head.

code/modules/mob/living/carbon/human/human_update_icons.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ There are several things that need to be remembered:
391391
if((dna.species.bodytype & BODYTYPE_DIGITIGRADE) && (worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
392392
var/obj/item/bodypart/leg/leg = src.get_bodypart(BODY_ZONE_L_LEG)
393393
if(leg.limb_id == leg.digitigrade_id)//Snowflakey and bad. But it makes it look consistent.
394-
icon_file = shoes.worn_icon_digitigrade || DIGITIGRADE_SHOES_FILE //PARIAH EDIT
394+
icon_file = shoes.worn_icon_digitigrade || DIGITIGRADE_SHOES_FILE
395395

396396
if(dna.species.bodytype & BODYTYPE_TESHARI)
397397
if(worn_item.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
@@ -566,7 +566,7 @@ There are several things that need to be remembered:
566566
//More currently unused digitigrade handling
567567
if(dna.species.bodytype & BODYTYPE_DIGITIGRADE)
568568
if(worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION)
569-
icon_file = wear_suit.worn_icon_digitigrade || DIGITIGRADE_SUIT_FILE //PARIAH EDIT
569+
icon_file = wear_suit.worn_icon_digitigrade || DIGITIGRADE_SUIT_FILE
570570

571571
//PARIAH EDIT END
572572
if(dna.species.bodytype & BODYTYPE_TESHARI)

code/modules/mod/adding_new_mod.md

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Currently crew MODsuits should be lightly armored in combat relevant stats.
4040
for operating at lower power levels, keeping people sane. As consequence, the capacity \
4141
of the suit has decreased, not being able to fit many modules at all."
4242
default_skin = "psychological"
43-
armor = list(MELEE = 10, BULLET = 5, LASER = 5, ENERGY = 5, BOMB = 0, BIO = 100, FIRE = 10, ACID = 75, WOUND = 5)
43+
armor_type = /datum/armor/modtheme_psychological
4444
complexity_max = DEFAULT_MAX_COMPLEXITY - 7
4545
charge_drain = DEFAULT_CHARGE_DRAIN * 0.5
4646
```
@@ -79,19 +79,18 @@ So, now that we have our theme, we want to add a skin to it (or another theme of
7979
for operating at lower power levels, keeping people sane. As consequence, the capacity \
8080
of the suit has decreased, not being able to fit many modules at all."
8181
default_skin = "psychological"
82-
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 100, FIRE = 10, ACID = 75, WOUND = 5)
82+
armor_type = /datum/armor/modtheme_psychological
8383
complexity_max = DEFAULT_MAX_COMPLEXITY - 7
8484
charge_drain = DEFAULT_CHARGE_DRAIN * 0.5
85-
skins = list(
85+
variants = list(
8686
"psychological" = list(
87-
HELMET_LAYER = null,
88-
HELMET_FLAGS = list(
87+
/obj/item/clothing/head/mod = list(
8988
),
90-
CHESTPLATE_FLAGS = list(
89+
/obj/item/clothing/suit/mod = list(
9190
),
92-
GAUNTLETS_FLAGS = list(
91+
/obj/item/clothing/gloves/mod = list(
9392
),
94-
BOOTS_FLAGS = list(
93+
/obj/item/clothing/shoes/mod = list(
9594
),
9695
),
9796
)
@@ -101,8 +100,7 @@ We now have a psychological skin, this will apply the psychological icons to eve
101100
For example, if our helmet's icon covers the full head (like the research skin), we want to do something like this.
102101

103102
```dm
104-
HELMET_LAYER = null,
105-
HELMET_FLAGS = list(
103+
/obj/item/clothing/head/mod = list(
106104
UNSEALED_CLOTHING = SNUG_FIT|THICKMATERIAL,
107105
SEALED_CLOTHING = STOPSPRESSUREDAMAGE|BLOCK_GAS_SMOKE_EFFECT,
108106
UNSEALED_INVISIBILITY = HIDEFACIALHAIR|HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDESNOUT,
@@ -113,8 +111,8 @@ For example, if our helmet's icon covers the full head (like the research skin),
113111
Otherwise, with an open helmet that becomes closed (like the engineering skin), we'd do this.
114112

115113
```dm
116-
HELMET_LAYER = NECK_LAYER,
117-
HELMET_FLAGS = list(
114+
/obj/item/clothing/head/mod = list(
115+
UNSEALED_LAYER = NECK_LAYER
118116
UNSEALED_CLOTHING = SNUG_FIT,
119117
SEALED_CLOTHING = THICKMATERIAL|STOPSPRESSUREDAMAGE,
120118
UNSEALED_INVISIBILITY = HIDEFACIALHAIR,
@@ -134,50 +132,49 @@ There are specific cases of helmets that semi-cover the head, like the cosmohonk
134132
for operating at lower power levels, keeping people sane. As consequence, the capacity \
135133
of the suit has decreased, not being able to fit many modules at all."
136134
default_skin = "psychological"
137-
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 100, FIRE = 10, ACID = 75, WOUND = 5)
135+
armor_type = /datum/armor/modtheme_psychological
138136
complexity_max = DEFAULT_MAX_COMPLEXITY - 7
139137
charge_drain = DEFAULT_CHARGE_DRAIN * 0.5
140-
skins = list(
138+
variants = list(
141139
"psychological" = list(
142-
HELMET_LAYER = NECK_LAYER,
143-
HELMET_FLAGS = list(
140+
/obj/item/clothing/head/mod = list(
141+
UNSEALED_LAYER = NECK_LAYER
144142
UNSEALED_CLOTHING = SNUG_FIT,
145143
SEALED_CLOTHING = THICKMATERIAL|STOPSPRESSUREDAMAGE,
146144
UNSEALED_INVISIBILITY = HIDEFACIALHAIR,
147145
SEALED_INVISIBILITY = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDESNOUT,
148146
SEALED_COVER = HEADCOVERSMOUTH|HEADCOVERSEYES|PEPPERPROOF,
149147
),
150-
CHESTPLATE_FLAGS = list(
148+
/obj/item/clothing/suit/mod = list(
151149
UNSEALED_CLOTHING = THICKMATERIAL,
152150
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
153151
SEALED_INVISIBILITY = HIDEJUMPSUIT,
154152
),
155-
GAUNTLETS_FLAGS = list(
153+
/obj/item/clothing/gloves/mod = list(
156154
UNSEALED_CLOTHING = THICKMATERIAL,
157155
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
158156
),
159-
BOOTS_FLAGS = list(
157+
/obj/item/clothing/shoes/mod = list(
160158
UNSEALED_CLOTHING = THICKMATERIAL,
161159
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
162160
),
163161
"psychotherapeutic" = list(
164-
HELMET_LAYER = null,
165-
HELMET_FLAGS = list(
162+
/obj/item/clothing/head/mod = list(
166163
UNSEALED_CLOTHING = SNUG_FIT|THICKMATERIAL,
167164
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
168165
UNSEALED_INVISIBILITY = HIDEFACIALHAIR|HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDESNOUT,
169166
UNSEALED_COVER = HEADCOVERSMOUTH|HEADCOVERSEYES|PEPPERPROOF,
170167
),
171-
CHESTPLATE_FLAGS = list(
168+
/obj/item/clothing/suit/mod = list(
172169
UNSEALED_CLOTHING = THICKMATERIAL,
173170
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
174171
SEALED_INVISIBILITY = HIDEJUMPSUIT,
175172
),
176-
GAUNTLETS_FLAGS = list(
173+
/obj/item/clothing/gloves/mod = list(
177174
UNSEALED_CLOTHING = THICKMATERIAL,
178175
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
179176
),
180-
BOOTS_FLAGS = list(
177+
/obj/item/clothing/shoes/mod = list(
181178
UNSEALED_CLOTHING = THICKMATERIAL,
182179
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
183180
),
@@ -207,7 +204,7 @@ As we want this effect to be on demand, we probably want this to be an usable mo
207204
- Usable: You can use these for a one time effect.
208205
- Active: You can only have one selected at a time. It gives you a special click effect.
209206

210-
As we have an usable module, we want to set a cooldown time. All modules are also incompatible with themselves, have a specific power cost and complexity varying on how powerful they are, so let's update our definition, and also add a new variable for how much brain damage we'll heal.
207+
As we have an usable module, we want to set a cooldown time. All modules are also incompatible with themselves, have a specific power cost and complexity varying on how powerful they are, and are equippable to certain slots, so let's update our definition, and also add a new variable for how much brain damage we'll heal.
211208

212209
```dm
213210
/obj/item/mod/module/neuron_healer
@@ -217,35 +214,30 @@ As we have an usable module, we want to set a cooldown time. All modules are als
217214
icon_state = "neuron_healer"
218215
module_type = MODULE_USABLE
219216
complexity = 3
220-
use_power_cost = DEFAULT_CHARGE_DRAIN
217+
use_energy_cost = DEFAULT_CHARGE_DRAIN
221218
incompatible_modules = list(/obj/item/mod/module/neuron_healer)
222219
cooldown_time = 15 SECONDS
220+
required_slot = list(ITEM_SLOT_HEAD)
223221
var/brain_damage_healed = 25
224222
```
225223

226-
Now, we want to override the on_use proc for our new effect. We want to make sure the use checks passed from parent. You can read about most procs and variables by reading [this](modules/_module.dm)
224+
Now, we want to override the on_use proc for our new effect. You can read about most procs and variables by reading [this](modules/_module.dm)
227225

228226
```dm
229227
/obj/item/mod/module/neuron_healer/on_use()
230-
. = ..()
231-
if(!.)
232-
return
233228
```
234229

235230
After this, we want to put our special code, a basic effect of healing all mobs nearby for their brain damage and creating a beam to them.
236231

237232
```dm
238233
/obj/item/mod/module/neuron_healer/on_use()
239-
. = ..()
240-
if(!.)
241-
return
242234
for(var/mob/living/carbon/carbon_mob in range(5, src))
243235
if(carbon_mob == mod.wearer)
244236
continue
245237
carbon_mob.adjustOrganLoss(ORGAN_SLOT_BRAIN, -brain_damage_healed)
246238
mod.wearer.Beam(carbon_mob, icon_state = "plasmabeam", time = 1.5 SECONDS)
247239
playsound(src, 'sound/effects/magic.ogg', 100, TRUE)
248-
drain_power(use_power_cost)
240+
drain_power(use_energy_cost)
249241
```
250242

251243
We now have a basic module, we can add it to the techwebs to make it printable ingame, and we can add an inbuilt, advanced version of it for our psychological suit. We'll give it more healing power, no complexity and make it unremovable.
@@ -268,51 +260,50 @@ Now we want to add it to the psychological theme, which is very simple, finishin
268260
for operating at lower power levels, keeping people sane. As consequence, the capacity \
269261
of the suit has decreased, not being able to fit many modules at all."
270262
default_skin = "psychological"
271-
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 100, FIRE = 10, ACID = 75, WOUND = 5)
263+
armor_type = /datum/armor/modtheme_psychological
272264
complexity_max = DEFAULT_MAX_COMPLEXITY - 7
273265
charge_drain = DEFAULT_CHARGE_DRAIN * 0.5
274266
inbuilt_modules = list(/obj/item/mod/module/neuron_healer/advanced)
275-
skins = list(
267+
variants = list(
276268
"psychological" = list(
277-
HELMET_LAYER = NECK_LAYER,
278-
HELMET_FLAGS = list(
269+
/obj/item/clothing/head/mod = list(
270+
UNSEALED_LAYER = NECK_LAYER
279271
UNSEALED_CLOTHING = SNUG_FIT,
280272
SEALED_CLOTHING = THICKMATERIAL|STOPSPRESSUREDAMAGE,
281273
UNSEALED_INVISIBILITY = HIDEFACIALHAIR,
282274
SEALED_INVISIBILITY = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDESNOUT,
283275
SEALED_COVER = HEADCOVERSMOUTH|HEADCOVERSEYES|PEPPERPROOF,
284276
),
285-
CHESTPLATE_FLAGS = list(
277+
/obj/item/clothing/suit/mod = list(
286278
UNSEALED_CLOTHING = THICKMATERIAL,
287279
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
288280
SEALED_INVISIBILITY = HIDEJUMPSUIT,
289281
),
290-
GAUNTLETS_FLAGS = list(
282+
/obj/item/clothing/gloves/mod = list(
291283
UNSEALED_CLOTHING = THICKMATERIAL,
292284
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
293285
),
294-
BOOTS_FLAGS = list(
286+
/obj/item/clothing/shoes/mod = list(
295287
UNSEALED_CLOTHING = THICKMATERIAL,
296288
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
297289
),
298290
"psychotherapeutic" = list(
299-
HELMET_LAYER = null,
300-
HELMET_FLAGS = list(
291+
/obj/item/clothing/head/mod = list(
301292
UNSEALED_CLOTHING = SNUG_FIT|THICKMATERIAL,
302293
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
303294
UNSEALED_INVISIBILITY = HIDEFACIALHAIR|HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDESNOUT,
304295
UNSEALED_COVER = HEADCOVERSMOUTH|HEADCOVERSEYES|PEPPERPROOF,
305296
),
306-
CHESTPLATE_FLAGS = list(
297+
/obj/item/clothing/suit/mod = list(
307298
UNSEALED_CLOTHING = THICKMATERIAL,
308299
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
309300
SEALED_INVISIBILITY = HIDEJUMPSUIT,
310301
),
311-
GAUNTLETS_FLAGS = list(
302+
/obj/item/clothing/gloves/mod = list(
312303
UNSEALED_CLOTHING = THICKMATERIAL,
313304
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
314305
),
315-
BOOTS_FLAGS = list(
306+
/obj/item/clothing/shoes/mod = list(
316307
UNSEALED_CLOTHING = THICKMATERIAL,
317308
SEALED_CLOTHING = STOPSPRESSUREDAMAGE,
318309
),

0 commit comments

Comments
 (0)