Skip to content

Commit

Permalink
MakeAntag & Vox Shop js времянка
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantornRU committed Jan 9, 2024
1 parent 6a6e35b commit c0dc62d
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 97 deletions.
6 changes: 6 additions & 0 deletions code/modules/admin/verbs/one_click_antag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<a href='?src=[UID()];makeAntag=6'>Make Vampires</a><br>
<a href='?src=[UID()];makeAntag=7'>Make Abductor Team (Requires Ghosts)</a><br>
"}
// SS220 ADD - Start
dat += {"
<a href='?src=[UID()];makeAntag=8'>Make Blood Brothers Team</a><br>
<a href='?src=[UID()];makeAntag=9'>Make Vox Raiders</a><br>
"}
// SS220 ASS - End
usr << browse(dat, "window=oneclickantag;size=400x400")
return

Expand Down
86 changes: 86 additions & 0 deletions modular_ss220/antagonists/code/mind/memory_edit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,89 @@
. += "<a href='?src=[UID()];vox_raider=make'>Make Vox Raider</a>"

. += _memory_edit_role_enabled(ROLE_VOX_RAIDER)

// Если ОФФы добавят нового антагониста с разумом, то потребуется смещение (кто-нибудь дайте мне разума)
// Используется в /datum/admins/proc/one_click_antag()
/datum/admins/Topic(href, href_list)
. = ..()
if(href_list["makeAntag"])
switch(href_list["makeAntag"])
if("8")
log_admin("[key_name(usr)] has spawned a blood brothers.")
if(!makeBloodBrothersTeam())
to_chat(usr, "<span class='warning'>Unfortunately there weren't enough candidates available.</span>")
if("9")
log_admin("[key_name(usr)] has spawned a vox raiders.")
if(!makeVoxRaidersTeam())
to_chat(usr, "<span class='warning'>Unfortunately there weren't enough candidates available.</span>")

/datum/admins/proc/makeBloodBrothersTeam()
var/confirm = alert("Are you sure?", "Confirm creation", "Yes", "No")
if(confirm != "Yes")
return FALSE

var/amount = input("Size of team?", "Confirm creation")
if(!amount || amount >= 10 || amount <= 0)
return FALSE

var/datum/antagonist/blood_brother/temp = new
var/list/mob/living/carbon/human/candidates = list()

if(GLOB.configuration.gamemode.prevent_mindshield_antags)
temp.restricted_jobs += temp.protected_jobs

log_admin("[key_name(owner)] tried making Blood Brothers with One-Click-Antag")
message_admins("[key_name_admin(owner)] tried making Blood Brothers with One-Click-Antag")

for(var/mob/living/carbon/human/applicant in GLOB.player_list)
if(CandCheck(ROLE_BLOOD_BROTHER, applicant, temp))
candidates += applicant

if(candidates.len)
var/numBrothers = min(candidates.len, amount)
var/list/assigned = list()


for(var/i = 0, i<numBrothers, i++)
if(i>=amount)
break
H = pick(candidates)
assigned.Add(H)
candidates.Remove(H)

var/datum/team/blood_brothers_team/brother_team = new(assigned, TRUE)

return TRUE
return FALSE

/datum/admins/proc/makeVoxRaidersTeam()
var/confirm = alert("Are you sure?", "Confirm creation", "Yes", "No")
if(confirm != "Yes")
return FALSE
new /datum/event/abductor
//new /datum/event/vox_raider

log_admin("[key_name(owner)] tried making Vox Raiders with One-Click-Antag")
message_admins("[key_name_admin(owner)] tried making Vox Raiders with One-Click-Antag")

return TRUE





// var/image/I = new('icons/mob/simple_human.dmi', "wizard")
// var/list/candidates = SSghost_spawns.poll_candidates("Do you wish to be considered for the position of a Wizard Federation 'diplomat'?", "wizard", source = I)

// log_admin("[key_name(owner)] tried making a Wizard with One-Click-Antag")
// message_admins("[key_name_admin(owner)] tried making a Wizard with One-Click-Antag")

// if(candidates.len)
// var/mob/dead/observer/selected = pick(candidates)
// candidates -= selected

// var/mob/living/carbon/human/new_character = makeBody(selected)
// new_character.mind.make_Wizard()
// dust_if_respawnable(selected)
// return 1
// return 0
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@
"category" = pack.category,
"amount" = cart_list[reference]))

/obj/machinery/vox_shop/proc/remove_from_cart(item_reference) // i want to make it eventually remove all instances
// !!!!!!!!!! разобраться в ошибке с неправильно заносящимися items
// заношу я как supply_pack, а в .js как в uplink_item

/obj/machinery/vox_shop/proc/remove_from_cart(item_reference)
LAZYREMOVE(cart_list, item_reference)
generate_tgui_cart(TRUE)

Expand Down
159 changes: 63 additions & 96 deletions tgui/packages/tgui/interfaces/VoxShop.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ const PickTab = (index) => {
return <ItemsPage />;
case 2:
return <CartPage />;
case 3:
return <MedicalPage />; // !!!!!!!! МЕДИЦИНСКАЯ СТРАНИЦА С ДАННЫМИ ЖИЗНЕОБЕСПЕЧЕНИЯ ВСЕХ ВОКСОВ
// case 3:
// return <MedicalPage />; // !!!!!!!! МЕДИЦИНСКАЯ СТРАНИЦА С ДАННЫМИ ЖИЗНЕОБЕСПЕЧЕНИЯ ВСЕХ ВОКСОВ
default:
return 'ОШИБКА, СООБЩИТЕ РАЗРАБОТЧИКУ';
}
};


export const VoxShop = (props, context) => {
const { act, data } = useBackend(context);
const { cart } = data;
Expand All @@ -33,7 +32,6 @@ export const VoxShop = (props, context) => {
<ComplexModal />
<Window.Content scrollable>
<Tabs>

<Tabs.Tab
key="PurchasePage"
selected={tabIndex === 0}
Expand All @@ -45,7 +43,6 @@ export const VoxShop = (props, context) => {
Торговля
</Tabs.Tab>


<Tabs.Tab
key="Cart"
selected={tabIndex === 1}
Expand All @@ -58,8 +55,6 @@ export const VoxShop = (props, context) => {
{cart && cart.length ? '(' + cart.length + ')' : ''}
</Tabs.Tab>



<Tabs.Tab
key="Medical"
selected={tabIndex === 2}
Expand All @@ -71,8 +66,6 @@ export const VoxShop = (props, context) => {
Жизнеобеспечение
</Tabs.Tab>



<Tabs.Tab
key="GetCash"
// This cant ever be selected. Its just a close button.
Expand All @@ -81,17 +74,13 @@ export const VoxShop = (props, context) => {
>
Выгрузить Кикиридиты
</Tabs.Tab>

</Tabs>
{PickTab(tabIndex)}

</Window.Content>
</Window>
);
};



// ================== ITEMS PAGE ==================

const ItemsPage = (_properties, context) => {
Expand All @@ -110,17 +99,14 @@ const ItemsPage = (_properties, context) => {
<Section
title={'Средства: ' + cash + 'Кикиридитов'}
buttons={
<Fragment>
<Button.Checkbox
content="Описание"
checked={showDesc}
onClick={() => setShowDesc(!showDesc)}
/>
</Fragment>
<Button.Checkbox
content="Описание"
checked={showDesc}
onClick={() => setShowDesc(!showDesc)}
/>
}
>
<Flex>

<FlexItem>
<Tabs vertical>
{cats.map((c) => (
Expand All @@ -146,19 +132,13 @@ const ItemsPage = (_properties, context) => {
/>
))}
</Flex.Item>

</Flex>
</Section>
);
);
};


const ShopItem = (props, context) => {
const {
i,
showDecription = 1,
buttons = <ShopItemButtons i={i} />,
} = props;
const { i, contents, showDecription = 1, buttons = <ShopItemButtons i={i} /> } = props;

return (
<Section
Expand All @@ -168,7 +148,7 @@ const ShopItem = (props, context) => {
buttons={buttons}
stretchContents
>
{showDecription ? <Box italic>{decodeHtmlEntities(i.desc)}</Box> : null}
{showDecription ? <Box italic>{decodeHtmlEntities(i.desc) + "\n" + contents}</Box> : null}
</Section>
);
};
Expand All @@ -179,29 +159,22 @@ const ShopItemButtons = (props, context) => {
const { cash } = data;

return (
<Fragment>
<Button
icon="shopping-cart"
content={
'Купить (' + i.cost + 'Кикиридитов)'
}
color={i.hijack_only === 1 && 'red'}
tooltip="Добавить в корзину."
tooltipPosition="left"
onClick={() =>
act('add_to_cart', {
item: i.obj_path,
})
}
disabled={i.cost > cash}
/>

</Fragment>
<Button
icon="shopping-cart"
content={'Купить (' + i.cost + 'Кикиридитов)'}
color={i.hijack_only === 1 && 'red'}
tooltip="Добавить в корзину."
tooltipPosition="left"
onClick={() =>
act('add_to_cart', {
item: i.obj_path,
})
}
disabled={i.cost > cash}
/>
);
};



// ================== CART PAGE ==================

const CartPage = (_properties, context) => {
Expand All @@ -211,53 +184,48 @@ const CartPage = (_properties, context) => {
const [showDesc, setShowDesc] = useLocalState(context, 'showDesc', 0);

return (
<Fragment>
<Section
title={'Средства: ' + cash + 'Кикиридитов'}
buttons={
<Fragment>
<Button.Checkbox
content="Описание"
checked={showDesc}
onClick={() => setShowDesc(!showDesc)}
/>
<Button
content="Очистить"
icon="trash"
onClick={() => act('empty_cart')}
disabled={!cart}
/>
<Button
content={'Оплатить (' + cart_price + ' Кикиридитов)'}
icon="shopping-cart"
onClick={() => act('purchase_cart')}
disabled={!cart || cart_price > cash}
<Section
title={'Средства: ' + cash + 'Кикиридитов'}
buttons={
<Fragment>
<Button.Checkbox
content="Описание"
checked={showDesc}
onClick={() => setShowDesc(!showDesc)}
/>
<Button
content="Очистить"
icon="trash"
onClick={() => act('empty_cart')}
disabled={!cart}
/>
<Button
content={'Оплатить (' + cart_price + ' Кикиридитов)'}
icon="shopping-cart"
onClick={() => act('purchase_cart')}
disabled={!cart || cart_price > cash}
/>
</Fragment>
}
>
<Flex.Item grow={1} basis={0}>
{cart ? (
cart.map((i) => (
<ShopItem
i={i}
showDecription={showDesc}
key={decodeHtmlEntities(i.name)}
buttons={<CartButtons i={i} />}
/>
</Fragment>
}
>

<Flex.Item grow={1} basis={0}>
{cart ? (
cart.map((i) => (
<ShopItem
i={i}
showDecription={showDesc}
key={decodeHtmlEntities(i.name)}
buttons={<CartButtons i={i} />}
/>
))
) : (
<Box italic>Список выбранных товаров пуст!</Box>
)}
</Flex.Item>

</Section>
</Fragment>
))
) : (
<Box italic>Список выбранных товаров пуст!</Box>
)}
</Flex.Item>
</Section>
);
};


const CartButtons = (props, context) => {
const { act, data } = useBackend(context);
const { i } = props;
Expand Down Expand Up @@ -317,10 +285,8 @@ const CartButtons = (props, context) => {
);
};



// ================== MEDICAL PAGE ==================

/*
const MedicalPage = (_properties, context) => {
const { act, data } = useBackend(context);
const crew = sortBy((cm) => cm.name)(data.crewmembers || []);
Expand Down Expand Up @@ -400,3 +366,4 @@ const MedicalPage = (_properties, context) => {
</Box>
);
};
*/

0 comments on commit c0dc62d

Please sign in to comment.